Home | History | Annotate | Download | only in blink
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "cc/blink/web_scroll_offset_animation_curve_impl.h"
      6 
      7 #include "cc/animation/scroll_offset_animation_curve.h"
      8 #include "cc/animation/timing_function.h"
      9 #include "cc/blink/web_animation_curve_common.h"
     10 
     11 using blink::WebFloatPoint;
     12 
     13 namespace cc_blink {
     14 
     15 WebScrollOffsetAnimationCurveImpl::WebScrollOffsetAnimationCurveImpl(
     16     WebFloatPoint target_value,
     17     TimingFunctionType timing_function)
     18     : curve_(cc::ScrollOffsetAnimationCurve::Create(
     19           gfx::Vector2dF(target_value.x, target_value.y),
     20           CreateTimingFunction(timing_function))) {
     21 }
     22 
     23 WebScrollOffsetAnimationCurveImpl::~WebScrollOffsetAnimationCurveImpl() {
     24 }
     25 
     26 blink::WebCompositorAnimationCurve::AnimationCurveType
     27 WebScrollOffsetAnimationCurveImpl::type() const {
     28   return WebCompositorAnimationCurve::AnimationCurveTypeScrollOffset;
     29 }
     30 
     31 void WebScrollOffsetAnimationCurveImpl::setInitialValue(
     32     WebFloatPoint initial_value) {
     33   curve_->SetInitialValue(gfx::Vector2dF(initial_value.x, initial_value.y));
     34 }
     35 
     36 WebFloatPoint WebScrollOffsetAnimationCurveImpl::getValue(double time) const {
     37   gfx::Vector2dF value = curve_->GetValue(time);
     38   return WebFloatPoint(value.x(), value.y());
     39 }
     40 
     41 double WebScrollOffsetAnimationCurveImpl::duration() const {
     42   return curve_->Duration();
     43 }
     44 
     45 scoped_ptr<cc::AnimationCurve>
     46 WebScrollOffsetAnimationCurveImpl::CloneToAnimationCurve() const {
     47   return curve_->Clone();
     48 }
     49 
     50 }  // namespace cc_blink
     51