Closed Bug 2092414 Opened 3 days ago Closed 1 day ago

[wpt-sync] Sync PR 64560 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=285130

Categories

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

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=285130

WebKit export from bug: insertRule does not work for inserting @<!---->scope styles

<pre>
insertRule does not work for inserting @scope styles

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

An @scope rule without a prelude finds its scoping root through
StyleRuleScope::m_styleSheetOwner, a weak pointer to the owning
StyleSheetContents. That pointer was stale in two cases:

  • CSSStyleSheet::insertRule() parses the rule against m_contents before
    RuleMutationScope runs willMutateRules(). Inline <style> sheets are
    cached and shared, so the first mutation clones the contents, and the
    new rule's owner pointed at the old, client-less contents. No scoping
    root was found and the rule never matched. CSSGroupingRule::insertRule()
    and CSSStyleRule::insertRule() had the same ordering problem.
  • StyleRuleScope's copy constructor is defaulted, so the copies made by
    the StyleSheetContents copy constructor kept pointing at the original
    contents.

Add StyleSheetContents::adoptScopeRules(), which recursively re-points
@scope rules (including ones nested in style and grouping rules) at the
given contents. Call it from the copy constructor, wrapperInsertRule(),
and the nested insertRule() paths.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=285130">https://bugs.webkit.org/show_bug.cgi?id=285130</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/325468@main">https://commits.webkit.org/325468@main</a>
</pre>

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 165 tests

Status Summary

Firefox

OK : 1[GitHub] 108[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-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 5[GitHub] 7[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 1665[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 1705[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] 1712[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 20[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-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-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 1
PASS: 5

Safari

OK : 1
PASS: 2
FAIL: 3

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Status: NEW → RESOLVED
Closed: 1 day ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.