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

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

Issue 1650473002: Setting selectorText of PageRule accepts invalid selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments Created 4 years, 11 months 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/CSSParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
index 85f65f96bbb96e5520c57eb9eccf4203051cb285..2c92c9655cfced9be696aeeb8beb8fe40ea68f1c 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParser.cpp
@@ -37,6 +37,16 @@ CSSSelectorList CSSParser::parseSelector(const CSSParserContext& context, StyleS
return CSSSelectorParser::parseSelector(scope.tokenRange(), context, styleSheetContents);
}
+CSSSelectorList CSSParser::parsePageSelector(const CSSParserContext& context, StyleSheetContents* styleSheetContents, const String& selector)
+{
+ CSSTokenizer::Scope scope(selector);
+ CSSParserTokenRange range = scope.tokenRange();
+ const CSSParserToken* preludeStart = &range.peek();
+ while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek().type() != SemicolonToken)
Timothy Loh 2016/02/01 21:55:15 Seems wrong, if you specify ":left { bla" as a pag
ramya.v 2016/02/02 05:43:24 In the existing implementation ":left { bla" is pa
Timothy Loh 2016/02/02 05:49:12 Yes, but this function only concerns itself with p
ramya.v 2016/02/02 06:40:17 Got your point. Thanks :) Done in https://coderev
+ range.consumeComponentValue();
+ return CSSParserImpl::parsePageSelector(range.makeSubRange(preludeStart, &range.peek()), styleSheetContents);
+}
+
PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& rule)
{
return CSSParserImpl::parseRule(rule, context, styleSheet, CSSParserImpl::AllowImportRules);

Powered by Google App Engine
This is Rietveld 408576698