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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { | 102 enum ScrollInputType { |
103 TOUCHSCREEN, | 103 TOUCHSCREEN, |
104 WHEEL, | 104 WHEEL, |
105 NON_BUBBLING_GESTURE | 105 NON_BUBBLING_GESTURE |
106 }; | 106 }; |
107 | 107 |
108 enum TouchEventDisposition { | |
bokan
2016/11/17 15:39:28
This looks unused?
lanwei
2016/11/18 00:54:07
Acknowledged.
| |
109 HANDLE, | |
110 NOT_HANDLE, | |
111 NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING | |
112 }; | |
113 | |
108 // Binds a client to this handler to receive notifications. Only one client | 114 // Binds a client to this handler to receive notifications. Only one client |
109 // can be bound to an InputHandler. The client must live at least until the | 115 // can be bound to an InputHandler. The client must live at least until the |
110 // handler calls WillShutdown() on the client. | 116 // handler calls WillShutdown() on the client. |
111 virtual void BindToClient(InputHandlerClient* client) = 0; | 117 virtual void BindToClient(InputHandlerClient* client) = 0; |
112 | 118 |
113 // Selects a layer to be scrolled using the |scroll_state| start position. | 119 // Selects a layer to be scrolled using the |scroll_state| start position. |
114 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, | 120 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, |
115 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to | 121 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to |
116 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at | 122 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at |
117 // the given coordinates. | 123 // the given coordinates. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 // Returns true if there is an active scroll on the viewport. | 187 // Returns true if there is an active scroll on the viewport. |
182 virtual bool IsCurrentlyScrollingViewport() const = 0; | 188 virtual bool IsCurrentlyScrollingViewport() const = 0; |
183 | 189 |
184 // Whether the layer under |viewport_point| is the currently scrolling layer. | 190 // Whether the layer under |viewport_point| is the currently scrolling layer. |
185 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 191 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
186 ScrollInputType type) const = 0; | 192 ScrollInputType type) const = 0; |
187 | 193 |
188 virtual EventListenerProperties GetEventListenerProperties( | 194 virtual EventListenerProperties GetEventListenerProperties( |
189 EventListenerClass event_class) const = 0; | 195 EventListenerClass event_class) const = 0; |
190 | 196 |
191 // Whether the page should be given the opportunity to suppress scrolling by | 197 // It returns the type of event listener at the given viewport point. Such as |
192 // consuming touch events that started at |viewport_point|. | 198 // if the page has a touch handler or not, and whether the page should |
193 virtual bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_point) = 0; | 199 // suppress scrolling by consuming touch events that started at |
200 // |viewport_point|. | |
201 virtual EventListenerProperties EventListenerTypeForTouchStartAt( | |
202 const gfx::Point& viewport_point) = 0; | |
194 | 203 |
195 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped | 204 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
196 // LatencyInfoSwapPromiseMonitor. During the life time of the | 205 // LatencyInfoSwapPromiseMonitor. During the life time of the |
197 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() | 206 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() |
198 // is called on LayerTreeHostImpl, the original latency info will be turned | 207 // is called on LayerTreeHostImpl, the original latency info will be turned |
199 // into a LatencyInfoSwapPromise. | 208 // into a LatencyInfoSwapPromise. |
200 virtual std::unique_ptr<SwapPromiseMonitor> | 209 virtual std::unique_ptr<SwapPromiseMonitor> |
201 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; | 210 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; |
202 | 211 |
203 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; | 212 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; |
204 | 213 |
205 // Called by the single-threaded UI Compositor to get or set the scroll offset | 214 // Called by the single-threaded UI Compositor to get or set the scroll offset |
206 // on the impl side. Retruns false if |layer_id| isn't in the active tree. | 215 // on the impl side. Retruns false if |layer_id| isn't in the active tree. |
207 virtual bool GetScrollOffsetForLayer(int layer_id, | 216 virtual bool GetScrollOffsetForLayer(int layer_id, |
208 gfx::ScrollOffset* offset) = 0; | 217 gfx::ScrollOffset* offset) = 0; |
209 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; | 218 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; |
210 | 219 |
211 protected: | 220 protected: |
212 InputHandler() {} | 221 InputHandler() {} |
213 virtual ~InputHandler() {} | 222 virtual ~InputHandler() {} |
214 | 223 |
215 private: | 224 private: |
216 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 225 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
217 }; | 226 }; |
218 | 227 |
219 } // namespace cc | 228 } // namespace cc |
220 | 229 |
221 #endif // CC_INPUT_INPUT_HANDLER_H_ | 230 #endif // CC_INPUT_INPUT_HANDLER_H_ |
OLD | NEW |