Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 872633005: Stop sending an async touchmove for the app slop region (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_event_queue.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index c22cbc51f38e296809ac32f8f160864d6c63392b..0b183112be0caebe97c5c1d4c631768d3f3f81ae 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -364,6 +364,7 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
: client_(client),
dispatching_touch_ack_(NULL),
dispatching_touch_(false),
+ processing_touch_ack_(false),
has_handlers_(true),
drop_remaining_touches_in_sequence_(false),
touchmove_slop_suppressor_(new TouchMoveSlopSuppressor),
@@ -420,6 +421,7 @@ void TouchEventQueue::QueueEvent(const TouchEventWithLatencyInfo& event) {
void TouchEventQueue::ProcessTouchAck(InputEventAckState ack_result,
const LatencyInfo& latency_info) {
TRACE_EVENT0("input", "TouchEventQueue::ProcessTouchAck");
+ base::AutoReset<bool> processing_touch_ack(&processing_touch_ack_, true);
DCHECK(!dispatching_touch_ack_);
dispatching_touch_ = false;
@@ -471,15 +473,20 @@ void TouchEventQueue::ForwardNextEventToRenderer() {
// application be sent touches at key points in the gesture stream,
// e.g., when the application slop region is exceeded or touchmove
// coalescing fails because of different modifiers.
- const bool send_touchmove_now =
- size() > 1 ||
- (touch.event.timeStampSeconds >=
- last_sent_touch_timestamp_sec_ + kAsyncTouchMoveIntervalSec) ||
- (needs_async_touchmove_for_outer_slop_region_ &&
- OutsideApplicationSlopRegion(touch.event,
- touch_sequence_start_position_)) ||
- (pending_async_touchmove_ &&
- !pending_async_touchmove_->CanCoalesceWith(touch));
+ bool send_touchmove_now = size() > 1;
+ send_touchmove_now |= pending_async_touchmove_ &&
+ !pending_async_touchmove_->CanCoalesceWith(touch);
+ // Avoid async touch dispatch immediately after receipt of a touch ack. This
+ // reduces the likelihood of the async touch contending with gestures
+ // (and gesture side effects) triggered by the touch ack.
+ if (!processing_touch_ack_) {
+ send_touchmove_now |=
+ touch.event.timeStampSeconds >=
+ last_sent_touch_timestamp_sec_ + kAsyncTouchMoveIntervalSec;
+ send_touchmove_now |= needs_async_touchmove_for_outer_slop_region_ &&
+ OutsideApplicationSlopRegion(
+ touch.event, touch_sequence_start_position_);
+ }
if (!send_touchmove_now) {
if (!pending_async_touchmove_) {

Powered by Google App Engine
This is Rietveld 408576698