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 TouchStartHitResult { HANDLER, SAME_LAYER, DIFFERENT_LAYER }; | |
tdresser
2016/11/04 17:15:20
These names aren't clear to me. Same layer as what
| |
109 | |
108 // 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 |
109 // 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 |
110 // handler calls WillShutdown() on the client. | 112 // handler calls WillShutdown() on the client. |
111 virtual void BindToClient(InputHandlerClient* client) = 0; | 113 virtual void BindToClient(InputHandlerClient* client) = 0; |
112 | 114 |
113 // 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. |
114 // 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, |
115 // 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 |
116 // 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 |
117 // the given coordinates. | 119 // the given coordinates. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 virtual bool IsCurrentlyScrollingViewport() const = 0; | 184 virtual bool IsCurrentlyScrollingViewport() const = 0; |
183 | 185 |
184 // Whether the layer under |viewport_point| is the currently scrolling layer. | 186 // Whether the layer under |viewport_point| is the currently scrolling layer. |
185 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 187 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
186 ScrollInputType type) const = 0; | 188 ScrollInputType type) const = 0; |
187 | 189 |
188 virtual EventListenerProperties GetEventListenerProperties( | 190 virtual EventListenerProperties GetEventListenerProperties( |
189 EventListenerClass event_class) const = 0; | 191 EventListenerClass event_class) const = 0; |
190 | 192 |
191 // Whether the page should be given the opportunity to suppress scrolling by | 193 // Whether the page should be given the opportunity to suppress scrolling by |
192 // consuming touch events that started at |viewport_point|. | 194 // consuming touch events that started at |viewport_point|. |
tdresser
2016/11/04 17:15:20
Update this comment.
lanwei
2016/11/11 18:22:45
Done.
| |
193 virtual bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_point) = 0; | 195 virtual TouchStartHitResult DoTouchEventsBlockScrollAt( |
196 const gfx::Point& viewport_point) = 0; | |
194 | 197 |
195 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped | 198 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
196 // LatencyInfoSwapPromiseMonitor. During the life time of the | 199 // LatencyInfoSwapPromiseMonitor. During the life time of the |
197 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() | 200 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() |
198 // is called on LayerTreeHostImpl, the original latency info will be turned | 201 // is called on LayerTreeHostImpl, the original latency info will be turned |
199 // into a LatencyInfoSwapPromise. | 202 // into a LatencyInfoSwapPromise. |
200 virtual std::unique_ptr<SwapPromiseMonitor> | 203 virtual std::unique_ptr<SwapPromiseMonitor> |
201 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; | 204 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; |
202 | 205 |
203 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; | 206 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; |
204 | 207 |
205 // Called by the single-threaded UI Compositor to get or set the scroll offset | 208 // 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. | 209 // on the impl side. Retruns false if |layer_id| isn't in the active tree. |
207 virtual bool GetScrollOffsetForLayer(int layer_id, | 210 virtual bool GetScrollOffsetForLayer(int layer_id, |
208 gfx::ScrollOffset* offset) = 0; | 211 gfx::ScrollOffset* offset) = 0; |
209 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; | 212 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; |
210 | 213 |
211 protected: | 214 protected: |
212 InputHandler() {} | 215 InputHandler() {} |
213 virtual ~InputHandler() {} | 216 virtual ~InputHandler() {} |
214 | 217 |
215 private: | 218 private: |
216 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 219 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
217 }; | 220 }; |
218 | 221 |
219 } // namespace cc | 222 } // namespace cc |
220 | 223 |
221 #endif // CC_INPUT_INPUT_HANDLER_H_ | 224 #endif // CC_INPUT_INPUT_HANDLER_H_ |
OLD | NEW |