Title: [285209] trunk
Revision
285209
Author
an...@apple.com
Date
2021-11-03 09:40:39 -0700 (Wed, 03 Nov 2021)

Log Message

::slotted shouldn't match an active <slot>
https://bugs.webkit.org/show_bug.cgi?id=232664

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-scoping/slotted-slot-expected.txt:

Source/WebCore:

https://drafts.csswg.org/css-scoping/#slotted-pseudo

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):

Avoid matching <slot>.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (285208 => 285209)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-03 16:17:21 UTC (rev 285208)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-11-03 16:40:39 UTC (rev 285209)
@@ -1,3 +1,12 @@
+2021-11-03  Antti Koivisto  <an...@apple.com>
+
+        ::slotted shouldn't match an active <slot>
+        https://bugs.webkit.org/show_bug.cgi?id=232664
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-scoping/slotted-slot-expected.txt:
+
 2021-11-01  Michael[tm] Smith  <m...@w3.org>
 
         [WebInspector][CORS] Show HTTP status code in CORS messages.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/slotted-slot-expected.txt (285208 => 285209)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/slotted-slot-expected.txt	2021-11-03 16:17:21 UTC (rev 285208)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/slotted-slot-expected.txt	2021-11-03 16:40:39 UTC (rev 285209)
@@ -1,4 +1,4 @@
 This text should be green.
 
-FAIL Check that ::slotted does not match slot elements assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
+PASS Check that ::slotted does not match slot elements
 

Modified: trunk/Source/WebCore/ChangeLog (285208 => 285209)


--- trunk/Source/WebCore/ChangeLog	2021-11-03 16:17:21 UTC (rev 285208)
+++ trunk/Source/WebCore/ChangeLog	2021-11-03 16:40:39 UTC (rev 285209)
@@ -1,3 +1,17 @@
+2021-11-03  Antti Koivisto  <an...@apple.com>
+
+        ::slotted shouldn't match an active <slot>
+        https://bugs.webkit.org/show_bug.cgi?id=232664
+
+        Reviewed by Simon Fraser.
+
+        https://drafts.csswg.org/css-scoping/#slotted-pseudo
+
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne const):
+
+        Avoid matching <slot>.
+
 2021-11-03  Chris Lord  <cl...@igalia.com>
 
         [GTK][WPE] Use the display refresh to drive scrolling animations (sync scroll)

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (285208 => 285209)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-03 16:17:21 UTC (rev 285208)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2021-11-03 16:40:39 UTC (rev 285209)
@@ -1156,6 +1156,9 @@
         case CSSSelector::PseudoElementSlotted: {
             if (!context.element->assignedSlot())
                 return false;
+            // ::slotted matches after flattening so it can't match an active <slot>.
+            if (is<HTMLSlotElement>(*context.element) && context.element->containingShadowRoot())
+                return false;
             auto* subselector = context.selector->selectorList()->first();
             LocalContext subcontext(context);
             subcontext.selector = subselector;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to