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

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

Issue 1661453002: Setting page selector text should not allow brace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSParser.h" 5 #include "core/css/parser/CSSParser.h"
6 6
7 #include "core/css/CSSColorValue.h" 7 #include "core/css/CSSColorValue.h"
8 #include "core/css/CSSKeyframeRule.h" 8 #include "core/css/CSSKeyframeRule.h"
9 #include "core/css/StyleColor.h" 9 #include "core/css/StyleColor.h"
10 #include "core/css/StylePropertySet.h" 10 #include "core/css/StylePropertySet.h"
(...skipping 22 matching lines...) Expand all
33 33
34 CSSSelectorList CSSParser::parseSelector(const CSSParserContext& context, StyleS heetContents* styleSheetContents, const String& selector) 34 CSSSelectorList CSSParser::parseSelector(const CSSParserContext& context, StyleS heetContents* styleSheetContents, const String& selector)
35 { 35 {
36 CSSTokenizer::Scope scope(selector); 36 CSSTokenizer::Scope scope(selector);
37 return CSSSelectorParser::parseSelector(scope.tokenRange(), context, styleSh eetContents); 37 return CSSSelectorParser::parseSelector(scope.tokenRange(), context, styleSh eetContents);
38 } 38 }
39 39
40 CSSSelectorList CSSParser::parsePageSelector(const CSSParserContext& context, St yleSheetContents* styleSheetContents, const String& selector) 40 CSSSelectorList CSSParser::parsePageSelector(const CSSParserContext& context, St yleSheetContents* styleSheetContents, const String& selector)
41 { 41 {
42 CSSTokenizer::Scope scope(selector); 42 CSSTokenizer::Scope scope(selector);
43 CSSParserTokenRange range = scope.tokenRange(); 43 return CSSParserImpl::parsePageSelector(scope.tokenRange(), styleSheetConten ts);
44 const CSSParserToken* preludeStart = &range.peek();
45 while (!range.atEnd() && range.peek().type() != LeftBraceToken && range.peek ().type() != SemicolonToken)
46 range.consumeComponentValue();
47 return CSSParserImpl::parsePageSelector(range.makeSubRange(preludeStart, &ra nge.peek()), styleSheetContents);
48 } 44 }
49 45
50 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule) 46 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex t& context, StyleSheetContents* styleSheet, const String& rule)
51 { 47 {
52 return CSSParserImpl::parseRule(rule, context, styleSheet, CSSParserImpl::Al lowImportRules); 48 return CSSParserImpl::parseRule(rule, context, styleSheet, CSSParserImpl::Al lowImportRules);
53 } 49 }
54 50
55 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text) 51 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents* styleSheet, const String& text)
56 { 52 {
57 return CSSParserImpl::parseStyleSheet(text, context, styleSheet); 53 return CSSParserImpl::parseStyleSheet(text, context, styleSheet);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 builder.appendLiteral(" : "); 173 builder.appendLiteral(" : ");
178 builder.append(propertyValue); 174 builder.append(propertyValue);
179 builder.appendLiteral("; }"); 175 builder.appendLiteral("; }");
180 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString()); 176 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder .toString());
181 if (!rule || !rule->isFontFaceRule()) 177 if (!rule || !rule->isFontFaceRule())
182 return nullptr; 178 return nullptr;
183 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID); 179 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro pertyID);
184 } 180 }
185 181
186 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698