commit | 72de3a83885efa87e56ac40783c0c10154f096cb | [log] [tgz] |
---|---|---|
author | Anders Hartvoll Ruud <andruud@chromium.org> | Fri Feb 02 06:09:31 2024 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Feb 02 06:09:31 2024 |
tree | 1019a986b3f95d7a2348eb05f67b11d91c028224 | |
parent | 53bad06ee5c40bc587ced8eb8e19106b88999583 [diff] |
[css-nesting] Create invisible/signaling rules during parsing This CL emits invisible rules and signaling rules (which were introduced by CL:5201402 and follow-ups) during parsing, in order to use-count two situations: 1. Instead of "shifting up" bare declarations within nested style rules, can we generate wrapping rules "in-place"? [1] To figure this out, we generate those would-be in-place wrapping rules in ConsumeDeclarationList, except they are marked as *invisible*, i.e. they participate until the StyleCascade, but are dropped during that process. In addition, those invisible rules are marked as *signaling*, which means that they trigger a use counter if they have some effect on the cascade. The hope is that by adding these rules, and proving that they don't have any effect, we can conclude that the change is safe, because adding the invisible rules gave us the same end result as before. 2. Can we change the effective specificity of the generated &-rule wrappers? [2] This is only relevant for nested grouping rules, like @media. To measure if this is safe, we generate an additional invisible wrapping rule (before the regular &-rule) with the new specificity characteristics (in ConsumeRuleListOrNested- DeclarationList). Additionally, we make the existing &-rule signaling. Hopefully, we if we can show that the &-rule has no effect on the end result if the (invisible) alternative rule is present, we can conclude that it's safe to remove. The two approaches in (1) and (2) kind of mirror each other: - In (1), we add an invisible rule *after* the main rule, hoping that the quiet rule has no effect. - In (2), we add an invisible rule *before* the main rule, hoping that the *main rule* has no effect. Note that invisible/signaling rules are only emitted when parsing bare declarations: the rule *parsed* by a call to insertRule can contain invisible/signaling rules, but nothing special happens for the insertion itself. In other words, inserting a rule with CSSOM does not create invisible/signaling sibling rules. Introducing signaling/invisible rules adds quite a bit of complexity to the code, and negatively impacts performance. All code introduced by CL:5201402 and its follow-ups are therefore planned to be removed again some time during 2024. StyleCalcPerfTest for this CL: Initial style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 8099 8174 -0.9% [ -1.3%, -0.6%] Encyclopedia 72995 73268 -0.4% [ -0.7%, -0.0%] Extension 84010 84599 -0.7% [ -1.1%, -0.3%] News 33645 33942 -0.9% [ -1.3%, -0.5%] Search 10059 10133 -0.7% [ -1.1%, -0.3%] Social1 18862 19007 -0.8% [ -1.1%, -0.5%] Social2 12782 12885 -0.8% [ -1.3%, -0.4%] Sports 41048 41146 -0.2% [ -0.5%, +0.0%] Video 25840 25953 -0.4% [ -0.6%, -0.2%] Geometric mean -0.6% [ -0.9%, -0.4%] Parse (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 1401 1435 -2.4% [ -3.0%, -1.9%] Encyclopedia 7794 7935 -1.8% [ -2.1%, -1.5%] Extension 1374 1391 -1.2% [ -1.5%, -0.8%] News 8372 8579 -2.4% [ -2.7%, -2.1%] Search 5244 5374 -2.4% [ -2.8%, -2.1%] Social1 15499 15935 -2.7% [ -3.2%, -2.4%] Social2 635 653 -2.7% [ -3.2%, -2.3%] Sports 59797 61250 -2.4% [ -2.7%, -2.1%] Video 37212 38083 -2.3% [ -2.6%, -2.0%] Geometric mean -2.3% [ -2.5%, -2.0%] Recalc style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 4274 4330 -1.3% [ -1.7%, -0.8%] Encyclopedia 53741 54462 -1.3% [ -1.8%, -0.9%] Extension 67906 69119 -1.8% [ -2.3%, -1.3%] News 24823 25113 -1.2% [ -1.8%, -0.6%] Search 4307 4343 -0.8% [ -1.3%, -0.3%] Social1 10078 10195 -1.2% [ -1.5%, -0.8%] Social2 7881 7965 -1.1% [ -1.6%, -0.6%] Sports 18426 18608 -1.0% [ -1.5%, -0.6%] Video 11884 12000 -1.0% [ -1.2%, -0.7%] Geometric mean -1.2% [ -1.4%, -0.9%] Bug: 1517290 [1] https://github.com/w3c/csswg-drafts/issues/8738 [2] https://github.com/w3c/csswg-drafts/issues/9492 Change-Id: Icb12186f02f4c17070f9ef34907136a6d56e7745 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5217094 Reviewed-by: Steinar H Gunderson <sesse@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1255444}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.