Closed Bug 1317179 Opened 3 years ago Closed 3 years ago

Stylo: Use XPCOM string bindings instead of Gecko_Utf8SliceToString

Categories

(Core :: DOM: Animation, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox52 --- affected
firefox53 --- fixed

People

(Reporter: birtles, Assigned: boris)

References

Details

Attachments

(2 files, 1 obsolete file)

In bug 1302949 I introduced some fairly clumsy string handling while we were waiting for bug 1294742 (actually bug 1295762) to land. I haven't looked into those bindings at all, but now that they've landed I wonder if we can:

* Use them in Servo_DeclarationBlock_SerializeOneValue[1]
* Drop Gecko_Utf8SliceToString[2]

[1] https://dxr.mozilla.org/servo/rev/38e97d26c6e812bb2a8ba3f46707625ee733e56e/ports/geckolib/glue.rs#503
[2] http://searchfox.org/mozilla-central/rev/4b6cab91f93c73ae591dafaea40fd5704b41810e/layout/style/ServoBindings.h#147
Blocks: 1302945
Priority: -- → P3
Assignee: nobody → boris.chiou
Status: NEW → ASSIGNED
Depends on: 1295762
Comment on attachment 8813619 [details]
Bug 1317179 - [Servo] Use XPCOM string bindings instead of Gecko_Utf8SliceToString.

https://reviewboard.mozilla.org/r/95054/#review95280

::: servo/ports/geckolib/glue.rs:493
(Diff revision 1)
>      let property = get_property_name_from_atom(property, is_custom);
>      let mut string = String::new();
>      let rv = declarations.read().single_value_to_css(&property, &mut string);
>      debug_assert!(rv.is_ok());
>  
> -    // FIXME: Once we have nsString bindings for Servo (bug 1294742), we should be able to drop
> +    write!(unsafe { buffer.as_mut().unwrap() }, "{}", string).expect("Failed to copy string");

`&mut *` buffer should work here.
Attachment #8813619 - Flags: review?(manishearth) → review+
Comment on attachment 8813618 [details]
Bug 1317179 - Use nsAString as the parameter type and drop Gecko_Utf8SliceToString.

https://reviewboard.mozilla.org/r/95052/#review95282
Attachment #8813618 - Flags: review?(manishearth) → review+
Comment on attachment 8813619 [details]
Bug 1317179 - [Servo] Use XPCOM string bindings instead of Gecko_Utf8SliceToString.

https://reviewboard.mozilla.org/r/95054/#review95280

> `&mut *` buffer should work here.

Thanks, I will replace my code with "unsafe { &mut * buffer }".
I will create a PR and land the gecko-side change after bug 1317178 is merged to m-c.
Attachment #8813619 - Attachment is obsolete: true
Attached file Servo PR, #14404
Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/53d1dbd5e905
Use nsAString as the parameter type and drop Gecko_Utf8SliceToString. r=manishearth
https://hg.mozilla.org/mozilla-central/rev/53d1dbd5e905
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.