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