Closed Bug 1361303 Opened 7 years ago Closed 7 years ago

stylo: custom property name serialization is wrong

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

Details

Attachments

(2 files, 1 obsolete file)

Attachment #8863637 - Flags: review?(xidorn+moz)
Comment on attachment 8863637 [details]
Correctly serialize CSS Custom Property names.

https://reviewboard.mozilla.org/r/135434/#review138382

::: servo/components/style/properties/properties.mako.rs:813
(Diff revision 1)
>              _ => false,
>          }
>      }
> +
> +    /// Returns the name of the property without CSS escaping.
> +    pub fn name(&self) -> String {

We can probably use `Cow<'static, str>` here, but that probably doesn't matter a lot.

::: servo/components/style/properties/properties.mako.rs:817
(Diff revision 1)
> +                let mut s = String::from("--");
> +                s += name.to_string().as_str();
> +                s

Maybe better
```rust
let mut s = String::new();
write!(&mut s, "--{}", name).unwrap();
s
```
so that we can avoid the allocation from `name.to_string()`.

::: servo/components/style/properties/properties.mako.rs:961
(Diff revision 1)
> +                let mut s = String::from("--");
> +                s += name.to_string().as_str();
> +                s

Ditto.
Attachment #8863637 - Flags: review?(xidorn+moz) → review+
Comment on attachment 8863638 [details]
Bug 1361303 - Part 1: Add test for serialization of CSS Custom Property names.

https://reviewboard.mozilla.org/r/135436/#review138392
Attachment #8863638 - Flags: review?(xidorn+moz) → review+
Comment on attachment 8863639 [details]
Bug 1361303 - Part 2: Update test expectations.

https://reviewboard.mozilla.org/r/135438/#review138394
Attachment #8863639 - Flags: review?(xidorn+moz) → review+
Attachment #8863637 - Attachment is obsolete: true
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc77087efa2e
Part 1: Add test for serialization of CSS Custom Property names. r=xidorn
https://hg.mozilla.org/integration/autoland/rev/545f5678ceaf
Part 2: Update test expectations. r=xidorn
https://hg.mozilla.org/mozilla-central/rev/dc77087efa2e
https://hg.mozilla.org/mozilla-central/rev/545f5678ceaf
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee: nobody → cam
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: