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 16 matching lines...) Expand all Loading... |
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/geometry/FloatPoint.h" | 35 #include "platform/geometry/FloatPoint.h" |
36 #include "platform/scroll/ScrollAnimatorBase.h" | 36 #include "platform/scroll/ScrollAnimatorBase.h" |
| 37 #include "public/platform/WebCompositorAnimationDelegate.h" |
| 38 #include "public/platform/WebCompositorAnimationPlayerClient.h" |
37 #include "public/platform/WebScrollOffsetAnimationCurve.h" | 39 #include "public/platform/WebScrollOffsetAnimationCurve.h" |
38 | 40 |
39 namespace blink { | 41 namespace blink { |
40 | 42 |
41 class ScrollAnimatorTest; | 43 class ScrollAnimatorTest; |
| 44 class WebCompositorAnimationTimeline; |
42 | 45 |
43 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { | 46 class PLATFORM_EXPORT ScrollAnimator final : public ScrollAnimatorBase { |
44 public: | 47 public: |
45 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); | 48 explicit ScrollAnimator(ScrollableArea*, WTF::TimeFunction = WTF::monotonica
llyIncreasingTime); |
46 ~ScrollAnimator() override; | 49 ~ScrollAnimator() override; |
47 | 50 |
48 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; | 51 float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const ov
erride; |
49 | 52 |
50 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; | 53 ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGranularit
y, float step, float delta) override; |
51 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; | 54 void scrollToOffsetWithoutAnimation(const FloatPoint&) override; |
52 | 55 |
53 void cancelAnimations() override; | 56 // ScrollAnimatorCompositorCoordinator implementation. |
54 void serviceScrollAnimations() override; | 57 void tickAnimation(double monotonicTime) override; |
55 bool hasRunningAnimation() const override; | 58 void cancelAnimation() override; |
| 59 void resetAnimationState() override; |
| 60 void updateCompositorAnimations() override; |
| 61 void notifyCompositorAnimationFinished(int groupId) override; |
| 62 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride; |
56 | 63 |
57 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
58 | 65 |
59 protected: | 66 protected: |
60 void animationTimerFired(); | |
61 | |
62 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 67 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; |
| 68 double m_lastTickTime; |
63 double m_startTime; | 69 double m_startTime; |
64 WTF::TimeFunction m_timeFunction; | 70 WTF::TimeFunction m_timeFunction; |
| 71 |
65 private: | 72 private: |
66 FloatPoint desiredTargetPosition() const; | 73 FloatPoint desiredTargetPosition() const; |
| 74 |
| 75 FloatPoint m_targetOffset; |
67 }; | 76 }; |
68 | 77 |
69 } // namespace blink | 78 } // namespace blink |
70 | 79 |
71 #endif // ScrollAnimator_h | 80 #endif // ScrollAnimator_h |
OLD | NEW |