<!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>[205660] 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/205660">205660</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-09-08 14:09:04 -0700 (Thu, 08 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CSS Parser] Add support for new CSS selector parsing
https://bugs.webkit.org/show_bug.cgi?id=161749
Reviewed by Dean Jackson.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::isValidSelector):
* css/CSSDefaultStyleSheets.cpp:
(WebCore::parseUASheet):
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::matchingFaces):
* css/CSSGrammar.y.in:
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
* css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::supports):
* css/FontFace.cpp:
(WebCore::FontFace::parseString):
(WebCore::FontFace::setVariant):
* css/MediaList.cpp:
(WebCore::MediaQuerySet::internalParse):
(WebCore::MediaQuerySet::parse):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
* css/SelectorFilter.cpp:
(WebCore::SelectorFilter::collectIdentifierHashes):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/SelectorPseudoTypeMap.h:
* css/SourceSizeList.cpp:
(WebCore::parseSizesAttribute):
* css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::MutableStyleProperties):
* css/StyleProperties.h:
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::setCSSStyleSheet):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::StyleSheetContents):
(WebCore::StyleSheetContents::parserAddNamespace):
(WebCore::StyleSheetContents::namespaceURIFromPrefix):
(WebCore::StyleSheetContents::determineNamespace): Deleted.
* css/StyleSheetContents.h:
* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::setMatrixValue):
* css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
* css/parser/CSSParser.cpp:
(WebCore::strictCSSParserContext):
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::CSSParser::parseColor):
(WebCore::CSSParser::shouldAcceptUnitLessValues):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseColumnWidth):
(WebCore::CSSParser::parseColumnCount):
(WebCore::CSSParser::parseFontWeight):
(WebCore::CSSParser::parseColorParameters):
(WebCore::CSSParser::parseHSLParameters):
(WebCore::CSSParser::parseShadow):
(WebCore::CSSParser::parseBorderImageSlice):
(WebCore::CSSParser::parseBorderImageQuad):
(WebCore::CSSParser::parseDeprecatedLinearGradient):
(WebCore::CSSParser::parseLinearGradient):
(WebCore::CSSParser::parseTransformValue):
(WebCore::CSSParser::parseBuiltinFilterArguments):
(WebCore::CSSParser::determineNameInNamespace):
* css/parser/CSSParser.h:
(WebCore::CSSParser::inStrictMode):
(WebCore::CSSParser::inQuirksMode):
* css/parser/CSSParserMode.h:
(WebCore::isQuirksModeBehavior):
(WebCore::isUASheetBehavior):
(WebCore::isUnitLessLengthParsingEnabledForMode):
(WebCore::isCSSViewportParsingEnabledForMode):
(WebCore::strictToCSSParserMode):
(WebCore::isStrictParserMode):
* css/parser/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
(WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
(WebCore::CSSParserSelector::setSelectorList):
(WebCore::CSSParserSelector::appendTagHistory):
(WebCore::CSSParserSelector::releaseTagHistory):
(WebCore::CSSParserSelector::isHostPseudoSelector):
* css/parser/CSSParserValues.h:
(WebCore::CSSParserSelector::match):
(WebCore::CSSParserSelector::pseudoElementType):
(WebCore::CSSParserSelector::selectorList):
(WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
* css/parser/CSSPropertyParser.h:
(WebCore::CSSPropertyParser::inQuirksMode):
* css/parser/CSSSelectorParser.cpp: Added.
(WebCore::CSSSelectorParser::parseSelector):
(WebCore::CSSSelectorParser::CSSSelectorParser):
(WebCore::CSSSelectorParser::consumeComplexSelectorList):
(WebCore::CSSSelectorParser::consumeCompoundSelectorList):
(WebCore::CSSSelectorParser::consumeComplexSelector):
(WebCore::CSSSelectorParser::consumeCompoundSelector):
(WebCore::CSSSelectorParser::consumeSimpleSelector):
(WebCore::CSSSelectorParser::consumeName):
(WebCore::CSSSelectorParser::consumeId):
(WebCore::CSSSelectorParser::consumeClass):
(WebCore::CSSSelectorParser::consumeAttribute):
(WebCore::CSSSelectorParser::consumePseudo):
(WebCore::CSSSelectorParser::consumeCombinator):
(WebCore::CSSSelectorParser::consumeAttributeMatch):
(WebCore::CSSSelectorParser::consumeAttributeFlags):
(WebCore::CSSSelectorParser::consumeANPlusB):
(WebCore::CSSSelectorParser::defaultNamespace):
(WebCore::CSSSelectorParser::determineNamespace):
(WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
(WebCore::CSSSelectorParser::addSimpleSelectorToCompound):
(WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
* css/parser/CSSSelectorParser.h: Added.
(WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope):
(WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
* dom/StyledElement.cpp:
(WebCore::StyledElement::rebuildPresentationAttributeStyle):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::SVGFontFaceElement):</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="#trunkSourceWebCorecontentextensionsContentExtensionParsercpp">trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSDefaultStyleSheetscpp">trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSetcpp">trunk/Source/WebCore/css/CSSFontFaceSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/css/CSSGrammar.y.in</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="#trunkSourceWebCorecssDOMCSSNamespacecpp">trunk/Source/WebCore/css/DOMCSSNamespace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssFontFacecpp">trunk/Source/WebCore/css/FontFace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaListcpp">trunk/Source/WebCore/css/MediaList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorFiltercpp">trunk/Source/WebCore/css/SelectorFilter.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin">trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoTypeMaph">trunk/Source/WebCore/css/SelectorPseudoTypeMap.h</a></li>
<li><a href="#trunkSourceWebCorecssSourceSizeListcpp">trunk/Source/WebCore/css/SourceSizeList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiesh">trunk/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImportcpp">trunk/Source/WebCore/css/StyleRuleImport.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCorecssWebKitCSSMatrixcpp">trunk/Source/WebCore/css/WebKitCSSMatrix.cpp</a></li>
<li><a href="#trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy">trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParsercpp">trunk/Source/WebCore/css/parser/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserh">trunk/Source/WebCore/css/parser/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParserModeh">trunk/Source/WebCore/css/parser/CSSParserMode.h</a></li>
<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>
<li><a href="#trunkSourceWebCorecssparserCSSPropertyParserh">trunk/Source/WebCore/css/parser/CSSPropertyParser.h</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementcpp">trunk/Source/WebCore/dom/StyledElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFontFaceElementcpp">trunk/Source/WebCore/svg/SVGFontFaceElement.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecssparserCSSSelectorParsercpp">trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSSelectorParserh">trunk/Source/WebCore/css/parser/CSSSelectorParser.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 (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -1359,6 +1359,7 @@
</span><span class="cx"> css/parser/CSSParserValues.cpp
</span><span class="cx"> css/parser/CSSPropertyParser.cpp
</span><span class="cx"> css/parser/CSSPropertyParserHelpers.cpp
</span><ins>+ css/parser/CSSSelectorParser.cpp
</ins><span class="cx"> css/parser/CSSTokenizer.cpp
</span><span class="cx"> css/parser/CSSTokenizerInputStream.cpp
</span><span class="cx"> css/parser/MediaQueryBlockWatcher.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/ChangeLog        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -1,3 +1,127 @@
</span><ins>+2016-09-08 Dave Hyatt <hyatt@apple.com>
+
+ [CSS Parser] Add support for new CSS selector parsing
+ https://bugs.webkit.org/show_bug.cgi?id=161749
+
+ Reviewed by Dean Jackson.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * contentextensions/ContentExtensionParser.cpp:
+ (WebCore::ContentExtensions::isValidSelector):
+ * css/CSSDefaultStyleSheets.cpp:
+ (WebCore::parseUASheet):
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::matchingFaces):
+ * css/CSSGrammar.y.in:
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::selectorText):
+ * css/CSSSelector.h:
+ * css/DOMCSSNamespace.cpp:
+ (WebCore::DOMCSSNamespace::supports):
+ * css/FontFace.cpp:
+ (WebCore::FontFace::parseString):
+ (WebCore::FontFace::setVariant):
+ * css/MediaList.cpp:
+ (WebCore::MediaQuerySet::internalParse):
+ (WebCore::MediaQuerySet::parse):
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::matchRecursively):
+ * css/SelectorFilter.cpp:
+ (WebCore::SelectorFilter::collectIdentifierHashes):
+ * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+ * css/SelectorPseudoTypeMap.h:
+ * css/SourceSizeList.cpp:
+ (WebCore::parseSizesAttribute):
+ * css/StyleProperties.cpp:
+ (WebCore::MutableStyleProperties::MutableStyleProperties):
+ * css/StyleProperties.h:
+ * css/StyleRuleImport.cpp:
+ (WebCore::StyleRuleImport::setCSSStyleSheet):
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::StyleSheetContents):
+ (WebCore::StyleSheetContents::parserAddNamespace):
+ (WebCore::StyleSheetContents::namespaceURIFromPrefix):
+ (WebCore::StyleSheetContents::determineNamespace): Deleted.
+ * css/StyleSheetContents.h:
+ * css/WebKitCSSMatrix.cpp:
+ (WebCore::WebKitCSSMatrix::setMatrixValue):
+ * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
+ * css/parser/CSSParser.cpp:
+ (WebCore::strictCSSParserContext):
+ (WebCore::CSSParserContext::CSSParserContext):
+ (WebCore::CSSParser::parseColor):
+ (WebCore::CSSParser::shouldAcceptUnitLessValues):
+ (WebCore::CSSParser::parseValue):
+ (WebCore::CSSParser::parseColumnWidth):
+ (WebCore::CSSParser::parseColumnCount):
+ (WebCore::CSSParser::parseFontWeight):
+ (WebCore::CSSParser::parseColorParameters):
+ (WebCore::CSSParser::parseHSLParameters):
+ (WebCore::CSSParser::parseShadow):
+ (WebCore::CSSParser::parseBorderImageSlice):
+ (WebCore::CSSParser::parseBorderImageQuad):
+ (WebCore::CSSParser::parseDeprecatedLinearGradient):
+ (WebCore::CSSParser::parseLinearGradient):
+ (WebCore::CSSParser::parseTransformValue):
+ (WebCore::CSSParser::parseBuiltinFilterArguments):
+ (WebCore::CSSParser::determineNameInNamespace):
+ * css/parser/CSSParser.h:
+ (WebCore::CSSParser::inStrictMode):
+ (WebCore::CSSParser::inQuirksMode):
+ * css/parser/CSSParserMode.h:
+ (WebCore::isQuirksModeBehavior):
+ (WebCore::isUASheetBehavior):
+ (WebCore::isUnitLessLengthParsingEnabledForMode):
+ (WebCore::isCSSViewportParsingEnabledForMode):
+ (WebCore::strictToCSSParserMode):
+ (WebCore::isStrictParserMode):
+ * css/parser/CSSParserValues.cpp:
+ (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
+ (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
+ (WebCore::CSSParserSelector::setSelectorList):
+ (WebCore::CSSParserSelector::appendTagHistory):
+ (WebCore::CSSParserSelector::releaseTagHistory):
+ (WebCore::CSSParserSelector::isHostPseudoSelector):
+ * css/parser/CSSParserValues.h:
+ (WebCore::CSSParserSelector::match):
+ (WebCore::CSSParserSelector::pseudoElementType):
+ (WebCore::CSSParserSelector::selectorList):
+ (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
+ * css/parser/CSSPropertyParser.h:
+ (WebCore::CSSPropertyParser::inQuirksMode):
+ * css/parser/CSSSelectorParser.cpp: Added.
+ (WebCore::CSSSelectorParser::parseSelector):
+ (WebCore::CSSSelectorParser::CSSSelectorParser):
+ (WebCore::CSSSelectorParser::consumeComplexSelectorList):
+ (WebCore::CSSSelectorParser::consumeCompoundSelectorList):
+ (WebCore::CSSSelectorParser::consumeComplexSelector):
+ (WebCore::CSSSelectorParser::consumeCompoundSelector):
+ (WebCore::CSSSelectorParser::consumeSimpleSelector):
+ (WebCore::CSSSelectorParser::consumeName):
+ (WebCore::CSSSelectorParser::consumeId):
+ (WebCore::CSSSelectorParser::consumeClass):
+ (WebCore::CSSSelectorParser::consumeAttribute):
+ (WebCore::CSSSelectorParser::consumePseudo):
+ (WebCore::CSSSelectorParser::consumeCombinator):
+ (WebCore::CSSSelectorParser::consumeAttributeMatch):
+ (WebCore::CSSSelectorParser::consumeAttributeFlags):
+ (WebCore::CSSSelectorParser::consumeANPlusB):
+ (WebCore::CSSSelectorParser::defaultNamespace):
+ (WebCore::CSSSelectorParser::determineNamespace):
+ (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
+ (WebCore::CSSSelectorParser::addSimpleSelectorToCompound):
+ (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
+ * css/parser/CSSSelectorParser.h: Added.
+ (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope):
+ (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::rebuildPresentationAttributeStyle):
+ * svg/SVGFontFaceElement.cpp:
+ (WebCore::SVGFontFaceElement::SVGFontFaceElement):
+
</ins><span class="cx"> 2016-09-08 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Don't run transitions to or from undefined Lengths
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -3374,6 +3374,8 @@
</span><span class="cx">                 94DE5C7E1D78CB2E00164F2A /* CSSParserIdioms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94DE5C7D1D78CB2500164F2A /* CSSParserIdioms.cpp */; };
</span><span class="cx">                 94DE5C811D7F3A1400164F2A /* CSSAtRuleID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94DE5C7F1D7F39D000164F2A /* CSSAtRuleID.cpp */; };
</span><span class="cx">                 94DE5C821D7F3A1400164F2A /* CSSAtRuleID.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DE5C801D7F39D000164F2A /* CSSAtRuleID.h */; };
</span><ins>+                94DE5C8D1D80802700164F2A /* CSSSelectorParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */; };
+                94DE5C8E1D80802700164F2A /* CSSSelectorParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */; };
</ins><span class="cx">                 96ABA42314BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */; };
</span><span class="cx">                 9703E1BF15DC4E37001F24C8 /* JSVoidCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E9EC8B15DC492F004F2E71 /* JSVoidCallback.cpp */; };
</span><span class="cx">                 97059977107D975200A50A7C /* PolicyCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97059973107D975200A50A7C /* PolicyCallback.cpp */; };
</span><span class="lines">@@ -10525,6 +10527,8 @@
</span><span class="cx">                 94DE5C7D1D78CB2500164F2A /* CSSParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParserIdioms.cpp; path = parser/CSSParserIdioms.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 94DE5C7F1D7F39D000164F2A /* CSSAtRuleID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSAtRuleID.cpp; path = parser/CSSAtRuleID.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 94DE5C801D7F39D000164F2A /* CSSAtRuleID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSAtRuleID.h; path = parser/CSSAtRuleID.h; sourceTree = "<group>"; };
</span><ins>+                94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSSelectorParser.cpp; path = parser/CSSSelectorParser.cpp; sourceTree = "<group>"; };
+                94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSSelectorParser.h; path = parser/CSSSelectorParser.h; sourceTree = "<group>"; };
</ins><span class="cx">                 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGGraphicsElement.h; sourceTree = "<group>"; };
</span><span class="cx">                 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DOpenGLCommon.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 97059973107D975200A50A7C /* PolicyCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolicyCallback.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -18184,6 +18188,8 @@
</span><span class="cx">                                 946D37421D6CF6320077084F /* CSSPropertyParser.h */,
</span><span class="cx">                                 949C77021D6E393500C0DE4F /* CSSPropertyParserHelpers.cpp */,
</span><span class="cx">                                 949C77031D6E393500C0DE4F /* CSSPropertyParserHelpers.h */,
</span><ins>+                                94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */,
+                                94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */,
</ins><span class="cx">                                 946D37341D6CDF980077084F /* CSSTokenizer.cpp */,
</span><span class="cx">                                 946D37371D6CDF980077084F /* CSSTokenizer.h */,
</span><span class="cx">                                 946D37351D6CDF980077084F /* CSSTokenizerInputStream.cpp */,
</span><span class="lines">@@ -26651,6 +26657,7 @@
</span><span class="cx">                                 B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
</span><span class="cx">                                 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
</span><span class="cx">                                 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
</span><ins>+                                94DE5C8E1D80802700164F2A /* CSSSelectorParser.h in Headers */,
</ins><span class="cx">                                 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
</span><span class="cx">                                 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,
</span><span class="cx">                                 088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */,
</span><span class="lines">@@ -28929,6 +28936,7 @@
</span><span class="cx">                                 BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */,
</span><span class="cx">                                 BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */,
</span><span class="cx">                                 A84EBD840CB8C97700079609 /* JSStyleSheetList.cpp in Sources */,
</span><ins>+                                94DE5C8D1D80802700164F2A /* CSSSelectorParser.cpp in Sources */,
</ins><span class="cx">                                 A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */,
</span><span class="cx">                                 B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */,
</span><span class="cx">                                 24D9129113CA951E00D21915 /* JSSVGAltGlyphDefElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">
</span><span class="cx"> static bool isValidSelector(const String& selector)
</span><span class="cx"> {
</span><del>- CSSParserContext context(CSSQuirksMode);
</del><ins>+ CSSParserContext context(HTMLQuirksMode);
</ins><span class="cx"> CSSParser parser(context);
</span><span class="cx"> CSSSelectorList selectorList;
</span><span class="cx"> parser.parseSelector(selector, selectorList);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSDefaultStyleSheetscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">
</span><span class="cx"> static StyleSheetContents* parseUASheet(const String& str)
</span><span class="cx"> {
</span><del>- StyleSheetContents& sheet = StyleSheetContents::create().leakRef(); // leak the sheet on purpose
</del><ins>+ StyleSheetContents& sheet = StyleSheetContents::create(CSSParserContext(UASheetMode)).leakRef(); // leak the sheet on purpose
</ins><span class="cx"> sheet.parseString(str);
</span><span class="cx"> return &sheet;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx"> {
</span><span class="cx"> Vector<std::reference_wrapper<CSSFontFace>> result;
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><del>- auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, CSSStrictMode, nullptr);
</del><ins>+ auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, HTMLStandardMode, nullptr);
</ins><span class="cx"> if (parseResult == CSSParser::ParseResult::Error) {
</span><span class="cx"> ec = SYNTAX_ERR;
</span><span class="cx"> return result;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSGrammar.y.in        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -1256,7 +1256,7 @@
</span><span class="cx"> IDSEL {
</span><span class="cx"> $$ = new CSSParserSelector;
</span><span class="cx"> $$->setMatch(CSSSelector::Id);
</span><del>- if (parser->m_context.mode == CSSQuirksMode)
</del><ins>+ if (parser->m_context.mode == HTMLQuirksMode)
</ins><span class="cx"> $1.convertToASCIILowercaseInPlace();
</span><span class="cx"> $$->setValue($1);
</span><span class="cx"> }
</span><span class="lines">@@ -1266,7 +1266,7 @@
</span><span class="cx"> else {
</span><span class="cx"> $$ = new CSSParserSelector;
</span><span class="cx"> $$->setMatch(CSSSelector::Id);
</span><del>- if (parser->m_context.mode == CSSQuirksMode)
</del><ins>+ if (parser->m_context.mode == HTMLQuirksMode)
</ins><span class="cx"> $1.convertToASCIILowercaseInPlace();
</span><span class="cx"> $$->setValue($1);
</span><span class="cx"> }
</span><span class="lines">@@ -1280,7 +1280,7 @@
</span><span class="cx"> '.' IDENT {
</span><span class="cx"> $$ = new CSSParserSelector;
</span><span class="cx"> $$->setMatch(CSSSelector::Class);
</span><del>- if (parser->m_context.mode == CSSQuirksMode)
</del><ins>+ if (parser->m_context.mode == HTMLQuirksMode)
</ins><span class="cx"> $2.convertToASCIILowercaseInPlace();
</span><span class="cx"> $$->setValue($2);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/CSSSelector.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -735,6 +735,8 @@
</span><span class="cx"> return tagHistory->selectorText(" " + str.toString() + rightSide);
</span><span class="cx"> case CSSSelector::Child:
</span><span class="cx"> return tagHistory->selectorText(" > " + str.toString() + rightSide);
</span><ins>+ case CSSSelector::ShadowDeep:
+ return tagHistory->selectorText(" /deep/ " + str.toString() + rightSide);
</ins><span class="cx"> case CSSSelector::DirectAdjacent:
</span><span class="cx"> return tagHistory->selectorText(" + " + str.toString() + rightSide);
</span><span class="cx"> case CSSSelector::IndirectAdjacent:
</span><span class="lines">@@ -745,6 +747,8 @@
</span><span class="cx"> FALLTHROUGH;
</span><span class="cx"> #endif
</span><span class="cx"> case CSSSelector::ShadowDescendant:
</span><ins>+ case CSSSelector::ShadowPseudo:
+ case CSSSelector::ShadowSlot:
</ins><span class="cx"> return tagHistory->selectorText(str.toString() + rightSide);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/CSSSelector.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -87,7 +87,10 @@
</span><span class="cx"> DirectAdjacent,
</span><span class="cx"> IndirectAdjacent,
</span><span class="cx"> SubSelector,
</span><del>- ShadowDescendant,
</del><ins>+ ShadowDescendant, // FIXME-NEWPARSER: Remove this in favor of the new shadow values below.
+ ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element
+ ShadowDeep, // /deep/ combinator
+ ShadowSlot // slotted to <slot> e
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum PseudoClassType {
</span><span class="lines">@@ -217,6 +220,11 @@
</span><span class="cx"> RightBottomMarginBox,
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+ enum AttributeMatchType {
+ CaseSensitive,
+ CaseInsensitive,
+ };
+
</ins><span class="cx"> static PseudoElementType parsePseudoElementType(const String&);
</span><span class="cx"> static PseudoId pseudoId(PseudoElementType);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssDOMCSSNamespacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DOMCSSNamespace.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -69,12 +69,12 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> auto dummyStyle = MutableStyleProperties::create();
</span><del>- return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error;
</del><ins>+ return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, HTMLStandardMode, nullptr) != CSSParser::ParseResult::Error;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DOMCSSNamespace::supports(const String& conditionText)
</span><span class="cx"> {
</span><del>- CSSParserContext context(CSSStrictMode);
</del><ins>+ CSSParserContext context(HTMLStandardMode);
</ins><span class="cx"> CSSParser parser(context);
</span><span class="cx"> return parser.parseSupportsCondition(conditionText);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssFontFacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/FontFace.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/FontFace.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/FontFace.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> RefPtr<CSSValue> FontFace::parseString(const String& string, CSSPropertyID propertyID)
</span><span class="cx"> {
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><del>- if (CSSParser::parseValue(style, propertyID, string, true, CSSStrictMode, nullptr) == CSSParser::ParseResult::Error)
</del><ins>+ if (CSSParser::parseValue(style, propertyID, string, true, HTMLStandardMode, nullptr) == CSSParser::ParseResult::Error)
</ins><span class="cx"> return nullptr;
</span><span class="cx"> return style->getPropertyCSSValue(propertyID);
</span><span class="cx"> }
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> auto style = MutableStyleProperties::create();
</span><del>- auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, CSSStrictMode, nullptr);
</del><ins>+ auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, HTMLStandardMode, nullptr);
</ins><span class="cx"> if (result == CSSParser::ParseResult::Error) {
</span><span class="cx"> ec = SYNTAX_ERR;
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaList.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaList.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/MediaList.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -129,13 +129,13 @@
</span><span class="cx">
</span><span class="cx"> Optional<MediaQuery> MediaQuerySet::internalParse(const String& queryString)
</span><span class="cx"> {
</span><del>- CSSParser parser(CSSStrictMode);
</del><ins>+ CSSParser parser(HTMLStandardMode);
</ins><span class="cx"> return internalParse(parser, queryString);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MediaQuerySet::parse(const String& mediaString)
</span><span class="cx"> {
</span><del>- CSSParser parser(CSSStrictMode);
</del><ins>+ CSSParser parser(HTMLStandardMode);
</ins><span class="cx">
</span><span class="cx"> Vector<MediaQuery> result;
</span><span class="cx"> Vector<String> list;
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -452,8 +452,16 @@
</span><span class="cx">
</span><span class="cx"> return MatchResult::updateWithMatchType(result, matchType);
</span><span class="cx"> }
</span><ins>+
+ case CSSSelector::ShadowPseudo:
+ case CSSSelector::ShadowDeep:
+ case CSSSelector::ShadowSlot:
+ // FIXME-NEWPARSER: Have to implement these.
+ ASSERT_NOT_REACHED();
+ return MatchResult::fails(Match::SelectorFailsCompletely);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> return MatchResult::fails(Match::SelectorFailsCompletely);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorFilter.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorFilter.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/SelectorFilter.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -138,8 +138,14 @@
</span><span class="cx"> case CSSSelector::ShadowDescendant:
</span><span class="cx"> skipOverSubselectors = true;
</span><span class="cx"> break;
</span><ins>+ case CSSSelector::ShadowSlot:
+ // Disable fastRejectSelector.
+ *identifierHashes = 0;
+ return;
</ins><span class="cx"> case CSSSelector::Descendant:
</span><span class="cx"> case CSSSelector::Child:
</span><ins>+ case CSSSelector::ShadowPseudo:
+ case CSSSelector::ShadowDeep:
</ins><span class="cx"> skipOverSubselectors = false;
</span><span class="cx"> collectDescendantSelectorIdentifierHashes(selector, hash);
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> focus
</span><span class="cx"> focus-within
</span><span class="cx"> horizontal
</span><del>-host
</del><ins>+host, PseudoClassHost, PseudoElementUnknown
</ins><span class="cx"> hover
</span><span class="cx"> in-range
</span><span class="cx"> increment
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoTypeMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoTypeMap.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoTypeMap.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/SelectorPseudoTypeMap.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const CSSParserString& pseudoTypeString);
</span><ins>+PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const StringView& pseudoTypeString);
</ins><span class="cx"> CSSSelector::PseudoElementType parsePseudoElementString(const StringImpl& pseudoTypeString);
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssSourceSizeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SourceSizeList.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SourceSizeList.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/SourceSizeList.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> if (!renderer)
</span><span class="cx"> return 0;
</span><span class="cx"> auto& style = renderer->style();
</span><del>- for (auto& sourceSize : CSSParser(CSSStrictMode).parseSizesAttribute(sizesAttribute)) {
</del><ins>+ for (auto& sourceSize : CSSParser(HTMLStandardMode).parseSizesAttribute(sizesAttribute)) {
</ins><span class="cx"> if (match(sourceSize.expression, style, document))
</span><span class="cx"> return computeLength(sourceSize.length.get(), style, *renderer);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MutableStyleProperties::MutableStyleProperties(const CSSProperty* properties, unsigned length)
</span><del>- : StyleProperties(CSSStrictMode)
</del><ins>+ : StyleProperties(HTMLStandardMode)
</ins><span class="cx"> {
</span><span class="cx"> m_propertyVector.reserveInitialCapacity(length);
</span><span class="cx"> for (unsigned i = 0; i < length; ++i)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/StyleProperties.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -134,9 +134,9 @@
</span><span class="cx"> int findPropertyIndex(CSSPropertyID) const;
</span><span class="cx"> int findCustomPropertyIndex(const String& propertyName) const;
</span><span class="cx">
</span><del>- unsigned m_cssParserMode : 2;
</del><ins>+ unsigned m_cssParserMode : 3;
</ins><span class="cx"> mutable unsigned m_isMutable : 1;
</span><del>- unsigned m_arraySize : 29;
</del><ins>+ unsigned m_arraySize : 28;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> String getShorthandValue(const StylePropertyShorthand&) const;
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">
</span><span class="cx"> class MutableStyleProperties final : public StyleProperties {
</span><span class="cx"> public:
</span><del>- WEBCORE_EXPORT static Ref<MutableStyleProperties> create(CSSParserMode = CSSQuirksMode);
</del><ins>+ WEBCORE_EXPORT static Ref<MutableStyleProperties> create(CSSParserMode = HTMLQuirksMode);
</ins><span class="cx"> static Ref<MutableStyleProperties> create(const CSSProperty* properties, unsigned count);
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT ~MutableStyleProperties();
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImportcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> if (m_styleSheet)
</span><span class="cx"> m_styleSheet->clearOwnerRule();
</span><span class="cx">
</span><del>- CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserContext() : CSSStrictMode;
</del><ins>+ CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserContext() : HTMLStandardMode;
</ins><span class="cx"> context.charset = charset;
</span><span class="cx"> if (!baseURL.isNull())
</span><span class="cx"> context.baseURL = baseURL;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context)
</span><span class="cx"> : m_ownerRule(ownerRule)
</span><span class="cx"> , m_originalURL(originalURL)
</span><ins>+ , m_defaultNamespace(starAtom)
</ins><span class="cx"> , m_loadCompleted(false)
</span><span class="cx"> , m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet())
</span><span class="cx"> , m_hasSyntacticallyValidCSSHeader(true)
</span><span class="lines">@@ -82,6 +83,7 @@
</span><span class="cx"> , m_importRules(o.m_importRules.size())
</span><span class="cx"> , m_childRules(o.m_childRules.size())
</span><span class="cx"> , m_namespaces(o.m_namespaces)
</span><ins>+ , m_defaultNamespace(o.m_defaultNamespace)
</ins><span class="cx"> , m_loadCompleted(true)
</span><span class="cx"> , m_isUserStyleSheet(o.m_isUserStyleSheet)
</span><span class="cx"> , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader)
</span><span class="lines">@@ -269,8 +271,11 @@
</span><span class="cx">
</span><span class="cx"> void StyleSheetContents::parserAddNamespace(const AtomicString& prefix, const AtomicString& uri)
</span><span class="cx"> {
</span><del>- if (uri.isNull() || prefix.isNull())
</del><ins>+ ASSERT(!uri.isNull());
+ if (prefix.isNull()) {
+ m_defaultNamespace = uri;
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx"> PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri);
</span><span class="cx"> if (result.isNewEntry)
</span><span class="cx"> return;
</span><span class="lines">@@ -277,7 +282,7 @@
</span><span class="cx"> result.iterator->value = uri;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-const AtomicString& StyleSheetContents::determineNamespace(const AtomicString& prefix)
</del><ins>+const AtomicString& StyleSheetContents::namespaceURIFromPrefix(const AtomicString& prefix)
</ins><span class="cx"> {
</span><span class="cx"> PrefixNamespaceURIMap::const_iterator it = m_namespaces.find(prefix);
</span><span class="cx"> if (it == m_namespaces.end())
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">
</span><span class="cx"> class StyleSheetContents final : public RefCounted<StyleSheetContents> {
</span><span class="cx"> public:
</span><del>- static Ref<StyleSheetContents> create(const CSSParserContext& context = CSSParserContext(CSSStrictMode))
</del><ins>+ static Ref<StyleSheetContents> create(const CSSParserContext& context = CSSParserContext(HTMLStandardMode))
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new StyleSheetContents(0, String(), context));
</span><span class="cx"> }
</span><span class="lines">@@ -60,9 +60,10 @@
</span><span class="cx"> WEBCORE_EXPORT ~StyleSheetContents();
</span><span class="cx">
</span><span class="cx"> const CSSParserContext& parserContext() const { return m_parserContext; }
</span><ins>+
+ const AtomicString& defaultNamespace() { return m_defaultNamespace; }
+ const AtomicString& namespaceURIFromPrefix(const AtomicString& prefix);
</ins><span class="cx">
</span><del>- const AtomicString& determineNamespace(const AtomicString& prefix);
-
</del><span class="cx"> void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*);
</span><span class="cx"> WEBCORE_EXPORT bool parseString(const String&);
</span><span class="cx"> bool parseStringAtPosition(const String&, const TextPosition&, bool createdByParser);
</span><span class="lines">@@ -160,6 +161,7 @@
</span><span class="cx"> Vector<RefPtr<StyleRuleBase>> m_childRules;
</span><span class="cx"> typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap;
</span><span class="cx"> PrefixNamespaceURIMap m_namespaces;
</span><ins>+ AtomicString m_defaultNamespace;
</ins><span class="cx">
</span><span class="cx"> bool m_loadCompleted : 1;
</span><span class="cx"> bool m_isUserStyleSheet : 1;
</span></span></pre></div>
<a id="trunkSourceWebCorecssWebKitCSSMatrixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/WebKitCSSMatrix.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/WebKitCSSMatrix.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/WebKitCSSMatrix.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> auto styleDeclaration = MutableStyleProperties::create();
</span><del>- if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error) {
</del><ins>+ if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, HTMLStandardMode, nullptr) != CSSParser::ParseResult::Error) {
</ins><span class="cx"> // Convert to TransformOperations. This can fail if a property
</span><span class="cx"> // requires style (i.e., param uses 'ems' or 'exs')
</span><span class="cx"> RefPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSPropertyTransform);
</span></span></pre></div>
<a id="trunkSourceWebCorecssmakeSelectorPseudoClassAndCompatibilityElementMappy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> output_file.write("""
</span><span class="cx"> %{
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -198,6 +198,19 @@
</span><span class="cx"> return { CSSSelector::PseudoClassUnknown, CSSSelector::PseudoElementUnknown };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const StringView& pseudoTypeString)
+{
+ const SelectorPseudoClassOrCompatibilityPseudoElementEntry* entry;
+ if (pseudoTypeString.is8Bit())
+ entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters8(), pseudoTypeString.length());
+ else
+ entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters16(), pseudoTypeString.length());
+
+ if (entry)
+ return entry->pseudoTypes;
+ return { CSSSelector::PseudoClassUnknown, CSSSelector::PseudoElementUnknown };
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #if defined(__clang__)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -232,7 +232,7 @@
</span><span class="cx">
</span><span class="cx"> const CSSParserContext& strictCSSParserContext()
</span><span class="cx"> {
</span><del>- static NeverDestroyed<CSSParserContext> strictContext(CSSStrictMode);
</del><ins>+ static NeverDestroyed<CSSParserContext> strictContext(HTMLStandardMode);
</ins><span class="cx"> return strictContext;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx"> CSSParserContext::CSSParserContext(Document& document, const URL& baseURL, const String& charset)
</span><span class="cx"> : baseURL(baseURL.isNull() ? document.baseURL() : baseURL)
</span><span class="cx"> , charset(charset)
</span><del>- , mode(document.inQuirksMode() ? CSSQuirksMode : CSSStrictMode)
</del><ins>+ , mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode)
</ins><span class="cx"> , isHTMLDocument(document.isHTMLDocument())
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> , cssGridLayoutEnabled(document.isCSSGridLayoutEnabled())
</span><span class="lines">@@ -1392,7 +1392,7 @@
</span><span class="cx"> if (fastParseColor(color, string, strict))
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- CSSParser parser(CSSStrictMode);
</del><ins>+ CSSParser parser(HTMLStandardMode);
</ins><span class="cx">
</span><span class="cx"> // In case the fast-path parser didn't understand the color, try the full parser.
</span><span class="cx"> if (!parser.parseColor(string))
</span><span class="lines">@@ -1719,7 +1719,7 @@
</span><span class="cx"> inline bool CSSParser::shouldAcceptUnitLessValues(CSSParserValue& value, Units unitFlags, CSSParserMode cssParserMode)
</span><span class="cx"> {
</span><span class="cx"> // Qirks mode and svg presentation attributes accept unit less values.
</span><del>- return (unitFlags & (FLength | FAngle | FTime)) && (!value.fValue || cssParserMode == CSSQuirksMode || cssParserMode == SVGAttributeMode);
</del><ins>+ return (unitFlags & (FLength | FAngle | FTime)) && (!value.fValue || cssParserMode == HTMLQuirksMode || cssParserMode == SVGAttributeMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool CSSParser::validateUnit(ValueWithCalculation& valueWithCalculation, Units unitFlags, CSSParserMode cssParserMode)
</span><span class="lines">@@ -2356,7 +2356,7 @@
</span><span class="cx"> if (id == CSSValueAuto)
</span><span class="cx"> validPrimitive = true;
</span><span class="cx"> else
</span><del>- validPrimitive = (!id && validateUnit(valueWithCalculation, FInteger, CSSQuirksMode));
</del><ins>+ validPrimitive = (!id && validateUnit(valueWithCalculation, FInteger, HTMLQuirksMode));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CSSPropertyOrphans: // <integer> | inherit | auto (We've added support for auto for backwards compatibility)
</span><span class="lines">@@ -2364,7 +2364,7 @@
</span><span class="cx"> if (id == CSSValueAuto)
</span><span class="cx"> validPrimitive = true;
</span><span class="cx"> else
</span><del>- validPrimitive = (!id && validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode));
</del><ins>+ validPrimitive = (!id && validateUnit(valueWithCalculation, FPositiveInteger, HTMLQuirksMode));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CSSPropertyLineHeight:
</span><span class="lines">@@ -2415,7 +2415,7 @@
</span><span class="cx"> if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocument)
</span><span class="cx"> validPrimitive = true;
</span><span class="cx"> else
</span><del>- validPrimitive = (!id && validateUnit(valueWithCalculation, FNumber | FPercent | FNonNeg, CSSStrictMode));
</del><ins>+ validPrimitive = (!id && validateUnit(valueWithCalculation, FNumber | FPercent | FNonNeg, HTMLStandardMode));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CSSPropertyWebkitTextZoom:
</span><span class="lines">@@ -2567,10 +2567,10 @@
</span><span class="cx"> validPrimitive = validateUnit(valueWithCalculation, FNumber);
</span><span class="cx"> break;
</span><span class="cx"> case CSSPropertyWebkitBoxFlexGroup:
</span><del>- validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode);
</del><ins>+ validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode);
</ins><span class="cx"> break;
</span><span class="cx"> case CSSPropertyWebkitBoxOrdinalGroup:
</span><del>- validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode) && valueWithCalculation.value().fValue;
</del><ins>+ validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode) && valueWithCalculation.value().fValue;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSPropertyFilter:
</span><span class="cx"> #if ENABLE(FILTERS_LEVEL_2)
</span><span class="lines">@@ -2616,7 +2616,7 @@
</span><span class="cx"> validPrimitive = validateUnit(valueWithCalculation, FNumber | FNonNeg);
</span><span class="cx"> break;
</span><span class="cx"> case CSSPropertyOrder:
</span><del>- if (validateUnit(valueWithCalculation, FInteger, CSSStrictMode)) {
</del><ins>+ if (validateUnit(valueWithCalculation, FInteger, HTMLStandardMode)) {
</ins><span class="cx"> // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
</span><span class="cx"> double result = std::max<double>(std::numeric_limits<int>::min() + 2, parsedDouble(valueWithCalculation));
</span><span class="cx"> parsedValue = cssValuePool.createValue(result, CSSPrimitiveValue::CSS_NUMBER);
</span><span class="lines">@@ -2898,7 +2898,7 @@
</span><span class="cx"> case CSSPropertyWebkitLineClamp:
</span><span class="cx"> // When specifying number of lines, don't allow 0 as a valid value
</span><span class="cx"> // When specifying either type of unit, require non-negative integers
</span><del>- validPrimitive = (!id && (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_PERCENTAGE || valueWithCalculation.value().fValue) && validateUnit(valueWithCalculation, FInteger | FPercent | FNonNeg, CSSQuirksMode));
</del><ins>+ validPrimitive = (!id && (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_PERCENTAGE || valueWithCalculation.value().fValue) && validateUnit(valueWithCalculation, FInteger | FPercent | FNonNeg, HTMLQuirksMode));
</ins><span class="cx"> break;
</span><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span><span class="cx"> case CSSPropertyWebkitTextSizeAdjust:
</span><span class="lines">@@ -2909,7 +2909,7 @@
</span><span class="cx"> validPrimitive = true;
</span><span class="cx"> else {
</span><span class="cx"> // FIXME: Handle multilength case where we allow relative units.
</span><del>- validPrimitive = (!id && validateUnit(valueWithCalculation, FPercent | FNonNeg, CSSStrictMode));
</del><ins>+ validPrimitive = (!id && validateUnit(valueWithCalculation, FPercent | FNonNeg, HTMLStandardMode));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> #endif
</span><span class="lines">@@ -2925,12 +2925,12 @@
</span><span class="cx">
</span><span class="cx"> case CSSPropertyWebkitHyphenateLimitBefore:
</span><span class="cx"> case CSSPropertyWebkitHyphenateLimitAfter:
</span><del>- if (id == CSSValueAuto || validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode))
</del><ins>+ if (id == CSSValueAuto || validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> validPrimitive = true;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case CSSPropertyWebkitHyphenateLimitLines:
</span><del>- if (id == CSSValueNoLimit || validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode))
</del><ins>+ if (id == CSSValueNoLimit || validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> validPrimitive = true;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -3874,7 +3874,7 @@
</span><span class="cx"> ValueWithCalculation valueWithCalculation(*m_valueList->current());
</span><span class="cx"> CSSValueID id = valueWithCalculation.value().id;
</span><span class="cx"> // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property.
</span><del>- if (id != CSSValueAuto && !(validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode) && parsedDouble(valueWithCalculation)))
</del><ins>+ if (id != CSSValueAuto && !(validateUnit(valueWithCalculation, FLength | FNonNeg, HTMLStandardMode) && parsedDouble(valueWithCalculation)))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto parsedValue = parseValidPrimitive(id, valueWithCalculation);
</span><span class="lines">@@ -3887,7 +3887,7 @@
</span><span class="cx"> ValueWithCalculation valueWithCalculation(*m_valueList->current());
</span><span class="cx"> CSSValueID id = valueWithCalculation.value().id;
</span><span class="cx">
</span><del>- if (id != CSSValueAuto && !validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode))
</del><ins>+ if (id != CSSValueAuto && !validateUnit(valueWithCalculation, FPositiveInteger, HTMLQuirksMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto parsedValue = parseValidPrimitive(id, valueWithCalculation);
</span><span class="lines">@@ -7237,7 +7237,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> ValueWithCalculation valueWithCalculation(value);
</span><del>- if (validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSQuirksMode)) {
</del><ins>+ if (validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLQuirksMode)) {
</ins><span class="cx"> int weight = static_cast<int>(parsedDouble(valueWithCalculation));
</span><span class="cx"> if (!(weight % 100) && weight >= 100 && weight <= 900) {
</span><span class="cx"> addProperty(CSSPropertyFontWeight, CSSValuePool::singleton().createIdentifierValue(createFontWeightValueKeyword(weight)), important);
</span><span class="lines">@@ -7812,9 +7812,9 @@
</span><span class="cx"> ValueWithCalculation firstArgumentWithCalculation(*args->current());
</span><span class="cx"> Units unitType = FUnknown;
</span><span class="cx"> // Get the first value and its type
</span><del>- if (validateUnit(firstArgumentWithCalculation, FInteger, CSSStrictMode))
</del><ins>+ if (validateUnit(firstArgumentWithCalculation, FInteger, HTMLStandardMode))
</ins><span class="cx"> unitType = FInteger;
</span><del>- else if (validateUnit(firstArgumentWithCalculation, FPercent, CSSStrictMode))
</del><ins>+ else if (validateUnit(firstArgumentWithCalculation, FPercent, HTMLStandardMode))
</ins><span class="cx"> unitType = FPercent;
</span><span class="cx"> else
</span><span class="cx"> return false;
</span><span class="lines">@@ -7825,7 +7825,7 @@
</span><span class="cx"> if (operatorArgument.unit != CSSParserValue::Operator && operatorArgument.iValue != ',')
</span><span class="cx"> return false;
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args->next());
</span><del>- if (!validateUnit(argumentWithCalculation, unitType, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, unitType, HTMLStandardMode))
</ins><span class="cx"> return false;
</span><span class="cx"> colorArray[i] = colorIntFromValue(argumentWithCalculation);
</span><span class="cx"> }
</span><span class="lines">@@ -7834,7 +7834,7 @@
</span><span class="cx"> if (operatorArgument.unit != CSSParserValue::Operator && operatorArgument.iValue != ',')
</span><span class="cx"> return false;
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args->next());
</span><del>- if (!validateUnit(argumentWithCalculation, FNumber, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FNumber, HTMLStandardMode))
</ins><span class="cx"> return false;
</span><span class="cx"> double doubleValue = parsedDouble(argumentWithCalculation);
</span><span class="cx"> // Convert the floating pointer number of alpha to an integer in the range [0, 256),
</span><span class="lines">@@ -7854,7 +7854,7 @@
</span><span class="cx"> CSSParserValueList* args = value.function->args.get();
</span><span class="cx"> ValueWithCalculation firstArgumentWithCalculation(*args->current());
</span><span class="cx"> // Get the first value
</span><del>- if (!validateUnit(firstArgumentWithCalculation, FNumber, CSSStrictMode))
</del><ins>+ if (!validateUnit(firstArgumentWithCalculation, FNumber, HTMLStandardMode))
</ins><span class="cx"> return false;
</span><span class="cx"> // normalize the Hue value and change it to be between 0 and 1.0
</span><span class="cx"> colorArray[0] = (((static_cast<int>(parsedDouble(firstArgumentWithCalculation)) % 360) + 360) % 360) / 360.0;
</span><span class="lines">@@ -7863,7 +7863,7 @@
</span><span class="cx"> if (operatorArgument.unit != CSSParserValue::Operator && operatorArgument.iValue != ',')
</span><span class="cx"> return false;
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args->next());
</span><del>- if (!validateUnit(argumentWithCalculation, FPercent, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FPercent, HTMLStandardMode))
</ins><span class="cx"> return false;
</span><span class="cx"> colorArray[i] = std::max<double>(0, std::min<double>(100, parsedDouble(argumentWithCalculation))) / 100.0; // needs to be value between 0 and 1.0
</span><span class="cx"> }
</span><span class="lines">@@ -7872,7 +7872,7 @@
</span><span class="cx"> if (operatorArgument.unit != CSSParserValue::Operator && operatorArgument.iValue != ',')
</span><span class="cx"> return false;
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args->next());
</span><del>- if (!validateUnit(argumentWithCalculation, FNumber, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FNumber, HTMLStandardMode))
</ins><span class="cx"> return false;
</span><span class="cx"> colorArray[3] = std::max<double>(0, std::min<double>(1, parsedDouble(argumentWithCalculation)));
</span><span class="cx"> }
</span><span class="lines">@@ -8079,13 +8079,13 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> // The value is good. Commit it.
</span><span class="cx"> context.commitValue();
</span><del>- } else if (validateUnit(valueWithCalculation, FLength, CSSStrictMode)) {
</del><ins>+ } else if (validateUnit(valueWithCalculation, FLength, HTMLStandardMode)) {
</ins><span class="cx"> // We required a length and didn't get one. Invalid.
</span><span class="cx"> if (!context.allowLength())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> // Blur radius must be non-negative.
</span><del>- if (context.allowBlur && !validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode))
</del><ins>+ if (context.allowBlur && !validateUnit(valueWithCalculation, FLength | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> // A length is allowed here. Construct the value and add it.
</span><span class="lines">@@ -8533,7 +8533,7 @@
</span><span class="cx"> while ((value = m_valueList->current())) {
</span><span class="cx"> ValueWithCalculation valueWithCalculation(*value);
</span><span class="cx"> // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values are not created yet.
</span><del>- if (context.allowNumber() && !isCalculation(valueWithCalculation) && validateUnit(valueWithCalculation, FInteger | FNonNeg | FPercent, CSSStrictMode)) {
</del><ins>+ if (context.allowNumber() && !isCalculation(valueWithCalculation) && validateUnit(valueWithCalculation, FInteger | FNonNeg | FPercent, HTMLStandardMode)) {
</ins><span class="cx"> context.commitNumber(valueWithCalculation);
</span><span class="cx"> } else if (context.allowFill() && value->id == CSSValueFill)
</span><span class="cx"> context.commitFill();
</span><span class="lines">@@ -8647,7 +8647,7 @@
</span><span class="cx"> CSSParserValue* value;
</span><span class="cx"> while ((value = m_valueList->current())) {
</span><span class="cx"> ValueWithCalculation valueWithCalculation(*value);
</span><del>- if (context.allowNumber() && (validateUnit(valueWithCalculation, validUnits, CSSStrictMode) || value->id == CSSValueAuto)) {
</del><ins>+ if (context.allowNumber() && (validateUnit(valueWithCalculation, validUnits, HTMLStandardMode) || value->id == CSSValueAuto)) {
</ins><span class="cx"> context.commitNumber(valueWithCalculation);
</span><span class="cx"> } else if (!inShorthand()) {
</span><span class="cx"> // If we're not parsing a shorthand then we are invalid.
</span><span class="lines">@@ -9077,7 +9077,7 @@
</span><span class="cx">
</span><span class="cx"> bool expectComma = false;
</span><span class="cx"> // Look for angle.
</span><del>- if (validateUnit(argumentWithCalculation, FAngle, CSSStrictMode)) {
</del><ins>+ if (validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode)) {
</ins><span class="cx"> result->setAngle(createPrimitiveNumericValue(argumentWithCalculation));
</span><span class="cx">
</span><span class="cx"> args->next();
</span><span class="lines">@@ -9263,7 +9263,7 @@
</span><span class="cx">
</span><span class="cx"> bool expectComma = false;
</span><span class="cx"> // Look for angle.
</span><del>- if (validateUnit(firstArgumentWithCalculation, FAngle, CSSStrictMode)) {
</del><ins>+ if (validateUnit(firstArgumentWithCalculation, FAngle, HTMLStandardMode)) {
</ins><span class="cx"> result->setAngle(createPrimitiveNumericValue(firstArgumentWithCalculation));
</span><span class="cx">
</span><span class="cx"> args->next();
</span><span class="lines">@@ -10078,21 +10078,21 @@
</span><span class="cx">
</span><span class="cx"> if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation && argNumber == 3) {
</span><span class="cx"> // 4th param of rotate3d() is an angle rather than a bare number, validate it as such
</span><del>- if (!validateUnit(argumentWithCalculation, FAngle, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> } else if (info.type() == WebKitCSSTransformValue::Translate3DTransformOperation && argNumber == 2) {
</span><span class="cx"> // 3rd param of translate3d() cannot be a percentage
</span><del>- if (!validateUnit(argumentWithCalculation, FLength, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FLength, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> } else if (info.type() == WebKitCSSTransformValue::TranslateZTransformOperation && !argNumber) {
</span><span class="cx"> // 1st param of translateZ() cannot be a percentage
</span><del>- if (!validateUnit(argumentWithCalculation, FLength, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FLength, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx"> } else if (info.type() == WebKitCSSTransformValue::PerspectiveTransformOperation && !argNumber) {
</span><span class="cx"> // 1st param of perspective() must be a non-negative number (deprecated) or length.
</span><del>- if (!validateUnit(argumentWithCalculation, FNumber | FLength | FNonNeg, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FNumber | FLength | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><del>- } else if (!validateUnit(argumentWithCalculation, unit, CSSStrictMode))
</del><ins>+ } else if (!validateUnit(argumentWithCalculation, unit, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> // Add the value to the current transform operation.
</span><span class="lines">@@ -10167,7 +10167,7 @@
</span><span class="cx">
</span><span class="cx"> if (args.size()) {
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args.current());
</span><del>- if (!validateUnit(argumentWithCalculation, FNumber | FPercent | FNonNeg, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FNumber | FPercent | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> auto primitiveValue = createPrimitiveNumericValue(argumentWithCalculation);
</span><span class="lines">@@ -10191,7 +10191,7 @@
</span><span class="cx">
</span><span class="cx"> if (args.size()) {
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args.current());
</span><del>- if (!validateUnit(argumentWithCalculation, FNumber | FPercent, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FNumber | FPercent, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> filterValue->append(createPrimitiveNumericValue(argumentWithCalculation));
</span><span class="lines">@@ -10205,7 +10205,7 @@
</span><span class="cx">
</span><span class="cx"> if (args.size()) {
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args.current());
</span><del>- if (!validateUnit(argumentWithCalculation, FAngle, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> filterValue->append(createPrimitiveNumericValue(argumentWithCalculation));
</span><span class="lines">@@ -10219,7 +10219,7 @@
</span><span class="cx">
</span><span class="cx"> if (args.size()) {
</span><span class="cx"> ValueWithCalculation argumentWithCalculation(*args.current());
</span><del>- if (!validateUnit(argumentWithCalculation, FLength | FNonNeg, CSSStrictMode))
</del><ins>+ if (!validateUnit(argumentWithCalculation, FLength | FNonNeg, HTMLStandardMode))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> filterValue->append(createPrimitiveNumericValue(argumentWithCalculation));
</span><span class="lines">@@ -13125,7 +13125,7 @@
</span><span class="cx">
</span><span class="cx"> if (!m_styleSheet)
</span><span class="cx"> return QualifiedName(prefix, localName, m_defaultNamespace);
</span><del>- return QualifiedName(prefix, localName, m_styleSheet->determineNamespace(prefix));
</del><ins>+ return QualifiedName(prefix, localName, m_styleSheet->namespaceURIFromPrefix(prefix));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSParser::rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector& specifiers)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSParser.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -571,8 +571,8 @@
</span><span class="cx">
</span><span class="cx"> void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleSheet; }
</span><span class="cx">
</span><del>- inline bool inStrictMode() const { return m_context.mode == CSSStrictMode || m_context.mode == SVGAttributeMode; }
- inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }
</del><ins>+ inline bool inStrictMode() const { return m_context.mode == UASheetMode || m_context.mode == HTMLStandardMode || m_context.mode == SVGAttributeMode; }
+ inline bool inQuirksMode() const { return m_context.mode == HTMLQuirksMode; }
</ins><span class="cx">
</span><span class="cx"> URL completeURL(const String& url) const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserModeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserMode.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserMode.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSParserMode.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -37,21 +37,50 @@
</span><span class="cx">
</span><span class="cx"> class Document;
</span><span class="cx">
</span><ins>+// Must not grow beyond 3 bits, due to packing in StyleProperties.
</ins><span class="cx"> enum CSSParserMode {
</span><del>- CSSQuirksMode,
- CSSStrictMode,
- // SVG should always be in strict mode. For SVG attributes, the rules differ to strict sometimes.
- SVGAttributeMode
</del><ins>+ HTMLStandardMode,
+ HTMLQuirksMode,
+ // HTML attributes are parsed in quirks mode but also allows internal properties and values.
+ HTMLAttributeMode,
+ // SVG attributes are parsed in quirks mode but rules differ slightly.
+ SVGAttributeMode,
+ // @viewport rules are parsed in standards mode but CSSOM modifications (via StylePropertySet)
+ // must call parseViewportProperties so needs a special mode.
+ CSSViewportRuleMode,
+ // User agent stylesheets are parsed in standards mode but also allows internal properties and values.
+ UASheetMode
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+inline bool isQuirksModeBehavior(CSSParserMode mode)
+{
+ return mode == HTMLQuirksMode || mode == HTMLAttributeMode;
+}
+
+inline bool isUASheetBehavior(CSSParserMode mode)
+{
+ return mode == UASheetMode;
+}
+
+inline bool isUnitLessLengthParsingEnabledForMode(CSSParserMode mode)
+{
+ return mode == HTMLAttributeMode || mode == SVGAttributeMode;
+}
+
+inline bool isCSSViewportParsingEnabledForMode(CSSParserMode mode)
+{
+ return mode == CSSViewportRuleMode;
+}
+
+// FIXME-NEWPARSER: Next two functions should be removed eventually.
</ins><span class="cx"> inline CSSParserMode strictToCSSParserMode(bool inStrictMode)
</span><span class="cx"> {
</span><del>- return inStrictMode ? CSSStrictMode : CSSQuirksMode;
</del><ins>+ return inStrictMode ? HTMLStandardMode : HTMLQuirksMode;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool isStrictParserMode(CSSParserMode cssParserMode)
</span><span class="cx"> {
</span><del>- return cssParserMode == CSSStrictMode || cssParserMode == SVGAttributeMode;
</del><ins>+ return cssParserMode == UASheetMode || cssParserMode == HTMLStandardMode || cssParserMode == SVGAttributeMode;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> struct CSSParserContext {
</span><span class="lines">@@ -62,7 +91,7 @@
</span><span class="cx">
</span><span class="cx"> URL baseURL;
</span><span class="cx"> String charset;
</span><del>- CSSParserMode mode { CSSStrictMode };
</del><ins>+ CSSParserMode mode { HTMLStandardMode };
</ins><span class="cx"> bool isHTMLDocument { false };
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><span class="cx"> bool cssGridLayoutEnabled { false };
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserValues.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserValues.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSParserValues.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #include "CSSParserValues.h"
</span><span class="cx">
</span><span class="cx"> #include "CSSCustomPropertyValue.h"
</span><ins>+#include "CSSParserIdioms.h"
</ins><span class="cx"> #include "CSSPrimitiveValue.h"
</span><span class="cx"> #include "CSSFunctionValue.h"
</span><span class="cx"> #include "CSSSelector.h"
</span><span class="lines">@@ -219,6 +220,27 @@
</span><span class="cx"> return selector.release();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSParserSelector* CSSParserSelector::parsePseudoElementSelectorFromStringView(StringView& pseudoTypeString)
+{
+ convertToASCIILowercaseInPlace(pseudoTypeString);
+ AtomicString name = pseudoTypeString.toAtomicString();
+
+ CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(name);
+ if (pseudoType == CSSSelector::PseudoElementUnknown)
+ 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();
+}
+
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* parsedSelectorVector)
</span><span class="cx"> {
</span><span class="lines">@@ -308,6 +330,29 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSParserSelector* CSSParserSelector::parsePseudoClassSelectorFromStringView(StringView& pseudoTypeString)
+{
+ if (pseudoTypeString.length() && pseudoTypeString[pseudoTypeString.length() - 1] == '(')
+ return nullptr;
+
+ PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString);
+ if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) {
+ auto selector = std::make_unique<CSSParserSelector>();
+ 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;
+}
+
</ins><span class="cx"> CSSParserSelector::CSSParserSelector()
</span><span class="cx"> : m_selector(std::make_unique<CSSSelector>())
</span><span class="cx"> {
</span><span class="lines">@@ -349,7 +394,12 @@
</span><span class="cx"> argumentList->append(languageArgument);
</span><span class="cx"> m_selector->setLangArgumentList(WTFMove(argumentList));
</span><span class="cx"> }
</span><del>-
</del><ins>+
+void CSSParserSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList)
+{
+ m_selector->setSelectorList(WTFMove(selectorList));
+}
+
</ins><span class="cx"> void CSSParserSelector::setPseudoClassValue(const CSSParserString& pseudoClassString)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_selector->match() == CSSSelector::PseudoClass);
</span><span class="lines">@@ -425,6 +475,15 @@
</span><span class="cx"> case CSSParserSelectorCombinator::IndirectAdjacent:
</span><span class="cx"> selectorRelation = CSSSelector::IndirectAdjacent;
</span><span class="cx"> break;
</span><ins>+ case CSSParserSelectorCombinator::ShadowDeep:
+ selectorRelation = CSSSelector::ShadowDeep;
+ break;
+ case CSSParserSelectorCombinator::ShadowPseudo:
+ selectorRelation = CSSSelector::ShadowPseudo;
+ break;
+ case CSSParserSelectorCombinator::ShadowSlot:
+ selectorRelation = CSSSelector::ShadowSlot;
+ break;
</ins><span class="cx"> }
</span><span class="cx"> end->setRelation(selectorRelation);
</span><span class="cx">
</span><span class="lines">@@ -447,5 +506,17 @@
</span><span class="cx"> m_selector->setRelation(CSSSelector::SubSelector);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory()
+{
+ setRelation(CSSSelector::SubSelector);
+ return WTFMove(m_tagHistory);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME-NEWPARSER: Add support for :host-context
+bool CSSParserSelector::isHostPseudoSelector() const
+{
+ return pseudoClassType() == CSSSelector::PseudoClassHost;
+}
+
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParserValuesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParserValues.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParserValues.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSParserValues.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -193,7 +193,10 @@
</span><span class="cx"> DescendantDoubleChild,
</span><span class="cx"> #endif
</span><span class="cx"> DirectAdjacent,
</span><del>- IndirectAdjacent
</del><ins>+ IndirectAdjacent,
+ ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element
+ ShadowDeep, // /deep/ combinator
+ ShadowSlot // slotted to <slot> e
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class CSSParserSelector {
</span><span class="lines">@@ -206,6 +209,9 @@
</span><span class="cx"> static CSSParserSelector* parsePseudoClassHostFunctionSelector(const CSSParserString& functionIdentifier, CSSParserSelector*);
</span><span class="cx"> static CSSParserSelector* parsePseudoClassAndCompatibilityElementSelector(CSSParserString& pseudoTypeString);
</span><span class="cx">
</span><ins>+ static CSSParserSelector* parsePseudoClassSelectorFromStringView(StringView&);
+ static CSSParserSelector* parsePseudoElementSelectorFromStringView(StringView&);
+
</ins><span class="cx"> CSSParserSelector();
</span><span class="cx"> explicit CSSParserSelector(const QualifiedName&);
</span><span class="cx"> ~CSSParserSelector();
</span><span class="lines">@@ -220,8 +226,13 @@
</span><span class="cx"> void setRelation(CSSSelector::Relation value) { m_selector->setRelation(value); }
</span><span class="cx"> void setForPage() { m_selector->setForPage(); }
</span><span class="cx">
</span><ins>+ CSSSelector::Match match() const { return m_selector->match(); }
+ CSSSelector::PseudoElementType pseudoElementType() const { return m_selector->pseudoElementType(); }
+ const CSSSelectorList* selectorList() const { return m_selector->selectorList(); }
+
</ins><span class="cx"> void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
</span><span class="cx"> void setLangArgumentList(const Vector<CSSParserString>& stringVector);
</span><ins>+ void setSelectorList(std::unique_ptr<CSSSelectorList>);
</ins><span class="cx">
</span><span class="cx"> void setPseudoClassValue(const CSSParserString& pseudoClassString);
</span><span class="cx"> CSSSelector::PseudoClassType pseudoClassType() const { return m_selector->pseudoClassType(); }
</span><span class="lines">@@ -239,6 +250,11 @@
</span><span class="cx"> bool hasShadowDescendant() const;
</span><span class="cx"> bool matchesPseudoElement() const;
</span><span class="cx">
</span><ins>+ bool isHostPseudoSelector() const;
+
+ // FIXME-NEWPARSER: Missing "shadow"
+ bool needsImplicitShadowCombinatorForMatching() const { return pseudoElementType() == CSSSelector::PseudoElementWebKitCustom || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed || pseudoElementType() == CSSSelector::PseudoElementCue || pseudoElementType() == CSSSelector::PseudoElementSlotted; }
+
</ins><span class="cx"> CSSParserSelector* tagHistory() const { return m_tagHistory.get(); }
</span><span class="cx"> void setTagHistory(std::unique_ptr<CSSParserSelector> selector) { m_tagHistory = WTFMove(selector); }
</span><span class="cx"> void clearTagHistory() { m_tagHistory.reset(); }
</span><span class="lines">@@ -246,6 +262,7 @@
</span><span class="cx"> void appendTagHistory(CSSSelector::Relation, std::unique_ptr<CSSParserSelector>);
</span><span class="cx"> void appendTagHistory(CSSParserSelectorCombinator, std::unique_ptr<CSSParserSelector>);
</span><span class="cx"> void prependTagSelector(const QualifiedName&, bool tagIsForNamespaceRule = false);
</span><ins>+ std::unique_ptr<CSSParserSelector> releaseTagHistory();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> #if ENABLE(CSS_SELECTORS_LEVEL4)
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSPropertyParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> bool consumeCSSWideKeyword(CSSPropertyID unresolvedProperty, bool important);
</span><span class="cx"> const CSSValue* parseSingleValue(CSSPropertyID, CSSPropertyID = CSSPropertyInvalid);
</span><span class="cx">
</span><del>- bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }
</del><ins>+ bool inQuirksMode() const { return m_context.mode == HTMLQuirksMode; }
</ins><span class="cx">
</span><span class="cx"> bool parseViewportDescriptor(CSSPropertyID propId, bool important);
</span><span class="cx"> bool parseFontFaceDescriptor(CSSPropertyID);
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSSelectorParsercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (0 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -0,0 +1,771 @@
</span><ins>+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSSelectorParser.h"
+
+#include "CSSParserMode.h"
+#include "CSSSelectorList.h"
+#include "StyleSheetContents.h"
+#include <memory>
+
+namespace WebCore {
+
+CSSSelectorList CSSSelectorParser::parseSelector(CSSParserTokenRange range, const CSSParserContext& context, StyleSheetContents* styleSheet)
+{
+ CSSSelectorParser parser(context, styleSheet);
+ range.consumeWhitespace();
+ CSSSelectorList result = parser.consumeComplexSelectorList(range);
+ if (!range.atEnd())
+ return CSSSelectorList();
+ return result;
+}
+
+CSSSelectorParser::CSSSelectorParser(const CSSParserContext& context, StyleSheetContents* styleSheet)
+ : m_context(context)
+ , m_styleSheet(styleSheet)
+{
+}
+
+CSSSelectorList CSSSelectorParser::consumeComplexSelectorList(CSSParserTokenRange& range)
+{
+ Vector<std::unique_ptr<CSSParserSelector>> selectorList;
+ std::unique_ptr<CSSParserSelector> selector = consumeComplexSelector(range);
+ if (!selector)
+ return CSSSelectorList();
+ selectorList.append(WTFMove(selector));
+ while (!range.atEnd() && range.peek().type() == CommaToken) {
+ range.consumeIncludingWhitespace();
+ selector = consumeComplexSelector(range);
+ if (!selector)
+ return CSSSelectorList();
+ selectorList.append(WTFMove(selector));
+ }
+
+ CSSSelectorList list;
+ if (m_failedParsing)
+ return list;
+ list.adoptSelectorVector(selectorList);
+ return list;
+}
+
+CSSSelectorList CSSSelectorParser::consumeCompoundSelectorList(CSSParserTokenRange& range)
+{
+ Vector<std::unique_ptr<CSSParserSelector>> selectorList;
+ std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range);
+ range.consumeWhitespace();
+ if (!selector)
+ return CSSSelectorList();
+ selectorList.append(WTFMove(selector));
+ while (!range.atEnd() && range.peek().type() == CommaToken) {
+ range.consumeIncludingWhitespace();
+ selector = consumeCompoundSelector(range);
+ range.consumeWhitespace();
+ if (!selector)
+ return CSSSelectorList();
+ selectorList.append(WTFMove(selector));
+ }
+
+ CSSSelectorList list;
+ if (m_failedParsing)
+ return list;
+ list.adoptSelectorVector(selectorList);
+ return list;
+}
+
+namespace {
+
+enum CompoundSelectorFlags {
+ HasPseudoElementForRightmostCompound = 1 << 0,
+ HasContentPseudoElement = 1 << 1
+};
+
+unsigned extractCompoundFlags(const CSSParserSelector& simpleSelector, CSSParserMode parserMode)
+{
+ if (simpleSelector.match() != CSSSelector::PseudoElement)
+ return 0;
+ // FIXME-NEWPARSER: These don't exist for us, so may need to revisit.
+ // if (simpleSelector.pseudoElementType() == CSSSelector::PseudoContent)
+ // return HasContentPseudoElement;
+ // if (simpleSelector.pseudoElementType() == CSSSelector::PseudoShadow)
+ // return 0;
+
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=161747
+ // The UASheetMode check is a work-around to allow this selector in mediaControls(New).css:
+ // input[type="range" i]::-webkit-media-slider-container > div {
+ if (parserMode == UASheetMode && simpleSelector.pseudoElementType() == CSSSelector::PseudoElementWebKitCustom)
+ return 0;
+ return HasPseudoElementForRightmostCompound;
+}
+
+} // namespace
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeComplexSelector(CSSParserTokenRange& range)
+{
+ std::unique_ptr<CSSParserSelector> selector = consumeCompoundSelector(range);
+ if (!selector)
+ return nullptr;
+
+
+ unsigned previousCompoundFlags = 0;
+
+ for (CSSParserSelector* simple = selector.get(); simple && !previousCompoundFlags; simple = simple->tagHistory())
+ previousCompoundFlags |= extractCompoundFlags(*simple, m_context.mode);
+
+ while (CSSSelector::Relation combinator = consumeCombinator(range)) {
+ std::unique_ptr<CSSParserSelector> nextSelector = consumeCompoundSelector(range);
+ if (!nextSelector)
+ return combinator == CSSSelector::Descendant ? WTFMove(selector) : nullptr;
+ if (previousCompoundFlags & HasPseudoElementForRightmostCompound)
+ return nullptr;
+ CSSParserSelector* end = nextSelector.get();
+ unsigned compoundFlags = extractCompoundFlags(*end, m_context.mode);
+ while (end->tagHistory()) {
+ end = end->tagHistory();
+ compoundFlags |= extractCompoundFlags(*end, m_context.mode);
+ }
+ end->setRelation(combinator);
+ // FIXME-NEWPARSER: Shadow stuff that we don't have.
+ // if (previousCompoundFlags & HasContentPseudoElement)
+ // end->setRelationIsAffectedByPseudoContent();
+ previousCompoundFlags = compoundFlags;
+ end->setTagHistory(WTFMove(selector));
+
+ selector = WTFMove(nextSelector);
+ }
+
+ return selector;
+}
+
+namespace {
+
+bool isScrollbarPseudoClass(CSSSelector::PseudoClassType pseudo)
+{
+ switch (pseudo) {
+ case CSSSelector::PseudoClassEnabled:
+ case CSSSelector::PseudoClassDisabled:
+ case CSSSelector::PseudoClassHover:
+ case CSSSelector::PseudoClassActive:
+ case CSSSelector::PseudoClassHorizontal:
+ case CSSSelector::PseudoClassVertical:
+ case CSSSelector::PseudoClassDecrement:
+ case CSSSelector::PseudoClassIncrement:
+ case CSSSelector::PseudoClassStart:
+ case CSSSelector::PseudoClassEnd:
+ case CSSSelector::PseudoClassDoubleButton:
+ case CSSSelector::PseudoClassSingleButton:
+ case CSSSelector::PseudoClassNoButton:
+ case CSSSelector::PseudoClassCornerPresent:
+ case CSSSelector::PseudoClassWindowInactive:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool isUserActionPseudoClass(CSSSelector::PseudoClassType pseudo)
+{
+ switch (pseudo) {
+ case CSSSelector::PseudoClassHover:
+ case CSSSelector::PseudoClassFocus:
+ case CSSSelector::PseudoClassActive:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool isPseudoClassValidAfterPseudoElement(CSSSelector::PseudoClassType pseudoClass, CSSSelector::PseudoElementType compoundPseudoElement)
+{
+ switch (compoundPseudoElement) {
+ case CSSSelector::PseudoElementResizer:
+ case CSSSelector::PseudoElementScrollbar:
+ case CSSSelector::PseudoElementScrollbarCorner:
+ case CSSSelector::PseudoElementScrollbarButton:
+ case CSSSelector::PseudoElementScrollbarThumb:
+ case CSSSelector::PseudoElementScrollbarTrack:
+ case CSSSelector::PseudoElementScrollbarTrackPiece:
+ return isScrollbarPseudoClass(pseudoClass);
+ case CSSSelector::PseudoElementSelection:
+ return pseudoClass == CSSSelector::PseudoClassWindowInactive;
+ case CSSSelector::PseudoElementWebKitCustom:
+ case CSSSelector::PseudoElementWebKitCustomLegacyPrefixed:
+ return isUserActionPseudoClass(pseudoClass);
+ default:
+ return false;
+ }
+}
+
+bool isSimpleSelectorValidAfterPseudoElement(const CSSParserSelector& simpleSelector, CSSSelector::PseudoElementType compoundPseudoElement)
+{
+ if (compoundPseudoElement == CSSSelector::PseudoElementUnknown)
+ return true;
+ // FIXME-NEWPARSER: This doesn't exist for us.
+ // if (compoundPseudoElement == CSSSelector::PseudoElementContent)
+ // return simpleSelector.match() != CSSSelector::PseudoElement;
+ if (simpleSelector.match() != CSSSelector::PseudoClass)
+ return false;
+ CSSSelector::PseudoClassType pseudo = simpleSelector.pseudoClassType();
+ if (pseudo == CSSSelector::PseudoClassNot) {
+ ASSERT(simpleSelector.selectorList());
+ ASSERT(simpleSelector.selectorList()->first());
+ ASSERT(!simpleSelector.selectorList()->first()->tagHistory());
+ pseudo = simpleSelector.selectorList()->first()->pseudoClassType();
+ }
+ return isPseudoClassValidAfterPseudoElement(pseudo, compoundPseudoElement);
+}
+
+} // namespace
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range)
+{
+ std::unique_ptr<CSSParserSelector> compoundSelector;
+
+ AtomicString namespacePrefix;
+ AtomicString elementName;
+ CSSSelector::PseudoElementType compoundPseudoElement = CSSSelector::PseudoElementUnknown;
+ if (!consumeName(range, elementName, namespacePrefix)) {
+ compoundSelector = consumeSimpleSelector(range);
+ if (!compoundSelector)
+ return nullptr;
+ if (compoundSelector->match() == CSSSelector::PseudoElement)
+ compoundPseudoElement = compoundSelector->pseudoElementType();
+ }
+ if (m_context.isHTMLDocument)
+ elementName = elementName.convertToASCIILowercase();
+
+ while (std::unique_ptr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) {
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=161747
+ // The UASheetMode check is a work-around to allow this selector in mediaControls(New).css:
+ // video::-webkit-media-text-track-region-container.scrolling
+ if (m_context.mode != UASheetMode && !isSimpleSelectorValidAfterPseudoElement(*simpleSelector.get(), compoundPseudoElement)) {
+ m_failedParsing = true;
+ return nullptr;
+ }
+ if (simpleSelector->match() == CSSSelector::PseudoElement)
+ compoundPseudoElement = simpleSelector->pseudoElementType();
+
+ if (compoundSelector)
+ compoundSelector = addSimpleSelectorToCompound(WTFMove(compoundSelector), WTFMove(simpleSelector));
+ else
+ compoundSelector = WTFMove(simpleSelector);
+ }
+
+ if (!compoundSelector) {
+ AtomicString namespaceURI = determineNamespace(namespacePrefix);
+ if (namespaceURI.isNull()) {
+ m_failedParsing = true;
+ return nullptr;
+ }
+ if (namespaceURI == defaultNamespace())
+ namespacePrefix = nullAtom;
+
+ CSSParserSelector* rawSelector = new CSSParserSelector(QualifiedName(namespacePrefix, elementName, namespaceURI));
+ std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(rawSelector);
+ return selector;
+ }
+ prependTypeSelectorIfNeeded(namespacePrefix, elementName, compoundSelector.get());
+ return splitCompoundAtImplicitShadowCrossingCombinator(WTFMove(compoundSelector));
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeSimpleSelector(CSSParserTokenRange& range)
+{
+ const CSSParserToken& token = range.peek();
+ std::unique_ptr<CSSParserSelector> selector;
+ if (token.type() == HashToken)
+ selector = consumeId(range);
+ else if (token.type() == DelimiterToken && token.delimiter() == '.')
+ selector = consumeClass(range);
+ else if (token.type() == LeftBracketToken)
+ selector = consumeAttribute(range);
+ else if (token.type() == ColonToken)
+ selector = consumePseudo(range);
+ else
+ return nullptr;
+ if (!selector)
+ m_failedParsing = true;
+ return selector;
+}
+
+bool CSSSelectorParser::consumeName(CSSParserTokenRange& range, AtomicString& name, AtomicString& namespacePrefix)
+{
+ name = nullAtom;
+ namespacePrefix = nullAtom;
+
+ const CSSParserToken& firstToken = range.peek();
+ if (firstToken.type() == IdentToken) {
+ name = firstToken.value().toAtomicString();
+ range.consume();
+ } else if (firstToken.type() == DelimiterToken && firstToken.delimiter() == '*') {
+ name = starAtom;
+ range.consume();
+ } else if (firstToken.type() == DelimiterToken && firstToken.delimiter() == '|') {
+ // This is an empty namespace, which'll get assigned this value below
+ name = emptyAtom;
+ } else
+ return false;
+
+ if (range.peek().type() != DelimiterToken || range.peek().delimiter() != '|')
+ return true;
+ range.consume();
+
+ namespacePrefix = name;
+ const CSSParserToken& nameToken = range.consume();
+ if (nameToken.type() == IdentToken) {
+ name = nameToken.value().toAtomicString();
+ } else if (nameToken.type() == DelimiterToken && nameToken.delimiter() == '*')
+ name = starAtom;
+ else {
+ name = nullAtom;
+ namespacePrefix = nullAtom;
+ return false;
+ }
+
+ return true;
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeId(CSSParserTokenRange& range)
+{
+ ASSERT(range.peek().type() == HashToken);
+ if (range.peek().getHashTokenType() != HashTokenId)
+ return nullptr;
+ std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
+ selector->setMatch(CSSSelector::Id);
+ AtomicString value = range.consume().value().toAtomicString();
+ selector->setValue(value);
+ return selector;
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeClass(CSSParserTokenRange& range)
+{
+ ASSERT(range.peek().type() == DelimiterToken);
+ ASSERT(range.peek().delimiter() == '.');
+ range.consume();
+ if (range.peek().type() != IdentToken)
+ return nullptr;
+ std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
+ selector->setMatch(CSSSelector::Class);
+ AtomicString value = range.consume().value().toAtomicString();
+ selector->setValue(value);
+ return selector;
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeAttribute(CSSParserTokenRange& range)
+{
+ ASSERT(range.peek().type() == LeftBracketToken);
+ CSSParserTokenRange block = range.consumeBlock();
+ block.consumeWhitespace();
+
+ AtomicString namespacePrefix;
+ AtomicString attributeName;
+ if (!consumeName(block, attributeName, namespacePrefix))
+ return nullptr;
+ block.consumeWhitespace();
+
+ if (m_context.isHTMLDocument)
+ attributeName = attributeName.convertToASCIILowercase();
+
+ AtomicString namespaceURI = determineNamespace(namespacePrefix);
+ if (namespaceURI.isNull())
+ return nullptr;
+
+ QualifiedName qualifiedName = namespacePrefix.isNull()
+ ? QualifiedName(nullAtom, attributeName, nullAtom)
+ : QualifiedName(namespacePrefix, attributeName, namespaceURI);
+
+ std::unique_ptr<CSSParserSelector> selector = std::unique_ptr<CSSParserSelector>(new CSSParserSelector());
+
+ if (block.atEnd()) {
+ selector->setAttribute(qualifiedName, CSSSelector::CaseSensitive);
+ selector->setMatch(CSSSelector::Set);
+ return selector;
+ }
+
+ selector->setMatch(consumeAttributeMatch(block));
+
+ const CSSParserToken& attributeValue = block.consumeIncludingWhitespace();
+ if (attributeValue.type() != IdentToken && attributeValue.type() != StringToken)
+ return nullptr;
+ selector->setValue(attributeValue.value().toAtomicString());
+ selector->setAttribute(qualifiedName, consumeAttributeFlags(block));
+
+ if (!block.atEnd())
+ return nullptr;
+ return selector;
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumePseudo(CSSParserTokenRange& range)
+{
+ ASSERT(range.peek().type() == ColonToken);
+ range.consume();
+
+ int colons = 1;
+ if (range.peek().type() == ColonToken) {
+ range.consume();
+ colons++;
+ }
+
+ const CSSParserToken& token = range.peek();
+ if (token.type() != IdentToken && token.type() != FunctionToken)
+ return nullptr;
+
+ std::unique_ptr<CSSParserSelector> selector;
+ StringView value = token.value();
+ if (selector->match() == CSSSelector::PseudoClass)
+ selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoClassSelectorFromStringView(value));
+ else
+ selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoElementSelectorFromStringView(value));
+
+ if (!selector || (selector->match() == CSSSelector::PseudoElement && m_disallowPseudoElements))
+ return nullptr;
+
+ if (token.type() == IdentToken) {
+ range.consume();
+ if (selector->pseudoElementType() == CSSSelector::PseudoElementUnknown)
+ return nullptr;
+ return selector;
+ }
+
+ CSSParserTokenRange block = range.consumeBlock();
+ block.consumeWhitespace();
+ if (token.type() != FunctionToken)
+ return nullptr;
+
+ switch (selector->pseudoClassType()) {
+ case CSSSelector::PseudoClassNot: {
+ std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
+ block.consumeWhitespace();
+ if (!innerSelector || !block.atEnd())
+ return nullptr;
+ Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
+ selectorVector.append(WTFMove(innerSelector));
+ selector->adoptSelectorVector(selectorVector);
+ return selector;
+ }
+ case CSSSelector::PseudoClassNthChild:
+ case CSSSelector::PseudoClassNthLastChild:
+ case CSSSelector::PseudoClassNthOfType:
+ case CSSSelector::PseudoClassNthLastOfType: {
+ std::pair<int, int> ab;
+ if (!consumeANPlusB(block, ab))
+ return nullptr;
+ block.consumeWhitespace();
+ if (!block.atEnd())
+ return nullptr;
+ selector->setArgument(AtomicString::number(ab.first * ab.second));
+ return selector;
+ }
+ case CSSSelector::PseudoClassLang: {
+ // FIXME: CSS Selectors Level 4 allows :lang(*-foo)
+ const CSSParserToken& ident = block.consumeIncludingWhitespace();
+ if (ident.type() != IdentToken || !block.atEnd())
+ return nullptr;
+ selector->setArgument(ident.value().toAtomicString());
+ return selector;
+ }
+ // FIXME-NEWPARSER: Support :host-context
+ case CSSSelector::PseudoClassAny:
+ case CSSSelector::PseudoClassHost: {
+ DisallowPseudoElementsScope scope(this);
+ std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
+ *selectorList = consumeCompoundSelectorList(block);
+ if (!selectorList->isValid() || !block.atEnd())
+ return nullptr;
+ selector->setSelectorList(WTFMove(selectorList));
+ return selector;
+ }
+ default:
+ break;
+ }
+
+ switch (selector->pseudoElementType()) {
+ case CSSSelector::PseudoElementCue: {
+ DisallowPseudoElementsScope scope(this);
+ std::unique_ptr<CSSSelectorList> selectorList = std::unique_ptr<CSSSelectorList>(new CSSSelectorList());
+ *selectorList = consumeCompoundSelectorList(block);
+ if (!selectorList->isValid() || !block.atEnd())
+ return nullptr;
+ selector->setSelectorList(WTFMove(selectorList));
+ return selector;
+ }
+ case CSSSelector::PseudoElementSlotted: {
+ DisallowPseudoElementsScope scope(this);
+
+ std::unique_ptr<CSSParserSelector> innerSelector = consumeCompoundSelector(block);
+ block.consumeWhitespace();
+ if (!innerSelector || !block.atEnd())
+ return nullptr;
+ Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
+ selectorVector.append(WTFMove(innerSelector));
+ selector->adoptSelectorVector(selectorVector);
+ return selector;
+ }
+ default:
+ break;
+ }
+
+ return nullptr;
+}
+
+CSSSelector::Relation CSSSelectorParser::consumeCombinator(CSSParserTokenRange& range)
+{
+ CSSSelector::Relation fallbackResult = CSSSelector::SubSelector;
+ while (range.peek().type() == WhitespaceToken) {
+ range.consume();
+ fallbackResult = CSSSelector::Descendant;
+ }
+
+ if (range.peek().type() != DelimiterToken)
+ return fallbackResult;
+
+ UChar delimiter = range.peek().delimiter();
+
+ if (delimiter == '+' || delimiter == '~' || delimiter == '>') {
+ range.consumeIncludingWhitespace();
+ if (delimiter == '+')
+ return CSSSelector::DirectAdjacent;
+ if (delimiter == '~')
+ return CSSSelector::IndirectAdjacent;
+ return CSSSelector::Child;
+ }
+
+ // Match /deep/
+ if (delimiter != '/')
+ return fallbackResult;
+ range.consume();
+ const CSSParserToken& ident = range.consume();
+ if (ident.type() != IdentToken || !equalIgnoringASCIICase(ident.value(), "deep"))
+ m_failedParsing = true;
+ const CSSParserToken& slash = range.consumeIncludingWhitespace();
+ if (slash.type() != DelimiterToken || slash.delimiter() != '/')
+ m_failedParsing = true;
+ return CSSSelector::ShadowDeep;
+}
+
+CSSSelector::Match CSSSelectorParser::consumeAttributeMatch(CSSParserTokenRange& range)
+{
+ const CSSParserToken& token = range.consumeIncludingWhitespace();
+ switch (token.type()) {
+ case IncludeMatchToken:
+ return CSSSelector::List;
+ case DashMatchToken:
+ return CSSSelector::Hyphen;
+ case PrefixMatchToken:
+ return CSSSelector::Begin;
+ case SuffixMatchToken:
+ return CSSSelector::End;
+ case SubstringMatchToken:
+ return CSSSelector::Contain;
+ case DelimiterToken:
+ if (token.delimiter() == '=')
+ return CSSSelector::Exact;
+ FALLTHROUGH;
+ default:
+ m_failedParsing = true;
+ return CSSSelector::Exact;
+ }
+}
+
+CSSSelector::AttributeMatchType CSSSelectorParser::consumeAttributeFlags(CSSParserTokenRange& range)
+{
+ if (range.peek().type() != IdentToken)
+ return CSSSelector::CaseSensitive;
+ const CSSParserToken& flag = range.consumeIncludingWhitespace();
+ if (equalIgnoringASCIICase(flag.value(), "i"))
+ return CSSSelector::CaseInsensitive;
+ m_failedParsing = true;
+ return CSSSelector::CaseSensitive;
+}
+
+bool CSSSelectorParser::consumeANPlusB(CSSParserTokenRange& range, std::pair<int, int>& result)
+{
+ const CSSParserToken& token = range.consume();
+ if (token.type() == NumberToken && token.numericValueType() == IntegerValueType) {
+ result = std::make_pair(0, static_cast<int>(token.numericValue()));
+ return true;
+ }
+ if (token.type() == IdentToken) {
+ if (equalIgnoringASCIICase(token.value(), "odd")) {
+ result = std::make_pair(2, 1);
+ return true;
+ }
+ if (equalIgnoringASCIICase(token.value(), "even")) {
+ result = std::make_pair(2, 0);
+ return true;
+ }
+ }
+
+ // The 'n' will end up as part of an ident or dimension. For a valid <an+b>,
+ // this will store a string of the form 'n', 'n-', or 'n-123'.
+ String nString;
+
+ if (token.type() == DelimiterToken && token.delimiter() == '+' && range.peek().type() == IdentToken) {
+ result.first = 1;
+ nString = range.consume().value().toString();
+ } else if (token.type() == DimensionToken && token.numericValueType() == IntegerValueType) {
+ result.first = token.numericValue();
+ nString = token.value().toString();
+ } else if (token.type() == IdentToken) {
+ if (token.value()[0] == '-') {
+ result.first = -1;
+ nString = token.value().toString().substring(1);
+ } else {
+ result.first = 1;
+ nString = token.value().toString();
+ }
+ }
+
+ range.consumeWhitespace();
+
+ if (nString.isEmpty() || !isASCIIAlphaCaselessEqual(nString[0], 'n'))
+ return false;
+ if (nString.length() > 1 && nString[1] != '-')
+ return false;
+
+ if (nString.length() > 2) {
+ bool valid;
+ result.second = nString.substring(1).toIntStrict(&valid);
+ return valid;
+ }
+
+ NumericSign sign = nString.length() == 1 ? NoSign : MinusSign;
+ if (sign == NoSign && range.peek().type() == DelimiterToken) {
+ char delimiterSign = range.consumeIncludingWhitespace().delimiter();
+ if (delimiterSign == '+')
+ sign = PlusSign;
+ else if (delimiterSign == '-')
+ sign = MinusSign;
+ else
+ return false;
+ }
+
+ if (sign == NoSign && range.peek().type() != NumberToken) {
+ result.second = 0;
+ return true;
+ }
+
+ const CSSParserToken& b = range.consume();
+ if (b.type() != NumberToken || b.numericValueType() != IntegerValueType)
+ return false;
+ if ((b.numericSign() == NoSign) == (sign == NoSign))
+ return false;
+ result.second = b.numericValue();
+ if (sign == MinusSign)
+ result.second = -result.second;
+ return true;
+}
+
+const AtomicString& CSSSelectorParser::defaultNamespace() const
+{
+ if (!m_styleSheet)
+ return starAtom;
+ return m_styleSheet->defaultNamespace();
+}
+
+const AtomicString& CSSSelectorParser::determineNamespace(const AtomicString& prefix)
+{
+ if (prefix.isNull())
+ return defaultNamespace();
+ if (prefix.isEmpty())
+ return emptyAtom; // No namespace. If an element/attribute has a namespace, we won't match it.
+ if (prefix == starAtom)
+ return starAtom; // We'll match any namespace.
+ if (!m_styleSheet)
+ return nullAtom; // Cannot resolve prefix to namespace without a stylesheet, syntax error.
+ return m_styleSheet->namespaceURIFromPrefix(prefix);
+}
+
+void CSSSelectorParser::prependTypeSelectorIfNeeded(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector* compoundSelector)
+{
+ if (elementName.isNull() && defaultNamespace() == starAtom && !compoundSelector->needsImplicitShadowCombinatorForMatching())
+ return;
+
+ AtomicString determinedElementName = elementName.isNull() ? starAtom : elementName;
+ AtomicString namespaceURI = determineNamespace(namespacePrefix);
+ if (namespaceURI.isNull()) {
+ m_failedParsing = true;
+ return;
+ }
+ AtomicString determinedPrefix = namespacePrefix;
+ if (namespaceURI == defaultNamespace())
+ determinedPrefix = nullAtom;
+ QualifiedName tag = QualifiedName(determinedPrefix, determinedElementName, namespaceURI);
+
+ // *:host/*:host-context never matches, so we can't discard the *,
+ // otherwise we can't tell the difference between *:host and just :host.
+ //
+ // Also, selectors where we use a ShadowPseudo combinator between the
+ // element and the pseudo element for matching (custom pseudo elements,
+ // ::cue, ::shadow), we need a universal selector to set the combinator
+ // (relation) on in the cases where there are no simple selectors preceding
+ // the pseudo element.
+ bool explicitForHost = compoundSelector->isHostPseudoSelector() && !elementName.isNull();
+ if (tag != anyQName() || explicitForHost || compoundSelector->needsImplicitShadowCombinatorForMatching())
+ compoundSelector->prependTagSelector(tag, determinedPrefix == nullAtom && determinedElementName == starAtom && !explicitForHost);
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector)
+{
+ compoundSelector->appendTagHistory(CSSSelector::SubSelector, WTFMove(simpleSelector));
+ return compoundSelector;
+}
+
+std::unique_ptr<CSSParserSelector> CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector)
+{
+ // The tagHistory is a linked list that stores combinator separated compound selectors
+ // from right-to-left. Yet, within a single compound selector, stores the simple selectors
+ // from left-to-right.
+ //
+ // ".a.b > div#id" is stored in a tagHistory as [div, #id, .a, .b], each element in the
+ // list stored with an associated relation (combinator or SubSelector).
+ //
+ // ::cue, ::shadow, and custom pseudo elements have an implicit ShadowPseudo combinator
+ // to their left, which really makes for a new compound selector, yet it's consumed by
+ // the selector parser as a single compound selector.
+ //
+ // Example: input#x::-webkit-clear-button -> [ ::-webkit-clear-button, input, #x ]
+ //
+ // Likewise, ::slotted() pseudo element has an implicit ShadowSlot combinator to its left
+ // for finding matching slot element in other TreeScope.
+ //
+ // Example: slot[name=foo]::slotted(div) -> [ ::slotted(div), slot, [name=foo] ]
+ CSSParserSelector* splitAfter = compoundSelector.get();
+
+ while (splitAfter->tagHistory() && !splitAfter->tagHistory()->needsImplicitShadowCombinatorForMatching())
+ splitAfter = splitAfter->tagHistory();
+
+ if (!splitAfter || !splitAfter->tagHistory())
+ return compoundSelector;
+
+ std::unique_ptr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory();
+ secondCompound->appendTagHistory(secondCompound->pseudoElementType() == CSSSelector::PseudoElementSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, WTFMove(compoundSelector));
+ return secondCompound;
+}
+
+} // namespace blink
</ins></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSSelectorParserh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/css/parser/CSSSelectorParser.h (0 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSSelectorParser.h         (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.h        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSParserTokenRange.h"
+#include "CSSParserValues.h" // FIXME-NEWPARSER Change when CSSParserSelector moves into its own file.
+#include <memory>
+
+namespace WebCore {
+
+struct CSSParserContext;
+class CSSSelectorList;
+class StyleSheetContents;
+
+// FIXME: We should consider building CSSSelectors directly instead of using
+// the intermediate CSSParserSelector.
+class CSSSelectorParser {
+public:
+ static CSSSelectorList parseSelector(CSSParserTokenRange, const CSSParserContext&, StyleSheetContents*);
+
+ static bool consumeANPlusB(CSSParserTokenRange&, std::pair<int, int>&);
+
+private:
+ CSSSelectorParser(const CSSParserContext&, StyleSheetContents*);
+
+ // These will all consume trailing comments if successful
+
+ CSSSelectorList consumeComplexSelectorList(CSSParserTokenRange&);
+ CSSSelectorList consumeCompoundSelectorList(CSSParserTokenRange&);
+
+ std::unique_ptr<CSSParserSelector> consumeComplexSelector(CSSParserTokenRange&);
+ std::unique_ptr<CSSParserSelector> consumeCompoundSelector(CSSParserTokenRange&);
+ // This doesn't include element names, since they're handled specially
+ std::unique_ptr<CSSParserSelector> consumeSimpleSelector(CSSParserTokenRange&);
+
+ bool consumeName(CSSParserTokenRange&, AtomicString& name, AtomicString& namespacePrefix);
+
+ // These will return nullptr when the selector is invalid
+ std::unique_ptr<CSSParserSelector> consumeId(CSSParserTokenRange&);
+ std::unique_ptr<CSSParserSelector> consumeClass(CSSParserTokenRange&);
+ std::unique_ptr<CSSParserSelector> consumePseudo(CSSParserTokenRange&);
+ std::unique_ptr<CSSParserSelector> consumeAttribute(CSSParserTokenRange&);
+
+ CSSSelector::Relation consumeCombinator(CSSParserTokenRange&);
+ CSSSelector::Match consumeAttributeMatch(CSSParserTokenRange&);
+ CSSSelector::AttributeMatchType consumeAttributeFlags(CSSParserTokenRange&);
+
+ const AtomicString& defaultNamespace() const;
+ const AtomicString& determineNamespace(const AtomicString& prefix);
+ void prependTypeSelectorIfNeeded(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*);
+ static std::unique_ptr<CSSParserSelector> addSimpleSelectorToCompound(std::unique_ptr<CSSParserSelector> compoundSelector, std::unique_ptr<CSSParserSelector> simpleSelector);
+ static std::unique_ptr<CSSParserSelector> splitCompoundAtImplicitShadowCrossingCombinator(std::unique_ptr<CSSParserSelector> compoundSelector);
+
+ const CSSParserContext& m_context;
+ RefPtr<StyleSheetContents> m_styleSheet; // FIXME: Should be const
+
+ bool m_failedParsing = false;
+ bool m_disallowPseudoElements = false;
+
+ class DisallowPseudoElementsScope {
+ WTF_MAKE_NONCOPYABLE(DisallowPseudoElementsScope);
+ public:
+ DisallowPseudoElementsScope(CSSSelectorParser* parser)
+ : m_parser(parser), m_wasDisallowed(m_parser->m_disallowPseudoElements)
+ {
+ m_parser->m_disallowPseudoElements = true;
+ }
+
+ ~DisallowPseudoElementsScope()
+ {
+ m_parser->m_disallowPseudoElements = m_wasDisallowed;
+ }
+
+ private:
+ CSSSelectorParser* m_parser;
+ bool m_wasDisallowed;
+ };
+};
+
+} // namespace WebCore
+
</ins></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -411,6 +411,9 @@
</span><span class="cx"> return FragmentRelation::IndirectAdjacent;
</span><span class="cx"> case CSSSelector::SubSelector:
</span><span class="cx"> case CSSSelector::ShadowDescendant:
</span><ins>+ case CSSSelector::ShadowPseudo:
+ case CSSSelector::ShadowDeep:
+ case CSSSelector::ShadowSlot:
</ins><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/dom/StyledElement.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -331,7 +331,7 @@
</span><span class="cx"> style = cacheIterator->value->value;
</span><span class="cx"> presentationAttributeCacheCleaner().didHitPresentationAttributeCache();
</span><span class="cx"> } else {
</span><del>- style = MutableStyleProperties::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode);
</del><ins>+ style = MutableStyleProperties::create(isSVGElement() ? SVGAttributeMode : HTMLQuirksMode);
</ins><span class="cx"> for (const Attribute& attribute : attributesIterator())
</span><span class="cx"> collectStyleForPresentationAttribute(attribute.name(), attribute.value(), static_cast<MutableStyleProperties&>(*style));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFontFaceElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.cpp (205659 => 205660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2016-09-08 20:54:24 UTC (rev 205659)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.cpp        2016-09-08 21:09:04 UTC (rev 205660)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">
</span><span class="cx"> inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document& document)
</span><span class="cx"> : SVGElement(tagName, document)
</span><del>- , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(CSSStrictMode)))
</del><ins>+ , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(HTMLStandardMode)))
</ins><span class="cx"> , m_fontElement(nullptr)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(hasTagName(font_faceTag));
</span></span></pre>
</div>
</div>
</body>
</html>