Title: [250701] trunk
Revision
250701
Author
[email protected]
Date
2019-10-03 22:22:42 -0700 (Thu, 03 Oct 2019)

Log Message

[CSS Shadow Parts] Correct interaction with other pseudo elements
https://bugs.webkit.org/show_bug.cgi?id=202526

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-shadow-parts/interaction-with-pseudo-elements-expected.txt:

Source/WebCore:

Cases like foo::part(bar)::before should work.

This patch doesn't cover ::placeholder which is implemented as PseudoElementWebKitCustom (like internal -webkit-* properties).

* css/CSSSelector.h:
(WebCore::isTreeStructuralPseudoClass):

Add a helper.

* css/parser/CSSSelectorParser.cpp:

Allow non-structural pseudo classes after ::part().
Allow other pseudo elements after ::part().

(WebCore::CSSSelectorParser::consumePseudo):

No need for DisallowPseudoElementsScope, we are just parsing identifiers.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (250700 => 250701)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-04 05:05:58 UTC (rev 250700)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-04 05:22:42 UTC (rev 250701)
@@ -1,3 +1,12 @@
+2019-10-03  Antti Koivisto  <[email protected]>
+
+        [CSS Shadow Parts] Correct interaction with other pseudo elements
+        https://bugs.webkit.org/show_bug.cgi?id=202526
+
+        Reviewed by Ryosuke Niwa.
+
+        * web-platform-tests/css/css-shadow-parts/interaction-with-pseudo-elements-expected.txt:
+
 2019-10-03  Ryosuke Niwa  <[email protected]>
 
         Resync WPT shadow DOM tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/interaction-with-pseudo-elements-expected.txt (250700 => 250701)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/interaction-with-pseudo-elements-expected.txt	2019-10-04 05:05:58 UTC (rev 250700)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shadow-parts/interaction-with-pseudo-elements-expected.txt	2019-10-04 05:22:42 UTC (rev 250701)
@@ -1,8 +1,8 @@
 
-FAIL ::before in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL ::after in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
+PASS ::before in selected host is styled 
+PASS ::after in selected host is styled 
 FAIL ::placeholder in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"
-FAIL ::selection in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL ::first-line in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
-FAIL ::first-letter in selected host is styled assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
+PASS ::selection in selected host is styled 
+PASS ::first-line in selected host is styled 
+PASS ::first-letter in selected host is styled 
 

Modified: trunk/Source/WebCore/ChangeLog (250700 => 250701)


--- trunk/Source/WebCore/ChangeLog	2019-10-04 05:05:58 UTC (rev 250700)
+++ trunk/Source/WebCore/ChangeLog	2019-10-04 05:22:42 UTC (rev 250701)
@@ -1,3 +1,28 @@
+2019-10-03  Antti Koivisto  <[email protected]>
+
+        [CSS Shadow Parts] Correct interaction with other pseudo elements
+        https://bugs.webkit.org/show_bug.cgi?id=202526
+
+        Reviewed by Ryosuke Niwa.
+
+        Cases like foo::part(bar)::before should work.
+
+        This patch doesn't cover ::placeholder which is implemented as PseudoElementWebKitCustom (like internal -webkit-* properties).
+
+        * css/CSSSelector.h:
+        (WebCore::isTreeStructuralPseudoClass):
+
+        Add a helper.
+
+        * css/parser/CSSSelectorParser.cpp:
+
+        Allow non-structural pseudo classes after ::part().
+        Allow other pseudo elements after ::part().
+
+        (WebCore::CSSSelectorParser::consumePseudo):
+
+        No need for DisallowPseudoElementsScope, we are just parsing identifiers.
+
 2019-10-03  James Darpinian  <[email protected]>
 
         Fix WebGL 1 conformance regressions when USE_ANGLE=1

Modified: trunk/Source/WebCore/css/CSSSelector.h (250700 => 250701)


--- trunk/Source/WebCore/css/CSSSelector.h	2019-10-04 05:05:58 UTC (rev 250700)
+++ trunk/Source/WebCore/css/CSSSelector.h	2019-10-04 05:22:42 UTC (rev 250701)
@@ -439,6 +439,11 @@
         || type == CSSSelector::PseudoClassNthLastOfType;
 }
 
+static inline bool isTreeStructuralPseudoClass(CSSSelector::PseudoClassType type)
+{
+    return pseudoClassIsRelativeToSiblings(type) || type == CSSSelector::PseudoClassRoot;
+}
+
 inline bool CSSSelector::isSiblingSelector() const
 {
     return relation() == DirectAdjacent

Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (250700 => 250701)


--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2019-10-04 05:05:58 UTC (rev 250700)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2019-10-04 05:22:42 UTC (rev 250701)
@@ -209,6 +209,7 @@
     case CSSSelector::PseudoClassHover:
     case CSSSelector::PseudoClassFocus:
     case CSSSelector::PseudoClassActive:
+    case CSSSelector::PseudoClassFocusWithin:
         return true;
     default:
         return false;
@@ -218,6 +219,8 @@
 bool isPseudoClassValidAfterPseudoElement(CSSSelector::PseudoClassType pseudoClass, CSSSelector::PseudoElementType compoundPseudoElement)
 {
     switch (compoundPseudoElement) {
+    case CSSSelector::PseudoElementPart:
+        return !isTreeStructuralPseudoClass(pseudoClass);
     case CSSSelector::PseudoElementResizer:
     case CSSSelector::PseudoElementScrollbar:
     case CSSSelector::PseudoElementScrollbarCorner:
@@ -240,9 +243,10 @@
 {
     if (compoundPseudoElement == CSSSelector::PseudoElementUnknown)
         return true;
-    // FIXME-NEWPARSER: This doesn't exist for us.
-    // if (compoundPseudoElement == CSSSelector::PseudoElementContent)
-    //    return simpleSelector.match() != CSSSelector::PseudoElement;
+    if (compoundPseudoElement == CSSSelector::PseudoElementPart) {
+        if (simpleSelector.match() == CSSSelector::PseudoElement && simpleSelector.pseudoElementType() != CSSSelector::PseudoElementPart)
+            return true;
+    }
     if (simpleSelector.match() != CSSSelector::PseudoClass)
         return false;
     CSSSelector::PseudoClassType pseudo = simpleSelector.pseudoClassType();
@@ -618,8 +622,6 @@
         }
 #endif
         case CSSSelector::PseudoElementPart: {
-            DisallowPseudoElementsScope scope(this);
-
             auto argumentList = makeUnique<Vector<AtomString>>();
             do {
                 auto& ident = block.consumeIncludingWhitespace();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to