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 <memory> |
7 #include "core/css/CSSColorValue.h" | 8 #include "core/css/CSSColorValue.h" |
8 #include "core/css/CSSKeyframeRule.h" | 9 #include "core/css/CSSKeyframeRule.h" |
9 #include "core/css/StyleColor.h" | 10 #include "core/css/StyleColor.h" |
10 #include "core/css/StyleRule.h" | 11 #include "core/css/StyleRule.h" |
11 #include "core/css/StyleSheetContents.h" | 12 #include "core/css/StyleSheetContents.h" |
12 #include "core/css/parser/CSSParserFastPaths.h" | 13 #include "core/css/parser/CSSParserFastPaths.h" |
13 #include "core/css/parser/CSSParserImpl.h" | 14 #include "core/css/parser/CSSParserImpl.h" |
14 #include "core/css/parser/CSSPropertyParser.h" | 15 #include "core/css/parser/CSSPropertyParser.h" |
15 #include "core/css/parser/CSSSelectorParser.h" | 16 #include "core/css/parser/CSSSelectorParser.h" |
16 #include "core/css/parser/CSSSupportsParser.h" | 17 #include "core/css/parser/CSSSupportsParser.h" |
17 #include "core/css/parser/CSSTokenizer.h" | 18 #include "core/css/parser/CSSTokenizer.h" |
18 #include "core/css/parser/CSSVariableParser.h" | 19 #include "core/css/parser/CSSVariableParser.h" |
19 #include "core/layout/LayoutTheme.h" | 20 #include "core/layout/LayoutTheme.h" |
20 #include <memory> | |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 using namespace cssvalue; | 24 using namespace cssvalue; |
25 | 25 |
26 bool CSSParser::ParseDeclarationList(const CSSParserContext* context, | 26 bool CSSParser::ParseDeclarationList(const CSSParserContext* context, |
27 MutableStylePropertySet* property_set, | 27 MutableStylePropertySet* property_set, |
28 const String& declaration) { | 28 const String& declaration) { |
29 return CSSParserImpl::ParseDeclarationList(property_set, declaration, | 29 return CSSParserImpl::ParseDeclarationList(property_set, declaration, |
30 context); | 30 context); |
(...skipping 10 matching lines...) Expand all Loading... |
41 CSSSelectorList CSSParser::ParseSelector( | 41 CSSSelectorList CSSParser::ParseSelector( |
42 const CSSParserContext* context, | 42 const CSSParserContext* context, |
43 StyleSheetContents* style_sheet_contents, | 43 StyleSheetContents* style_sheet_contents, |
44 const String& selector) { | 44 const String& selector) { |
45 CSSTokenizer tokenizer(selector); | 45 CSSTokenizer tokenizer(selector); |
46 return CSSSelectorParser::ParseSelector(tokenizer.TokenRange(), context, | 46 return CSSSelectorParser::ParseSelector(tokenizer.TokenRange(), context, |
47 style_sheet_contents); | 47 style_sheet_contents); |
48 } | 48 } |
49 | 49 |
50 CSSSelectorList CSSParser::ParsePageSelector( | 50 CSSSelectorList CSSParser::ParsePageSelector( |
51 const CSSParserContext* context, | 51 const CSSParserContext& context, |
52 StyleSheetContents* style_sheet_contents, | 52 StyleSheetContents* style_sheet_contents, |
53 const String& selector) { | 53 const String& selector) { |
54 CSSTokenizer tokenizer(selector); | 54 CSSTokenizer tokenizer(selector); |
55 return CSSParserImpl::ParsePageSelector(tokenizer.TokenRange(), | 55 return CSSParserImpl::ParsePageSelector(context, tokenizer.TokenRange(), |
56 style_sheet_contents); | 56 style_sheet_contents); |
57 } | 57 } |
58 | 58 |
59 StyleRuleBase* CSSParser::ParseRule(const CSSParserContext* context, | 59 StyleRuleBase* CSSParser::ParseRule(const CSSParserContext* context, |
60 StyleSheetContents* style_sheet, | 60 StyleSheetContents* style_sheet, |
61 const String& rule) { | 61 const String& rule) { |
62 return CSSParserImpl::ParseRule(rule, context, style_sheet, | 62 return CSSParserImpl::ParseRule(rule, context, style_sheet, |
63 CSSParserImpl::kAllowImportRules); | 63 CSSParserImpl::kAllowImportRules); |
64 } | 64 } |
65 | 65 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 builder.Append(property_value); | 246 builder.Append(property_value); |
247 builder.Append("; }"); | 247 builder.Append("; }"); |
248 StyleRuleBase* rule = ParseRule(context, nullptr, builder.ToString()); | 248 StyleRuleBase* rule = ParseRule(context, nullptr, builder.ToString()); |
249 if (!rule || !rule->IsFontFaceRule()) | 249 if (!rule || !rule->IsFontFaceRule()) |
250 return nullptr; | 250 return nullptr; |
251 return ToStyleRuleFontFace(rule)->Properties().GetPropertyCSSValue( | 251 return ToStyleRuleFontFace(rule)->Properties().GetPropertyCSSValue( |
252 property_id); | 252 property_id); |
253 } | 253 } |
254 | 254 |
255 } // namespace blink | 255 } // namespace blink |
OLD | NEW |