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 "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" | 10 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
14 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class ScrollableArea; | 18 class ScrollableArea; |
19 class CompositorAnimationTimeline; | 19 class CompositorAnimationTimeline; |
20 class CompositorScrollOffsetAnimationCurve; | 20 class CompositorScrollOffsetAnimationCurve; |
21 | 21 |
22 // Animator for fixed-destination scrolls, such as those triggered by | 22 // Animator for fixed-destination scrolls, such as those triggered by |
23 // CSSOM View scroll APIs. | 23 // CSSOM View scroll APIs. |
24 class ProgrammaticScrollAnimator : public ScrollAnimatorCompositorCoordinator { | 24 class ProgrammaticScrollAnimator : public ScrollAnimatorCompositorCoordinator { |
25 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); | 25 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); |
26 public: | 26 public: |
27 static RawPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); | 27 static ProgrammaticScrollAnimator* create(ScrollableArea* scrollableArea) |
| 28 { |
| 29 return new ProgrammaticScrollAnimator(scrollableArea); |
| 30 } |
28 | 31 |
29 virtual ~ProgrammaticScrollAnimator(); | 32 virtual ~ProgrammaticScrollAnimator(); |
30 | 33 |
31 void scrollToOffsetWithoutAnimation(const FloatPoint&); | 34 void scrollToOffsetWithoutAnimation(const FloatPoint&); |
32 void animateToOffset(FloatPoint); | 35 void animateToOffset(FloatPoint); |
33 | 36 |
34 // ScrollAnimatorCompositorCoordinator implementation. | 37 // ScrollAnimatorCompositorCoordinator implementation. |
35 void resetAnimationState() override; | 38 void resetAnimationState() override; |
36 void cancelAnimation() override; | 39 void cancelAnimation() override; |
37 void takeoverCompositorAnimation() override { }; | 40 void takeoverCompositorAnimation() override { }; |
(...skipping 13 matching lines...) Expand all Loading... |
51 | 54 |
52 Member<ScrollableArea> m_scrollableArea; | 55 Member<ScrollableArea> m_scrollableArea; |
53 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; | 56 OwnPtr<CompositorScrollOffsetAnimationCurve> m_animationCurve; |
54 FloatPoint m_targetOffset; | 57 FloatPoint m_targetOffset; |
55 double m_startTime; | 58 double m_startTime; |
56 }; | 59 }; |
57 | 60 |
58 } // namespace blink | 61 } // namespace blink |
59 | 62 |
60 #endif // ProgrammaticScrollAnimator_h | 63 #endif // ProgrammaticScrollAnimator_h |
OLD | NEW |