| Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| index ebd5ed5d1efa43c4a51ad65617cc900d051f62d1..bea8d346d91b0ee7ff8e71d84d87fa9f6099724c 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| @@ -45,6 +45,7 @@
|
| #include "core/css/BasicShapeFunctions.h"
|
| #include "core/css/CSSCounterValue.h"
|
| #include "core/css/CSSCursorImageValue.h"
|
| +#include "core/css/CSSCustomPropertyDeclaration.h"
|
| #include "core/css/CSSFunctionValue.h"
|
| #include "core/css/CSSGradientValue.h"
|
| #include "core/css/CSSGridTemplateAreasValue.h"
|
| @@ -56,6 +57,7 @@
|
| #include "core/css/CSSValuePair.h"
|
| #include "core/css/StylePropertySet.h"
|
| #include "core/css/StyleRule.h"
|
| +#include "core/css/resolver/CSSVariableResolver.h"
|
| #include "core/css/resolver/ElementStyleResources.h"
|
| #include "core/css/resolver/FilterOperationResolver.h"
|
| #include "core/css/resolver/FontBuilder.h"
|
| @@ -106,6 +108,11 @@ static inline bool isValidVisitedLinkProperty(CSSPropertyID id)
|
|
|
| void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CSSValue* value)
|
| {
|
| + if (RuntimeEnabledFeatures::cssVariablesEnabled() && id != CSSPropertyVariable && value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isVariableReference()) {
|
| + CSSVariableResolver::resolveAndApplyVariableReferences(state, id, *toCSSPrimitiveValue(value));
|
| + return;
|
| + }
|
| +
|
| ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wasn't expanded at parsing time", id);
|
|
|
| bool isInherit = state.parentNode() && value->isInheritedValue();
|
| @@ -815,6 +822,34 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
|
| state.setTextOrientation(*toCSSPrimitiveValue(value));
|
| }
|
|
|
| +void StyleBuilderFunctions::applyValueCSSPropertyVariable(StyleResolverState& state, CSSValue* value)
|
| +{
|
| + CSSCustomPropertyDeclaration* varVal = toCSSCustomPropertyDeclaration(value);
|
| + switch (varVal->id()) {
|
| + case CSSValueInitial:
|
| + state.style()->removeVariable(varVal->name());
|
| + break;
|
| +
|
| + case CSSValueUnset:
|
| + case CSSValueInherit: {
|
| + state.style()->removeVariable(varVal->name());
|
| + StyleVariableData* parentVariables = state.parentStyle()->variables();
|
| + if (!parentVariables)
|
| + return;
|
| + CSSVariableData* value = parentVariables->getVariable(varVal->name());
|
| + if (!value)
|
| + return;
|
| + state.style()->setVariable(varVal->name(), value);
|
| + break;
|
| + }
|
| + case CSSValueInternalVariableValue:
|
| + state.style()->setVariable(varVal->name(), varVal->value());
|
| + break;
|
| + default:
|
| + ASSERT_NOT_REACHED();
|
| + }
|
| +}
|
| +
|
| void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverState& state)
|
| {
|
| const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle();
|
|
|