Index: Source/core/animation/InvalidatableStyleInterpolation.cpp |
diff --git a/Source/core/animation/InvalidatableStyleInterpolation.cpp b/Source/core/animation/InvalidatableStyleInterpolation.cpp |
index 1de10b401231bfa59ee073ddfefec095dfb23b22..49dc3a5b1082250960c512ed59d478f177fbca37 100644 |
--- a/Source/core/animation/InvalidatableStyleInterpolation.cpp |
+++ b/Source/core/animation/InvalidatableStyleInterpolation.cpp |
@@ -128,12 +128,14 @@ void InvalidatableStyleInterpolation::applyStack(const ActiveInterpolations& int |
while (startingIndex > 0 && toInvalidatableStyleInterpolation(*interpolations.at(startingIndex)).dependsOnUnderlyingValue()) |
startingIndex--; |
+ // Compute the underlying value to composite onto. |
OwnPtr<InterpolationValue> underlyingValueOwner = nullptr; |
InterpolationValue* underlyingValue = nullptr; |
- bool shouldApply = false; |
- |
const InvalidatableStyleInterpolation& firstInterpolation = toInvalidatableStyleInterpolation(*interpolations.at(startingIndex)); |
- if (!firstInterpolation.dependsOnUnderlyingValue()) { |
+ if (firstInterpolation.dependsOnUnderlyingValue()) { |
+ underlyingValueOwner = firstInterpolation.maybeConvertUnderlyingValue(state); |
+ underlyingValue = underlyingValueOwner.get(); |
+ } else { |
firstInterpolation.ensureValidInterpolation(state, nullptr); |
// Fast path for replace interpolations that are the last to apply. |
if (startingIndex == interpolations.size() - 1) { |
@@ -148,11 +150,8 @@ void InvalidatableStyleInterpolation::applyStack(const ActiveInterpolations& int |
startingIndex++; |
} |
- if (!underlyingValue && startingIndex < interpolations.size()) { |
- underlyingValueOwner = toInvalidatableStyleInterpolation(*interpolations.at(startingIndex)).maybeConvertUnderlyingValue(state); |
- underlyingValue = underlyingValueOwner.get(); |
- } |
- |
+ // Composite interpolations onto the underlying value. |
+ bool shouldApply = false; |
for (size_t i = startingIndex; i < interpolations.size(); i++) { |
const InvalidatableStyleInterpolation& currentInterpolation = toInvalidatableStyleInterpolation(*interpolations.at(i)); |
ASSERT(currentInterpolation.dependsOnUnderlyingValue()); |
@@ -179,6 +178,7 @@ void InvalidatableStyleInterpolation::applyStack(const ActiveInterpolations& int |
underlyingValue->interpolableValue().scaleAndAdd(underlyingFraction, currentInterpolation.m_cachedValue->interpolableValue()); |
} |
} |
+ |
if (shouldApply && underlyingValue) { |
underlyingValue->type().apply(underlyingValue->interpolableValue(), underlyingValue->nonInterpolableValue(), state); |
} |