Bug 1848612 [wpt PR 41440] - [@scope] Scope to host element if there's no owner-paren...
commit530a6f21284329f831107576056594166619049b
authorAnders Hartvoll Ruud <andruud@chromium.org>
Fri, 8 Sep 2023 18:33:24 +0000 (8 18:33 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Wed, 13 Sep 2023 11:36:20 +0000 (13 11:36 +0000)
treeaa1c602cf814eb7d681128965511d0982b647761
parentff74ba865c0ca398203b706085198d880d1ad62f
Bug 1848612 [wpt PR 41440] - [@scope] Scope to host element if there's no owner-parent element, a=testonly

Automatic update from web-platform-tests
[@scope] Scope to host element if there's no owner-parent element

Implicit scopes, i.e. scopes without a <scope-start> selector,
should scope to the parent element of the owner element:

  <div id=foo>
    <style>
      @scope { ... } /* Scoped to #foo */
    </style>
  </div>

However, there are two ShadowDOM-related cases where we don't have
an owner-parent element:

 1. When the <style> element appears directly below a shadow root.
 2. When the stylesheet is constructed/adopted. In this case we don't
    even have an owner element.

Currently, we handle this by never activating the scope.
This CL fixes this issue by instead scoping implicit @scope rules
to the shadow *host* instead of the *root*. This requires a spec
change [1], therefore the tests are marked as tentative.

Fixed: 1379844

[1] https://github.com/w3c/csswg-drafts/issues/9178

Change-Id: I9146ffb3c6cb5e2f5697dc3d3e62cda9396709b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4778499
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1184653}

--

wpt-commits: 21cc51826719698a688a92e7a48c8775a5329c20
wpt-pr: 41440
testing/web-platform/tests/css/css-cascade/scope-shadow.tentative.html