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

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: Rebased Created 5 years, 6 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/PrimitiveInterpolation.h
diff --git a/Source/core/animation/PrimitiveInterpolation.h b/Source/core/animation/PrimitiveInterpolation.h
index a452f1e3299c7accce4ad855b43e18b92c4d16e8..b920ab5d333a87ae0526e00b659f57896f2dd0ed 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)
{ }
- virtual void interpolate(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const override final
+ virtual void interpolateValue(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const override final
{
ASSERT(result);
ASSERT(&result->type() == &m_type);
@@ -64,6 +67,8 @@ private:
m_start->interpolate(*m_end, fraction, result->interpolableValue());
}
+ virtual double interpolateUnderlyingFraction(double start, double end, double fraction) const override 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);
- }
+ { }
- virtual void interpolate(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const override final
+ virtual void interpolateValue(double fraction, OwnPtrWillBeMember<InterpolationValue>& result) const override 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;
}
+ virtual double interpolateUnderlyingFraction(double start, double end, double fraction) const override final { return fraction < 0.5 ? start : end; }
+
+ virtual bool isFlip() const override final { return true; }
+
OwnPtrWillBeMember<InterpolationValue> m_start;
OwnPtrWillBeMember<InterpolationValue> m_end;
mutable double m_lastFraction;

Powered by Google App Engine
This is Rietveld 408576698