Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp

Issue 2500813003: Parser support for >>> (shadow-piercing descendant) combinator. (Closed)
Patch Set: Address timloh's comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
index 6b8666c9a652d7051fa2fcda9017de5d41d25fbe..4d12e5759fc253124c19cf35e982edffc3d22c86 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp
@@ -606,13 +606,32 @@ CSSSelector::RelationType CSSSelectorParser::consumeCombinator(
UChar delimiter = range.peek().delimiter();
- if (delimiter == '+' || delimiter == '~' || delimiter == '>') {
+ if (delimiter == '+' || delimiter == '~') {
range.consumeIncludingWhitespace();
if (delimiter == '+')
return CSSSelector::DirectAdjacent;
- if (delimiter == '~')
- return CSSSelector::IndirectAdjacent;
- return CSSSelector::Child;
+ return CSSSelector::IndirectAdjacent;
+ }
+
+ if (delimiter == '>') {
+ if (!RuntimeEnabledFeatures::shadowPiercingDescendantCombinatorEnabled() ||
+ m_context.isDynamicProfile() ||
+ range.peek(1).type() != DelimiterToken ||
+ range.peek(1).delimiter() != '>') {
+ range.consumeIncludingWhitespace();
+ return CSSSelector::Child;
+ }
+ range.consume();
+
+ // Check the 3rd '>'.
+ if (range.peek(1).type() != DelimiterToken ||
+ range.peek(1).delimiter() != '>') {
+ // TODO: Treat '>>' as a CSSSelector::Descendant here.
+ return CSSSelector::Child;
+ }
+ range.consume();
+ range.consumeIncludingWhitespace();
+ return CSSSelector::ShadowPiercingDescendant;
}
// Match /deep/

Powered by Google App Engine
This is Rietveld 408576698