WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-238934-20220407174744.patch (text/plain), 7.35 KB, created by
Antti Koivisto
on 2022-04-07 07:47:45 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2022-04-07 07:47:45 PDT
Size:
7.35 KB
patch
obsolete
>Subversion Revision: 292523 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a0a449f15cae4e17c36ed0db9868ed9ca5dc1da4..54a0320c9e063ac7a7750b51b02c8f0a2f5e5ccc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2022-04-07 Antti Koivisto <antti@apple.com> >+ >+ [CSS Container Queries] Evaluate against shadow-including ancestors >+ https://bugs.webkit.org/show_bug.cgi?id=238934 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ "Style rules applying to its shadow-including descendants can then be conditioned by querying against it, >+ using the @container conditional group rule." >+ >+ https://drafts.csswg.org/css-contain-3/#container-queries >+ >+ * style/ContainerQueryEvaluator.cpp: >+ (WebCore::Style::ContainerQueryEvaluator::selectContainer): >+ >+ Evaluate against shadow-including ancestors instead of flat tree ancestors if the cache is not available. >+ >+ * style/StyleTreeResolver.cpp: >+ (WebCore::Style::TreeResolver::Scope::Scope): >+ >+ Copy the container state when pushing scope. This also creates a stack of shadow-including ancestors. >+ >+ * style/StyleTreeResolver.h: >+ > 2022-04-06 Tim Nguyen <ntim@apple.com> > > [:has() pseudo-class] Support invalidation for :placeholder-shown >diff --git a/Source/WebCore/style/ContainerQueryEvaluator.cpp b/Source/WebCore/style/ContainerQueryEvaluator.cpp >index f405c93ce0cc2ef1d1a12419473ef8b1d89cfd13..4afa049e1d39d7d9a5202cbd5e7df93fef21322c 100644 >--- a/Source/WebCore/style/ContainerQueryEvaluator.cpp >+++ b/Source/WebCore/style/ContainerQueryEvaluator.cpp >@@ -136,9 +136,9 @@ const Element* ContainerQueryEvaluator::selectContainer(OptionSet<CQ::Axis> axes > return &element; > } > >- for (auto& ancestor : composedTreeAncestors(const_cast<Element&>(element))) { >- if (isContainerForQuery(ancestor)) >- return &ancestor; >+ for (auto* ancestor = element.parentOrShadowHostElement(); ancestor; ancestor = ancestor->parentOrShadowHostElement()) { >+ if (isContainerForQuery(*ancestor)) >+ return ancestor; > } > return { }; > } >diff --git a/Source/WebCore/style/StyleTreeResolver.cpp b/Source/WebCore/style/StyleTreeResolver.cpp >index 1b0f70798d8532276a2902adf9f1ed9711eb8797..e2d5f5b80ebb73ef5996d0ee260fa4d56494a5ee 100644 >--- a/Source/WebCore/style/StyleTreeResolver.cpp >+++ b/Source/WebCore/style/StyleTreeResolver.cpp >@@ -88,6 +88,7 @@ TreeResolver::Scope::Scope(ShadowRoot& shadowRoot, Scope& enclosingScope) > , shadowRoot(&shadowRoot) > , enclosingScope(&enclosingScope) > { >+ selectorMatchingState.queryContainers = enclosingScope.selectorMatchingState.queryContainers; > } > > TreeResolver::Scope::~Scope() >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index b7f2a40211929fa975a8b0624236fcc11689aac2..196c539e24dd6f1256dbca33307aa16e4c1391b2 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,15 @@ >+2022-04-07 Antti Koivisto <antti@apple.com> >+ >+ [CSS Container Queries] Evaluate against shadow-including ancestors >+ https://bugs.webkit.org/show_bug.cgi?id=238934 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom-expected.txt: >+ * web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom.html: >+ >+ Add declarative shadow DOM polyfill. >+ > 2022-04-06 Tim Nguyen <ntim@apple.com> > > [:has() pseudo-class] Support invalidation for :placeholder-shown >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom-expected.txt >index e376a2c0920ef13c53bcd3a81bc090d50492a5b5..2ef9ebd38eff5027075070f7a795c517eee665ce 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom-expected.txt >@@ -1,12 +1,12 @@ > >-FAIL Match container in outer tree null is not an object (evaluating 'document.querySelector("#inclusive-ancestor-across-root > div").shadowRoot.querySelector') >+PASS Match container in outer tree > PASS Match container in same tree, not walking flat tree ancestors > FAIL Match container in ::slotted selector's originating element tree assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >-FAIL Match container in outer tree for :host assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >-FAIL Match container in ::part selector's originating element tree null is not an object (evaluating 'document.querySelector("#inclusive-ancestor-part > div").shadowRoot.querySelector') >+PASS Match container in outer tree for :host >+FAIL Match container in ::part selector's originating element tree assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" > FAIL Match container for ::before in ::slotted selector's originating element tree assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >-FAIL Match container in outer tree for :host::before assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >-FAIL Match container for ::before in ::part selector's originating element tree null is not an object (evaluating 'document.querySelector("#inclusive-ancestor-part-before > div").shadowRoot.querySelector') >-FAIL Match container for ::part selector's originating element tree for exportparts null is not an object (evaluating 'outerhost.shadowRoot.querySelector') >-FAIL Match container for slot light tree child fallback null is not an object (evaluating 'document.querySelector("#inclusive-ancestor-slot-fallback > div").shadowRoot.querySelector') >+PASS Match container in outer tree for :host::before >+FAIL Match container for ::before in ::part selector's originating element tree assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >+FAIL Match container for ::part selector's originating element tree for exportparts assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" >+PASS Match container for slot light tree child fallback > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom.html >index 1ac4243bc41819a7ede64fefef6966644ac0c878..33a2ce23e0d5a7f93cf98a9a00b191a500044adf 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-shadow-dom.html >@@ -231,6 +231,18 @@ > <script> > setup(() => assert_implements_container_queries()); > >+ function attachShadowRoots(root) { >+ root.querySelectorAll("template[shadowroot]").forEach(template => { >+ const mode = template.getAttribute("shadowroot"); >+ const shadowRoot = template.parentNode.attachShadow({ mode }); >+ shadowRoot.appendChild(template.content); >+ template.remove(); >+ attachShadowRoots(shadowRoot); >+ }); >+ } >+ if (!document.querySelector("template[shadowroot]").parentNode.shadowRoot) >+ attachShadowRoots(document); >+ > const green = "rgb(0, 128, 0)"; > > test(() => {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 238934
: 456922