Index: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp |
index a522dcc5fb07d0d812f1cade7946bf343588228f..b22cb6b06189b3cbcac827e7c11a614778ad57f5 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp |
@@ -8,6 +8,8 @@ |
#include "core/CSSPropertyNames.h" |
#include "core/CSSValueKeywords.h" |
#include "core/StyleBuilderFunctions.h" |
+#include "core/StylePropertyShorthand.h" |
+#include "core/css/CSSValuePool.h" |
#include "core/css/CSSVariableData.h" |
#include "core/css/CSSVariableReferenceValue.h" |
#include "core/css/parser/CSSParserToken.h" |
@@ -109,24 +111,36 @@ void CSSVariableResolver::resolveVariableReferencesFromTokens(CSSParserTokenRang |
void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState& state, CSSPropertyID id, const CSSVariableReferenceValue& value) |
{ |
+ |
// TODO(leviw): This should be a stack |
CSSVariableResolver resolver(state.style()->variables()); |
Vector<CSSParserToken> tokens; |
ResolutionState resolutionContext; |
resolver.resolveVariableReferencesFromTokens(value.variableDataValue()->tokens(), tokens, resolutionContext); |
- if (!resolutionContext.success) |
- return; |
- CSSParserContext context(HTMLStandardMode, 0); |
+ if (resolutionContext.success) { |
+ CSSParserContext context(HTMLStandardMode, 0); |
- WillBeHeapVector<CSSProperty, 256> parsedProperties; |
+ WillBeHeapVector<CSSProperty, 256> parsedProperties; |
+ |
+ if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens), context, parsedProperties, StyleRule::Type::Style)) { |
+ unsigned parsedPropertiesCount = parsedProperties.size(); |
+ for (unsigned i = 0; i < parsedPropertiesCount; ++i) |
+ StyleBuilder::applyProperty(parsedProperties[i].id(), state, parsedProperties[i].value()); |
+ return; |
+ } |
+ } |
- CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens), context, parsedProperties, StyleRule::Type::Style); |
+ RefPtrWillBeRawPtr<CSSUnsetValue> unset = cssValuePool().createUnsetValue(); |
+ if (isShorthandProperty(id)) { |
+ StylePropertyShorthand shorthand = shorthandForProperty(id); |
+ for (unsigned i = 0; i < shorthand.length(); i++) |
+ StyleBuilder::applyProperty(shorthand.properties()[i], state, unset.get()); |
+ return; |
+ } |
- unsigned parsedPropertiesCount = parsedProperties.size(); |
- for (unsigned i = 0; i < parsedPropertiesCount; ++i) |
- StyleBuilder::applyProperty(parsedProperties[i].id(), state, parsedProperties[i].value()); |
+ StyleBuilder::applyProperty(id, state, unset.get()); |
} |
void CSSVariableResolver::resolveVariableDefinitions(StyleVariableData* variables) |