| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | 5 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ |
| 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "cc/animation/animation_curve.h" | 12 #include "cc/animation/animation_curve.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "ui/gfx/geometry/scroll_offset.h" | 14 #include "ui/gfx/geometry/scroll_offset.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class TimingFunction; | 18 class TimingFunction; |
| 19 | 19 |
| 20 class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve { | 20 class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve { |
| 21 public: | 21 public: |
| 22 enum class DurationBehavior { DELTA_BASED, CONSTANT, INVERSE_DELTA }; | 22 enum class DurationBehavior { DELTA_BASED, CONSTANT, INVERSE_DELTA }; |
| 23 static std::unique_ptr<ScrollOffsetAnimationCurve> Create( | 23 static std::unique_ptr<ScrollOffsetAnimationCurve> Create( |
| 24 const gfx::ScrollOffset& target_value, | 24 const gfx::ScrollOffset& target_value, |
| 25 std::unique_ptr<TimingFunction> timing_function, | 25 std::unique_ptr<TimingFunction> timing_function, |
| 26 DurationBehavior = DurationBehavior::DELTA_BASED); | 26 DurationBehavior = DurationBehavior::DELTA_BASED); |
| 27 | 27 |
| 28 static base::TimeDelta SegmentDuration(const gfx::Vector2dF& delta, |
| 29 DurationBehavior behavior, |
| 30 base::TimeDelta delayed_by); |
| 31 |
| 28 ~ScrollOffsetAnimationCurve() override; | 32 ~ScrollOffsetAnimationCurve() override; |
| 29 | 33 |
| 30 void SetInitialValue(const gfx::ScrollOffset& initial_value); | 34 void SetInitialValue(const gfx::ScrollOffset& initial_value, |
| 35 base::TimeDelta delayed_by = base::TimeDelta()); |
| 31 bool HasSetInitialValue() const; | 36 bool HasSetInitialValue() const; |
| 32 gfx::ScrollOffset GetValue(base::TimeDelta t) const; | 37 gfx::ScrollOffset GetValue(base::TimeDelta t) const; |
| 33 gfx::ScrollOffset target_value() const { return target_value_; } | 38 gfx::ScrollOffset target_value() const { return target_value_; } |
| 34 void UpdateTarget(double t, const gfx::ScrollOffset& new_target); | 39 void UpdateTarget(double t, const gfx::ScrollOffset& new_target); |
| 35 void ApplyAdjustment(const gfx::Vector2dF& adjustment); | 40 void ApplyAdjustment(const gfx::Vector2dF& adjustment); |
| 36 | 41 |
| 37 // AnimationCurve implementation | 42 // AnimationCurve implementation |
| 38 base::TimeDelta Duration() const override; | 43 base::TimeDelta Duration() const override; |
| 39 CurveType Type() const override; | 44 CurveType Type() const override; |
| 40 std::unique_ptr<AnimationCurve> Clone() const override; | 45 std::unique_ptr<AnimationCurve> Clone() const override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 DurationBehavior duration_behavior_; | 62 DurationBehavior duration_behavior_; |
| 58 | 63 |
| 59 bool has_set_initial_value_; | 64 bool has_set_initial_value_; |
| 60 | 65 |
| 61 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve); | 66 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve); |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 } // namespace cc | 69 } // namespace cc |
| 65 | 70 |
| 66 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | 71 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ |
| OLD | NEW |