Unreviewed, rolling out r207783.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 00:11:38 +0000 (00:11 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Oct 2016 00:11:38 +0000 (00:11 +0000)
This change appears to have caused fast/selectors/invalid-
functional-pseudo-class.html to crash on iOS and macOS

Reverted changeset:

"[CSS Parser] Fix :lang argument parsing"
https://bugs.webkit.org/show_bug.cgi?id=163913
http://trac.webkit.org/changeset/207783

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207790 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
Source/WebCore/css/parser/CSSParserValues.cpp
Source/WebCore/css/parser/CSSParserValues.h
Source/WebCore/css/parser/CSSSelectorParser.cpp

index 573383f..d1bf517 100644 (file)
@@ -1,3 +1,16 @@
+2016-10-24  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r207783.
+
+        This change appears to have caused fast/selectors/invalid-
+        functional-pseudo-class.html to crash on iOS and macOS
+
+        Reverted changeset:
+
+        "[CSS Parser] Fix :lang argument parsing"
+        https://bugs.webkit.org/show_bug.cgi?id=163913
+        http://trac.webkit.org/changeset/207783
+
 2016-10-24  Brady Eidson  <beidson@apple.com>
 
         IndexedDB 2.0: Support new IDBKeyRange interfaces.
index d534fbb..def93ce 100644 (file)
@@ -1,5 +1,4 @@
 -khtml-drag
--webkit-any
 -webkit-any(
 -webkit-any-link, PseudoClassAnyLinkDeprecated, PseudoElementUnknown
 -webkit-autofill
@@ -14,7 +13,6 @@ corner-present
 decrement
 default
 #if ENABLE(CSS_SELECTORS_LEVEL4)
-dir
 dir(
 #endif
 disabled
@@ -35,23 +33,16 @@ in-range
 increment
 indeterminate
 invalid
-lang
 lang(
 last-child
 last-of-type
 link
-matches
 matches(
 no-button
-not
 not(
-nth-child
 nth-child(
-nth-last-child
 nth-last-child(
-nth-last-of-type
 nth-last-of-type(
-nth-of-type
 nth-of-type(
 only-child
 only-of-type
@@ -62,7 +53,6 @@ read-only
 read-write
 required
 #if ENABLE(CSS_SELECTORS_LEVEL4)
-role
 role(
 #endif
 root
index 5e7253f..82af72e 100644 (file)
@@ -410,13 +410,7 @@ void CSSParserSelector::setLangArgumentList(const Vector<CSSParserString>& strin
         argumentList->append(languageArgument);
     m_selector->setLangArgumentList(WTFMove(argumentList));
 }
-
-void CSSParserSelector::setLangArgumentList(std::unique_ptr<Vector<AtomicString>> argumentList)
-{
-    ASSERT_WITH_MESSAGE(!argumentList->isEmpty(), "No CSS Selector takes an empty argument list.");
-    m_selector->setLangArgumentList(WTFMove(argumentList));
-}
-
+    
 void CSSParserSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList)
 {
     m_selector->setSelectorList(WTFMove(selectorList));
index 4ed443b..6869c3b 100644 (file)
@@ -235,7 +235,6 @@ public:
 
     void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
     void setLangArgumentList(const Vector<CSSParserString>& stringVector);
-    void setLangArgumentList(std::unique_ptr<Vector<AtomicString>>);
     void setSelectorList(std::unique_ptr<CSSSelectorList>);
 
     void setPseudoClassValue(const CSSParserString& pseudoClassString);
index 7a56255..be72e38 100644 (file)
@@ -100,23 +100,6 @@ CSSSelectorList CSSSelectorParser::consumeCompoundSelectorList(CSSParserTokenRan
     return list;
 }
 
-static void consumeLangArgumentList(std::unique_ptr<Vector<AtomicString>>& argumentList, CSSParserTokenRange& range)
-{
-    const CSSParserToken& ident = range.consumeIncludingWhitespace();
-    if (ident.type() != IdentToken)
-        return;
-    argumentList->append(ident.value().toAtomicString());
-    while (!range.atEnd() && range.peek().type() == CommaToken) {
-        range.consumeIncludingWhitespace();
-        const CSSParserToken& ident = range.consumeIncludingWhitespace();
-        if (ident.type() != IdentToken) {
-            argumentList->clear();
-            return;
-        }
-        argumentList->append(ident.value().toAtomicString());
-    }
-}
-    
 namespace {
 
 enum CompoundSelectorFlags {
@@ -486,82 +469,77 @@ std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTok
     if (token.type() != FunctionToken)
         return nullptr;
 
-    if (selector->match() == CSSSelector::PseudoClass) {
-        switch (selector->pseudoClassType()) {
-        case CSSSelector::PseudoClassNot: {
-            std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
-            block.consumeWhitespace();
-            if (!innerSelector || !block.atEnd())
-                return nullptr;
-            Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
-            selectorVector.append(WTFMove(innerSelector));
-            selector->adoptSelectorVector(selectorVector);
-            return selector;
-        }
-        case CSSSelector::PseudoClassNthChild:
-        case CSSSelector::PseudoClassNthLastChild:
-        case CSSSelector::PseudoClassNthOfType:
-        case CSSSelector::PseudoClassNthLastOfType: {
-            std::pair<int, int> ab;
-            if (!consumeANPlusB(block, ab))
-                return nullptr;
-            block.consumeWhitespace();
-            if (!block.atEnd())
-                return nullptr;
-            selector->setArgument(AtomicString::number(ab.first * ab.second));
-            return selector;
-        }
-        case CSSSelector::PseudoClassLang: {
-            // FIXME: CSS Selectors Level 4 allows :lang(*-foo)
-            auto argumentList = std::make_unique<Vector<AtomicString>>();
-            consumeLangArgumentList(argumentList, block);
-            if (argumentList->isEmpty())
-                return nullptr;
-            selector->setLangArgumentList(WTFMove(argumentList));
-            return selector;
-        }
-        // FIXME-NEWPARSER: Support :host-context
-        case CSSSelector::PseudoClassAny:
-        case CSSSelector::PseudoClassHost: {
-            DisallowPseudoElementsScope scope(this);
-            std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
-            *selectorList = consumeCompoundSelectorList(block);
-            if (!selectorList->isValid() || !block.atEnd())
-                return nullptr;
-            selector->setSelectorList(WTFMove(selectorList));
-            return selector;
-        }
-        default:
-            break;
-        }
+    switch (selector->pseudoClassType()) {
+    case CSSSelector::PseudoClassNot: {
+        std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
+        block.consumeWhitespace();
+        if (!innerSelector || !block.atEnd())
+            return nullptr;
+        Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
+        selectorVector.append(WTFMove(innerSelector));
+        selector->adoptSelectorVector(selectorVector);
+        return selector;
     }
-    
-    if (selector->match() == CSSSelector::PseudoElement) {
-        switch (selector->pseudoElementType()) {
-        case CSSSelector::PseudoElementCue: {
-            DisallowPseudoElementsScope scope(this);
-            std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
-            *selectorList = consumeCompoundSelectorList(block);
-            if (!selectorList->isValid() || !block.atEnd())
-                return nullptr;
-            selector->setSelectorList(WTFMove(selectorList));
-            return selector;
-        }
-        case CSSSelector::PseudoElementSlotted: {
-            DisallowPseudoElementsScope scope(this);
-
-            std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
-            block.consumeWhitespace();
-            if (!innerSelector || !block.atEnd())
-                return nullptr;
-            Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
-            selectorVector.append(WTFMove(innerSelector));
-            selector->adoptSelectorVector(selectorVector);
-            return selector;
-        }
-        default:
-            break;
-        }
+    case CSSSelector::PseudoClassNthChild:
+    case CSSSelector::PseudoClassNthLastChild:
+    case CSSSelector::PseudoClassNthOfType:
+    case CSSSelector::PseudoClassNthLastOfType: {
+        std::pair<int, int> ab;
+        if (!consumeANPlusB(block, ab))
+            return nullptr;
+        block.consumeWhitespace();
+        if (!block.atEnd())
+            return nullptr;
+        selector->setArgument(AtomicString::number(ab.first * ab.second));
+        return selector;
+    }
+    case CSSSelector::PseudoClassLang: {
+        // FIXME: CSS Selectors Level 4 allows :lang(*-foo)
+        const CSSParserToken& ident = block.consumeIncludingWhitespace();
+        if (ident.type() != IdentToken || !block.atEnd())
+            return nullptr;
+        selector->setArgument(ident.value().toAtomicString());
+        return selector;
+    }
+    // FIXME-NEWPARSER: Support :host-context
+    case CSSSelector::PseudoClassAny:
+    case CSSSelector::PseudoClassHost: {
+        DisallowPseudoElementsScope scope(this);
+        std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
+        *selectorList = consumeCompoundSelectorList(block);
+        if (!selectorList->isValid() || !block.atEnd())
+            return nullptr;
+        selector->setSelectorList(WTFMove(selectorList));
+        return selector;
+    }
+    default:
+        break;
+    }
+
+    switch (selector->pseudoElementType()) {
+    case CSSSelector::PseudoElementCue: {
+        DisallowPseudoElementsScope scope(this);
+        std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
+        *selectorList = consumeCompoundSelectorList(block);
+        if (!selectorList->isValid() || !block.atEnd())
+            return nullptr;
+        selector->setSelectorList(WTFMove(selectorList));
+        return selector;
+    }
+    case CSSSelector::PseudoElementSlotted: {
+        DisallowPseudoElementsScope scope(this);
+
+        std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
+        block.consumeWhitespace();
+        if (!innerSelector || !block.atEnd())
+            return nullptr;
+        Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
+        selectorVector.append(WTFMove(innerSelector));
+        selector->adoptSelectorVector(selectorVector);
+        return selector;
+    }
+    default:
+        break;
     }
 
     return nullptr;