Index: Source/core/animation/AnimatableDouble.cpp |
diff --git a/Source/core/animation/AnimatableVisibility.cpp b/Source/core/animation/AnimatableDouble.cpp |
similarity index 65% |
copy from Source/core/animation/AnimatableVisibility.cpp |
copy to Source/core/animation/AnimatableDouble.cpp |
index 2cfc097ada77aa7750f4157b2240c07ba9ce1b0f..211452c2b5b24bd12ea4483eab700cd5ed10a425 100644 |
--- a/Source/core/animation/AnimatableVisibility.cpp |
+++ b/Source/core/animation/AnimatableDouble.cpp |
@@ -29,21 +29,35 @@ |
*/ |
#include "config.h" |
-#include "core/animation/AnimatableVisibility.h" |
+#include "core/animation/AnimatableDouble.h" |
+ |
+#include "core/css/CSSPrimitiveValue.h" |
+#include "core/css/CSSValuePool.h" |
+#include "core/platform/animation/AnimationUtilities.h" |
namespace WebCore { |
-PassRefPtr<AnimatableValue> AnimatableVisibility::interpolateTo(const AnimatableValue* value, double fraction) const |
+PassRefPtr<CSSValue> AnimatableDouble::toCSSValue() const |
{ |
- EVisibility from = m_visibility; |
- EVisibility to = toAnimatableVisibility(value)->m_visibility; |
- if (from != VISIBLE && to != VISIBLE) |
- return defaultInterpolateTo(this, value, fraction); |
- if (fraction <= 0) |
- return takeConstRef(this); |
- if (fraction >= 1) |
+ return cssValuePool().createValue(m_number, CSSPrimitiveValue::CSS_NUMBER); |
+} |
+ |
+PassRefPtr<AnimatableValue> AnimatableDouble::interpolateTo(const AnimatableValue* value, double fraction) const |
+{ |
+ const AnimatableDouble* other = toAnimatableDouble(value); |
+ return AnimatableDouble::create(blend(m_number, other->m_number, fraction)); |
+} |
+ |
+PassRefPtr<AnimatableValue> AnimatableDouble::addWith(const AnimatableValue* value) const |
+{ |
+ // Optimization for adding with 0. |
+ if (!m_number) |
return takeConstRef(value); |
- return takeConstRef(from == VISIBLE ? this : value); |
+ const AnimatableDouble* other = toAnimatableDouble(value); |
+ if (!other->m_number) |
+ return takeConstRef(this); |
+ |
+ return AnimatableDouble::create(m_number + other->m_number); |
} |
} // namespace WebCore |