Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-nesting] Implement CSSNestedDeclarations behind a flag #47744

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Aug 22, 2024

The CSSWG recently resolved to change how "bare" declarations work
when mixed with nested style rules. Previously, any declaration
following a nested style rule would be "shifted up" to join
the leading declarations, but as of the work leading up to
Issue 10234 [1], such declarations now instead remain in place
(wrapped in a CSSNestedDeclarations rule).

This CL implements this rule, as well as the parser changes needed
to produce those rules during ConsumeDeclarationList.
The parsing behavior is similar to the behavior previously seen
for emitting signalling/invisible rules (removed in CL:5593832),
although naturally without any signalling, nor any invisibility.

Per spec, CSSNestedDeclarations is a kind of style rule that matches
exactly what its parent style rule matches, and with the same
specificity behavior. This is different from the '&' pseudo-class,
which uses the maximum specificity across its arguments, and can't
match pseudo-elements. This CL implements this via an inner
StyleRule, held by the CSSNestedDeclarations rule.
This inner StyleRule can't be observed via CSSOM. It exists primarily
to be able to bucket the rule normally on RuleSet.

[1] w3c/csswg-drafts#10234

Change-Id: If9afe0cbb41e7de0acdd781ecfbf6884d677c6f8
Binary-Size: crbug.com/344608183
Bug: 343463516, 361600667
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5594117
Reviewed-by: Steinar H Gunderson <[email protected]>
Commit-Queue: Anders Hartvoll Ruud <[email protected]>
Reviewed-by: Philip Pfaffe <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1347266}

The CSSWG recently resolved to change how "bare" declarations work
when mixed with nested style rules. Previously, any declaration
following a nested style rule would be "shifted up" to join
the leading declarations, but as of the work leading up to
Issue 10234 [1], such declarations now instead remain in place
(wrapped in a CSSNestedDeclarations rule).

This CL implements this rule, as well as the parser changes needed
to produce those rules during ConsumeDeclarationList.
The parsing behavior is similar to the behavior previously seen
for emitting signalling/invisible rules (removed in CL:5593832),
although naturally without any signalling, nor any invisibility.

Per spec, CSSNestedDeclarations is a kind of style rule that matches
exactly what its parent style rule matches, and with the same
specificity behavior. This is different from the '&' pseudo-class,
which uses the maximum specificity across its arguments, and can't
match pseudo-elements. This CL implements this via an inner
StyleRule, held by the CSSNestedDeclarations rule.
This inner StyleRule can't be observed via CSSOM. It exists primarily
to be able to bucket the rule normally on RuleSet.

[1] w3c/csswg-drafts#10234

Change-Id: If9afe0cbb41e7de0acdd781ecfbf6884d677c6f8
Binary-Size: crbug.com/344608183
Bug: 343463516, 361600667
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5594117
Reviewed-by: Steinar H Gunderson <[email protected]>
Commit-Queue: Anders Hartvoll Ruud <[email protected]>
Reviewed-by: Philip Pfaffe <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1347266}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit b23720e into master Aug 27, 2024
15 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-5594117 branch August 27, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants