Closed Bug 1857158 Opened 1 year ago Closed 1 year ago

CSSPropertyRule.name should not serialize @property name as identifier

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: fredw, Assigned: fredw)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This is the remaining failure for /css/css-properties-values-api/at-property-cssom.html

See https://chromium-review.googlesource.com/c/chromium/src/+/2238117
'The serialization must follow the "serialize an identifier" algorithm,
otherwise characters like U+0009 CHARACTER TABULATION will not be
escaped correctly.'

OK, so I checked a bit that, here is the spec: https://drafts.css-houdini.org/css-properties-values-api/#the-css-property-rule-interface

No escaping is mentioned when accessing CSSPropertyRule.name directly, but when serializing the whole CSSPropertyRule it is explicitly said that the name is serialized as an identifier.

The test assumes that no escaping is done for CSSPropertyRule.name but that escaping is done when serializing the whole CSSPropertyRule. Chrome and WebKit implement that behavior and so pass the test:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/css_property_rule.cc
https://searchfox.org/wubkat/source/Source/WebCore/css/CSSPropertyRule.cpp

Currently we are failing the test because in both cases we perform escaping during serialization (via serialize_atom_name):
https://searchfox.org/mozilla-central/rev/d436104fc6c31677b08a851796bead25153be699/servo/components/style/properties_and_values/rule.rs#290
https://searchfox.org/mozilla-central/rev/d436104fc6c31677b08a851796bead25153be699/servo/components/style/properties_and_values/rule.rs#313

@Emilio: What do you think about that? Does Chrome/WebKit's behavior seem correct and we should align on it?

Flags: needinfo?(emilio)
Summary: Serialize property name as an identifier → /css/css-properties-values-api/at-property-cssom.html
Summary: /css/css-properties-values-api/at-property-cssom.html → /css/css-properties-values-api/at-property-cssom.html -- Rule for --tab\ttab

@Emilio: What do you think about that? Does Chrome/WebKit's behavior seem correct and we should align on it?

Seems reasonable, it is what we do for keyframe names too here

We shouldn't change the ToCss implementation, we should just make PropertyRule_GetName not use it and return the atom directly.

Flags: needinfo?(emilio)

The spec just says to return the name as is [1]. This aligns with
WebKit and Chrome's behavior and fixes remaining issue in [2].

[1] https://drafts.css-houdini.org/css-properties-values-api/#the-css-property-rule-interface
[2] /css/css-properties-values-api/at-property-cssom.html

Pushed by fred.wang@free.fr: https://hg.mozilla.org/integration/autoland/rev/812ec42fdd13 CSSPropertyRule.name should not serialize @property name as identifier. r=emilio
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
Summary: /css/css-properties-values-api/at-property-cssom.html -- Rule for --tab\ttab → CSSPropertyRule.name should not serialize @property name as identifier
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: