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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 11361150: Suppress sending mousedown / mouseup when in fling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed checking GEF's queue back when it is empty in unit tests Created 8 years, 1 month 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_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 7ca455b49d209dae0e4d33bce17954abf489bc9e..057db8493b9f3644b86b64afb10d5643836b2311 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -903,37 +903,16 @@ void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
return;
}
- // Avoid spamming the renderer with mouse move events. It is important
- // to note that WM_MOUSEMOVE events are anyways synthetic, but since our
- // thread is able to rapidly consume WM_MOUSEMOVE events, we may get way
- // more WM_MOUSEMOVE events than we wish to send to the renderer.
- if (mouse_event.type == WebInputEvent::MouseMove) {
- if (mouse_move_pending_) {
- if (!next_mouse_move_.get()) {
- next_mouse_move_.reset(new WebMouseEvent(mouse_event));
- } else {
- // Accumulate movement deltas.
- int x = next_mouse_move_->movementX;
- int y = next_mouse_move_->movementY;
- *next_mouse_move_ = mouse_event;
- next_mouse_move_->movementX += x;
- next_mouse_move_->movementY += y;
- }
- return;
- }
- mouse_move_pending_ = true;
- } else if (mouse_event.type == WebInputEvent::MouseDown) {
- if (gesture_event_filter_->GetTapSuppressionController()->
+ if (mouse_event.type == WebInputEvent::MouseDown &&
+ gesture_event_filter_->GetTapSuppressionController()->
ShouldDeferMouseDown(mouse_event))
return;
- OnUserGesture();
- } else if (mouse_event.type == WebInputEvent::MouseUp) {
- if (gesture_event_filter_->GetTapSuppressionController()->
+ if (mouse_event.type == WebInputEvent::MouseUp &&
+ gesture_event_filter_->GetTapSuppressionController()->
ShouldSuppressMouseUp())
return;
- }
- ForwardInputEvent(mouse_event, sizeof(WebMouseEvent), false);
+ ForwardMouseEventImmediately(mouse_event);
}
void RenderWidgetHostImpl::OnPointerEventActivate() {
@@ -989,6 +968,47 @@ void RenderWidgetHostImpl::ForwardGestureEvent(
ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), false);
}
+// Forwards MouseEvent without passing it through TapSuppressionController
+void RenderWidgetHostImpl::ForwardMouseEventImmediately(
+ const WebMouseEvent& mouse_event) {
+ TRACE_EVENT2("renderer_host",
+ "RenderWidgetHostImpl::ForwardMouseEventImmediately",
+ "x", mouse_event.x, "y", mouse_event.y);
+ if (ignore_input_events_ || process_->IgnoreInputEvents())
+ return;
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSimulateTouchScreenWithMouse)) {
+ SimulateTouchGestureWithMouse(mouse_event);
+ return;
+ }
+
+ // Avoid spamming the renderer with mouse move events. It is important
+ // to note that WM_MOUSEMOVE events are anyways synthetic, but since our
+ // thread is able to rapidly consume WM_MOUSEMOVE events, we may get way
+ // more WM_MOUSEMOVE events than we wish to send to the renderer.
+ if (mouse_event.type == WebInputEvent::MouseMove) {
+ if (mouse_move_pending_) {
+ if (!next_mouse_move_.get()) {
+ next_mouse_move_.reset(new WebMouseEvent(mouse_event));
+ } else {
+ // Accumulate movement deltas.
+ int x = next_mouse_move_->movementX;
+ int y = next_mouse_move_->movementY;
+ *next_mouse_move_ = mouse_event;
+ next_mouse_move_->movementX += x;
+ next_mouse_move_->movementY += y;
+ }
+ return;
+ }
+ mouse_move_pending_ = true;
+ } else if (mouse_event.type == WebInputEvent::MouseDown) {
+ OnUserGesture();
+ }
+
+ ForwardInputEvent(mouse_event, sizeof(WebMouseEvent), false);
+}
+
void RenderWidgetHostImpl::ForwardTouchEventImmediately(
const WebKit::WebTouchEvent& touch_event) {
TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardTouchEvent");
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698