<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166883] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166883">166883</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-07 13:26:44 -0700 (Mon, 07 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Split CSS Selectors pseudo class and pseudo elements
https://bugs.webkit.org/show_bug.cgi?id=131295

Reviewed by Andreas Kling.

Split pseudo class and pseudo element to make it clearer what pseudo types
are possible for a given match type.

Pseudo Element types are separated and Pseudo Class are left in place. The Pseudo Class
will have to be renamed too but that will be done separately to make this change smaller.

* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::rewriteSpecifiersWithElementName):
(WebCore::CSSParser::rewriteSpecifiers):
Use a method isPseudoElementCueFunction() to abstract the #ifdef out of the parser.

* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoElementSelector):

(WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
Rename to specify this is for the pseudo element cue function, not the pseudo element cue.

(WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector):
(WebCore::CSSParserSelector::parsePseudoCueFunctionSelector): Deleted.
* css/CSSParserValues.h:
(WebCore::CSSParserSelector::isPseudoElementCueFunction):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::specificityForOneSelector):
(WebCore::CSSSelector::pseudoId):
(WebCore::CSSSelector::parsePseudoElementType):
(WebCore::CSSSelector::operator==):
* css/CSSSelector.h:
(WebCore::CSSSelector::pseudoType):
(WebCore::CSSSelector::setPseudoElementType):
(WebCore::CSSSelector::pseudoElementType):
(WebCore::CSSSelector::isUnknownPseudoElement):
(WebCore::CSSSelector::isCustomPseudoElement):
(WebCore::pseudoClassIsRelativeToSiblings):
(WebCore::CSSSelector::isSiblingSelector):
* css/RuleFeature.cpp:
(WebCore::RuleFeatureSet::collectFeaturesFromSelector):
* css/RuleSet.cpp:
(WebCore::determinePropertyWhitelistType):
(WebCore::RuleSet::findBestRuleSetAndAdd):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::checkScrollbarPseudoClass):
(WebCore::SelectorChecker::determineLinkMatchType):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/SelectorPseudoElementTypeMap.in:
* css/SelectorPseudoTypeMap.h:
* css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
* css/makeSelectorPseudoElementsMap.py:
(enumerablePseudoType):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getMatchedCSSRules):

