| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/CSSParser.h" | 6 #include "core/css/parser/CSSParser.h" |
| 7 | 7 |
| 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 13 matching lines...) Expand all Loading... |
| 24 { | 24 { |
| 25 if (observer) { | 25 if (observer) { |
| 26 CSSParserImpl::parseDeclarationListForInspector(declaration, context, *o
bserver); | 26 CSSParserImpl::parseDeclarationListForInspector(declaration, context, *o
bserver); |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 return CSSParserImpl::parseDeclarationList(propertySet, declaration, context
); | 29 return CSSParserImpl::parseDeclarationList(propertySet, declaration, context
); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void CSSParser::parseSelector(const CSSParserContext& context, const String& sel
ector, CSSSelectorList& selectorList) | 32 void CSSParser::parseSelector(const CSSParserContext& context, const String& sel
ector, CSSSelectorList& selectorList) |
| 33 { | 33 { |
| 34 CSSTokenizer::Scope scope(selector); | 34 CSSTokenizerScope scope(selector); |
| 35 CSSSelectorParser::parseSelector(scope.tokenRange(), context, starAtom, null
ptr, selectorList); | 35 CSSSelectorParser::parseSelector(scope.tokenRange(), context, starAtom, null
ptr, selectorList); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex
t& context, const String& rule) | 38 PassRefPtrWillBeRawPtr<StyleRuleBase> CSSParser::parseRule(const CSSParserContex
t& context, const String& rule) |
| 39 { | 39 { |
| 40 return CSSParserImpl::parseRule(rule, context, CSSParserImpl::AllowImportRul
es); | 40 return CSSParserImpl::parseRule(rule, context, CSSParserImpl::AllowImportRul
es); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents*
styleSheet, const String& text, CSSParserObserver* observer) | 43 void CSSParser::parseSheet(const CSSParserContext& context, StyleSheetContents*
styleSheet, const String& text, CSSParserObserver* observer) |
| 44 { | 44 { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> CSSParser::parseKeyframeRule(const CSS
ParserContext& context, const String& rule) | 93 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> CSSParser::parseKeyframeRule(const CSS
ParserContext& context, const String& rule) |
| 94 { | 94 { |
| 95 RefPtrWillBeRawPtr<StyleRuleBase> keyframe = CSSParserImpl::parseRule(rule,
context, CSSParserImpl::KeyframeRules); | 95 RefPtrWillBeRawPtr<StyleRuleBase> keyframe = CSSParserImpl::parseRule(rule,
context, CSSParserImpl::KeyframeRules); |
| 96 return toStyleRuleKeyframe(keyframe.get()); | 96 return toStyleRuleKeyframe(keyframe.get()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool CSSParser::parseSupportsCondition(const String& condition) | 99 bool CSSParser::parseSupportsCondition(const String& condition) |
| 100 { | 100 { |
| 101 CSSTokenizer::Scope scope(condition); | 101 CSSTokenizerScope scope(condition); |
| 102 CSSParserImpl parser(strictCSSParserContext()); | 102 CSSParserImpl parser(strictCSSParserContext()); |
| 103 return CSSSupportsParser::supportsCondition(scope.tokenRange(), parser) == C
SSSupportsParser::Supported; | 103 return CSSSupportsParser::supportsCondition(scope.tokenRange(), parser) == C
SSSupportsParser::Supported; |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict) | 106 bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict) |
| 107 { | 107 { |
| 108 if (string.isEmpty()) | 108 if (string.isEmpty()) |
| 109 return false; | 109 return false; |
| 110 | 110 |
| 111 // First try creating a color specified by name, rgba(), rgb() or "#" syntax
. | 111 // First try creating a color specified by name, rgba(), rgb() or "#" syntax
. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 builder.appendLiteral(" : "); | 162 builder.appendLiteral(" : "); |
| 163 builder.append(propertyValue); | 163 builder.append(propertyValue); |
| 164 builder.appendLiteral("; }"); | 164 builder.appendLiteral("; }"); |
| 165 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, builder.toString
()); | 165 RefPtrWillBeRawPtr<StyleRuleBase> rule = parseRule(context, builder.toString
()); |
| 166 if (!rule || !rule->isFontFaceRule()) | 166 if (!rule || !rule->isFontFaceRule()) |
| 167 return nullptr; | 167 return nullptr; |
| 168 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); | 168 return toStyleRuleFontFace(rule.get())->properties().getPropertyCSSValue(pro
pertyID); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |