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/StyleRule.h" | 10 #include "core/css/StyleRule.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 context = styleSheet->parserContext(); | 102 context = styleSheet->parserContext(); |
103 context.setMode(parserMode); | 103 context.setMode(parserMode); |
104 } | 104 } |
105 return parseValue(declaration, unresolvedProperty, string, important, | 105 return parseValue(declaration, unresolvedProperty, string, important, |
106 context); | 106 context); |
107 } | 107 } |
108 | 108 |
109 MutableStylePropertySet::SetResult CSSParser::parseValueForCustomProperty( | 109 MutableStylePropertySet::SetResult CSSParser::parseValueForCustomProperty( |
110 MutableStylePropertySet* declaration, | 110 MutableStylePropertySet* declaration, |
111 const AtomicString& propertyName, | 111 const AtomicString& propertyName, |
| 112 const PropertyRegistry* registry, |
112 const String& value, | 113 const String& value, |
113 bool important, | 114 bool important, |
114 StyleSheetContents* styleSheet, | 115 StyleSheetContents* styleSheet, |
115 bool isAnimationTainted) { | 116 bool isAnimationTainted) { |
116 DCHECK(CSSVariableParser::isValidVariableName(propertyName)); | 117 DCHECK(CSSVariableParser::isValidVariableName(propertyName)); |
117 if (value.isEmpty()) { | 118 if (value.isEmpty()) { |
118 bool didParse = false; | 119 bool didParse = false; |
119 bool didChange = false; | 120 bool didChange = false; |
120 return MutableStylePropertySet::SetResult{didParse, didChange}; | 121 return MutableStylePropertySet::SetResult{didParse, didChange}; |
121 } | 122 } |
122 CSSParserMode parserMode = declaration->cssParserMode(); | 123 CSSParserMode parserMode = declaration->cssParserMode(); |
123 CSSParserContext context(parserMode, nullptr); | 124 CSSParserContext context(parserMode, nullptr); |
124 if (styleSheet) { | 125 if (styleSheet) { |
125 context = styleSheet->parserContext(); | 126 context = styleSheet->parserContext(); |
126 context.setMode(parserMode); | 127 context.setMode(parserMode); |
127 } | 128 } |
128 return CSSParserImpl::parseVariableValue( | 129 return CSSParserImpl::parseVariableValue(declaration, propertyName, registry, |
129 declaration, propertyName, value, important, context, isAnimationTainted); | 130 value, important, context, |
| 131 isAnimationTainted); |
130 } | 132 } |
131 | 133 |
132 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet( | 134 ImmutableStylePropertySet* CSSParser::parseCustomPropertySet( |
133 CSSParserTokenRange range) { | 135 CSSParserTokenRange range) { |
134 return CSSParserImpl::parseCustomPropertySet(range); | 136 return CSSParserImpl::parseCustomPropertySet(range); |
135 } | 137 } |
136 | 138 |
137 MutableStylePropertySet::SetResult CSSParser::parseValue( | 139 MutableStylePropertySet::SetResult CSSParser::parseValue( |
138 MutableStylePropertySet* declaration, | 140 MutableStylePropertySet* declaration, |
139 CSSPropertyID unresolvedProperty, | 141 CSSPropertyID unresolvedProperty, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 builder.append(propertyValue); | 229 builder.append(propertyValue); |
228 builder.append("; }"); | 230 builder.append("; }"); |
229 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); | 231 StyleRuleBase* rule = parseRule(context, nullptr, builder.toString()); |
230 if (!rule || !rule->isFontFaceRule()) | 232 if (!rule || !rule->isFontFaceRule()) |
231 return nullptr; | 233 return nullptr; |
232 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue( | 234 return toStyleRuleFontFace(rule)->properties().getPropertyCSSValue( |
233 propertyID); | 235 propertyID); |
234 } | 236 } |
235 | 237 |
236 } // namespace blink | 238 } // namespace blink |
OLD | NEW |