| Index: Source/core/css/resolver/StyleBuilderCustom.cpp
|
| diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| index ff629ab79e437a58c16a05f4d9d724c6861f07c9..3e5d887f61e5dfda7fd20e3026e2dbcf48de0701 100644
|
| --- a/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| +++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
|
| @@ -44,6 +44,7 @@
|
| #include "core/StylePropertyShorthand.h"
|
| #include "core/css/BasicShapeFunctions.h"
|
| #include "core/css/CSSCursorImageValue.h"
|
| +#include "core/css/CSSCustomVariableValue.h"
|
| #include "core/css/CSSGradientValue.h"
|
| #include "core/css/CSSGridTemplateAreasValue.h"
|
| #include "core/css/CSSHelper.h"
|
| @@ -56,6 +57,10 @@
|
| #include "core/css/Pair.h"
|
| #include "core/css/StylePropertySet.h"
|
| #include "core/css/StyleRule.h"
|
| +#include "core/css/parser/CSSParser.h"
|
| +#include "core/css/parser/CSSParserTokenRange.h"
|
| +#include "core/css/parser/CSSPropertyParser.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 +111,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();
|
| @@ -799,6 +809,45 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
|
| state.setTextOrientation(*toCSSPrimitiveValue(value));
|
| }
|
|
|
| +void StyleBuilderFunctions::applyValueCSSPropertyVariable(StyleResolverState& state, CSSValue* value)
|
| +{
|
| + CSSCustomVariableValue* varVal = toCSSCustomVariableValue(value);
|
| + switch (varVal->id()) {
|
| + case CSSValueInitial:
|
| + state.style()->removeVariable(varVal->name());
|
| + break;
|
| +
|
| + case CSSValueUnset:
|
| + state.style()->removeVariable(varVal->name());
|
| + // Intentional fallthrough.
|
| + case CSSValueInherit: {
|
| + 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::applyInheritCSSPropertyVariable(StyleResolverState& state)
|
| +{
|
| + // We reach this via the 'all' property, which does not apply to variables
|
| +}
|
| +
|
| +void StyleBuilderFunctions::applyInitialCSSPropertyVariable(StyleResolverState& state)
|
| +{
|
| + ASSERT_NOT_REACHED();
|
| +}
|
| +
|
| void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverState& state)
|
| {
|
| const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle();
|
|
|