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

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

Issue 16114003: Don't send touch move to renderer while scrolling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: use ScrollBegin instead of ScrollUpdate as the indication of stop sending touch move & rebase Created 7 years, 4 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/immediate_input_router.cc
diff --git a/content/browser/renderer_host/input/immediate_input_router.cc b/content/browser/renderer_host/input/immediate_input_router.cc
index 96e8bb9ac44dc6a81a71ab800d5ab60429ba28f8..368619cc1e633721beac4f37fa29314ea22bce62 100644
--- a/content/browser/renderer_host/input/immediate_input_router.cc
+++ b/content/browser/renderer_host/input/immediate_input_router.cc
@@ -85,6 +85,9 @@ ImmediateInputRouter::ImmediateInputRouter(
has_touch_handler_(false),
touch_event_queue_(new TouchEventQueue(this)),
gesture_event_filter_(new GestureEventFilter(this)) {
+ enable_no_touch_to_renderer_while_scrolling_ =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kNoTouchToRendererWhileScrolling) == "1";
DCHECK(process);
DCHECK(client);
}
@@ -199,6 +202,7 @@ void ImmediateInputRouter::SendKeyboardEvent(
void ImmediateInputRouter::SendGestureEvent(
const GestureEventWithLatencyInfo& gesture_event) {
+ HandleGestureScroll(gesture_event);
if (!client_->OnSendGestureEvent(gesture_event))
return;
FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false);
@@ -252,6 +256,7 @@ void ImmediateInputRouter::SendTouchEventImmediately(
void ImmediateInputRouter::SendGestureEventImmediately(
const GestureEventWithLatencyInfo& gesture_event) {
+ HandleGestureScroll(gesture_event);
if (!client_->OnSendGestureEventImmediately(gesture_event))
return;
FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false);
@@ -556,4 +561,19 @@ void ImmediateInputRouter::ProcessTouchAck(
touch_event_queue_->ProcessTouchAck(ack_result, latency_info);
}
+void ImmediateInputRouter::HandleGestureScroll(
+ const GestureEventWithLatencyInfo& gesture_event) {
+ if (!enable_no_touch_to_renderer_while_scrolling_)
+ return;
+
+ // Once scrolling is started stop forwarding touch move events to renderer.
+ if (gesture_event.event.type == WebInputEvent::GestureScrollBegin)
+ touch_event_queue_->set_no_touch_move_to_renderer(true);
+
+ if (gesture_event.event.type == WebInputEvent::GestureScrollEnd ||
+ gesture_event.event.type == WebInputEvent::GestureFlingStart) {
+ touch_event_queue_->set_no_touch_move_to_renderer(false);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698