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

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

Issue 242733008: Prevent Control+two-finger-scroll from zooming the page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 ad374246f96ac5d750fb9703868bb584f8262ff5..805992629e4040c2cf9b9c19d6fb5134297d931c 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2514,6 +2514,18 @@ void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
host_->ForwardGestureEvent(gesture_event);
blink::WebMouseWheelEvent mouse_wheel_event =
MakeWebMouseWheelEvent(event);
+
+ // We don't want Control+two-finger-scroll to trigger the WebContents
+ // zooming function as it is too sensitive and most people don't expect the
+ // effect (unlike Control+mouse-wheel, which is commonly used to zoom the
+ // page). Therefore, clear the modifier here if and only if the Control key
+ // is pressed and no any other key is pressed at the same time. This
+ // prevents WebContentsImpl from zooming the page while retaining the scroll
+ // event and other modifier combinations in case the webpage might want to
+ // use them.
+ if (mouse_wheel_event.modifiers == blink::WebInputEvent::ControlKey)
+ mouse_wheel_event.modifiers = 0;
Rick Byers 2014/04/22 14:15:15 Now that it's possible for pages to receive ctrl+w
Daniel Erat 2014/04/22 15:27:04 thanks, makes sense (and i agree that it seems muc
+
host_->ForwardWheelEvent(mouse_wheel_event);
RecordAction(base::UserMetricsAction("TrackpadScroll"));
} else if (event->type() == ui::ET_SCROLL_FLING_START ||

Powered by Google App Engine
This is Rietveld 408576698