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 #ifndef ProgrammaticScrollAnimator_h | 5 #ifndef ProgrammaticScrollAnimator_h |
6 #define ProgrammaticScrollAnimator_h | 6 #define ProgrammaticScrollAnimator_h |
7 | 7 |
8 #include "platform/geometry/FloatPoint.h" | 8 #include "platform/geometry/FloatPoint.h" |
9 #include "wtf/FastAllocBase.h" | 9 #include "wtf/FastAllocBase.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); | 22 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); |
23 WTF_MAKE_FAST_ALLOCATED; | 23 WTF_MAKE_FAST_ALLOCATED; |
24 public: | 24 public: |
25 static PassOwnPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); | 25 static PassOwnPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); |
26 | 26 |
27 ~ProgrammaticScrollAnimator(); | 27 ~ProgrammaticScrollAnimator(); |
28 | 28 |
29 void animateToOffset(FloatPoint); | 29 void animateToOffset(FloatPoint); |
30 void cancelAnimation(); | 30 void cancelAnimation(); |
31 void tickAnimation(double monotonicTime); | 31 void tickAnimation(double monotonicTime); |
32 bool hasRunningAnimation() const; | 32 bool hasAnimationThatRequiresService() const; |
| 33 void updateCompositorAnimations(); |
| 34 void notifyCompositorAnimationFinished(int groupId); |
33 | 35 |
34 private: | 36 private: |
35 explicit ProgrammaticScrollAnimator(ScrollableArea*); | 37 explicit ProgrammaticScrollAnimator(ScrollableArea*); |
36 | 38 |
| 39 enum class RunState { |
| 40 // No animation. |
| 41 Idle, |
| 42 |
| 43 // Waiting to send an animation to the compositor. There might also |
| 44 // already be another animation running on the compositor that will need |
| 45 // to be canceled first. |
| 46 WaitingToSendToCompositor, |
| 47 |
| 48 // Running an animation on the compositor. |
| 49 RunningOnCompositor, |
| 50 |
| 51 // Running an animation on the main thread. |
| 52 RunningOnMainThread, |
| 53 |
| 54 // Waiting to cancel the animation currently running on the compositor. |
| 55 // There is no pending animation to replace the canceled animation. |
| 56 WaitingToCancelOnCompositor |
| 57 }; |
| 58 |
37 void resetAnimationState(); | 59 void resetAnimationState(); |
38 | 60 |
39 ScrollableArea* m_scrollableArea; | 61 ScrollableArea* m_scrollableArea; |
40 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; | 62 OwnPtr<WebScrollOffsetAnimationCurve> m_animationCurve; |
41 FloatPoint m_targetOffset; | 63 FloatPoint m_targetOffset; |
42 double m_startTime; | 64 double m_startTime; |
| 65 RunState m_runState; |
| 66 int m_compositorAnimationId; |
| 67 int m_compositorAnimationGroupId; |
43 }; | 68 }; |
44 | 69 |
45 } // namespace blink | 70 } // namespace blink |
46 | 71 |
47 #endif // ProgrammaticScrollAnimator_h | 72 #endif // ProgrammaticScrollAnimator_h |
OLD | NEW |