<!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>[209671] 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/209671">209671</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-12-10 12:38:50 -0800 (Sat, 10 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CSS Parser] Move CSSParserValues.h/.cpp to CSSParserSelector.h/.cpp
https://bugs.webkit.org/show_bug.cgi?id=165730
Reviewed by Simon Fraser.
* WebCore.xcodeproj/project.pbxproj:
* css/CSSCustomPropertyValue.cpp:
* css/CSSPrimitiveValue.cpp:
* css/CSSSelectorList.cpp:
* css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
* css/parser/CSSParserImpl.cpp:
* css/parser/CSSParserSelector.cpp: Copied from Source/WebCore/css/parser/CSSParserValues.cpp.
* css/parser/CSSParserSelector.h: Copied from Source/WebCore/css/parser/CSSParserValues.h.
* css/parser/CSSParserValues.cpp: Removed.
* css/parser/CSSParserValues.h: Removed.
* css/parser/CSSSelectorParser.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssCSSAllInOnecpp">trunk/Source/WebCore/css/CSSAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSCustomPropertyValuecpp">trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValuecpp">trunk/Source/WebCore/css/CSSPrimitiveValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorListcpp">trunk/Source/WebCore/css/CSSSelectorList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy">trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserImplcpp">trunk/Source/WebCore/css/parser/CSSParserImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSSelectorParserh">trunk/Source/WebCore/css/parser/CSSSelectorParser.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecssparserCSSParserSelectorcpp">trunk/Source/WebCore/css/parser/CSSParserSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserSelectorh">trunk/Source/WebCore/css/parser/CSSParserSelector.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecssparserCSSParserValuescpp">trunk/Source/WebCore/css/parser/CSSParserValues.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserValuesh">trunk/Source/WebCore/css/parser/CSSParserValues.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -1380,7 +1380,7 @@
</span><span class="cx"> css/parser/CSSParserObserverWrapper.cpp
</span><span class="cx"> css/parser/CSSParserToken.cpp
</span><span class="cx"> css/parser/CSSParserTokenRange.cpp
</span><del>- css/parser/CSSParserValues.cpp
</del><ins>+ css/parser/CSSParserSelector.cpp
</ins><span class="cx"> css/parser/CSSPropertyParser.cpp
</span><span class="cx"> css/parser/CSSPropertyParserHelpers.cpp
</span><span class="cx"> css/parser/CSSSelectorParser.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/ChangeLog        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2016-12-10 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><ins>+ [CSS Parser] Move CSSParserValues.h/.cpp to CSSParserSelector.h/.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=165730
+
+ Reviewed by Simon Fraser.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSCustomPropertyValue.cpp:
+ * css/CSSPrimitiveValue.cpp:
+ * css/CSSSelectorList.cpp:
+ * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
+ * css/parser/CSSParserImpl.cpp:
+ * css/parser/CSSParserSelector.cpp: Copied from Source/WebCore/css/parser/CSSParserValues.cpp.
+ * css/parser/CSSParserSelector.h: Copied from Source/WebCore/css/parser/CSSParserValues.h.
+ * css/parser/CSSParserValues.cpp: Removed.
+ * css/parser/CSSParserValues.h: Removed.
+ * css/parser/CSSSelectorParser.h:
+
+2016-12-10 Dave Hyatt <hyatt@apple.com>
+
</ins><span class="cx"> [CSS Parser] Remove the pseudoclass/element hacks
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=165729
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -3518,8 +3518,8 @@
</span><span class="cx">                 946D372D1D6CB2940077084F /* CSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D37281D6CB28B0077084F /* CSSParser.cpp */; };
</span><span class="cx">                 946D372E1D6CB2940077084F /* CSSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D37291D6CB28B0077084F /* CSSParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 946D372F1D6CB2940077084F /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D372A1D6CB28B0077084F /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                946D37301D6CB2940077084F /* CSSParserValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D372B1D6CB28B0077084F /* CSSParserValues.cpp */; };
-                946D37311D6CB2940077084F /* CSSParserValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D372C1D6CB28B0077084F /* CSSParserValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                946D37301D6CB2940077084F /* CSSParserSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D372B1D6CB28B0077084F /* CSSParserSelector.cpp */; };
+                946D37311D6CB2940077084F /* CSSParserSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D372C1D6CB28B0077084F /* CSSParserSelector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 946D37391D6CDFC00077084F /* CSSTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D37341D6CDF980077084F /* CSSTokenizer.cpp */; };
</span><span class="cx">                 946D373A1D6CDFC00077084F /* CSSTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D37371D6CDF980077084F /* CSSTokenizer.h */; };
</span><span class="cx">                 946D373B1D6CDFC00077084F /* CSSTokenizerInputStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D37351D6CDF980077084F /* CSSTokenizerInputStream.cpp */; };
</span><span class="lines">@@ -11094,8 +11094,8 @@
</span><span class="cx">                 946D37281D6CB28B0077084F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParser.cpp; path = parser/CSSParser.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 946D37291D6CB28B0077084F /* CSSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParser.h; path = parser/CSSParser.h; sourceTree = "<group>"; };
</span><span class="cx">                 946D372A1D6CB28B0077084F /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserMode.h; path = parser/CSSParserMode.h; sourceTree = "<group>"; };
</span><del>-                946D372B1D6CB28B0077084F /* CSSParserValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParserValues.cpp; path = parser/CSSParserValues.cpp; sourceTree = "<group>"; };
-                946D372C1D6CB28B0077084F /* CSSParserValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserValues.h; path = parser/CSSParserValues.h; sourceTree = "<group>"; };
</del><ins>+                946D372B1D6CB28B0077084F /* CSSParserSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParserSelector.cpp; path = parser/CSSParserSelector.cpp; sourceTree = "<group>"; };
+                946D372C1D6CB28B0077084F /* CSSParserSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserSelector.h; path = parser/CSSParserSelector.h; sourceTree = "<group>"; };
</ins><span class="cx">                 946D37341D6CDF980077084F /* CSSTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSTokenizer.cpp; path = parser/CSSTokenizer.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 946D37351D6CDF980077084F /* CSSTokenizerInputStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSTokenizerInputStream.cpp; path = parser/CSSTokenizerInputStream.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 946D37371D6CDF980077084F /* CSSTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSTokenizer.h; path = parser/CSSTokenizer.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -19073,8 +19073,8 @@
</span><span class="cx">                                 946D373D1D6CE31A0077084F /* CSSParserToken.h */,
</span><span class="cx">                                 946D374B1D6D07F50077084F /* CSSParserTokenRange.cpp */,
</span><span class="cx">                                 946D374C1D6D07F50077084F /* CSSParserTokenRange.h */,
</span><del>-                                946D372B1D6CB28B0077084F /* CSSParserValues.cpp */,
-                                946D372C1D6CB28B0077084F /* CSSParserValues.h */,
</del><ins>+                                946D372B1D6CB28B0077084F /* CSSParserSelector.cpp */,
+                                946D372C1D6CB28B0077084F /* CSSParserSelector.h */,
</ins><span class="cx">                                 946D37411D6CF6320077084F /* CSSPropertyParser.cpp */,
</span><span class="cx">                                 946D37421D6CF6320077084F /* CSSPropertyParser.h */,
</span><span class="cx">                                 949C77021D6E393500C0DE4F /* CSSPropertyParserHelpers.cpp */,
</span><span class="lines">@@ -25250,7 +25250,7 @@
</span><span class="cx">                                 949C77091D6E498700C0DE4F /* CSSParserObserverWrapper.h in Headers */,
</span><span class="cx">                                 946D37401D6CE3C20077084F /* CSSParserToken.h in Headers */,
</span><span class="cx">                                 946D374E1D6D08AA0077084F /* CSSParserTokenRange.h in Headers */,
</span><del>-                                946D37311D6CB2940077084F /* CSSParserValues.h in Headers */,
</del><ins>+                                946D37311D6CB2940077084F /* CSSParserSelector.h in Headers */,
</ins><span class="cx">                                 9418278F1D8CAF9200492764 /* CSSPendingSubstitutionValue.h in Headers */,
</span><span class="cx">                                 977B3863122883E900B81FF8 /* CSSPreloadScanner.h in Headers */,
</span><span class="cx">                                 A80E6CE60A1989CA007FB8C5 /* CSSPrimitiveValue.h in Headers */,
</span><span class="lines">@@ -29063,7 +29063,7 @@
</span><span class="cx">                                 949C77081D6E498700C0DE4F /* CSSParserObserverWrapper.cpp in Sources */,
</span><span class="cx">                                 946D373F1D6CE3C20077084F /* CSSParserToken.cpp in Sources */,
</span><span class="cx">                                 946D374D1D6D08A60077084F /* CSSParserTokenRange.cpp in Sources */,
</span><del>-                                946D37301D6CB2940077084F /* CSSParserValues.cpp in Sources */,
</del><ins>+                                946D37301D6CB2940077084F /* CSSParserSelector.cpp in Sources */,
</ins><span class="cx">                                 9418278E1D8CAF9200492764 /* CSSPendingSubstitutionValue.cpp in Sources */,
</span><span class="cx">                                 977B3862122883E900B81FF8 /* CSSPreloadScanner.cpp in Sources */,
</span><span class="cx">                                 A80E6D050A1989CA007FB8C5 /* CSSPrimitiveValue.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSAllInOne.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSAllInOne.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/CSSAllInOne.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> #include "CSSNamedImageValue.cpp"
</span><span class="cx"> #include "CSSPageRule.cpp"
</span><span class="cx"> #include "CSSParser.cpp"
</span><del>-#include "CSSParserValues.cpp"
</del><ins>+#include "CSSParserSelector.cpp"
</ins><span class="cx"> #include "CSSProperty.cpp"
</span><span class="cx"> #include "CSSPropertySourceData.cpp"
</span><span class="cx"> #include "CSSReflectValue.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCustomPropertyValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSCustomPropertyValue.h"
</span><span class="cx">
</span><del>-#include "CSSParserValues.h"
</del><ins>+#include "CSSParserSelector.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include "CSSFontFamily.h"
</span><span class="cx"> #include "CSSHelper.h"
</span><span class="cx"> #include "CSSMarkup.h"
</span><del>-#include "CSSParserValues.h"
</del><ins>+#include "CSSParserSelector.h"
</ins><span class="cx"> #include "CSSPrimitiveValueMappings.h"
</span><span class="cx"> #include "CSSPropertyNames.h"
</span><span class="cx"> #include "CSSToLengthConversionData.h"
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelectorList.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelectorList.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/CSSSelectorList.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CSSSelectorList.h"
</span><span class="cx">
</span><del>-#include "CSSParserValues.h"
</del><ins>+#include "CSSParserSelector.h"
</ins><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "SelectorPseudoTypeMap.h"
</span><span class="cx">
</span><del>-#include "CSSParserValues.h"
</del><ins>+#include "CSSParserSelector.h"
</ins><span class="cx">
</span><span class="cx"> #if defined(__clang__)
</span><span class="cx"> #pragma clang diagnostic push
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> #include "CSSKeyframesRule.h"
</span><span class="cx"> #include "CSSParserObserver.h"
</span><span class="cx"> #include "CSSParserObserverWrapper.h"
</span><del>-#include "CSSParserValues.h" // FIXME-NEWPARSER We need to move CSSParserSelector to its own file.
</del><ins>+#include "CSSParserSelector.h"
</ins><span class="cx"> #include "CSSPropertyParser.h"
</span><span class="cx"> #include "CSSSelectorParser.h"
</span><span class="cx"> #include "CSSStyleSheet.h"
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserSelectorcppfromrev209670trunkSourceWebCorecssparserCSSParserValuescpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/css/parser/CSSParserSelector.cpp (from rev 209670, trunk/Source/WebCore/css/parser/CSSParserValues.cpp) (0 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserSelector.cpp         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSParserSelector.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -0,0 +1,245 @@
</span><ins>+/*
+ * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "CSSParserSelector.h"
+
+#include "CSSCustomPropertyValue.h"
+#include "CSSParserIdioms.h"
+#include "CSSPrimitiveValue.h"
+#include "CSSFunctionValue.h"
+#include "CSSSelector.h"
+#include "CSSSelectorList.h"
+#include "SelectorPseudoTypeMap.h"
+
+#if COMPILER(MSVC)
+// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx
+#pragma warning(disable: 4701)
+#endif
+
+namespace WebCore {
+
+using namespace WTF;
+
+CSSParserSelector* CSSParserSelector::parsePagePseudoSelector(const AtomicString& pseudoTypeString)
+{
+ CSSSelector::PagePseudoClassType pseudoType;
+ if (equalLettersIgnoringASCIICase(pseudoTypeString, "first"))
+ pseudoType = CSSSelector::PagePseudoClassFirst;
+ else if (equalLettersIgnoringASCIICase(pseudoTypeString, "left"))
+ pseudoType = CSSSelector::PagePseudoClassLeft;
+ else if (equalLettersIgnoringASCIICase(pseudoTypeString, "right"))
+ pseudoType = CSSSelector::PagePseudoClassRight;
+ else
+ return nullptr;
+
+ auto selector = std::make_unique<CSSParserSelector>();
+ selector->m_selector->setMatch(CSSSelector::PagePseudoClass);
+ selector->m_selector->setPagePseudoType(pseudoType);
+ return selector.release();
+}
+
+CSSParserSelector* CSSParserSelector::parsePseudoElementSelectorFromStringView(StringView& pseudoTypeString)
+{
+ AtomicString name = pseudoTypeString.toAtomicString();
+
+ CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(name);
+ if (pseudoType == CSSSelector::PseudoElementUnknown) {
+ // FIXME-NEWPARSER: We can't add "slotted" to the map without breaking the old
+ // parser, so this hack ensures the new parser still recognizes it. When the new
+ // parser turns on, we can add "slotted" to the map and remove this code.
+ if (pseudoTypeString.startsWithIgnoringASCIICase("slotted"))
+ pseudoType = CSSSelector::PseudoElementSlotted;
+ else
+ return nullptr;
+ }
+
+ auto selector = std::make_unique<CSSParserSelector>();
+ selector->m_selector->setMatch(CSSSelector::PseudoElement);
+ selector->m_selector->setPseudoElementType(pseudoType);
+ if (pseudoType == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed) {
+ ASSERT_WITH_MESSAGE(name == "-webkit-input-placeholder", "-webkit-input-placeholder is the only LegacyPrefix pseudo type.");
+ if (name == "-webkit-input-placeholder")
+ name = AtomicString("placeholder", AtomicString::ConstructFromLiteral);
+ }
+ selector->m_selector->setValue(name);
+ return selector.release();
+}
+
+CSSParserSelector* CSSParserSelector::parsePseudoClassSelectorFromStringView(StringView& pseudoTypeString)
+{
+ PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString);
+ if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) {
+ auto selector = std::make_unique<CSSParserSelector>();
+ selector->m_selector->setMatch(CSSSelector::PseudoClass);
+ selector->m_selector->setPseudoClassType(pseudoType.pseudoClass);
+ return selector.release();
+ }
+ if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoElementUnknown) {
+ auto selector = std::make_unique<CSSParserSelector>();
+ selector->m_selector->setMatch(CSSSelector::PseudoElement);
+ selector->m_selector->setPseudoElementType(pseudoType.compatibilityPseudoElement);
+ AtomicString name = pseudoTypeString.toAtomicString();
+ selector->m_selector->setValue(name);
+ return selector.release();
+ }
+ return nullptr;
+}
+
+CSSParserSelector::CSSParserSelector()
+ : m_selector(std::make_unique<CSSSelector>())
+{
+}
+
+CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName)
+ : m_selector(std::make_unique<CSSSelector>(tagQName))
+{
+}
+
+CSSParserSelector::~CSSParserSelector()
+{
+ if (!m_tagHistory)
+ return;
+ Vector<std::unique_ptr<CSSParserSelector>, 16> toDelete;
+ std::unique_ptr<CSSParserSelector> selector = WTFMove(m_tagHistory);
+ while (true) {
+ std::unique_ptr<CSSParserSelector> next = WTFMove(selector->m_tagHistory);
+ toDelete.append(WTFMove(selector));
+ if (!next)
+ break;
+ selector = WTFMove(next);
+ }
+}
+
+void CSSParserSelector::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
+{
+ auto selectorList = std::make_unique<CSSSelectorList>();
+ selectorList->adoptSelectorVector(selectorVector);
+ m_selector->setSelectorList(WTFMove(selectorList));
+}
+
+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));
+}
+
+static bool selectorListMatchesPseudoElement(const CSSSelectorList* selectorList)
+{
+ if (!selectorList)
+ return false;
+
+ for (const CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = CSSSelectorList::next(subSelector)) {
+ for (const CSSSelector* selector = subSelector; selector; selector = selector->tagHistory()) {
+ if (selector->matchesPseudoElement())
+ return true;
+ if (const CSSSelectorList* subselectorList = selector->selectorList()) {
+ if (selectorListMatchesPseudoElement(subselectorList))
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool CSSParserSelector::matchesPseudoElement() const
+{
+ return m_selector->matchesPseudoElement() || selectorListMatchesPseudoElement(m_selector->selectorList());
+}
+
+void CSSParserSelector::insertTagHistory(CSSSelector::RelationType before, std::unique_ptr<CSSParserSelector> selector, CSSSelector::RelationType after)
+{
+ if (m_tagHistory)
+ selector->setTagHistory(WTFMove(m_tagHistory));
+ setRelation(before);
+ selector->setRelation(after);
+ m_tagHistory = WTFMove(selector);
+}
+
+void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, std::unique_ptr<CSSParserSelector> selector)
+{
+ CSSParserSelector* end = this;
+ while (end->tagHistory())
+ end = end->tagHistory();
+
+ end->setRelation(relation);
+ end->setTagHistory(WTFMove(selector));
+}
+
+void CSSParserSelector::appendTagHistory(CSSParserSelectorCombinator relation, std::unique_ptr<CSSParserSelector> selector)
+{
+ CSSParserSelector* end = this;
+ while (end->tagHistory())
+ end = end->tagHistory();
+
+ CSSSelector::RelationType selectorRelation;
+ switch (relation) {
+ case CSSParserSelectorCombinator::Child:
+ selectorRelation = CSSSelector::Child;
+ break;
+ case CSSParserSelectorCombinator::DescendantSpace:
+ selectorRelation = CSSSelector::DescendantSpace;
+ break;
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ case CSSParserSelectorCombinator::DescendantDoubleChild:
+ selectorRelation = CSSSelector::DescendantDoubleChild;
+ break;
+#endif
+ case CSSParserSelectorCombinator::DirectAdjacent:
+ selectorRelation = CSSSelector::DirectAdjacent;
+ break;
+ case CSSParserSelectorCombinator::IndirectAdjacent:
+ selectorRelation = CSSSelector::IndirectAdjacent;
+ break;
+ }
+ end->setRelation(selectorRelation);
+ end->setTagHistory(WTFMove(selector));
+}
+
+void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool tagIsForNamespaceRule)
+{
+ auto second = std::make_unique<CSSParserSelector>();
+ second->m_selector = WTFMove(m_selector);
+ second->m_tagHistory = WTFMove(m_tagHistory);
+ m_tagHistory = WTFMove(second);
+
+ m_selector = std::make_unique<CSSSelector>(tagQName, tagIsForNamespaceRule);
+ m_selector->setRelation(CSSSelector::Subselector);
+}
+
+std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory()
+{
+ setRelation(CSSSelector::Subselector);
+ return WTFMove(m_tagHistory);
+}
+
+// FIXME-NEWPARSER: Add support for :host-context
+bool CSSParserSelector::isHostPseudoSelector() const
+{
+ return match() == CSSSelector::PseudoClass && pseudoClassType() == CSSSelector::PseudoClassHost;
+}
+
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserSelectorhfromrev209670trunkSourceWebCorecssparserCSSParserValuesh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/css/parser/CSSParserSelector.h (from rev 209670, trunk/Source/WebCore/css/parser/CSSParserValues.h) (0 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserSelector.h         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSParserSelector.h        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -0,0 +1,135 @@
</span><ins>+/*
+ * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "CSSSelector.h"
+#include "CSSValueKeywords.h"
+#include "CSSValueList.h"
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSValue;
+class QualifiedName;
+
+enum class CSSParserSelectorCombinator {
+ Child,
+ DescendantSpace,
+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ DescendantDoubleChild,
+#endif
+ DirectAdjacent,
+ IndirectAdjacent
+};
+
+class CSSParserSelector {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static CSSParserSelector* parsePseudoClassSelectorFromStringView(StringView&);
+ static CSSParserSelector* parsePseudoElementSelectorFromStringView(StringView&);
+ static CSSParserSelector* parsePagePseudoSelector(const AtomicString&);
+
+ CSSParserSelector();
+ explicit CSSParserSelector(const QualifiedName&);
+ ~CSSParserSelector();
+
+ std::unique_ptr<CSSSelector> releaseSelector() { return WTFMove(m_selector); }
+
+ void setValue(const AtomicString& value, bool matchLowerCase = false) { m_selector->setValue(value, matchLowerCase); }
+
+ // FIXME-NEWPARSER: These two methods can go away once old parser is gone.
+ void setAttribute(const QualifiedName& value, bool isCaseInsensitive) { m_selector->setAttribute(value, isCaseInsensitive); }
+ void setAttributeValueMatchingIsCaseInsensitive(bool isCaseInsensitive) { m_selector->setAttributeValueMatchingIsCaseInsensitive(isCaseInsensitive); }
+
+ void setAttribute(const QualifiedName& value, bool convertToLowercase, CSSSelector::AttributeMatchType type) { m_selector->setAttribute(value, convertToLowercase, type); }
+
+ void setArgument(const AtomicString& value) { m_selector->setArgument(value); }
+ void setNth(int a, int b) { m_selector->setNth(a, b); }
+ void setMatch(CSSSelector::Match value) { m_selector->setMatch(value); }
+ void setRelation(CSSSelector::RelationType value) { m_selector->setRelation(value); }
+ void setForPage() { m_selector->setForPage(); }
+
+ CSSSelector::Match match() const { return m_selector->match(); }
+ CSSSelector::PseudoElementType pseudoElementType() const { return m_selector->pseudoElementType(); }
+ const CSSSelectorList* selectorList() const { return m_selector->selectorList(); }
+
+ void setPseudoElementType(CSSSelector::PseudoElementType type) { m_selector->setPseudoElementType(type); }
+
+ void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
+ void setLangArgumentList(std::unique_ptr<Vector<AtomicString>>);
+ void setSelectorList(std::unique_ptr<CSSSelectorList>);
+
+ CSSSelector::PseudoClassType pseudoClassType() const { return m_selector->pseudoClassType(); }
+ bool isCustomPseudoElement() const { return m_selector->isCustomPseudoElement(); }
+
+ bool isPseudoElementCueFunction() const
+ {
+#if ENABLE(VIDEO_TRACK)
+ return m_selector->match() == CSSSelector::PseudoElement && m_selector->pseudoElementType() == CSSSelector::PseudoElementCue;
+#else
+ return false;
+#endif
+ }
+
+ bool hasShadowDescendant() const;
+ bool matchesPseudoElement() const;
+
+ bool isHostPseudoSelector() const;
+
+ // FIXME-NEWPARSER: "slotted" was removed here for now, since it leads to a combinator
+ // connection of ShadowDescendant, and the current shadow DOM code doesn't expect this. When
+ // we do fix this issue, make sure to patch the namespace prependTag code to remove the slotted
+ // special case, since it will be covered by this function once again.
+ bool needsImplicitShadowCombinatorForMatching() const;
+
+ CSSParserSelector* tagHistory() const { return m_tagHistory.get(); }
+ void setTagHistory(std::unique_ptr<CSSParserSelector> selector) { m_tagHistory = WTFMove(selector); }
+ void clearTagHistory() { m_tagHistory.reset(); }
+ void insertTagHistory(CSSSelector::RelationType before, std::unique_ptr<CSSParserSelector>, CSSSelector::RelationType after);
+ void appendTagHistory(CSSSelector::RelationType, std::unique_ptr<CSSParserSelector>);
+ void appendTagHistory(CSSParserSelectorCombinator, std::unique_ptr<CSSParserSelector>);
+ void prependTagSelector(const QualifiedName&, bool tagIsForNamespaceRule = false);
+ std::unique_ptr<CSSParserSelector> releaseTagHistory();
+
+private:
+ std::unique_ptr<CSSSelector> m_selector;
+ std::unique_ptr<CSSParserSelector> m_tagHistory;
+};
+
+inline bool CSSParserSelector::hasShadowDescendant() const
+{
+ return m_selector->relation() == CSSSelector::ShadowDescendant;
+}
+
+inline bool CSSParserSelector::needsImplicitShadowCombinatorForMatching() const
+{
+ return match() == CSSSelector::PseudoElement
+ && (pseudoElementType() == CSSSelector::PseudoElementWebKitCustom
+ || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom
+#if ENABLE(VIDEO_TRACK)
+ || pseudoElementType() == CSSSelector::PseudoElementCue
+#endif
+ || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserValuescpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/css/parser/CSSParserValues.cpp (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserValues.cpp        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/parser/CSSParserValues.cpp        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -1,245 +0,0 @@
</span><del>-/*
- * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "CSSParserValues.h"
-
-#include "CSSCustomPropertyValue.h"
-#include "CSSParserIdioms.h"
-#include "CSSPrimitiveValue.h"
-#include "CSSFunctionValue.h"
-#include "CSSSelector.h"
-#include "CSSSelectorList.h"
-#include "SelectorPseudoTypeMap.h"
-
-#if COMPILER(MSVC)
-// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx
-#pragma warning(disable: 4701)
-#endif
-
-namespace WebCore {
-
-using namespace WTF;
-
-CSSParserSelector* CSSParserSelector::parsePagePseudoSelector(const AtomicString& pseudoTypeString)
-{
- CSSSelector::PagePseudoClassType pseudoType;
- if (equalLettersIgnoringASCIICase(pseudoTypeString, "first"))
- pseudoType = CSSSelector::PagePseudoClassFirst;
- else if (equalLettersIgnoringASCIICase(pseudoTypeString, "left"))
- pseudoType = CSSSelector::PagePseudoClassLeft;
- else if (equalLettersIgnoringASCIICase(pseudoTypeString, "right"))
- pseudoType = CSSSelector::PagePseudoClassRight;
- else
- return nullptr;
-
- auto selector = std::make_unique<CSSParserSelector>();
- selector->m_selector->setMatch(CSSSelector::PagePseudoClass);
- selector->m_selector->setPagePseudoType(pseudoType);
- return selector.release();
-}
-
-CSSParserSelector* CSSParserSelector::parsePseudoElementSelectorFromStringView(StringView& pseudoTypeString)
-{
- AtomicString name = pseudoTypeString.toAtomicString();
-
- CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(name);
- if (pseudoType == CSSSelector::PseudoElementUnknown) {
- // FIXME-NEWPARSER: We can't add "slotted" to the map without breaking the old
- // parser, so this hack ensures the new parser still recognizes it. When the new
- // parser turns on, we can add "slotted" to the map and remove this code.
- if (pseudoTypeString.startsWithIgnoringASCIICase("slotted"))
- pseudoType = CSSSelector::PseudoElementSlotted;
- else
- return nullptr;
- }
-
- auto selector = std::make_unique<CSSParserSelector>();
- selector->m_selector->setMatch(CSSSelector::PseudoElement);
- selector->m_selector->setPseudoElementType(pseudoType);
- if (pseudoType == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed) {
- ASSERT_WITH_MESSAGE(name == "-webkit-input-placeholder", "-webkit-input-placeholder is the only LegacyPrefix pseudo type.");
- if (name == "-webkit-input-placeholder")
- name = AtomicString("placeholder", AtomicString::ConstructFromLiteral);
- }
- selector->m_selector->setValue(name);
- return selector.release();
-}
-
-CSSParserSelector* CSSParserSelector::parsePseudoClassSelectorFromStringView(StringView& pseudoTypeString)
-{
- PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString);
- if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) {
- auto selector = std::make_unique<CSSParserSelector>();
- selector->m_selector->setMatch(CSSSelector::PseudoClass);
- selector->m_selector->setPseudoClassType(pseudoType.pseudoClass);
- return selector.release();
- }
- if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoElementUnknown) {
- auto selector = std::make_unique<CSSParserSelector>();
- selector->m_selector->setMatch(CSSSelector::PseudoElement);
- selector->m_selector->setPseudoElementType(pseudoType.compatibilityPseudoElement);
- AtomicString name = pseudoTypeString.toAtomicString();
- selector->m_selector->setValue(name);
- return selector.release();
- }
- return nullptr;
-}
-
-CSSParserSelector::CSSParserSelector()
- : m_selector(std::make_unique<CSSSelector>())
-{
-}
-
-CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName)
- : m_selector(std::make_unique<CSSSelector>(tagQName))
-{
-}
-
-CSSParserSelector::~CSSParserSelector()
-{
- if (!m_tagHistory)
- return;
- Vector<std::unique_ptr<CSSParserSelector>, 16> toDelete;
- std::unique_ptr<CSSParserSelector> selector = WTFMove(m_tagHistory);
- while (true) {
- std::unique_ptr<CSSParserSelector> next = WTFMove(selector->m_tagHistory);
- toDelete.append(WTFMove(selector));
- if (!next)
- break;
- selector = WTFMove(next);
- }
-}
-
-void CSSParserSelector::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
-{
- auto selectorList = std::make_unique<CSSSelectorList>();
- selectorList->adoptSelectorVector(selectorVector);
- m_selector->setSelectorList(WTFMove(selectorList));
-}
-
-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));
-}
-
-static bool selectorListMatchesPseudoElement(const CSSSelectorList* selectorList)
-{
- if (!selectorList)
- return false;
-
- for (const CSSSelector* subSelector = selectorList->first(); subSelector; subSelector = CSSSelectorList::next(subSelector)) {
- for (const CSSSelector* selector = subSelector; selector; selector = selector->tagHistory()) {
- if (selector->matchesPseudoElement())
- return true;
- if (const CSSSelectorList* subselectorList = selector->selectorList()) {
- if (selectorListMatchesPseudoElement(subselectorList))
- return true;
- }
- }
- }
- return false;
-}
-
-bool CSSParserSelector::matchesPseudoElement() const
-{
- return m_selector->matchesPseudoElement() || selectorListMatchesPseudoElement(m_selector->selectorList());
-}
-
-void CSSParserSelector::insertTagHistory(CSSSelector::RelationType before, std::unique_ptr<CSSParserSelector> selector, CSSSelector::RelationType after)
-{
- if (m_tagHistory)
- selector->setTagHistory(WTFMove(m_tagHistory));
- setRelation(before);
- selector->setRelation(after);
- m_tagHistory = WTFMove(selector);
-}
-
-void CSSParserSelector::appendTagHistory(CSSSelector::RelationType relation, std::unique_ptr<CSSParserSelector> selector)
-{
- CSSParserSelector* end = this;
- while (end->tagHistory())
- end = end->tagHistory();
-
- end->setRelation(relation);
- end->setTagHistory(WTFMove(selector));
-}
-
-void CSSParserSelector::appendTagHistory(CSSParserSelectorCombinator relation, std::unique_ptr<CSSParserSelector> selector)
-{
- CSSParserSelector* end = this;
- while (end->tagHistory())
- end = end->tagHistory();
-
- CSSSelector::RelationType selectorRelation;
- switch (relation) {
- case CSSParserSelectorCombinator::Child:
- selectorRelation = CSSSelector::Child;
- break;
- case CSSParserSelectorCombinator::DescendantSpace:
- selectorRelation = CSSSelector::DescendantSpace;
- break;
-#if ENABLE(CSS_SELECTORS_LEVEL4)
- case CSSParserSelectorCombinator::DescendantDoubleChild:
- selectorRelation = CSSSelector::DescendantDoubleChild;
- break;
-#endif
- case CSSParserSelectorCombinator::DirectAdjacent:
- selectorRelation = CSSSelector::DirectAdjacent;
- break;
- case CSSParserSelectorCombinator::IndirectAdjacent:
- selectorRelation = CSSSelector::IndirectAdjacent;
- break;
- }
- end->setRelation(selectorRelation);
- end->setTagHistory(WTFMove(selector));
-}
-
-void CSSParserSelector::prependTagSelector(const QualifiedName& tagQName, bool tagIsForNamespaceRule)
-{
- auto second = std::make_unique<CSSParserSelector>();
- second->m_selector = WTFMove(m_selector);
- second->m_tagHistory = WTFMove(m_tagHistory);
- m_tagHistory = WTFMove(second);
-
- m_selector = std::make_unique<CSSSelector>(tagQName, tagIsForNamespaceRule);
- m_selector->setRelation(CSSSelector::Subselector);
-}
-
-std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory()
-{
- setRelation(CSSSelector::Subselector);
- return WTFMove(m_tagHistory);
-}
-
-// FIXME-NEWPARSER: Add support for :host-context
-bool CSSParserSelector::isHostPseudoSelector() const
-{
- return match() == CSSSelector::PseudoClass && pseudoClassType() == CSSSelector::PseudoClassHost;
-}
-
-}
-
</del></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserValuesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/css/parser/CSSParserValues.h (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserValues.h        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/parser/CSSParserValues.h        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -1,135 +0,0 @@
</span><del>-/*
- * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "CSSSelector.h"
-#include "CSSValueKeywords.h"
-#include "CSSValueList.h"
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/AtomicStringHash.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class CSSValue;
-class QualifiedName;
-
-enum class CSSParserSelectorCombinator {
- Child,
- DescendantSpace,
-#if ENABLE(CSS_SELECTORS_LEVEL4)
- DescendantDoubleChild,
-#endif
- DirectAdjacent,
- IndirectAdjacent
-};
-
-class CSSParserSelector {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static CSSParserSelector* parsePseudoClassSelectorFromStringView(StringView&);
- static CSSParserSelector* parsePseudoElementSelectorFromStringView(StringView&);
- static CSSParserSelector* parsePagePseudoSelector(const AtomicString&);
-
- CSSParserSelector();
- explicit CSSParserSelector(const QualifiedName&);
- ~CSSParserSelector();
-
- std::unique_ptr<CSSSelector> releaseSelector() { return WTFMove(m_selector); }
-
- void setValue(const AtomicString& value, bool matchLowerCase = false) { m_selector->setValue(value, matchLowerCase); }
-
- // FIXME-NEWPARSER: These two methods can go away once old parser is gone.
- void setAttribute(const QualifiedName& value, bool isCaseInsensitive) { m_selector->setAttribute(value, isCaseInsensitive); }
- void setAttributeValueMatchingIsCaseInsensitive(bool isCaseInsensitive) { m_selector->setAttributeValueMatchingIsCaseInsensitive(isCaseInsensitive); }
-
- void setAttribute(const QualifiedName& value, bool convertToLowercase, CSSSelector::AttributeMatchType type) { m_selector->setAttribute(value, convertToLowercase, type); }
-
- void setArgument(const AtomicString& value) { m_selector->setArgument(value); }
- void setNth(int a, int b) { m_selector->setNth(a, b); }
- void setMatch(CSSSelector::Match value) { m_selector->setMatch(value); }
- void setRelation(CSSSelector::RelationType value) { m_selector->setRelation(value); }
- void setForPage() { m_selector->setForPage(); }
-
- CSSSelector::Match match() const { return m_selector->match(); }
- CSSSelector::PseudoElementType pseudoElementType() const { return m_selector->pseudoElementType(); }
- const CSSSelectorList* selectorList() const { return m_selector->selectorList(); }
-
- void setPseudoElementType(CSSSelector::PseudoElementType type) { m_selector->setPseudoElementType(type); }
-
- void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
- void setLangArgumentList(std::unique_ptr<Vector<AtomicString>>);
- void setSelectorList(std::unique_ptr<CSSSelectorList>);
-
- CSSSelector::PseudoClassType pseudoClassType() const { return m_selector->pseudoClassType(); }
- bool isCustomPseudoElement() const { return m_selector->isCustomPseudoElement(); }
-
- bool isPseudoElementCueFunction() const
- {
-#if ENABLE(VIDEO_TRACK)
- return m_selector->match() == CSSSelector::PseudoElement && m_selector->pseudoElementType() == CSSSelector::PseudoElementCue;
-#else
- return false;
-#endif
- }
-
- bool hasShadowDescendant() const;
- bool matchesPseudoElement() const;
-
- bool isHostPseudoSelector() const;
-
- // FIXME-NEWPARSER: "slotted" was removed here for now, since it leads to a combinator
- // connection of ShadowDescendant, and the current shadow DOM code doesn't expect this. When
- // we do fix this issue, make sure to patch the namespace prependTag code to remove the slotted
- // special case, since it will be covered by this function once again.
- bool needsImplicitShadowCombinatorForMatching() const;
-
- CSSParserSelector* tagHistory() const { return m_tagHistory.get(); }
- void setTagHistory(std::unique_ptr<CSSParserSelector> selector) { m_tagHistory = WTFMove(selector); }
- void clearTagHistory() { m_tagHistory.reset(); }
- void insertTagHistory(CSSSelector::RelationType before, std::unique_ptr<CSSParserSelector>, CSSSelector::RelationType after);
- void appendTagHistory(CSSSelector::RelationType, std::unique_ptr<CSSParserSelector>);
- void appendTagHistory(CSSParserSelectorCombinator, std::unique_ptr<CSSParserSelector>);
- void prependTagSelector(const QualifiedName&, bool tagIsForNamespaceRule = false);
- std::unique_ptr<CSSParserSelector> releaseTagHistory();
-
-private:
- std::unique_ptr<CSSSelector> m_selector;
- std::unique_ptr<CSSParserSelector> m_tagHistory;
-};
-
-inline bool CSSParserSelector::hasShadowDescendant() const
-{
- return m_selector->relation() == CSSSelector::ShadowDescendant;
-}
-
-inline bool CSSParserSelector::needsImplicitShadowCombinatorForMatching() const
-{
- return match() == CSSSelector::PseudoElement
- && (pseudoElementType() == CSSSelector::PseudoElementWebKitCustom
- || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom
-#if ENABLE(VIDEO_TRACK)
- || pseudoElementType() == CSSSelector::PseudoElementCue
-#endif
- || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSSelectorParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.h (209670 => 209671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSSelectorParser.h        2016-12-10 20:22:37 UTC (rev 209670)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.h        2016-12-10 20:38:50 UTC (rev 209671)
</span><span class="lines">@@ -29,8 +29,8 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "CSSParserSelector.h"
</ins><span class="cx"> #include "CSSParserTokenRange.h"
</span><del>-#include "CSSParserValues.h" // FIXME-NEWPARSER Change when CSSParserSelector moves into its own file.
</del><span class="cx"> #include <memory>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span></span></pre>
</div>
</div>
</body>
</html>