Prevent Control+two-finger-scroll from zooming the page.

Make WebContentsImpl avoid zooming in response to a
two-finger-scroll event while the Control key is held. It's
very easy to accidentally trigger this feature and difficult
to undo it when a windowed app is focused.

Control+scrollwheel is still supported for zooming.

BUG=323164
[email protected]

Review URL: https://codereview.chromium.org/242733008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265391 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 566e7f7..bddc8de 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1223,7 +1223,10 @@
   //      with control key set which isn't what the user wants
   if (delegate_ &&
       event.wheelTicksY &&
-      (event.modifiers & blink::WebInputEvent::ControlKey)) {
+      (event.modifiers & blink::WebInputEvent::ControlKey) &&
+      // Avoid adjusting the zoom in response to two-finger-scrolling touchpad
+      // gestures, which are regrettably easy to trigger accidentally.
+      !event.hasPreciseScrollingDeltas) {
     delegate_->ContentsZoomChange(event.wheelTicksY > 0);
     return true;
   }