Index: third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp |
diff --git a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp |
index 3bba53443d1fcab5c49285183ae2199c3016b653..c07374ca4ea733e4cc61a45581bd729ed611d353 100644 |
--- a/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp |
+++ b/third_party/WebKit/Source/platform/animation/CompositorFloatAnimationCurve.cpp |
@@ -17,10 +17,57 @@ CompositorFloatAnimationCurve::CompositorFloatAnimationCurve() |
{ |
} |
+CompositorFloatAnimationCurve::CompositorFloatAnimationCurve(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) |
+ : m_curve(std::move(curve)) |
+{ |
+} |
+ |
CompositorFloatAnimationCurve::~CompositorFloatAnimationCurve() |
{ |
} |
+PassOwnPtr<CompositorFloatAnimationCurve> CompositorFloatAnimationCurve::CreateForTesting(std::unique_ptr<cc::KeyframedFloatAnimationCurve> curve) |
+{ |
+ return adoptPtr(new CompositorFloatAnimationCurve(std::move(curve))); |
+} |
+ |
+Vector<CompositorFloatKeyframe> CompositorFloatAnimationCurve::keyframesForTesting() const |
+{ |
+ Vector<CompositorFloatKeyframe> keyframes; |
+ for (auto& ccKeyframe : m_curve->keyframes_for_testing()) { |
+ CompositorFloatKeyframe keyframe(ccKeyframe->Time().InSecondsF(), ccKeyframe->Value()); |
+ keyframes.append(keyframe); |
+ } |
+ return keyframes; |
+} |
+ |
+CubicBezierTimingFunction::EaseType CompositorFloatAnimationCurve::getCurveEaseTypeForTesting() const |
+{ |
+ auto timingFunction = static_cast<const cc::CubicBezierTimingFunction*>(m_curve->timing_function_for_testing()); |
+ DCHECK(timingFunction); |
+ return timingFunction->ease_type(); |
+} |
+ |
+bool CompositorFloatAnimationCurve::curveHasLinearTimingFunctionForTesting() const |
+{ |
+ return !m_curve->timing_function_for_testing(); |
+} |
+ |
+CubicBezierTimingFunction::EaseType CompositorFloatAnimationCurve::getKeyframeEaseTypeForTesting(unsigned long index) const |
+{ |
+ DCHECK_LT(index, m_curve->keyframes_for_testing().size()); |
+ const cc::TimingFunction* timingFunction = m_curve->keyframes_for_testing()[index]->timing_function(); |
+ DCHECK(timingFunction); |
+ auto cubicTimingFunction = static_cast<const cc::CubicBezierTimingFunction*>(timingFunction); |
alancutter (OOO until 2018)
2016/06/01 02:20:55
Need a check that this static_cast is correct.
loyso (OOO)
2016/06/01 02:36:47
This would require an extra data member in cc::Tim
ajuma
2016/06/01 13:16:06
Yeah, that sounds fine.
loyso (OOO)
2016/06/02 02:16:46
Done. Without overhead. :)
|
+ return cubicTimingFunction->ease_type(); |
+} |
+ |
+bool CompositorFloatAnimationCurve::keyframeHasLinearTimingFunctionForTesting(unsigned long index) const |
+{ |
+ DCHECK_LT(index, m_curve->keyframes_for_testing().size()); |
+ return !m_curve->keyframes_for_testing()[index]->timing_function(); |
+} |
+ |
void CompositorFloatAnimationCurve::addLinearKeyframe(const CompositorFloatKeyframe& keyframe) |
{ |
m_curve->AddKeyframe( |