[css-nesting] Use "quiet" rules for use-counting bare declarations #43973
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 wants to change how non-leading bare declarations work.
Instead of "shifting up" those declarations to the rule's main
declaration block, we want to treat them as wrapped by an &-rule,
except with parse-time expansion of selectors instead of the normal
behavior for '&' [1][2].
Actually making this change is easier said than done, since we now
have to worry about the compat risk. A naive use-counter added
previously shows that ~0.16% of page loads at some point parse
bare declarations after a nested rule. This is too high, and we
need a more advanced use-counter.
This CL adds the concept of "quiet rules", which are generated
automatically from detecting bare declarations in CSSParserImpl
and mostly treated normally until we reach StyleCascade.
In StyleCascade we cascade with and without the quiet rules,
check if quiet rules made a difference, and trigger a use-counter
based on that.
[1] w3c/csswg-drafts#8738
[2] w3c/csswg-drafts#9492
[3] https://chromestatus.com/metrics/feature/timeline/popularity/4709
Bug: 1517290
Change-Id: Ieef0b47d85ffb5a5e58424457422686e74ea0668
Reviewed-on: https://chromium-review.googlesource.com/5177646
WPT-Export-Revision: f0c8d351a2483a1b93d9806afada5303b667c6cd