OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef ScrollAnimatorMac_h | 26 #ifndef ScrollAnimatorMac_h |
27 #define ScrollAnimatorMac_h | 27 #define ScrollAnimatorMac_h |
28 | 28 |
29 #include "platform/Timer.h" | 29 #include "platform/Timer.h" |
30 #include "platform/geometry/FloatPoint.h" | 30 #include "platform/geometry/FloatPoint.h" |
31 #include "platform/geometry/FloatSize.h" | 31 #include "platform/geometry/FloatSize.h" |
32 #include "platform/geometry/IntRect.h" | 32 #include "platform/geometry/IntRect.h" |
33 #include "platform/mac/ScrollElasticityController.h" | |
34 #include "platform/scroll/ScrollAnimator.h" | 33 #include "platform/scroll/ScrollAnimator.h" |
35 #include "wtf/RetainPtr.h" | 34 #include "wtf/RetainPtr.h" |
36 | 35 |
37 OBJC_CLASS WebScrollAnimationHelperDelegate; | 36 OBJC_CLASS WebScrollAnimationHelperDelegate; |
38 OBJC_CLASS WebScrollbarPainterControllerDelegate; | 37 OBJC_CLASS WebScrollbarPainterControllerDelegate; |
39 OBJC_CLASS WebScrollbarPainterDelegate; | 38 OBJC_CLASS WebScrollbarPainterDelegate; |
40 | 39 |
41 typedef id ScrollbarPainterController; | 40 typedef id ScrollbarPainterController; |
42 | 41 |
43 #if !USE(RUBBER_BANDING) | |
44 class ScrollElasticityControllerClient { }; | |
45 #endif | |
46 | |
47 namespace blink { | 42 namespace blink { |
48 | 43 |
49 class Scrollbar; | 44 class Scrollbar; |
50 | 45 |
51 class PLATFORM_EXPORT ScrollAnimatorMac : public ScrollAnimator, private ScrollE
lasticityControllerClient { | 46 class PLATFORM_EXPORT ScrollAnimatorMac : public ScrollAnimator { |
52 | 47 |
53 public: | 48 public: |
54 ScrollAnimatorMac(ScrollableArea*); | 49 ScrollAnimatorMac(ScrollableArea*); |
55 virtual ~ScrollAnimatorMac(); | 50 virtual ~ScrollAnimatorMac(); |
56 | 51 |
57 void immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition)
; | 52 void immediateScrollToPointForScrollAnimation(const FloatPoint& newPosition)
; |
58 bool haveScrolledSincePageLoad() const { return m_haveScrolledSincePageLoad;
} | 53 bool haveScrolledSincePageLoad() const { return m_haveScrolledSincePageLoad;
} |
59 | 54 |
60 void updateScrollerStyle(); | 55 void updateScrollerStyle(); |
61 | 56 |
(...skipping 19 matching lines...) Expand all Loading... |
81 void initialScrollbarPaintTimerFired(Timer<ScrollAnimatorMac>*); | 76 void initialScrollbarPaintTimerFired(Timer<ScrollAnimatorMac>*); |
82 Timer<ScrollAnimatorMac> m_initialScrollbarPaintTimer; | 77 Timer<ScrollAnimatorMac> m_initialScrollbarPaintTimer; |
83 | 78 |
84 void sendContentAreaScrolledTimerFired(Timer<ScrollAnimatorMac>*); | 79 void sendContentAreaScrolledTimerFired(Timer<ScrollAnimatorMac>*); |
85 Timer<ScrollAnimatorMac> m_sendContentAreaScrolledTimer; | 80 Timer<ScrollAnimatorMac> m_sendContentAreaScrolledTimer; |
86 FloatSize m_contentAreaScrolledTimerScrollDelta; | 81 FloatSize m_contentAreaScrolledTimerScrollDelta; |
87 | 82 |
88 virtual ScrollResultOneDimensional scroll(ScrollbarOrientation, ScrollGranul
arity, float step, float delta) override; | 83 virtual ScrollResultOneDimensional scroll(ScrollbarOrientation, ScrollGranul
arity, float step, float delta) override; |
89 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&) override; | 84 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&) override; |
90 | 85 |
91 #if USE(RUBBER_BANDING) | |
92 virtual ScrollResult handleWheelEvent(const PlatformWheelEvent&) override; | |
93 #endif | |
94 | |
95 virtual void handleWheelEventPhase(PlatformWheelEventPhase) override; | 86 virtual void handleWheelEventPhase(PlatformWheelEventPhase) override; |
96 | 87 |
97 virtual void cancelAnimations() override; | 88 virtual void cancelAnimations() override; |
98 virtual void setIsActive() override; | 89 virtual void setIsActive() override; |
99 | 90 |
100 virtual void contentAreaWillPaint() const override; | 91 virtual void contentAreaWillPaint() const override; |
101 virtual void mouseEnteredContentArea() const override; | 92 virtual void mouseEnteredContentArea() const override; |
102 virtual void mouseExitedContentArea() const override; | 93 virtual void mouseExitedContentArea() const override; |
103 virtual void mouseMovedInContentArea() const override; | 94 virtual void mouseMovedInContentArea() const override; |
104 virtual void mouseEnteredScrollbar(Scrollbar*) const override; | 95 virtual void mouseEnteredScrollbar(Scrollbar*) const override; |
(...skipping 15 matching lines...) Expand all Loading... |
120 virtual void willRemoveHorizontalScrollbar(Scrollbar*) override; | 111 virtual void willRemoveHorizontalScrollbar(Scrollbar*) override; |
121 | 112 |
122 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) override; | 113 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) override; |
123 | 114 |
124 virtual void notifyContentAreaScrolled(const FloatSize& delta) override; | 115 virtual void notifyContentAreaScrolled(const FloatSize& delta) override; |
125 | 116 |
126 FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const; | 117 FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const; |
127 | 118 |
128 void immediateScrollTo(const FloatPoint&); | 119 void immediateScrollTo(const FloatPoint&); |
129 | 120 |
130 virtual bool isRubberBandInProgress() const override; | |
131 | |
132 #if USE(RUBBER_BANDING) | |
133 /// ScrollElasticityControllerClient member functions. | |
134 virtual IntSize stretchAmount() override; | |
135 virtual bool allowsHorizontalStretching() override; | |
136 virtual bool allowsVerticalStretching() override; | |
137 virtual bool pinnedInDirection(const FloatSize&) override; | |
138 virtual bool canScrollHorizontally() override; | |
139 virtual bool canScrollVertically() override; | |
140 virtual IntPoint absoluteScrollPosition() override; | |
141 virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&
) override; | |
142 virtual void immediateScrollBy(const FloatSize&) override; | |
143 virtual void startSnapRubberbandTimer() override; | |
144 virtual void stopSnapRubberbandTimer() override; | |
145 virtual void adjustScrollPositionToBoundsIfNecessary() override; | |
146 | |
147 bool pinnedInDirection(float deltaX, float deltaY); | |
148 void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*); | |
149 | |
150 ScrollElasticityController m_scrollElasticityController; | |
151 Timer<ScrollAnimatorMac> m_snapRubberBandTimer; | |
152 #endif | |
153 | |
154 bool m_haveScrolledSincePageLoad; | 121 bool m_haveScrolledSincePageLoad; |
155 bool m_needsScrollerStyleUpdate; | 122 bool m_needsScrollerStyleUpdate; |
156 IntRect m_visibleScrollerThumbRect; | 123 IntRect m_visibleScrollerThumbRect; |
157 }; | 124 }; |
158 | 125 |
159 } // namespace blink | 126 } // namespace blink |
160 | 127 |
161 #endif // ScrollAnimatorMac_h | 128 #endif // ScrollAnimatorMac_h |
OLD | NEW |