| 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 46ca6234c121452cf09e72bbed7f34487015a9ed..ade766d04b9c977bb6949bbb3251d3899a0b141f 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp
|
| @@ -8,6 +8,7 @@
|
| #include "core/CSSValueKeywords.h"
|
| #include "core/StyleBuilderFunctions.h"
|
| #include "core/StylePropertyShorthand.h"
|
| +#include "core/css/CSSCustomPropertyDeclaration.h"
|
| #include "core/css/CSSPendingSubstitutionValue.h"
|
| #include "core/css/CSSUnsetValue.h"
|
| #include "core/css/CSSVariableData.h"
|
| @@ -100,6 +101,7 @@ PassRefPtr<CSSVariableData> CSSVariableResolver::ResolveCustomProperty(
|
| Vector<CSSParserToken> tokens;
|
| Vector<String> backing_strings;
|
| backing_strings.AppendVector(variable_data.BackingStrings());
|
| + DCHECK(!variables_seen_.Contains(name));
|
| variables_seen_.insert(name);
|
| bool success =
|
| ResolveTokenRange(variable_data.Tokens(), disallow_animation_tainted,
|
| @@ -126,6 +128,20 @@ bool CSSVariableResolver::ResolveVariableReference(
|
| range.ConsumeIncludingWhitespace().Value().ToAtomicString();
|
| DCHECK(range.AtEnd() || (range.Peek().GetType() == kCommaToken));
|
|
|
| + PropertyHandle property(variable_name);
|
| + if (state_.AnimationPendingCustomProperties().Contains(property) &&
|
| + !variables_seen_.Contains(variable_name)) {
|
| + // We make the StyleResolverState mutable for animated custom properties as
|
| + // an optimisation. Without this we would need to compute animated values on
|
| + // the stack without saving the result or perform an expensive and complex
|
| + // value dependency graph analysis to compute them in the required order.
|
| + StyleResolver::ApplyAnimatedCustomProperty(
|
| + const_cast<StyleResolverState&>(state_), *this, property);
|
| + // Null custom property storage may become non-null after application, we
|
| + // must refresh these cached values.
|
| + inherited_variables_ = state_.Style()->InheritedVariables();
|
| + non_inherited_variables_ = state_.Style()->NonInheritedVariables();
|
| + }
|
| CSSVariableData* variable_data = ValueForCustomProperty(variable_name);
|
| if (!variable_data ||
|
| (disallow_animation_tainted && variable_data->IsAnimationTainted())) {
|
| @@ -283,6 +299,31 @@ const CSSValue* CSSVariableResolver::ResolvePendingSubstitutions(
|
| return CSSUnsetValue::Create();
|
| }
|
|
|
| +const CSSValue*
|
| +CSSVariableResolver::ResolveRegisteredCustomPropertyAnimationKeyframe(
|
| + const PropertyRegistration& registration,
|
| + const CSSCustomPropertyDeclaration& keyframe) {
|
| + DCHECK(keyframe.Value());
|
| + const AtomicString& name = keyframe.GetName();
|
| + DCHECK_EQ(registry_->Registration(name), ®istration);
|
| +
|
| + if (variables_seen_.Contains(name)) {
|
| + cycle_start_points_.insert(name);
|
| + return nullptr;
|
| + }
|
| +
|
| + if (!keyframe.Value()->NeedsVariableResolution()) {
|
| + return keyframe.Value()->ParseForSyntax(registration.Syntax());
|
| + }
|
| +
|
| + RefPtr<CSSVariableData> resolved_tokens =
|
| + ResolveCustomProperty(name, *keyframe.Value());
|
| + if (!resolved_tokens) {
|
| + return nullptr;
|
| + }
|
| + return resolved_tokens->ParseForSyntax(registration.Syntax());
|
| +}
|
| +
|
| void CSSVariableResolver::ResolveVariableDefinitions() {
|
| if (!inherited_variables_ && !non_inherited_variables_)
|
| return;
|
|
|