OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |