OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_INPUT_HANDLER_H_ | 5 #ifndef CC_INPUT_INPUT_HANDLER_H_ |
6 #define CC_INPUT_INPUT_HANDLER_H_ | 6 #define CC_INPUT_INPUT_HANDLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 : thread(SCROLL_ON_IMPL_THREAD), | 92 : thread(SCROLL_ON_IMPL_THREAD), |
93 main_thread_scrolling_reasons( | 93 main_thread_scrolling_reasons( |
94 MainThreadScrollingReason::kNotScrollingOnMain) {} | 94 MainThreadScrollingReason::kNotScrollingOnMain) {} |
95 ScrollStatus(ScrollThread thread, uint32_t main_thread_scrolling_reasons) | 95 ScrollStatus(ScrollThread thread, uint32_t main_thread_scrolling_reasons) |
96 : thread(thread), | 96 : thread(thread), |
97 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} | 97 main_thread_scrolling_reasons(main_thread_scrolling_reasons) {} |
98 ScrollThread thread; | 98 ScrollThread thread; |
99 uint32_t main_thread_scrolling_reasons; | 99 uint32_t main_thread_scrolling_reasons; |
100 }; | 100 }; |
101 | 101 |
102 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; | 102 enum ScrollInputType { |
103 GESTURE, // TODO(dtapuska): Remove this and just use TOUCHSCREEN. | |
tdresser
2016/03/08 14:28:52
I'm a fan of giving TODOs associated bugs and refe
dtapuska
2016/03/08 20:31:49
Done.
| |
104 TOUCHSCREEN = GESTURE, | |
105 WHEEL, | |
106 ANIMATED_WHEEL, | |
107 NON_BUBBLING_GESTURE | |
108 }; | |
103 | 109 |
104 // Binds a client to this handler to receive notifications. Only one client | 110 // Binds a client to this handler to receive notifications. Only one client |
105 // can be bound to an InputHandler. The client must live at least until the | 111 // can be bound to an InputHandler. The client must live at least until the |
106 // handler calls WillShutdown() on the client. | 112 // handler calls WillShutdown() on the client. |
107 virtual void BindToClient(InputHandlerClient* client) = 0; | 113 virtual void BindToClient(InputHandlerClient* client) = 0; |
108 | 114 |
109 // Selects a layer to be scrolled using the |scroll_state| start position. | 115 // Selects a layer to be scrolled using the |scroll_state| start position. |
110 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, | 116 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, |
111 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to | 117 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to |
112 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at | 118 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at |
113 // the given coordinates. | 119 // the given coordinates. |
114 virtual ScrollStatus ScrollBegin(ScrollState* scroll_state, | 120 virtual ScrollStatus ScrollBegin(ScrollState* scroll_state, |
115 ScrollInputType type) = 0; | 121 ScrollInputType type) = 0; |
116 | 122 |
117 // Similar to ScrollBegin, except the hit test is skipped and scroll always | 123 // Similar to ScrollBegin, except the hit test is skipped and scroll always |
118 // targets at the root layer. | 124 // targets at the root layer. |
119 virtual ScrollStatus RootScrollBegin(ScrollState* scroll_state, | 125 virtual ScrollStatus RootScrollBegin(ScrollState* scroll_state, |
120 ScrollInputType type) = 0; | 126 ScrollInputType type) = 0; |
127 | |
128 // Returns SCROLL_ON_IMPL_THREAD if a layer is actively being scrolled or | |
129 // a subsequent call to ScrollAnimated can begin on the impl thread. | |
130 virtual ScrollStatus ScrollAnimatedBegin( | |
131 const gfx::Point& viewport_point) = 0; | |
132 | |
121 virtual ScrollStatus ScrollAnimated(const gfx::Point& viewport_point, | 133 virtual ScrollStatus ScrollAnimated(const gfx::Point& viewport_point, |
122 const gfx::Vector2dF& scroll_delta) = 0; | 134 const gfx::Vector2dF& scroll_delta) = 0; |
123 | 135 |
124 // Scroll the layer selected by |ScrollBegin| by given |scroll_state| delta. | 136 // Scroll the layer selected by |ScrollBegin| by given |scroll_state| delta. |
125 // Internally, the delta is transformed to local layer's coordinate space for | 137 // Internally, the delta is transformed to local layer's coordinate space for |
126 // scrolls gestures that are direct manipulation (e.g. touch). If there is no | 138 // scrolls gestures that are direct manipulation (e.g. touch). If there is no |
127 // room to move the layer in the requested direction, its first ancestor layer | 139 // room to move the layer in the requested direction, its first ancestor layer |
128 // that can be scrolled will be moved instead. The return value's |did_scroll| | 140 // that can be scrolled will be moved instead. The return value's |did_scroll| |
129 // field is set to false if no layer can be moved in the requested direction | 141 // field is set to false if no layer can be moved in the requested direction |
130 // at all, and set to true if any layer is moved. If the scroll delta hits the | 142 // at all, and set to true if any layer is moved. If the scroll delta hits the |
131 // root layer, and the layer can no longer move, the root overscroll | 143 // root layer, and the layer can no longer move, the root overscroll |
132 // accumulated within this ScrollBegin() scope is reported in the return | 144 // accumulated within this ScrollBegin() scope is reported in the return |
133 // value's |accumulated_overscroll| field. Should only be called if | 145 // value's |accumulated_overscroll| field. Should only be called if |
134 // ScrollBegin() returned SCROLL_STARTED. | 146 // ScrollBegin() returned SCROLL_STARTED. |
135 virtual InputHandlerScrollResult ScrollBy(ScrollState* scroll_state) = 0; | 147 virtual InputHandlerScrollResult ScrollBy(ScrollState* scroll_state) = 0; |
136 | 148 |
137 virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point, | 149 virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point, |
138 ScrollDirection direction) = 0; | 150 ScrollDirection direction) = 0; |
139 | 151 |
140 // Returns SCROLL_STARTED if a layer was being actively being scrolled, | 152 // Returns SCROLL_STARTED if a layer was actively being scrolled, |
141 // SCROLL_IGNORED if not. | 153 // SCROLL_IGNORED if not. |
142 virtual ScrollStatus FlingScrollBegin() = 0; | 154 virtual ScrollStatus FlingScrollBegin() = 0; |
143 | 155 |
144 virtual void MouseMoveAt(const gfx::Point& mouse_position) = 0; | 156 virtual void MouseMoveAt(const gfx::Point& mouse_position) = 0; |
145 | 157 |
146 // Stop scrolling the selected layer. Should only be called if ScrollBegin() | 158 // Stop scrolling the selected layer. Should only be called if ScrollBegin() |
147 // returned SCROLL_STARTED. | 159 // returned SCROLL_STARTED. |
148 virtual void ScrollEnd(ScrollState* scroll_state) = 0; | 160 virtual void ScrollEnd(ScrollState* scroll_state) = 0; |
149 | 161 |
150 // Requests a callback to UpdateRootLayerStateForSynchronousInputHandler() | 162 // Requests a callback to UpdateRootLayerStateForSynchronousInputHandler() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 InputHandler() {} | 204 InputHandler() {} |
193 virtual ~InputHandler() {} | 205 virtual ~InputHandler() {} |
194 | 206 |
195 private: | 207 private: |
196 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 208 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
197 }; | 209 }; |
198 | 210 |
199 } // namespace cc | 211 } // namespace cc |
200 | 212 |
201 #endif // CC_INPUT_INPUT_HANDLER_H_ | 213 #endif // CC_INPUT_INPUT_HANDLER_H_ |
OLD | NEW |