[css-nesting] Implement CSSNestedDeclarations behind a flag #47744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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}