commit e0e62582cc3bde303470002afce9f8073a13ee92
parent be8e466eb8e90ce1169af528453b3b3201ecb0fe
Author: Antti Koivisto <antti@apple.com>
Date: Wed, 15 Oct 2025 08:44:05 +0000
Bug 1993930 [wpt PR 55368] - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=300089, a=testonly
Automatic update from web-platform-tests
WebKit export of https://bugs.webkit.org/show_bug.cgi?id=300089 (#55368)
--
wpt-commits: 9a5c3cadc74be26ad5ef4bacd218d265f7964921
wpt-pr: 55368
Diffstat:
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-conditional/container-queries/container-for-shadow-dom.html b/testing/web-platform/tests/css/css-conditional/container-queries/container-for-shadow-dom.html
@@ -341,6 +341,32 @@
</style>
</div>
+<div>
+ <template shadowrootmode="open">
+ <style>
+ .container {
+ width: 400px;
+ container-type: inline-size;
+ }
+ </style>
+ <div class="container"><slot></slot></div>
+ </template>
+ <style>
+ @container (width = 200px) {
+ #pseudo-1::before { color: green; }
+ }
+ @container (width = 400px) {
+ #pseudo-2::before { color: green; }
+ }
+ #pseudo-1 {
+ container-type: inline-size;
+ width: 200px;
+ }
+ </style>
+ <div id="pseudo-1"></div>
+ <div id="pseudo-2"></div>
+</div>
+
<script>
setup(() => {
assert_implements_size_container_queries();
@@ -446,4 +472,13 @@
assert_equals(getComputedStyle(target).color, green);
}, "Container name set on :host from inside a shadow tree should match query for slotted from the outside of the shadow tree");
+ test(() => {
+ const target = document.querySelector("#pseudo-1");
+ assert_equals(getComputedStyle(target, "::before").color, green);
+ }, "The originating element should be the first container candidate of ::before");
+
+ test(() => {
+ const target = document.querySelector("#pseudo-2");
+ assert_equals(getComputedStyle(target, "::before").color, green);
+ }, "Search flat tree anchestors of the originating element of ::before");
</script>