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 15 matching lines...) Expand all Loading... | |
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 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/FloatPoint.h" | |
36 #include "platform/geometry/FloatSize.h" | 37 #include "platform/geometry/FloatSize.h" |
37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
38 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" | 39 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" |
39 #include "platform/scroll/ScrollTypes.h" | 40 #include "platform/scroll/ScrollTypes.h" |
40 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class FloatPoint; | |
45 class ScrollableArea; | 45 class ScrollableArea; |
46 class Scrollbar; | 46 class Scrollbar; |
47 class WebCompositorAnimationTimeline; | 47 class WebCompositorAnimationTimeline; |
48 | 48 |
49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi nator { | 49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi nator { |
50 public: | 50 public: |
51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); | 51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); |
52 | 52 |
53 virtual ~ScrollAnimatorBase(); | 53 virtual ~ScrollAnimatorBase(); |
54 | 54 |
55 virtual void dispose() { } | 55 virtual void dispose() { } |
56 | 56 |
57 // Computes a scroll destination for the given parameters. The returned | 57 // Computes a scroll destination for the given parameters. The returned |
58 // ScrollResultOneDimensional will have didScroll set to false if already at | 58 // ScrollResultOneDimensional will have didScroll set to false if already at |
59 // the destination. Otherwise, starts scrolling towards the destination and | 59 // the destination. Otherwise, starts scrolling towards the destination and |
60 // didScroll is true. Scrolling may be immediate or animated. The base | 60 // didScroll is true. Scrolling may be immediate or animated. The base |
61 // class implementation always scrolls immediately, never animates. | 61 // class implementation always scrolls immediately, never animates. |
62 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr anularity, float step, float delta); | 62 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr anularity, float step, float delta); |
63 | 63 |
64 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); | 64 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); |
65 | 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 virtual FloatPoint desiredTargetPosition() const { return currentPosition(); } | |
jbroman
2016/01/19 22:39:12
It's not obvious to me why this definition makes s
skobes
2016/01/19 23:44:14
The bug is specific to the non-Mac scroll animator
| |
74 | 75 |
75 // Returns how much of pixelDelta will be used by the underlying scrollable | 76 // Returns how much of pixelDelta will be used by the underlying scrollable |
76 // area. | 77 // area. |
77 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const; | 78 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta) const; |
78 | 79 |
79 | 80 |
80 // ScrollAnimatorCompositorCoordinator implementation. | 81 // ScrollAnimatorCompositorCoordinator implementation. |
81 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } | 82 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } |
82 void tickAnimation(double monotonicTime) override { }; | 83 void tickAnimation(double monotonicTime) override { }; |
83 void cancelAnimation() override { } | 84 void cancelAnimation() override { } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 float clampScrollPosition(ScrollbarOrientation, float) const; | 123 float clampScrollPosition(ScrollbarOrientation, float) const; |
123 | 124 |
124 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 125 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
125 float m_currentPosX; // We avoid using a FloatPoint in order to reduce | 126 float m_currentPosX; // We avoid using a FloatPoint in order to reduce |
126 float m_currentPosY; // subclass code complexity. | 127 float m_currentPosY; // subclass code complexity. |
127 }; | 128 }; |
128 | 129 |
129 } // namespace blink | 130 } // namespace blink |
130 | 131 |
131 #endif // ScrollAnimatorBase_h | 132 #endif // ScrollAnimatorBase_h |
OLD | NEW |