Index: third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h |
diff --git a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h |
index 5a74b4be30e4e3ff4ad41752785bbcb3317b5935..76951c1ddb5cdeede1e23c2edc79679a441471f5 100644 |
--- a/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h |
+++ b/third_party/WebKit/Source/core/animation/PrimitiveInterpolation.h |
@@ -5,6 +5,7 @@ |
#ifndef PrimitiveInterpolation_h |
#define PrimitiveInterpolation_h |
+#include "core/animation/PairwiseInterpolationValue.h" |
#include "core/animation/TypedInterpolationValue.h" |
#include "platform/animation/AnimationUtilities.h" |
#include "platform/heap/Handle.h" |
@@ -38,43 +39,39 @@ class PairwisePrimitiveInterpolation : public PrimitiveInterpolation { |
public: |
~PairwisePrimitiveInterpolation() override { } |
- static std::unique_ptr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) |
+ static std::unique_ptr<PairwisePrimitiveInterpolation> create(const InterpolationType& type, PairwiseInterpolationValue&& pairwiseInterpolationValue) |
{ |
- return wrapUnique(new PairwisePrimitiveInterpolation(type, std::move(start), std::move(end), nonInterpolableValue)); |
+ return wrapUnique(new PairwisePrimitiveInterpolation(type, std::move(pairwiseInterpolationValue))); |
} |
const InterpolationType& type() const { return m_type; } |
std::unique_ptr<TypedInterpolationValue> initialValue() const |
{ |
- return TypedInterpolationValue::create(m_type, m_start->clone(), m_nonInterpolableValue); |
+ return TypedInterpolationValue::create(m_type, InterpolationValue(m_pairwise.startInterpolableValue->clone(), m_pairwise.nonInterpolableValue)); |
} |
-private: |
- PairwisePrimitiveInterpolation(const InterpolationType& type, std::unique_ptr<InterpolableValue> start, std::unique_ptr<InterpolableValue> end, PassRefPtr<NonInterpolableValue> nonInterpolableValue) |
- : m_type(type) |
- , m_start(std::move(start)) |
- , m_end(std::move(end)) |
- , m_nonInterpolableValue(nonInterpolableValue) |
+ void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final |
{ |
- ASSERT(m_start); |
- ASSERT(m_end); |
+ DCHECK(result); |
+ DCHECK(&result->type() == &m_type); |
+ DCHECK(result->getNonInterpolableValue() == m_pairwise.nonInterpolableValue.get()); |
+ m_pairwise.startInterpolableValue->interpolate( |
+ *m_pairwise.endInterpolableValue, fraction, *result->mutableValue().interpolableValue); |
} |
- void interpolateValue(double fraction, std::unique_ptr<TypedInterpolationValue>& result) const final |
+private: |
+ PairwisePrimitiveInterpolation(const InterpolationType& type, PairwiseInterpolationValue&& pairwiseInterpolationValue) |
+ : m_type(type) |
+ , m_pairwise(std::move(pairwiseInterpolationValue)) |
{ |
- ASSERT(result); |
- ASSERT(&result->type() == &m_type); |
- ASSERT(result->getNonInterpolableValue() == m_nonInterpolableValue.get()); |
- m_start->interpolate(*m_end, fraction, *result->mutableValue().interpolableValue); |
+ DCHECK(m_pairwise); |
} |
double interpolateUnderlyingFraction(double start, double end, double fraction) const final { return blend(start, end, fraction); } |
const InterpolationType& m_type; |
- std::unique_ptr<InterpolableValue> m_start; |
- std::unique_ptr<InterpolableValue> m_end; |
- RefPtr<NonInterpolableValue> m_nonInterpolableValue; |
+ PairwiseInterpolationValue m_pairwise; |
}; |
// Represents a pair of incompatible keyframes that fall back to 50% flip behaviour eg. "auto" and "0px". |