OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ScrollAnimator_h | 31 #ifndef ScrollAnimator_h |
32 #define ScrollAnimator_h | 32 #define ScrollAnimator_h |
33 | 33 |
34 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
| 35 #include "platform/animation/CompositorAnimationPlayerClient.h" |
| 36 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" |
35 #include "platform/geometry/FloatPoint.h" | 37 #include "platform/geometry/FloatPoint.h" |
36 #include "platform/scroll/ScrollAnimatorBase.h" | 38 #include "platform/scroll/ScrollAnimatorBase.h" |
37 #include "public/platform/WebCompositorAnimationDelegate.h" | 39 #include "public/platform/WebCompositorAnimationDelegate.h" |
38 #include "public/platform/WebCompositorAnimationPlayerClient.h" | |
39 #include "public/platform/WebScrollOffsetAnimationCurve.h" | |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class ScrollAnimatorTest; | 43 class ScrollAnimatorTest; |
44 class WebCompositorAnimationTimeline; | 44 class CompositorAnimationTimeline; |
45 | 45 |
46 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { | 46 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { |
47 public: | 47 public: |
48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); | 48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); |
49 ~ScrollAnimator() override; | 49 ~ScrollAnimator() override; |
50 | 50 |
51 bool hasRunningAnimation() const; | 51 bool hasRunningAnimation() const; |
52 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; | 52 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; |
53 | 53 |
54 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; | 54 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; |
55 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; | 55 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; |
56 FloatPoint desiredTargetPosition() const override; | 56 FloatPoint desiredTargetPosition() const override; |
57 | 57 |
58 // ScrollAnimatorCompositorCoordinator implementation. | 58 // ScrollAnimatorCompositorCoordinator implementation. |
59 void tickAnimation(double monotonicTime) override; | 59 void tickAnimation(double monotonicTime) override; |
60 void cancelAnimation() override; | 60 void cancelAnimation() override; |
61 void resetAnimationState() override; | 61 void resetAnimationState() override; |
62 void updateCompositorAnimations() override; | 62 void updateCompositorAnimations() override; |
63 void notifyCompositorAnimationFinished(int groupId) override; | 63 void notifyCompositorAnimationFinished(int groupId) override; |
64 void notifyCompositorAnimationAborted(int groupId) override; | 64 void notifyCompositorAnimationAborted(int groupId) override; |
65 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; | 65 void layerForCompositedScrollingDidChange(CompositorAnimationTimeline*) over
ride; |
66 | 66 |
67 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
68 | 68 |
69 protected: | 69 protected: |
70 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 70 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; |
71 double m_startTime; | 71 double m_startTime; |
72 WTF::TimeFunction m_timeFunction; | 72 WTF::TimeFunction m_timeFunction; |
73 | 73 |
74 private: | 74 private: |
75 // Returns true if the animation was scheduled successfully. If animation | 75 // Returns true if the animation was scheduled successfully. If animation |
76 // could not be scheduled (e.g. because the frame is detached), scrolls | 76 // could not be scheduled (e.g. because the frame is detached), scrolls |
77 // immediately to the target and returns false. | 77 // immediately to the target and returns false. |
78 bool registerAndScheduleAnimation(); | 78 bool registerAndScheduleAnimation(); |
79 | 79 |
80 FloatPoint m_targetOffset; | 80 FloatPoint m_targetOffset; |
81 ScrollGranularity m_lastGranularity; | 81 ScrollGranularity m_lastGranularity; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
85 | 85 |
86 #endif // ScrollAnimator_h | 86 #endif // ScrollAnimator_h |
OLD | NEW |