| 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 08aab457152cbb5ee33af2f311ab1645411fb16a..219ea54eb84c380de3b72dd9f5ea375be35acc8c 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
|
| @@ -70,10 +70,7 @@ CSSVariableData* CSSVariableResolver::valueForCustomProperty(
|
| const CSSValue* parsedValue = nullptr;
|
| if (newVariableData) {
|
| parsedValue = newVariableData->parseForSyntax(registration->syntax());
|
| - if (parsedValue)
|
| - parsedValue = &StyleBuilderConverter::convertRegisteredPropertyValue(
|
| - m_styleResolverState, *parsedValue);
|
| - else
|
| + if (!parsedValue)
|
| newVariableData = nullptr;
|
| }
|
| if (registration->inherits()) {
|
| @@ -301,9 +298,37 @@ void CSSVariableResolver::resolveVariableDefinitions(
|
| }
|
| }
|
|
|
| +void CSSVariableResolver::computeRegisteredVariables(
|
| + const StyleResolverState& state) {
|
| + // const_cast is needed because Persistent<const ...> doesn't work properly.
|
| +
|
| + StyleInheritedVariables* inheritedVariables =
|
| + state.style()->inheritedVariables();
|
| + if (inheritedVariables) {
|
| + for (auto& variable : inheritedVariables->m_registeredData) {
|
| + if (variable.value) {
|
| + variable.value = const_cast<CSSValue*>(
|
| + &StyleBuilderConverter::convertRegisteredPropertyValue(
|
| + state, *variable.value));
|
| + }
|
| + }
|
| + }
|
| +
|
| + StyleNonInheritedVariables* nonInheritedVariables =
|
| + state.style()->nonInheritedVariables();
|
| + if (nonInheritedVariables) {
|
| + for (auto& variable : nonInheritedVariables->m_registeredData) {
|
| + if (variable.value) {
|
| + variable.value = const_cast<CSSValue*>(
|
| + &StyleBuilderConverter::convertRegisteredPropertyValue(
|
| + state, *variable.value));
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state)
|
| - : m_styleResolverState(state),
|
| - m_inheritedVariables(state.style()->inheritedVariables()),
|
| + : m_inheritedVariables(state.style()->inheritedVariables()),
|
| m_nonInheritedVariables(state.style()->nonInheritedVariables()),
|
| m_registry(state.document().propertyRegistry()) {}
|
|
|
|
|