Chromium Code Reviews| 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()) { |
|
jbroman
2016/06/01 14:51:28
nit: prefer "const auto&" unless you're mutation (
loyso (OOO)
2016/06/02 02:16:46
Done.
|
| + 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); |
| + 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( |