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 "content/renderer/compositor_bindings/web_scroll_offset_animation_curve_impl.h" 6 7#if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED 8 9#include "cc/animation/scroll_offset_animation_curve.h" 10#include "cc/animation/timing_function.h" 11#include "content/renderer/compositor_bindings/web_animation_curve_common.h" 12 13using blink::WebFloatPoint; 14 15namespace content { 16 17WebScrollOffsetAnimationCurveImpl::WebScrollOffsetAnimationCurveImpl( 18 WebFloatPoint target_value, 19 TimingFunctionType timing_function) 20 : curve_(cc::ScrollOffsetAnimationCurve::Create( 21 gfx::Vector2dF(target_value.x, target_value.y), 22 CreateTimingFunction(timing_function))) { 23} 24 25WebScrollOffsetAnimationCurveImpl::~WebScrollOffsetAnimationCurveImpl() { 26} 27 28blink::WebAnimationCurve::AnimationCurveType 29WebScrollOffsetAnimationCurveImpl::type() const { 30 return WebAnimationCurve::AnimationCurveTypeScrollOffset; 31} 32 33void WebScrollOffsetAnimationCurveImpl::setInitialValue( 34 WebFloatPoint initial_value) { 35 curve_->SetInitialValue(gfx::Vector2dF(initial_value.x, initial_value.y)); 36} 37 38WebFloatPoint WebScrollOffsetAnimationCurveImpl::getValue(double time) const { 39 gfx::Vector2dF value = curve_->GetValue(time); 40 return WebFloatPoint(value.x(), value.y()); 41} 42 43double WebScrollOffsetAnimationCurveImpl::duration() const { 44 return curve_->Duration(); 45} 46 47scoped_ptr<cc::AnimationCurve> 48WebScrollOffsetAnimationCurveImpl::CloneToAnimationCurve() const { 49 return curve_->Clone(); 50} 51 52} // namespace content 53 54#endif // WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED 55 56