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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.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: Created 7 years, 7 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/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 0da585350faa3e1e3fd09dbd9c5df1c4a8cde9d5..37caa35fb588e12053073e97b1934c5b784117f5 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -60,6 +60,7 @@
#include "ui/base/gestures/gesture_recognizer.h"
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
+#include "ui/base/ui_base_switches_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
@@ -2474,6 +2475,34 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
host_->ForwardGestureEvent(fling_cancel);
}
+ if (switches::IsTouchCancelAfterScrollEnabled()) {
Rick Byers 2013/05/30 01:53:29 This code should apply to windows (non-aura) as we
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Moved the logic to render_widget_host_impl.cc
+ // When there is touch handler on the page, once scrolling is started,
+ // we send a touch cancel to the page, and stops forwarding touch moves to
+ // the renderer. This is to align with Chrome on Android behavior.
+ if (event->type() == ui::ET_GESTURE_SCROLL_UPDATE &&
+ host_->ShouldForwardTouchEvent() &&
+ !host_->scroll_update_in_progress()) {
+ host_->scroll_update_in_progress() = true;
sadrul 2013/05/30 02:44:16 ew no
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
+ // Insert a TouchCancel event.
+ WebKit::WebTouchEvent cancel_event;
+ cancel_event.type = WebKit::WebInputEvent::TouchCancel;
+ cancel_event.timeStampSeconds = event->time_stamp().InSecondsF();
+ int id = event->GetLowestTouchId();
+ if (id != -1) {
+ cancel_event.touchesLength = 1;
+ cancel_event.touches[0].id = id;
+ cancel_event.touches[0].state = WebKit::WebTouchPoint::StateCancelled;
+ host_->skip_next_acked_touch_cancel() = true;
sadrul 2013/05/30 02:44:16 ew no
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
+ host_->ForwardTouchEvent(cancel_event);
+ }
+ }
+
+ if (event->type() == ui::ET_GESTURE_SCROLL_END ||
+ event->type() == ui::ET_SCROLL_FLING_START) {
+ host_->scroll_update_in_progress() = false;
sadrul 2013/05/30 02:44:16 stahp
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 Done.
+ }
+ }
sadrul 2013/05/30 02:44:16 There may be a few more touch-move events in the t
Yufeng Shen (Slow to review) 2013/05/30 22:34:38 moved to render_widge_host_impl.cc
+
if (gesture.type != WebKit::WebInputEvent::Undefined) {
host_->ForwardGestureEvent(gesture);

Powered by Google App Engine
This is Rietveld 408576698