Chromium Code Reviews| Index: content/browser/renderer_host/input/touch_event_queue.h |
| diff --git a/content/browser/renderer_host/input/touch_event_queue.h b/content/browser/renderer_host/input/touch_event_queue.h |
| index 07dee38a48b767474032686cc7240b2a41598ff3..f72a8afe1306886218bec8ec86bfe94e506b2ba0 100644 |
| --- a/content/browser/renderer_host/input/touch_event_queue.h |
| +++ b/content/browser/renderer_host/input/touch_event_queue.h |
| @@ -36,9 +36,27 @@ class CONTENT_EXPORT TouchEventQueueClient { |
| // A queue for throttling and coalescing touch-events. |
| class CONTENT_EXPORT TouchEventQueue { |
| public: |
| + // Different ways of dealing with touch events during scrolling. |
| + // TODO(rbyers): Remove (or otherwise update) this once results of |
| + // experiments are complete. http://crbug.com/328503 |
| + enum TouchScrollingMode { |
| + // Send a touchcancel on scroll start and no further touch events for the |
| + // duration of the scroll. Chrome Android's traditional behavior. |
| + TOUCH_SCROLLING_MODE_TOUCHCANCEL, |
| + // Send touchmove events throughout a scroll, blocking on each ACK and |
| + // using the disposition to determine whether a scroll update should be |
| + // sent. Mobile Safari's default overflow scroll behavior. |
| + TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE, |
| + // Like sync, except that consumed scroll events cause subsequent touchmove |
| + // events to be suppressed. Unconsumed scroll events return touchmove |
| + // events to being dispatched synchronously (so scrolling may be hijacked |
| + // when a scroll limit is reached, and later resumed). |
| + TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE |
|
jdduke (slow)
2014/02/13 16:53:06
Let's add a TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_S
tdresser
2014/02/13 18:14:09
Done.
|
| + }; |
| // The |client| must outlive the TouchEventQueue. |
| - explicit TouchEventQueue(TouchEventQueueClient* client); |
| + explicit TouchEventQueue(TouchEventQueueClient* client, |
| + TouchScrollingMode mode = TOUCH_SCROLLING_MODE_TOUCHCANCEL); |
|
jdduke (slow)
2014/02/13 16:53:06
Nit: No default args, and remove explicit.
tdresser
2014/02/13 18:14:09
Done.
|
| ~TouchEventQueue(); |
| // Adds an event to the queue. The event may be coalesced with previously |
| @@ -59,6 +77,10 @@ class CONTENT_EXPORT TouchEventQueue { |
| // resume the normal flow of sending touch events to the renderer. |
| void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); |
| + void OnGestureEventAck( |
| + const GestureEventWithLatencyInfo& event, |
| + InputEventAckState ack_result); |
| + |
| // Notifies the queue whether the renderer has at least one touch handler. |
| void OnHasTouchEventHandlers(bool has_handlers); |
| @@ -165,6 +187,18 @@ class CONTENT_EXPORT TouchEventQueue { |
| // has not yet been preventDefaulted, disabled by default. |
| scoped_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_; |
| + // How touch events are handled during scrolling. For now this is a global |
| + // setting for experimentation, but we may evolve it into an app-controlled |
| + // mode. |
| + const TouchScrollingMode touch_scrolling_mode_; |
| + |
| + // Whether touchmove events should be dropped due to the |
| + // TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE mode. Note that we can't use |
| + // touch_filtering_state_ for this (without adding a few new states and |
| + // complicating the code significantly) because it can occur with and without |
| + // timeout, and shouldn't cause touchend to be dropped. |
| + bool absorbing_touch_moves_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| }; |