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

Unified Diff: Source/core/animation/PrimitiveInterpolation.h

Issue 1215563002: Implement left property animation on InvalidatableStyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Windows not crash Created 5 years, 5 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
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/PrimitiveInterpolation.h
diff --git a/Source/core/animation/PrimitiveInterpolation.h b/Source/core/animation/PrimitiveInterpolation.h
index 8ae0d755ac3d5cde75d892f3c04ece8d28880dc7..885bae0620e8a7de2c54edb304f747cbd9eb9c3b 100644
--- a/Source/core/animation/PrimitiveInterpolation.h
+++ b/Source/core/animation/PrimitiveInterpolation.h
@@ -6,6 +6,7 @@
#define PrimitiveInterpolation_h
#include "core/animation/InterpolationValue.h"
+#include "platform/animation/AnimationUtilities.h"
#include "platform/heap/Handle.h"
#include "wtf/Vector.h"
#include <cmath>
@@ -20,7 +21,9 @@ class PrimitiveInterpolation : public NoBaseWillBeGarbageCollectedFinalized<Prim
public:
virtual ~PrimitiveInterpolation() { }
- virtual void interpolate(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const = 0;
+ virtual void interpolateValue(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const = 0;
+ virtual double interpolateUnderlyingFraction(double start, double end, double fraction) const = 0;
+ virtual bool isFlip() const { return false; }
DEFINE_INLINE_VIRTUAL_TRACE() { }
};
@@ -56,7 +59,7 @@ private:
, m_nonInterpolableValue(nonInterpolableValue)
{ }
- void interpolate(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const final
+ void interpolateValue(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const final
{
ASSERT(result);
ASSERT(&result->type() == &m_type);
@@ -64,6 +67,8 @@ private:
m_start->interpolate(*m_end, fraction, result->interpolableValue());
}
+ double interpolateUnderlyingFraction(double start, double end, double fraction) const final { return blend(start, end, fraction); }
+
const InterpolationType& m_type;
OwnPtrWillBeMember<InterpolableValue> m_start;
OwnPtrWillBeMember<InterpolableValue> m_end;
@@ -92,20 +97,22 @@ private:
: m_start(start)
, m_end(end)
, m_lastFraction(std::numeric_limits<double>::quiet_NaN())
- {
- ASSERT(m_start);
- ASSERT(m_end);
- }
+ { }
- void interpolate(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const final
+ void interpolateValue(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const final
{
// TODO(alancutter): Remove this optimisation once Oilpan is default.
if (!std::isnan(m_lastFraction) && (fraction < 0.5) == (m_lastFraction < 0.5))
return;
- result = ((fraction < 0.5) ? m_start : m_end)->clone();
+ const InterpolationValue* side = ((fraction < 0.5) ? m_start : m_end).get();
+ result = side ? side->clone() : nullptr;
m_lastFraction = fraction;
}
+ double interpolateUnderlyingFraction(double start, double end, double fraction) const final { return fraction < 0.5 ? start : end; }
+
+ bool isFlip() const final { return true; }
+
OwnPtrWillBeMember<InterpolationValue> m_start;
OwnPtrWillBeMember<InterpolationValue> m_end;
mutable double m_lastFraction;
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698