Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp

Issue 2340893003: Support interpolation of animatable shorthand properties containing var() (Closed)
Patch Set: Update DCHECK Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
index 745e456e152cf071dc2c6be7b1ed04ffd74aeea4..67d09d114977f14bf53f895fb985152f753a3ab7 100644
--- a/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
+++ b/third_party/WebKit/Source/core/animation/CSSInterpolationType.cpp
@@ -17,13 +17,13 @@ namespace blink {
class ResolvedVariableChecker : public InterpolationType::ConversionChecker {
public:
- static std::unique_ptr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue)
+ static std::unique_ptr<ResolvedVariableChecker> create(CSSPropertyID property, const CSSValue* variableReference, const CSSValue* resolvedValue)
{
return wrapUnique(new ResolvedVariableChecker(property, variableReference, resolvedValue));
}
private:
- ResolvedVariableChecker(CSSPropertyID property, const CSSVariableReferenceValue* variableReference, const CSSValue* resolvedValue)
+ ResolvedVariableChecker(CSSPropertyID property, const CSSValue* variableReference, const CSSValue* resolvedValue)
: m_property(property)
, m_variableReference(variableReference)
, m_resolvedValue(resolvedValue)
@@ -37,10 +37,16 @@ private:
}
CSSPropertyID m_property;
- Persistent<const CSSVariableReferenceValue> m_variableReference;
+ Persistent<const CSSValue> m_variableReference;
Persistent<const CSSValue> m_resolvedValue;
};
+CSSInterpolationType::CSSInterpolationType(CSSPropertyID property)
+ : InterpolationType(PropertyHandle(property))
+{
+ DCHECK(!isShorthandProperty(cssProperty()));
+}
+
InterpolationValue CSSInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const
{
const CSSValue* resolvedCSSValueOwner;
@@ -49,13 +55,9 @@ InterpolationValue CSSInterpolationType::maybeConvertSingle(const PropertySpecif
if (!value)
return maybeConvertNeutral(underlying, conversionCheckers);
- // TODO(alancutter): Support animation of var() in shorthand properties.
- if (value->isPendingSubstitutionValue())
- return nullptr;
-
- if (value->isVariableReferenceValue() && !isShorthandProperty(cssProperty())) {
- resolvedCSSValueOwner = CSSVariableResolver::resolveVariableReferences(environment.state(), cssProperty(), toCSSVariableReferenceValue(*value));
- conversionCheckers.append(ResolvedVariableChecker::create(cssProperty(), toCSSVariableReferenceValue(value), resolvedCSSValueOwner));
+ if (value->isVariableReferenceValue() || value->isPendingSubstitutionValue()) {
+ resolvedCSSValueOwner = CSSVariableResolver::resolveVariableReferences(environment.state(), cssProperty(), *value);
+ conversionCheckers.append(ResolvedVariableChecker::create(cssProperty(), value, resolvedCSSValueOwner));
value = resolvedCSSValueOwner;
}

Powered by Google App Engine
This is Rietveld 408576698