Closed Bug 2001980 Opened 1 year ago Closed 11 months ago

[wpt-sync] Sync PR 56223 - Use unconnected RuleSets for duplicate contents with cascade layers

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 56223 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/56223
Details from upstream follow.

Anders Hartvoll Ruud <andruud@chromium.org> wrote:

Use unconnected RuleSets for duplicate contents with cascade layers

We currently deduplicate shared StyleSheetContents during RuleSet-
building in order to avoid "collapsing" distinct anonymous layers
into one. This is done in a somewhat roundabout way with a "fake"
rule mutation event, but is otherwise not an unreasonable way
of handling it.

However, it does not handle the case where the same CSSStyleSheet
instance appears in the list of active stylesheets (which can happen
when the same sheet is listed multiple times in adoptedStyleSheets).
The exact behavior is not handled explicitly by specs, but what we're
doing is not a reasonable default: other things in the RuleSet
(e.g. style rules, named constructs defined by at-rules) do "see"
the different orders when the same sheet is specified multiple times
(see examples in Issue 462744687). Layers are just inconsistent with
this.

To address this, this CL tracks which StyleSheetContents we've already
seen (shared or otherwise), and adds an unconnected RuleSet for any
already-seen contents. (Unconnected RuleSets are one-off RuleSets that
ignore the RuleSet cache on StyleSheetContents). In sharing cases
(multiple CSSStyleSheets, same StyleSheetContents) this means we'll
cache less, but also deduplicate less. Under the assumption that
adding the same StyleSheetContents more than once is a rare corner case,
the performance characteristics of this seem unimportant anyway.

This change aligns our behavior with Firefox and Safari.

Fixed: 462744687
Change-Id: I564f7598204227213bce5b9b8eeb62c77acd079b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7185810
Reviewed-by: Steinar H Gunderson \<sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud \<andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1549143}

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 146 tests

Status Summary

Firefox

OK : 1[GitHub] 92[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]
PASS: 1[GitHub] 5[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 1506[Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt] 1545[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 1552[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]
FAIL: 20[Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt] 23[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]

Chrome

OK : 1
FAIL: 1

Safari

OK : 1
PASS: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/67ab25580840 https://hg.mozilla.org/integration/autoland/rev/abf6fb942c8e [wpt PR 56223] - Use unconnected RuleSets for duplicate contents with cascade layers, a=testonly
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
You need to log in before you can comment on or make changes to this bug.