OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 5 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
7 | 7 |
8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // DidResize expects to be called when clip layer size changed or scroll layer | 75 // DidResize expects to be called when clip layer size changed or scroll layer |
76 // size changed. | 76 // size changed. |
77 void DidResize(); | 77 void DidResize(); |
78 | 78 |
79 void DidScrollBegin(); | 79 void DidScrollBegin(); |
80 void DidScrollEnd(); | 80 void DidScrollEnd(); |
81 | 81 |
82 void DidMouseDown(); | 82 void DidMouseDown(); |
83 void DidMouseUp(); | 83 void DidMouseUp(); |
84 void DidMouseLeave(); | 84 void DidMouseLeave(); |
85 void DidMouseMoveNear(ScrollbarOrientation, float); | 85 void DidMouseMoveNear(ScrollbarOrientation orientation, |
| 86 const gfx::PointF& device_viewport_point); |
86 | 87 |
87 // Called when Blink wants to show the scrollbars (via | 88 // Called when Blink wants to show the scrollbars (via |
88 // ScrollableArea::showOverlayScrollbars). | 89 // ScrollableArea::showOverlayScrollbars). |
89 void DidRequestShowFromMainThread(); | 90 void DidRequestShowFromMainThread(); |
90 | 91 |
91 bool MouseIsOverScrollbar(ScrollbarOrientation orientation) const; | 92 bool MouseIsOverScrollbarThumb(ScrollbarOrientation orientation) const; |
| 93 bool MouseIsNearScrollbarThumb(ScrollbarOrientation orientation) const; |
92 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const; | 94 bool MouseIsNearScrollbar(ScrollbarOrientation orientation) const; |
93 bool MouseIsNearAnyScrollbar() const; | 95 bool MouseIsNearAnyScrollbar() const; |
94 | 96 |
95 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f; | 97 static constexpr float kMouseMoveDistanceToTriggerFadeIn = 30.0f; |
96 | 98 |
97 private: | 99 private: |
98 // Describes whether the current animation should FadeIn or FadeOut. | 100 // Describes whether the current animation should FadeIn or FadeOut. |
99 enum AnimationChange { NONE, FADE_IN, FADE_OUT }; | 101 enum AnimationChange { NONE, FADE_IN, FADE_OUT }; |
100 | 102 |
101 ScrollbarAnimationController(ElementId scroll_element_id, | 103 ScrollbarAnimationController(ElementId scroll_element_id, |
102 ScrollbarAnimationControllerClient* client, | 104 ScrollbarAnimationControllerClient* client, |
103 base::TimeDelta fade_delay, | 105 base::TimeDelta fade_delay, |
104 base::TimeDelta fade_out_resize_delay, | 106 base::TimeDelta fade_out_resize_delay, |
105 base::TimeDelta fade_duration); | 107 base::TimeDelta fade_duration); |
106 | 108 |
107 ScrollbarAnimationController(ElementId scroll_element_id, | 109 ScrollbarAnimationController(ElementId scroll_element_id, |
108 ScrollbarAnimationControllerClient* client, | 110 ScrollbarAnimationControllerClient* client, |
109 base::TimeDelta fade_delay, | 111 base::TimeDelta fade_delay, |
110 base::TimeDelta fade_out_resize_delay, | 112 base::TimeDelta fade_out_resize_delay, |
111 base::TimeDelta fade_duration, | 113 base::TimeDelta fade_duration, |
112 base::TimeDelta thinning_duration); | 114 base::TimeDelta thinning_duration); |
113 | 115 |
114 ScrollbarSet Scrollbars() const; | 116 ScrollbarSet Scrollbars() const; |
| 117 ScrollbarLayerImplBase* GetScrollbar(ScrollbarOrientation orientation) const; |
115 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController( | 118 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController( |
116 ScrollbarOrientation) const; | 119 ScrollbarOrientation) const; |
117 | 120 |
118 // Returns how far through the animation we are as a progress value from | 121 // Returns how far through the animation we are as a progress value from |
119 // 0 to 1. | 122 // 0 to 1. |
120 float AnimationProgressAtTime(base::TimeTicks now); | 123 float AnimationProgressAtTime(base::TimeTicks now); |
121 void RunAnimationFrame(float progress); | 124 void RunAnimationFrame(float progress); |
122 | 125 |
123 void StartAnimation(); | 126 void StartAnimation(); |
124 void StopAnimation(); | 127 void StopAnimation(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 vertical_controller_; | 165 vertical_controller_; |
163 std::unique_ptr<SingleScrollbarAnimationControllerThinning> | 166 std::unique_ptr<SingleScrollbarAnimationControllerThinning> |
164 horizontal_controller_; | 167 horizontal_controller_; |
165 | 168 |
166 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; | 169 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; |
167 }; | 170 }; |
168 | 171 |
169 } // namespace cc | 172 } // namespace cc |
170 | 173 |
171 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 174 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
OLD | NEW |