* rendering/style/RenderStyleConstants.h:
All the fullscreen pseudo types are pseudo class selectors. They should not have a pseudo ID.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/css/CSSGrammar.y.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserValuescpp">trunk/Source/WebCore/css/CSSParserValues.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserValuesh">trunk/Source/WebCore/css/CSSParserValues.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorcpp">trunk/Source/WebCore/css/CSSSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorh">trunk/Source/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkSourceWebCorecssRuleFeaturecpp">trunk/Source/WebCore/css/RuleFeature.cpp</a></li>
<li><a href="#trunkSourceWebCorecssRuleSetcpp">trunk/Source/WebCore/css/RuleSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin">trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoElementTypeMapin">trunk/Source/WebCore/css/SelectorPseudoElementTypeMap.in</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoTypeMaph">trunk/Source/WebCore/css/SelectorPseudoTypeMap.h</a></li>
<li><a href="#trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy">trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py</a></li>
<li><a href="#trunkSourceWebCorecssmakeSelectorPseudoElementsMappy">trunk/Source/WebCore/css/makeSelectorPseudoElementsMap.py</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleConstantsh">trunk/Source/WebCore/rendering/style/RenderStyleConstants.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/ChangeLog        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -1,3 +1,67 @@
</span><ins>+2014-04-07  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        Split CSS Selectors pseudo class and pseudo elements
+        https://bugs.webkit.org/show_bug.cgi?id=131295
+
+        Reviewed by Andreas Kling.
+
+        Split pseudo class and pseudo element to make it clearer what pseudo types
+        are possible for a given match type.
+
+        Pseudo Element types are separated and Pseudo Class are left in place. The Pseudo Class
+        will have to be renamed too but that will be done separately to make this change smaller.
+
+        * css/CSSGrammar.y.in:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::rewriteSpecifiersWithElementName):
+        (WebCore::CSSParser::rewriteSpecifiers):
+        Use a method isPseudoElementCueFunction() to abstract the #ifdef out of the parser.
+
+        * css/CSSParserValues.cpp:
+        (WebCore::CSSParserSelector::parsePseudoElementSelector):
+
+        (WebCore::CSSParserSelector::parsePseudoElementCueFunctionSelector):
+        Rename to specify this is for the pseudo element cue function, not the pseudo element cue.
+
+        (WebCore::CSSParserSelector::parsePseudoClassAndCompatibilityElementSelector):
+        (WebCore::CSSParserSelector::parsePseudoCueFunctionSelector): Deleted.
+        * css/CSSParserValues.h:
+        (WebCore::CSSParserSelector::isPseudoElementCueFunction):
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::specificityForOneSelector):
+        (WebCore::CSSSelector::pseudoId):
+        (WebCore::CSSSelector::parsePseudoElementType):
+        (WebCore::CSSSelector::operator==):
+        * css/CSSSelector.h:
+        (WebCore::CSSSelector::pseudoType):
+        (WebCore::CSSSelector::setPseudoElementType):
+        (WebCore::CSSSelector::pseudoElementType):
+        (WebCore::CSSSelector::isUnknownPseudoElement):
+        (WebCore::CSSSelector::isCustomPseudoElement):
+        (WebCore::pseudoClassIsRelativeToSiblings):
+        (WebCore::CSSSelector::isSiblingSelector):
+        * css/RuleFeature.cpp:
+        (WebCore::RuleFeatureSet::collectFeaturesFromSelector):
+        * css/RuleSet.cpp:
+        (WebCore::determinePropertyWhitelistType):
+        (WebCore::RuleSet::findBestRuleSetAndAdd):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::matchRecursively):
+        (WebCore::SelectorChecker::checkOne):
+        (WebCore::SelectorChecker::checkScrollbarPseudoClass):
+        (WebCore::SelectorChecker::determineLinkMatchType):
+        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+        * css/SelectorPseudoElementTypeMap.in:
+        * css/SelectorPseudoTypeMap.h:
+        * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
+        * css/makeSelectorPseudoElementsMap.py:
+        (enumerablePseudoType):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::getMatchedCSSRules):
+
+        * rendering/style/RenderStyleConstants.h:
+        All the fullscreen pseudo types are pseudo class selectors. They should not have a pseudo ID.
+
</ins><span class="cx"> 2014-04-07  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Replay: detect possible replay divergence from unexpected DOM event dispatches
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSGrammar.y.in        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -1204,7 +1204,7 @@
</span><span class="cx"> #if ENABLE_VIDEO_TRACK
</span><span class="cx">     // used by ::cue(:past/:future)
</span><span class="cx">     | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' {
</span><del>-        $$ = CSSParserSelector::parsePseudoCueFunctionSelector($3, $5);
</del><ins>+        $$ = CSSParserSelector::parsePseudoElementCueFunctionSelector($3, $5);
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx">     // use by :-webkit-any.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -11343,9 +11343,7 @@
</span><span class="cx">     if (!specifiers.isCustomPseudoElement()) {
</span><span class="cx">         if (tag == anyQName())
</span><span class="cx">             return;
</span><del>-#if ENABLE(VIDEO_TRACK)
-        if (specifiers.pseudoType() != CSSSelector::PseudoCue)
-#endif
</del><ins>+        if (!specifiers.isPseudoElementCueFunction())
</ins><span class="cx">             specifiers.prependTagSelector(tag, tagIsForNamespaceRule);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -11372,11 +11370,7 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;CSSParserSelector&gt; CSSParser::rewriteSpecifiers(std::unique_ptr&lt;CSSParserSelector&gt; specifiers, std::unique_ptr&lt;CSSParserSelector&gt; newSpecifier)
</span><span class="cx"> {
</span><del>-#if ENABLE(VIDEO_TRACK)
-    if (newSpecifier-&gt;isCustomPseudoElement() || newSpecifier-&gt;pseudoType() == CSSSelector::PseudoCue) {
-#else
-    if (newSpecifier-&gt;isCustomPseudoElement()) {
-#endif
</del><ins>+    if (newSpecifier-&gt;isCustomPseudoElement() || newSpecifier-&gt;isPseudoElementCueFunction()) {
</ins><span class="cx">         // Unknown pseudo element always goes at the top of selector chain.
</span><span class="cx">         newSpecifier-&gt;appendTagHistory(CSSSelector::ShadowDescendant, std::move(specifiers));
</span><span class="cx">         return newSpecifier;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParserValues.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParserValues.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSParserValues.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -174,19 +174,19 @@
</span><span class="cx">     pseudoTypeString.lower();
</span><span class="cx">     AtomicString name = pseudoTypeString;
</span><span class="cx"> 
</span><del>-    CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoElementType(name);
-    if (pseudoType == CSSSelector::PseudoUnknown)
</del><ins>+    CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(name);
+    if (pseudoType == CSSSelector::PseudoElementUnknown)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">     selector-&gt;m_selector-&gt;m_match = CSSSelector::PseudoElement;
</span><del>-    selector-&gt;m_selector-&gt;m_pseudoType = pseudoType;
</del><ins>+    selector-&gt;m_selector-&gt;setPseudoElementType(pseudoType);
</ins><span class="cx">     selector-&gt;m_selector-&gt;setValue(name);
</span><span class="cx">     return selector.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-CSSParserSelector* CSSParserSelector::parsePseudoCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* parsedSelectorVector)
</del><ins>+CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* parsedSelectorVector)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(functionIdentifier, String(functionIdentifier) == &quot;cue(&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">     selector-&gt;m_selector-&gt;m_match = CSSSelector::PseudoElement;
</span><del>-    selector-&gt;m_selector-&gt;m_pseudoType = CSSSelector::PseudoCue;
</del><ins>+    selector-&gt;m_selector-&gt;setPseudoElementType(CSSSelector::PseudoElementCue);
</ins><span class="cx">     selector-&gt;adoptSelectorVector(*selectorVector);
</span><span class="cx">     return selector.release();
</span><span class="cx"> }
</span><span class="lines">@@ -212,10 +212,10 @@
</span><span class="cx">         selector-&gt;m_selector-&gt;m_pseudoType = pseudoType.pseudoClass;
</span><span class="cx">         return selector.release();
</span><span class="cx">     }
</span><del>-    if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoUnknown) {
</del><ins>+    if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoElementUnknown) {
</ins><span class="cx">         auto selector = std::make_unique&lt;CSSParserSelector&gt;();
</span><span class="cx">         selector-&gt;m_selector-&gt;m_match = CSSSelector::PseudoElement;
</span><del>-        selector-&gt;m_selector-&gt;m_pseudoType = pseudoType.compatibilityPseudoElement;
</del><ins>+        selector-&gt;m_selector-&gt;setPseudoElementType(pseudoType.compatibilityPseudoElement);
</ins><span class="cx">         AtomicString name = pseudoTypeString;
</span><span class="cx">         selector-&gt;m_selector-&gt;setValue(name);
</span><span class="cx">         return selector.release();
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserValuesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParserValues.h (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParserValues.h        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSParserValues.h        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx"> public:
</span><span class="cx">     static CSSParserSelector* parsePagePseudoSelector(const CSSParserString&amp; pseudoTypeString);
</span><span class="cx">     static CSSParserSelector* parsePseudoElementSelector(CSSParserString&amp; pseudoTypeString);
</span><del>-    static CSSParserSelector* parsePseudoCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectorVector);
</del><ins>+    static CSSParserSelector* parsePseudoElementCueFunctionSelector(const CSSParserString&amp; functionIdentifier, Vector&lt;std::unique_ptr&lt;CSSParserSelector&gt;&gt;* selectorVector);
</ins><span class="cx">     static CSSParserSelector* parsePseudoClassAndCompatibilityElementSelector(CSSParserString&amp; pseudoTypeString);
</span><span class="cx"> 
</span><span class="cx">     CSSParserSelector();
</span><span class="lines">@@ -200,6 +200,15 @@
</span><span class="cx">     CSSSelector::PseudoType pseudoType() const { return m_selector-&gt;pseudoType(); }
</span><span class="cx">     bool isCustomPseudoElement() const { return m_selector-&gt;isCustomPseudoElement(); }
</span><span class="cx"> 
</span><ins>+    bool isPseudoElementCueFunction() const
+    {
+#if ENABLE(VIDEO_TRACK)
+        return m_selector-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; m_selector-&gt;pseudoElementType() == CSSSelector::PseudoElementCue;
+#else
+        return false;
+#endif
+    }
+
</ins><span class="cx">     bool isSimple() const;
</span><span class="cx">     bool hasShadowDescendant() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSSelector.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -88,21 +88,24 @@
</span><span class="cx">     switch (m_match) {
</span><span class="cx">     case Id:
</span><span class="cx">         return 0x10000;
</span><ins>+
+    case PseudoClass:
+        // FIXME: PsuedoAny should base the specificity on the sub-selectors.
+        // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html
+        if (pseudoType() == PseudoNot &amp;&amp; selectorList())
+            return selectorList()-&gt;first()-&gt;specificityForOneSelector();
+        FALLTHROUGH;
</ins><span class="cx">     case Exact:
</span><span class="cx">     case Class:
</span><span class="cx">     case Set:
</span><span class="cx">     case List:
</span><span class="cx">     case Hyphen:
</span><del>-    case PseudoClass:
</del><span class="cx">     case PseudoElement:
</span><span class="cx">     case Contain:
</span><span class="cx">     case Begin:
</span><span class="cx">     case End:
</span><del>-        // FIXME: PsuedoAny should base the specificity on the sub-selectors.
-        // See http://lists.w3.org/Archives/Public/www-style/2010Sep/0530.html
-        if (pseudoType() == PseudoNot &amp;&amp; selectorList())
-            return selectorList()-&gt;first()-&gt;specificityForOneSelector();
</del><span class="cx">         return 0x100;
</span><ins>+
</ins><span class="cx">     case Tag:
</span><span class="cx">         return (tagQName().localName() != starAtom) ? 1 : 0;
</span><span class="cx">     case Unknown:
</span><span class="lines">@@ -140,103 +143,39 @@
</span><span class="cx">     return s;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PseudoId CSSSelector::pseudoId(PseudoType type)
</del><ins>+PseudoId CSSSelector::pseudoId(PseudoElementType type)
</ins><span class="cx"> {
</span><span class="cx">     switch (type) {
</span><del>-    case PseudoFirstLine:
</del><ins>+    case PseudoElementFirstLine:
</ins><span class="cx">         return FIRST_LINE;
</span><del>-    case PseudoFirstLetter:
</del><ins>+    case PseudoElementFirstLetter:
</ins><span class="cx">         return FIRST_LETTER;
</span><del>-    case PseudoSelection:
</del><ins>+    case PseudoElementSelection:
</ins><span class="cx">         return SELECTION;
</span><del>-    case PseudoBefore:
</del><ins>+    case PseudoElementBefore:
</ins><span class="cx">         return BEFORE;
</span><del>-    case PseudoAfter:
</del><ins>+    case PseudoElementAfter:
</ins><span class="cx">         return AFTER;
</span><del>-    case PseudoScrollbar:
</del><ins>+    case PseudoElementScrollbar:
</ins><span class="cx">         return SCROLLBAR;
</span><del>-    case PseudoScrollbarButton:
</del><ins>+    case PseudoElementScrollbarButton:
</ins><span class="cx">         return SCROLLBAR_BUTTON;
</span><del>-    case PseudoScrollbarCorner:
</del><ins>+    case PseudoElementScrollbarCorner:
</ins><span class="cx">         return SCROLLBAR_CORNER;
</span><del>-    case PseudoScrollbarThumb:
</del><ins>+    case PseudoElementScrollbarThumb:
</ins><span class="cx">         return SCROLLBAR_THUMB;
</span><del>-    case PseudoScrollbarTrack:
</del><ins>+    case PseudoElementScrollbarTrack:
</ins><span class="cx">         return SCROLLBAR_TRACK;
</span><del>-    case PseudoScrollbarTrackPiece:
</del><ins>+    case PseudoElementScrollbarTrackPiece:
</ins><span class="cx">         return SCROLLBAR_TRACK_PIECE;
</span><del>-    case PseudoResizer:
</del><ins>+    case PseudoElementResizer:
</ins><span class="cx">         return RESIZER;
</span><del>-#if ENABLE(FULLSCREEN_API)
-    case PseudoFullScreen:
-        return FULL_SCREEN;
-    case PseudoFullScreenDocument:
-        return FULL_SCREEN_DOCUMENT;
-    case PseudoFullScreenAncestor:
-        return FULL_SCREEN_ANCESTOR;
-    case PseudoAnimatingFullScreenTransition:
-        return ANIMATING_FULL_SCREEN_TRANSITION;
-#endif
-    case PseudoUnknown:
-    case PseudoEmpty:
-    case PseudoFirstChild:
-    case PseudoFirstOfType:
-    case PseudoLastChild:
-    case PseudoLastOfType:
-    case PseudoOnlyChild:
-    case PseudoOnlyOfType:
-    case PseudoNthChild:
-    case PseudoNthOfType:
-    case PseudoNthLastChild:
-    case PseudoNthLastOfType:
-    case PseudoLink:
-    case PseudoVisited:
-    case PseudoAny:
-    case PseudoAnyLink:
-    case PseudoAutofill:
-    case PseudoHover:
-    case PseudoDrag:
-    case PseudoFocus:
-    case PseudoActive:
-    case PseudoChecked:
-    case PseudoEnabled:
-    case PseudoFullPageMedia:
-    case PseudoDefault:
-    case PseudoDisabled:
-    case PseudoOptional:
-    case PseudoRequired:
-    case PseudoReadOnly:
-    case PseudoReadWrite:
-    case PseudoValid:
-    case PseudoInvalid:
-    case PseudoIndeterminate:
-    case PseudoTarget:
-    case PseudoLang:
-    case PseudoNot:
-    case PseudoRoot:
-    case PseudoScope:
-    case PseudoScrollbarBack:
-    case PseudoScrollbarForward:
-    case PseudoWindowInactive:
-    case PseudoCornerPresent:
-    case PseudoDecrement:
-    case PseudoIncrement:
-    case PseudoHorizontal:
-    case PseudoVertical:
-    case PseudoStart:
-    case PseudoEnd:
-    case PseudoDoubleButton:
-    case PseudoSingleButton:
-    case PseudoNoButton:
-    case PseudoInRange:
-    case PseudoOutOfRange:
-    case PseudoUserAgentCustomElement:
-    case PseudoWebKitCustomElement:
</del><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-    case PseudoCue:
-    case PseudoFuture:
-    case PseudoPast:
</del><ins>+    case PseudoElementCue:
</ins><span class="cx"> #endif
</span><ins>+    case PseudoElementUnknown:
+    case PseudoElementUserAgentCustom:
+    case PseudoElementWebKitCustom:
</ins><span class="cx">         return NOPSEUDO;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -244,18 +183,18 @@
</span><span class="cx">     return NOPSEUDO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSSelector::PseudoType CSSSelector::parsePseudoElementType(const String&amp; name)
</del><ins>+CSSSelector::PseudoElementType CSSSelector::parsePseudoElementType(const String&amp; name)
</ins><span class="cx"> {
</span><span class="cx">     if (name.isNull())
</span><del>-        return PseudoUnknown;
</del><ins>+        return PseudoElementUnknown;
</ins><span class="cx"> 
</span><del>-    PseudoType type = parsePseudoElementString(*name.impl());
-    if (type == PseudoUnknown) {
</del><ins>+    PseudoElementType type = parsePseudoElementString(*name.impl());
+    if (type == PseudoElementUnknown) {
</ins><span class="cx">         if (name.startsWith(&quot;-webkit-&quot;))
</span><del>-            type = PseudoWebKitCustomElement;
</del><ins>+            type = PseudoElementWebKitCustom;
</ins><span class="cx"> 
</span><span class="cx">         if (name.startsWith(&quot;x-&quot;))
</span><del>-            type = PseudoUserAgentCustomElement;
</del><ins>+            type = PseudoElementUserAgentCustom;
</ins><span class="cx">     }
</span><span class="cx">     return type;
</span><span class="cx"> }
</span><span class="lines">@@ -271,7 +210,7 @@
</span><span class="cx">             || sel1-&gt;relation() != sel2-&gt;relation()
</span><span class="cx">             || sel1-&gt;m_match != sel2-&gt;m_match
</span><span class="cx">             || sel1-&gt;value() != sel2-&gt;value()
</span><del>-            || sel1-&gt;pseudoType() != sel2-&gt;pseudoType()
</del><ins>+            || sel1-&gt;m_pseudoType != sel2-&gt;m_pseudoType
</ins><span class="cx">             || sel1-&gt;argument() != sel2-&gt;argument()) {
</span><span class="cx">             return false;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.h (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.h        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/CSSSelector.h        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -87,8 +87,6 @@
</span><span class="cx">             PseudoLastOfType,
</span><span class="cx">             PseudoOnlyChild,
</span><span class="cx">             PseudoOnlyOfType,
</span><del>-            PseudoFirstLine,
-            PseudoFirstLetter,
</del><span class="cx">             PseudoNthChild,
</span><span class="cx">             PseudoNthOfType,
</span><span class="cx">             PseudoNthLastChild,
</span><span class="lines">@@ -115,21 +113,10 @@
</span><span class="cx">             PseudoInvalid,
</span><span class="cx">             PseudoIndeterminate,
</span><span class="cx">             PseudoTarget,
</span><del>-            PseudoBefore,
-            PseudoAfter,
</del><span class="cx">             PseudoLang,
</span><span class="cx">             PseudoNot,
</span><del>-            PseudoResizer,
</del><span class="cx">             PseudoRoot,
</span><span class="cx">             PseudoScope,
</span><del>-            PseudoScrollbar,
-            PseudoScrollbarBack,
-            PseudoScrollbarButton,
-            PseudoScrollbarCorner,
-            PseudoScrollbarForward,
-            PseudoScrollbarThumb,
-            PseudoScrollbarTrack,
-            PseudoScrollbarTrackPiece,
</del><span class="cx">             PseudoWindowInactive,
</span><span class="cx">             PseudoCornerPresent,
</span><span class="cx">             PseudoDecrement,
</span><span class="lines">@@ -141,7 +128,6 @@
</span><span class="cx">             PseudoDoubleButton,
</span><span class="cx">             PseudoSingleButton,
</span><span class="cx">             PseudoNoButton,
</span><del>-            PseudoSelection,
</del><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx">             PseudoFullScreen,
</span><span class="cx">             PseudoFullScreenDocument,
</span><span class="lines">@@ -150,15 +136,33 @@
</span><span class="cx"> #endif
</span><span class="cx">             PseudoInRange,
</span><span class="cx">             PseudoOutOfRange,
</span><del>-            PseudoUserAgentCustomElement,
-            PseudoWebKitCustomElement,
</del><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-            PseudoCue,
</del><span class="cx">             PseudoFuture,
</span><span class="cx">             PseudoPast,
</span><span class="cx"> #endif
</span><span class="cx">         };
</span><span class="cx"> 
</span><ins>+        enum PseudoElementType {
+            PseudoElementUnknown = 0,
+            PseudoElementAfter,
+            PseudoElementBefore,
+#if ENABLE(VIDEO_TRACK)
+            PseudoElementCue,
+#endif
+            PseudoElementFirstLetter,
+            PseudoElementFirstLine,
+            PseudoElementResizer,
+            PseudoElementScrollbar,
+            PseudoElementScrollbarButton,
+            PseudoElementScrollbarCorner,
+            PseudoElementScrollbarThumb,
+            PseudoElementScrollbarTrack,
+            PseudoElementScrollbarTrackPiece,
+            PseudoElementSelection,
+            PseudoElementUserAgentCustom,
+            PseudoElementWebKitCustom,
+        };
+
</ins><span class="cx">         enum PagePseudoClassType {
</span><span class="cx">             PagePseudoClassFirst = 1,
</span><span class="cx">             PagePseudoClassLeft,
</span><span class="lines">@@ -186,11 +190,12 @@
</span><span class="cx"> 
</span><span class="cx">         PseudoType pseudoType() const
</span><span class="cx">         {
</span><ins>+            ASSERT(m_match == PseudoClass);
</ins><span class="cx">             return static_cast&lt;PseudoType&gt;(m_pseudoType);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        static PseudoType parsePseudoElementType(const String&amp;);
-        static PseudoId pseudoId(PseudoType);
</del><ins>+        static PseudoElementType parsePseudoElementType(const String&amp;);
+        static PseudoId pseudoId(PseudoElementType);
</ins><span class="cx"> 
</span><span class="cx">         // Selectors are kept in an array by CSSSelectorList. The next component of the selector is
</span><span class="cx">         // the next item in the array.
</span><span class="lines">@@ -203,6 +208,7 @@
</span><span class="cx">         const AtomicString&amp; argument() const { return m_hasRareData ? m_data.m_rareData-&gt;m_argument : nullAtom; }
</span><span class="cx">         const CSSSelectorList* selectorList() const { return m_hasRareData ? m_data.m_rareData-&gt;m_selectorList.get() : 0; }
</span><span class="cx"> 
</span><ins>+        void setPseudoElementType(PseudoElementType pseudoElementType) { m_pseudoType = pseudoElementType; }
</ins><span class="cx">         void setPagePseudoType(PagePseudoClassType pagePseudoType) { m_pseudoType = pagePseudoType; }
</span><span class="cx">         void setValue(const AtomicString&amp;);
</span><span class="cx">         void setAttribute(const QualifiedName&amp;, bool isCaseInsensitive);
</span><span class="lines">@@ -212,6 +218,7 @@
</span><span class="cx">         bool parseNth() const;
</span><span class="cx">         bool matchNth(int count) const;
</span><span class="cx"> 
</span><ins>+        PseudoElementType pseudoElementType() const { ASSERT(m_match == PseudoElement); return static_cast&lt;PseudoElementType&gt;(m_pseudoType); }
</ins><span class="cx">         PagePseudoClassType pagePseudoClassType() const { ASSERT(m_match == PagePseudoClass); return static_cast&lt;PagePseudoClassType&gt;(m_pseudoType); }
</span><span class="cx"> 
</span><span class="cx">         bool matchesPseudoElement() const;
</span><span class="lines">@@ -299,30 +306,34 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool CSSSelector::isUnknownPseudoElement() const
</span><span class="cx"> {
</span><del>-    return m_match == PseudoElement &amp;&amp; m_pseudoType == PseudoUnknown;
</del><ins>+    return m_match == PseudoElement &amp;&amp; m_pseudoType == PseudoElementUnknown;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline bool CSSSelector::isCustomPseudoElement() const
</span><span class="cx"> {
</span><del>-    return m_match == PseudoElement &amp;&amp; (m_pseudoType == PseudoUserAgentCustomElement || m_pseudoType == PseudoWebKitCustomElement);
</del><ins>+    return m_match == PseudoElement &amp;&amp; (m_pseudoType == PseudoElementUserAgentCustom || m_pseudoType == PseudoElementWebKitCustom);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool pseudoClassIsRelativeToSiblings(CSSSelector::PseudoType type)
+{
+    return type == CSSSelector::PseudoEmpty
+        || type == CSSSelector::PseudoFirstChild
+        || type == CSSSelector::PseudoFirstOfType
+        || type == CSSSelector::PseudoLastChild
+        || type == CSSSelector::PseudoLastOfType
+        || type == CSSSelector::PseudoOnlyChild
+        || type == CSSSelector::PseudoOnlyOfType
+        || type == CSSSelector::PseudoNthChild
+        || type == CSSSelector::PseudoNthOfType
+        || type == CSSSelector::PseudoNthLastChild
+        || type == CSSSelector::PseudoNthLastOfType;
+}
+
</ins><span class="cx"> inline bool CSSSelector::isSiblingSelector() const
</span><span class="cx"> {
</span><del>-    PseudoType type = pseudoType();
</del><span class="cx">     return m_relation == DirectAdjacent
</span><span class="cx">         || m_relation == IndirectAdjacent
</span><del>-        || type == PseudoEmpty
-        || type == PseudoFirstChild
-        || type == PseudoFirstOfType
-        || type == PseudoLastChild
-        || type == PseudoLastOfType
-        || type == PseudoOnlyChild
-        || type == PseudoOnlyOfType
-        || type == PseudoNthChild
-        || type == PseudoNthOfType
-        || type == PseudoNthLastChild
-        || type == PseudoNthLastOfType;
</del><ins>+        || (m_match == CSSSelector::PseudoClass &amp;&amp; pseudoClassIsRelativeToSiblings(pseudoType()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline bool CSSSelector::isAttributeSelector() const
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleFeaturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleFeature.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleFeature.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/RuleFeature.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -41,16 +41,18 @@
</span><span class="cx">         classesInRules.add(selector-&gt;value().impl());
</span><span class="cx">     else if (selector-&gt;isAttributeSelector())
</span><span class="cx">         attrsInRules.add(selector-&gt;attribute().localName().impl());
</span><del>-    switch (selector-&gt;pseudoType()) {
-    case CSSSelector::PseudoFirstLine:
-        usesFirstLineRules = true;
-        break;
-    case CSSSelector::PseudoBefore:
-    case CSSSelector::PseudoAfter:
-        usesBeforeAfterRules = true;
-        break;
-    default:
-        break;
</del><ins>+    else if (selector-&gt;m_match == CSSSelector::PseudoElement) {
+        switch (selector-&gt;pseudoElementType()) {
+        case CSSSelector::PseudoElementFirstLine:
+            usesFirstLineRules = true;
+            break;
+        case CSSSelector::PseudoElementBefore:
+        case CSSSelector::PseudoElementAfter:
+            usesBeforeAfterRules = true;
+            break;
+        default:
+            break;
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssRuleSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleSet.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/RuleSet.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">         return PropertyWhitelistRegion;
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     for (const CSSSelector* component = selector; component; component = component-&gt;tagHistory()) {
</span><del>-        if (component-&gt;pseudoType() == CSSSelector::PseudoCue || (component-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; component-&gt;value() == TextTrackCue::cueShadowPseudoId()))
</del><ins>+        if (component-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; (component-&gt;pseudoElementType() == CSSSelector::PseudoElementCue || component-&gt;value() == TextTrackCue::cueShadowPseudoId()))
</ins><span class="cx">             return PropertyWhitelistCue;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-    if (component-&gt;pseudoType() == CSSSelector::PseudoCue) {
</del><ins>+    if (component-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; component-&gt;pseudoElementType() == CSSSelector::PseudoElementCue) {
</ins><span class="cx">         m_cuePseudoRules.append(ruleData);
</span><span class="cx">         return true;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">                 if (context.element-&gt;shadowPseudoId() != context.selector-&gt;value())
</span><span class="cx">                     return SelectorFailsLocally;
</span><span class="cx"> 
</span><del>-                if (context.selector-&gt;pseudoType() == CSSSelector::PseudoWebKitCustomElement &amp;&amp; root-&gt;type() != ShadowRoot::UserAgentShadowRoot)
</del><ins>+                if (context.selector-&gt;pseudoElementType() == CSSSelector::PseudoElementWebKitCustom &amp;&amp; root-&gt;type() != ShadowRoot::UserAgentShadowRoot)
</ins><span class="cx">                     return SelectorFailsLocally;
</span><span class="cx">             } else if (m_mode != StyleInvalidation)
</span><span class="cx">                 return SelectorFailsLocally;
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">                 return SelectorFailsLocally;
</span><span class="cx"> 
</span><span class="cx">             // When invalidating style all pseudo elements need to match.
</span><del>-            PseudoId pseudoId = m_mode == StyleInvalidation ? NOPSEUDO : CSSSelector::pseudoId(context.selector-&gt;pseudoType());
</del><ins>+            PseudoId pseudoId = m_mode == StyleInvalidation ? NOPSEUDO : CSSSelector::pseudoId(context.selector-&gt;pseudoElementType());
</ins><span class="cx">             if (pseudoId == FIRST_LETTER)
</span><span class="cx">                 context.element-&gt;document().styleSheetCollection().setUsesFirstLetterRules(true);
</span><span class="cx">             if (pseudoId != NOPSEUDO)
</span><span class="lines">@@ -395,13 +395,15 @@
</span><span class="cx">             SelectorCheckingContext subContext(context);
</span><span class="cx">             subContext.isSubSelector = true;
</span><span class="cx">             for (subContext.selector = selectorList-&gt;first(); subContext.selector; subContext.selector = subContext.selector-&gt;tagHistory()) {
</span><del>-                // :not cannot nest. I don't really know why this is a
-                // restriction in CSS3, but it is, so let's honor it.
-                // the parser enforces that this never occurs
-                ASSERT(subContext.selector-&gt;pseudoType() != CSSSelector::PseudoNot);
-                // We select between :visited and :link when applying. We don't know which one applied (or not) yet.
-                if (subContext.selector-&gt;pseudoType() == CSSSelector::PseudoVisited || (subContext.selector-&gt;pseudoType() == CSSSelector::PseudoLink &amp;&amp; subContext.visitedMatchType == VisitedMatchEnabled))
-                    return true;
</del><ins>+                if (subContext.selector-&gt;m_match == CSSSelector::PseudoClass) {
+                    // :not cannot nest. I don't really know why this is a
+                    // restriction in CSS3, but it is, so let's honor it.
+                    // the parser enforces that this never occurs
+                    ASSERT(subContext.selector-&gt;pseudoType() != CSSSelector::PseudoNot);
+                    // We select between :visited and :link when applying. We don't know which one applied (or not) yet.
+                    if (subContext.selector-&gt;pseudoType() == CSSSelector::PseudoVisited || (subContext.selector-&gt;pseudoType() == CSSSelector::PseudoLink &amp;&amp; subContext.visitedMatchType == VisitedMatchEnabled))
+                        return true;
+                }
</ins><span class="cx">                 if (!checkOne(subContext))
</span><span class="cx">                     return true;
</span><span class="cx">             }
</span><span class="lines">@@ -738,7 +740,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-    else if (selector-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; selector-&gt;pseudoType() == CSSSelector::PseudoCue) {
</del><ins>+    else if (selector-&gt;m_match == CSSSelector::PseudoElement &amp;&amp; selector-&gt;pseudoElementType() == CSSSelector::PseudoElementCue) {
</ins><span class="cx">         SelectorCheckingContext subContext(context);
</span><span class="cx">         subContext.isSubSelector = true;
</span><span class="cx"> 
</span><span class="lines">@@ -757,6 +759,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool SelectorChecker::checkScrollbarPseudoClass(const SelectorCheckingContext&amp; context, Document* document, const CSSSelector* selector) const
</span><span class="cx"> {
</span><ins>+    ASSERT(selector-&gt;m_match == CSSSelector::PseudoClass);
+
</ins><span class="cx">     RenderScrollbar* scrollbar = context.scrollbar;
</span><span class="cx">     ScrollbarPart part = context.scrollbarPart;
</span><span class="cx"> 
</span><span class="lines">@@ -768,7 +772,6 @@
</span><span class="cx">     if (!scrollbar)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    ASSERT(selector-&gt;m_match == CSSSelector::PseudoClass);
</del><span class="cx">     switch (selector-&gt;pseudoType()) {
</span><span class="cx">     case CSSSelector::PseudoEnabled:
</span><span class="cx">         return scrollbar-&gt;enabled();
</span><span class="lines">@@ -843,32 +846,36 @@
</span><span class="cx">     // Statically determine if this selector will match a link in visited, unvisited or any state, or never.
</span><span class="cx">     // :visited never matches other elements than the innermost link element.
</span><span class="cx">     for (; selector; selector = selector-&gt;tagHistory()) {
</span><del>-        switch (selector-&gt;pseudoType()) {
-        case CSSSelector::PseudoNot:
-            {
-                // :not(:visited) is equivalent to :link. Parser enforces that :not can't nest.
-                const CSSSelectorList* selectorList = selector-&gt;selectorList();
-                if (!selectorList)
-                    break;
</del><ins>+        if (selector-&gt;m_match == CSSSelector::PseudoClass) {
+            switch (selector-&gt;pseudoType()) {
+            case CSSSelector::PseudoNot:
+                {
+                    // :not(:visited) is equivalent to :link. Parser enforces that :not can't nest.
+                    const CSSSelectorList* selectorList = selector-&gt;selectorList();
+                    if (!selectorList)
+                        break;
</ins><span class="cx"> 
</span><del>-                for (const CSSSelector* subSelector = selectorList-&gt;first(); subSelector; subSelector = subSelector-&gt;tagHistory()) {
-                    CSSSelector::PseudoType subType = subSelector-&gt;pseudoType();
-                    if (subType == CSSSelector::PseudoVisited)
-                        linkMatchType &amp;= ~SelectorChecker::MatchVisited;
-                    else if (subType == CSSSelector::PseudoLink)
-                        linkMatchType &amp;= ~SelectorChecker::MatchLink;
</del><ins>+                    for (const CSSSelector* subSelector = selectorList-&gt;first(); subSelector; subSelector = subSelector-&gt;tagHistory()) {
+                        if (subSelector-&gt;m_match == CSSSelector::PseudoClass) {
+                            CSSSelector::PseudoType subType = subSelector-&gt;pseudoType();
+                            if (subType == CSSSelector::PseudoVisited)
+                                linkMatchType &amp;= ~SelectorChecker::MatchVisited;
+                            else if (subType == CSSSelector::PseudoLink)
+                                linkMatchType &amp;= ~SelectorChecker::MatchLink;
+                        }
+                    }
</ins><span class="cx">                 }
</span><ins>+                break;
+            case CSSSelector::PseudoLink:
+                linkMatchType &amp;= ~SelectorChecker::MatchVisited;
+                break;
+            case CSSSelector::PseudoVisited:
+                linkMatchType &amp;= ~SelectorChecker::MatchLink;
+                break;
+            default:
+                // We don't support :link and :visited inside :-webkit-any.
+                break;
</ins><span class="cx">             }
</span><del>-            break;
-        case CSSSelector::PseudoLink:
-            linkMatchType &amp;= ~SelectorChecker::MatchVisited;
-            break;
-        case CSSSelector::PseudoVisited:
-            linkMatchType &amp;= ~SelectorChecker::MatchLink;
-            break;
-        default:
-            // We don't support :link and :visited inside :-webkit-any.
-            break;
</del><span class="cx">         }
</span><span class="cx">         CSSSelector::Relation relation = selector-&gt;relation();
</span><span class="cx">         if (relation == CSSSelector::SubSelector)
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -5,8 +5,8 @@
</span><span class="cx"> -webkit-drag
</span><span class="cx"> -webkit-full-page-media
</span><span class="cx"> active
</span><del>-after, PseudoUnknown, PseudoAfter
-before, PseudoUnknown, PseudoBefore
</del><ins>+after, PseudoUnknown, PseudoElementAfter
+before, PseudoUnknown, PseudoElementBefore
</ins><span class="cx"> checked
</span><span class="cx"> corner-present
</span><span class="cx"> decrement
</span><span class="lines">@@ -17,8 +17,8 @@
</span><span class="cx"> enabled
</span><span class="cx"> end
</span><span class="cx"> first-child
</span><del>-first-letter, PseudoUnknown, PseudoFirstLetter
-first-line, PseudoUnknown, PseudoFirstLine
</del><ins>+first-letter, PseudoUnknown, PseudoElementFirstLetter
+first-line, PseudoUnknown, PseudoElementFirstLine
</ins><span class="cx"> first-of-type
</span><span class="cx"> focus
</span><span class="cx"> horizontal
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoElementTypeMapin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoElementTypeMap.in (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoElementTypeMap.in        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/SelectorPseudoElementTypeMap.in        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> after
</span><span class="cx"> before
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><del>-cue, PseudoWebKitCustomElement
</del><ins>+cue, PseudoElementWebKitCustom
</ins><span class="cx"> #endif
</span><span class="cx"> first-letter
</span><span class="cx"> first-line
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoTypeMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoTypeMap.h (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoTypeMap.h        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/SelectorPseudoTypeMap.h        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -33,11 +33,11 @@
</span><span class="cx"> 
</span><span class="cx"> struct PseudoClassOrCompatibilityPseudoElement {
</span><span class="cx">     CSSSelector::PseudoType pseudoClass;
</span><del>-    CSSSelector::PseudoType compatibilityPseudoElement;
</del><ins>+    CSSSelector::PseudoElementType compatibilityPseudoElement;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const CSSParserString&amp; pseudoTypeString);
</span><del>-CSSSelector::PseudoType parsePseudoElementString(const StringImpl&amp; pseudoTypeString);
</del><ins>+CSSSelector::PseudoElementType parsePseudoElementString(const StringImpl&amp; pseudoTypeString);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> 
</span><span class="cx"> %}
</span><span class="cx"> %struct-type
</span><del>-%define initializer-suffix ,{CSSSelector::PseudoUnknown,CSSSelector::PseudoUnknown}
</del><ins>+%define initializer-suffix ,{CSSSelector::PseudoUnknown,CSSSelector::PseudoElementUnknown}
</ins><span class="cx"> %define class-name SelectorPseudoClassAndCompatibilityElementMapHash
</span><span class="cx"> %omit-struct-type
</span><span class="cx"> %language=C++
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">     keyword_definition = line.split(',')
</span><span class="cx">     if len(keyword_definition) == 1:
</span><span class="cx">         keyword = keyword_definition[0].strip()
</span><del>-        output_file.write('&quot;%s&quot;, {%s, CSSSelector::PseudoUnknown}\n' % (keyword, enumerablePseudoType(keyword)))
</del><ins>+        output_file.write('&quot;%s&quot;, {%s, CSSSelector::PseudoElementUnknown}\n' % (keyword, enumerablePseudoType(keyword)))
</ins><span class="cx">     else:
</span><span class="cx">         output_file.write('&quot;%s&quot;, {CSSSelector::%s, CSSSelector::%s}\n' % (keyword_definition[0].strip(), keyword_definition[1].strip(), keyword_definition[2].strip()))
</span><span class="cx"> 
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (entry)
</span><span class="cx">         return entry-&gt;pseudoTypes;
</span><del>-    return { CSSSelector::PseudoUnknown, CSSSelector::PseudoUnknown };
</del><ins>+    return { CSSSelector::PseudoUnknown, CSSSelector::PseudoElementUnknown };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssmakeSelectorPseudoElementsMappy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/makeSelectorPseudoElementsMap.py (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/makeSelectorPseudoElementsMap.py        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/css/makeSelectorPseudoElementsMap.py        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> def enumerablePseudoType(stringPseudoType):
</span><del>-    output = ['CSSSelector::Pseudo']
</del><ins>+    output = ['CSSSelector::PseudoElement']
</ins><span class="cx"> 
</span><span class="cx">     if stringPseudoType.endswith('('):
</span><span class="cx">         stringPseudoType = stringPseudoType[:-1]
</span><span class="lines">@@ -102,12 +102,12 @@
</span><span class="cx"> 
</span><span class="cx"> struct SelectorPseudoTypeEntry {
</span><span class="cx">     const char* name;
</span><del>-    CSSSelector::PseudoType type;
</del><ins>+    CSSSelector::PseudoElementType type;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> %}
</span><span class="cx"> %struct-type
</span><del>-%define initializer-suffix ,CSSSelector::PseudoUnknown
</del><ins>+%define initializer-suffix ,CSSSelector::PseudoElementUnknown
</ins><span class="cx"> %define class-name SelectorPseudoElementTypeMapHash
</span><span class="cx"> %omit-struct-type
</span><span class="cx"> %language=C++
</span><span class="lines">@@ -158,26 +158,26 @@
</span><span class="cx"> 
</span><span class="cx"> output_file.write(&quot;&quot;&quot;%%
</span><span class="cx"> 
</span><del>-static inline CSSSelector::PseudoType parsePseudoElementString(const LChar* characters, unsigned length)
</del><ins>+static inline CSSSelector::PseudoElementType parsePseudoElementString(const LChar* characters, unsigned length)
</ins><span class="cx"> {
</span><span class="cx">     if (const SelectorPseudoTypeEntry* entry = SelectorPseudoElementTypeMapHash::in_word_set(reinterpret_cast&lt;const char*&gt;(characters), length))
</span><span class="cx">         return entry-&gt;type;
</span><del>-    return CSSSelector::PseudoUnknown;
</del><ins>+    return CSSSelector::PseudoElementUnknown;
</ins><span class="cx"> }&quot;&quot;&quot;)
</span><span class="cx"> 
</span><span class="cx"> output_file.write(&quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-static inline CSSSelector::PseudoType parsePseudoElementString(const UChar* characters, unsigned length)
</del><ins>+static inline CSSSelector::PseudoElementType parsePseudoElementString(const UChar* characters, unsigned length)
</ins><span class="cx"> {
</span><span class="cx">     const unsigned maxKeywordLength = %s;
</span><span class="cx">     LChar buffer[maxKeywordLength];
</span><span class="cx">     if (length &gt; maxKeywordLength)
</span><del>-        return CSSSelector::PseudoUnknown;
</del><ins>+        return CSSSelector::PseudoElementUnknown;
</ins><span class="cx"> 
</span><span class="cx">     for (unsigned i = 0; i &lt; length; ++i) {
</span><span class="cx">         UChar character = characters[i];
</span><span class="cx">         if (character &amp; ~0xff)
</span><del>-            return CSSSelector::PseudoUnknown;
</del><ins>+            return CSSSelector::PseudoElementUnknown;
</ins><span class="cx"> 
</span><span class="cx">         buffer[i] = static_cast&lt;LChar&gt;(character);
</span><span class="cx">     }
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx"> &quot;&quot;&quot; % longest_keyword)
</span><span class="cx"> 
</span><span class="cx"> output_file.write(&quot;&quot;&quot;
</span><del>-CSSSelector::PseudoType parsePseudoElementString(const StringImpl&amp; pseudoTypeString)
</del><ins>+CSSSelector::PseudoElementType parsePseudoElementString(const StringImpl&amp; pseudoTypeString)
</ins><span class="cx"> {
</span><span class="cx">     if (pseudoTypeString.is8Bit())
</span><span class="cx">         return parsePseudoElementString(pseudoTypeString.characters8(), pseudoTypeString.length());
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -1369,8 +1369,8 @@
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0;
</span><del>-    CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoElementType(pseudoElement.substringSharingImpl(colonStart));
-    if (pseudoType == CSSSelector::PseudoUnknown &amp;&amp; !pseudoElement.isEmpty())
</del><ins>+    CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(pseudoElement.substringSharingImpl(colonStart));
+    if (pseudoType == CSSSelector::PseudoElementUnknown &amp;&amp; !pseudoElement.isEmpty())
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleConstantsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (166882 => 166883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h        2014-04-07 20:20:28 UTC (rev 166882)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h        2014-04-07 20:26:44 UTC (rev 166883)
</span><span class="lines">@@ -74,7 +74,6 @@
</span><span class="cx">     // Internal IDs follow:
</span><span class="cx">     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
</span><span class="cx">     AFTER_LAST_INTERNAL_PSEUDOID,
</span><del>-    FULL_SCREEN, FULL_SCREEN_DOCUMENT, FULL_SCREEN_ANCESTOR, ANIMATING_FULL_SCREEN_TRANSITION,
</del><span class="cx">     FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
</span><span class="cx">     FIRST_INTERNAL_PSEUDOID = SCROLLBAR_THUMB,
</span><span class="cx">     PUBLIC_PSEUDOID_MASK = ((1 &lt;&lt; FIRST_INTERNAL_PSEUDOID) - 1) &amp; ~((1 &lt;&lt; FIRST_PUBLIC_PSEUDOID) - 1)
</span></span></pre>
</div>
</div>

</body>
</html>