Title: [207900] trunk/Source/WebCore
Revision
207900
Author
[email protected]
Date
2016-10-26 09:14:17 -0700 (Wed, 26 Oct 2016)

Log Message

[CSS Parser] Get functional pseudos parsing
https://bugs.webkit.org/show_bug.cgi?id=164018

Reviewed by Zalan Bujtas.

* css/parser/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
Remove the ( check so that we can parse strings that end in (.

* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumePseudo):
Put in a hack that adds a ( to the end of the string so that it will be found in the map.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207899 => 207900)


--- trunk/Source/WebCore/ChangeLog	2016-10-26 15:36:35 UTC (rev 207899)
+++ trunk/Source/WebCore/ChangeLog	2016-10-26 16:14:17 UTC (rev 207900)
@@ -1,3 +1,18 @@
+2016-10-26  Dave Hyatt  <[email protected]>
+
+        [CSS Parser] Get functional pseudos parsing
+        https://bugs.webkit.org/show_bug.cgi?id=164018
+
+        Reviewed by Zalan Bujtas.
+
+        * css/parser/CSSParserValues.cpp:
+        (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
+        Remove the ( check so that we can parse strings that end in (.
+
+        * css/parser/CSSSelectorParser.cpp:
+        (WebCore::CSSSelectorParser::consumePseudo):
+        Put in a hack that adds a ( to the end of the string so that it will be found in the map.
+
 2016-10-26  Zan Dobersek  <[email protected]>
 
         Unreviewed. Fixing compiler warnings in PlaybackPipeline

Modified: trunk/Source/WebCore/css/parser/CSSParserValues.cpp (207899 => 207900)


--- trunk/Source/WebCore/css/parser/CSSParserValues.cpp	2016-10-26 15:36:35 UTC (rev 207899)
+++ trunk/Source/WebCore/css/parser/CSSParserValues.cpp	2016-10-26 16:14:17 UTC (rev 207900)
@@ -348,9 +348,6 @@
 
 CSSParserSelector* CSSParserSelector::parsePseudoClassSelectorFromStringView(StringView& pseudoTypeString)
 {
-    if (pseudoTypeString.length() && pseudoTypeString[pseudoTypeString.length() - 1] == '(')
-        return nullptr;
-    
     PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString);
     if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) {
         auto selector = std::make_unique<CSSParserSelector>();

Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (207899 => 207900)


--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2016-10-26 15:36:35 UTC (rev 207899)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp	2016-10-26 16:14:17 UTC (rev 207900)
@@ -502,6 +502,16 @@
 
     std::unique_ptr<CSSParserSelector> selector;
     StringView value = token.value();
+    
+    // FIXME-NEWPARSER: We can't change the pseudoclass/element maps that the old parser
+    // uses without breaking it; this hack allows function selectors to work. When the new
+    // parser turns on, we can patch the map and remove this code.
+    String newValue;
+    if (token.type() == FunctionToken) {
+        newValue = value.toString() + "(";
+        value = newValue;
+    }
+
     if (colons == 1)
         selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoClassSelectorFromStringView(value));
     else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to