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 a3d3c9459564ab8e66bf95ed6efbe67ceb7e0c8b..749c98fb29e6c80e33ed028d4c309399475d48f7 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.h |
+++ b/content/browser/renderer_host/input/touch_event_queue.h |
@@ -36,11 +36,30 @@ 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, |
+ TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_TOUCHCANCEL |
+ }; |
// The |client| must outlive the TouchEventQueue. If |
// |touchmove_suppression_length_dips| <= 0, touch move suppression is |
// disabled. |
TouchEventQueue(TouchEventQueueClient* client, |
+ TouchScrollingMode mode, |
double touchmove_suppression_length_dips); |
~TouchEventQueue(); |
@@ -62,6 +81,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); |
@@ -163,6 +186,18 @@ class CONTENT_EXPORT TouchEventQueue { |
// been preventDefaulted. |
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); |
}; |