OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 17 matching lines...) Expand all Loading... |
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 ScrollAnimatorBase_h | 31 #ifndef ScrollAnimatorBase_h |
32 #define ScrollAnimatorBase_h | 32 #define ScrollAnimatorBase_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/PlatformWheelEvent.h" | 35 #include "platform/PlatformWheelEvent.h" |
36 #include "platform/geometry/FloatSize.h" | 36 #include "platform/geometry/FloatSize.h" |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" | |
39 #include "platform/scroll/ScrollTypes.h" | 38 #include "platform/scroll/ScrollTypes.h" |
40 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
41 | 40 |
42 namespace blink { | 41 namespace blink { |
43 | 42 |
44 class FloatPoint; | 43 class FloatPoint; |
45 class ScrollableArea; | 44 class ScrollableArea; |
46 class Scrollbar; | 45 class Scrollbar; |
47 class WebCompositorAnimationTimeline; | |
48 | 46 |
49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi
nator { | 47 class PLATFORM_EXPORT ScrollAnimatorBase : public NoBaseWillBeGarbageCollectedFi
nalized<ScrollAnimatorBase> { |
50 public: | 48 public: |
51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); | 49 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); |
52 | 50 |
53 virtual ~ScrollAnimatorBase(); | 51 virtual ~ScrollAnimatorBase(); |
54 | 52 |
55 virtual void dispose() { } | 53 virtual void dispose() { } |
56 | 54 |
57 // Computes a scroll destination for the given parameters. The returned | 55 // Computes a scroll destination for the given parameters. The returned |
58 // ScrollResultOneDimensional will have didScroll set to false if already at | 56 // ScrollResultOneDimensional will have didScroll set to false if already at |
59 // the destination. Otherwise, starts scrolling towards the destination and | 57 // the destination. Otherwise, starts scrolling towards the destination and |
60 // didScroll is true. Scrolling may be immediate or animated. The base | 58 // didScroll is true. Scrolling may be immediate or animated. The base |
61 // class implementation always scrolls immediately, never animates. | 59 // class implementation always scrolls immediately, never animates. |
62 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); | 60 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); |
63 | 61 |
64 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); | 62 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); |
65 | 63 |
| 64 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
| 65 |
66 virtual void setIsActive() { } | 66 virtual void setIsActive() { } |
67 | 67 |
68 #if OS(MACOSX) | 68 #if OS(MACOSX) |
69 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { } | 69 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { } |
70 #endif | 70 #endif |
71 | 71 |
72 void setCurrentPosition(const FloatPoint&); | 72 void setCurrentPosition(const FloatPoint&); |
73 FloatPoint currentPosition() const; | 73 FloatPoint currentPosition() const; |
74 | 74 |
75 // Returns how much of pixelDelta will be used by the underlying scrollable | 75 // Returns how much of pixelDelta will be used by the underlying scrollable |
76 // area. | 76 // area. |
77 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta)
const; | 77 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta)
const; |
78 | 78 |
79 | 79 virtual void cancelAnimations() { } |
80 // ScrollAnimatorCompositorCoordinator implementation. | 80 virtual void serviceScrollAnimations() { } |
81 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } | 81 virtual bool hasRunningAnimation() const { return false; } |
82 void tickAnimation(double monotonicTime) override { }; | |
83 void cancelAnimation() override { } | |
84 void updateCompositorAnimations() override { }; | |
85 void notifyCompositorAnimationFinished(int groupId) override { }; | |
86 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride { }; | |
87 | 82 |
88 virtual void contentAreaWillPaint() const { } | 83 virtual void contentAreaWillPaint() const { } |
89 virtual void mouseEnteredContentArea() const { } | 84 virtual void mouseEnteredContentArea() const { } |
90 virtual void mouseExitedContentArea() const { } | 85 virtual void mouseExitedContentArea() const { } |
91 virtual void mouseMovedInContentArea() const { } | 86 virtual void mouseMovedInContentArea() const { } |
92 virtual void mouseEnteredScrollbar(Scrollbar&) const { } | 87 virtual void mouseEnteredScrollbar(Scrollbar&) const { } |
93 virtual void mouseExitedScrollbar(Scrollbar&) const { } | 88 virtual void mouseExitedScrollbar(Scrollbar&) const { } |
94 virtual void willStartLiveResize() { } | 89 virtual void willStartLiveResize() { } |
95 virtual void updateAfterLayout() { } | 90 virtual void updateAfterLayout() { } |
96 virtual void contentsResized() const { } | 91 virtual void contentsResized() const { } |
(...skipping 24 matching lines...) Expand all Loading... |
121 float clampScrollPosition(ScrollbarOrientation, float) const; | 116 float clampScrollPosition(ScrollbarOrientation, float) const; |
122 | 117 |
123 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 118 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
124 float m_currentPosX; // We avoid using a FloatPoint in order to reduce | 119 float m_currentPosX; // We avoid using a FloatPoint in order to reduce |
125 float m_currentPosY; // subclass code complexity. | 120 float m_currentPosY; // subclass code complexity. |
126 }; | 121 }; |
127 | 122 |
128 } // namespace blink | 123 } // namespace blink |
129 | 124 |
130 #endif // ScrollAnimatorBase_h | 125 #endif // ScrollAnimatorBase_h |
OLD | NEW |