Index: Source/core/animation/InterpolableValue.cpp |
diff --git a/Source/core/animation/InterpolableValue.cpp b/Source/core/animation/InterpolableValue.cpp |
index a8117c760698818c3d445aa0fa374c3a485ec456..e60c9058eda67ed066f7056fe9e37a92573bf465 100644 |
--- a/Source/core/animation/InterpolableValue.cpp |
+++ b/Source/core/animation/InterpolableValue.cpp |
@@ -9,6 +9,27 @@ namespace blink { |
DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(InterpolableValue); |
+bool InterpolableValue::typesMatch(const InterpolableValue& other) const |
+{ |
+ if (isNumber()) |
+ return other.isNumber(); |
+ if (isBool()) |
+ return other.isBool(); |
+ if (isAnimatableValue()) |
+ return other.isAnimatableValue(); |
+ if (!(isList() && other.isList())) |
+ return false; |
+ const InterpolableList& listA = toInterpolableList(*this); |
+ const InterpolableList& listB = toInterpolableList(other); |
+ if (listA.length() != listB.length()) |
+ return false; |
+ for (size_t i = 0; i < listA.length(); ++i) { |
+ if (!listA.get(i)->typesMatch(*listB.get(i))) |
+ return false; |
+ } |
+ return true; |
+} |
+ |
void InterpolableNumber::interpolate(const InterpolableValue &to, const double progress, InterpolableValue& result) const |
{ |
const InterpolableNumber& toNumber = toInterpolableNumber(to); |