| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/resolver/CSSVariableResolver.h" | 5 #include "core/css/resolver/CSSVariableResolver.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/CSSValueKeywords.h" | 8 #include "core/CSSValueKeywords.h" |
| 9 #include "core/StyleBuilderFunctions.h" | 9 #include "core/StyleBuilderFunctions.h" |
| 10 #include "core/StylePropertyShorthand.h" | 10 #include "core/StylePropertyShorthand.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return CSSUnsetValue::create(); | 142 return CSSUnsetValue::create(); |
| 143 return result; | 143 return result; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState&
state, CSSPropertyID id, const CSSVariableReferenceValue& value) | 146 void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState&
state, CSSPropertyID id, const CSSVariableReferenceValue& value) |
| 147 { | 147 { |
| 148 CSSVariableResolver resolver(state.style()->variables()); | 148 CSSVariableResolver resolver(state.style()->variables()); |
| 149 | 149 |
| 150 Vector<CSSParserToken> tokens; | 150 Vector<CSSParserToken> tokens; |
| 151 if (resolver.resolveTokenRange(value.variableDataValue()->tokens(), tokens))
{ | 151 if (resolver.resolveTokenRange(value.variableDataValue()->tokens(), tokens))
{ |
| 152 CSSParserContext context(HTMLStandardMode, 0); | 152 CSSParserContext context(HTMLStandardMode, nullptr); |
| 153 | 153 |
| 154 HeapVector<CSSProperty, 256> parsedProperties; | 154 HeapVector<CSSProperty, 256> parsedProperties; |
| 155 | 155 |
| 156 // TODO: Non-shorthands should just call CSSPropertyParser::parseSingleV
alue | 156 // TODO: Non-shorthands should just call CSSPropertyParser::parseSingleV
alue |
| 157 if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens)
, context, parsedProperties, StyleRule::RuleType::Style)) { | 157 if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens)
, context, parsedProperties, StyleRule::RuleType::Style)) { |
| 158 unsigned parsedPropertiesCount = parsedProperties.size(); | 158 unsigned parsedPropertiesCount = parsedProperties.size(); |
| 159 for (unsigned i = 0; i < parsedPropertiesCount; ++i) | 159 for (unsigned i = 0; i < parsedPropertiesCount; ++i) |
| 160 StyleBuilder::applyProperty(parsedProperties[i].id(), state, *pa
rsedProperties[i].value()); | 160 StyleBuilder::applyProperty(parsedProperties[i].id(), state, *pa
rsedProperties[i].value()); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 184 variable.value = resolver.resolveCustomProperty(variable.key, *varia
ble.value); | 184 variable.value = resolver.resolveCustomProperty(variable.key, *varia
ble.value); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData) | 188 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData) |
| 189 : m_styleVariableData(styleVariableData) | 189 : m_styleVariableData(styleVariableData) |
| 190 { | 190 { |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |