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

Unified Diff: Source/core/animation/InterpolableValue.cpp

Issue 863863004: Implemented additive animations for length (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed AnimationStackTest Created 5 years, 10 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: 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);

Powered by Google App Engine
This is Rietveld 408576698