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