| 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 03d3210adb429c2fb3a9cebe33215f3058eb97c8..5d2edc27ec660cc1af0d986086cdc96e680c5d83 100644
|
| --- a/content/browser/renderer_host/input/touch_event_queue.h
|
| +++ b/content/browser/renderer_host/input/touch_event_queue.h
|
| @@ -48,12 +48,11 @@ class CONTENT_EXPORT TouchEventQueue {
|
| // 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). http://goo.gl/RShsdN
|
| - TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE,
|
| - TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_TOUCHCANCEL
|
| + // Send touchmove events throughout a scroll, but throttle sending and
|
| + // ignore the ACK as long as scrolling remains possible. Unconsumed scroll
|
| + // events return touchmove events to being dispatched synchronously.
|
| + TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE,
|
| + TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE
|
| };
|
|
|
| // The |client| must outlive the TouchEventQueue. If
|
| @@ -120,7 +119,7 @@ class CONTENT_EXPORT TouchEventQueue {
|
| friend class TouchTimeoutHandler;
|
| friend class TouchEventQueueTest;
|
|
|
| - bool HasTimeoutEvent() const;
|
| + bool HasPendingAsyncTouchMoveForTesting() const;
|
| bool IsTimeoutRunningForTesting() const;
|
| const TouchEventWithLatencyInfo& GetLatestEventForTesting() const;
|
|
|
| @@ -128,16 +127,32 @@ class CONTENT_EXPORT TouchEventQueue {
|
| // events being sent to the renderer.
|
| void FlushQueue();
|
|
|
| - // Walks the queue, checking each event for |ShouldForwardToRenderer()|.
|
| - // If true, forwards the touch event and stops processing further events.
|
| - // If false, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|.
|
| + // Walks the queue, checking each event with |FilterBeforeForwarding()|.
|
| + // If allowed, forwards the touch event and stops processing further events.
|
| + // Otherwise, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|.
|
| void TryForwardNextEventToRenderer();
|
|
|
| - // Pops the touch-event from the top of the queue and sends it to the
|
| - // TouchEventQueueClient. This reduces the size of the queue by one.
|
| + // Forwards the event at the head of the queue to the renderer.
|
| + void ForwardNextEventToRenderer();
|
| +
|
| + // Pops the touch-event from the head of the queue and acks it to the client.
|
| + void PopTouchEventToClient(InputEventAckState ack_result);
|
| +
|
| + // Pops the touch-event from the top of the queue and acks it to the client,
|
| + // updating the event with |renderer_latency_info|.
|
| void PopTouchEventToClient(InputEventAckState ack_result,
|
| const ui::LatencyInfo& renderer_latency_info);
|
|
|
| + // Ack all coalesced events in |acked_event| to the client with |ack_result|.
|
| + void AckTouchEventToClient(InputEventAckState ack_result,
|
| + scoped_ptr<CoalescedWebTouchEvent> acked_event);
|
| +
|
| + // Safely pop the head of the queue.
|
| + scoped_ptr<CoalescedWebTouchEvent> PopTouchEvent();
|
| +
|
| + // Dispatch |touch| to the client.
|
| + void SendTouchEventImmediately(const TouchEventWithLatencyInfo& touch);
|
| +
|
| enum PreFilterResult {
|
| ACK_WITH_NO_CONSUMER_EXISTS,
|
| ACK_WITH_NOT_CONSUMED,
|
| @@ -161,10 +176,14 @@ class CONTENT_EXPORT TouchEventQueue {
|
| typedef std::map<int, InputEventAckState> TouchPointAckStates;
|
| TouchPointAckStates touch_ack_states_;
|
|
|
| + // Position of the first touch in the most recent sequence forwarded to the
|
| + // client.
|
| + gfx::PointF touch_sequence_start_position_;
|
| +
|
| // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|.
|
| // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack
|
| // is being dispatched.
|
| - CoalescedWebTouchEvent* dispatching_touch_ack_;
|
| + const CoalescedWebTouchEvent* dispatching_touch_ack_;
|
|
|
| // Used to prevent touch timeout scheduling if we receive a synchronous
|
| // ack after forwarding a touch event to the client.
|
| @@ -188,12 +207,15 @@ class CONTENT_EXPORT TouchEventQueue {
|
| // been preventDefaulted.
|
| scoped_ptr<TouchMoveSlopSuppressor> touchmove_slop_suppressor_;
|
|
|
| - // 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_;
|
| + // Whether touch events should remain buffered and dispatched asynchronously
|
| + // while a scroll sequence is active. In this mode, touchmove's are throttled
|
| + // and ack'ed immediately, but remain buffered in |pending_async_touch_move_|
|
| + // until a sufficient time period has elapsed since the last sent touch event.
|
| + // For details see the design doc at http://goo.gl/lVyJAa.
|
| + bool send_touch_events_async_;
|
| + scoped_ptr<TouchEventWithLatencyInfo> pending_async_touch_move_;
|
| + double last_sent_touch_timestamp_sec_;
|
| + bool needs_async_touch_move_for_outer_slop_region_;
|
|
|
| // 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
|
|
|