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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 242733008: Prevent Control+two-finger-scroll from zooming the page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor change 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 const blink::WebMouseWheelEvent& event) { 1216 const blink::WebMouseWheelEvent& event) {
1217 #if !defined(OS_MACOSX) 1217 #if !defined(OS_MACOSX)
1218 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this 1218 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this
1219 // isn't done for two reasons: 1219 // isn't done for two reasons:
1220 // -the OS already has a gesture to do this through pinch-zoom 1220 // -the OS already has a gesture to do this through pinch-zoom
1221 // -if a user starts an inertial scroll, let's go, and presses control 1221 // -if a user starts an inertial scroll, let's go, and presses control
1222 // (i.e. control+tab) then the OS's buffered scroll events will come in 1222 // (i.e. control+tab) then the OS's buffered scroll events will come in
1223 // with control key set which isn't what the user wants 1223 // with control key set which isn't what the user wants
1224 if (delegate_ && 1224 if (delegate_ &&
1225 event.wheelTicksY && 1225 event.wheelTicksY &&
1226 (event.modifiers & blink::WebInputEvent::ControlKey)) { 1226 (event.modifiers & blink::WebInputEvent::ControlKey) &&
1227 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad
1228 // gestures, which are regrettably easy to trigger accidentally.
1229 !event.hasPreciseScrollingDeltas) {
1227 delegate_->ContentsZoomChange(event.wheelTicksY > 0); 1230 delegate_->ContentsZoomChange(event.wheelTicksY > 0);
1228 return true; 1231 return true;
1229 } 1232 }
1230 #endif 1233 #endif
1231 return false; 1234 return false;
1232 } 1235 }
1233 1236
1234 bool WebContentsImpl::PreHandleGestureEvent( 1237 bool WebContentsImpl::PreHandleGestureEvent(
1235 const blink::WebGestureEvent& event) { 1238 const blink::WebGestureEvent& event) {
1236 return delegate_ && delegate_->PreHandleGestureEvent(this, event); 1239 return delegate_ && delegate_->PreHandleGestureEvent(this, event);
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 3884
3882 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 3885 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
3883 if (!delegate_) 3886 if (!delegate_)
3884 return; 3887 return;
3885 const gfx::Size new_size = GetPreferredSize(); 3888 const gfx::Size new_size = GetPreferredSize();
3886 if (new_size != old_size) 3889 if (new_size != old_size)
3887 delegate_->UpdatePreferredSize(this, new_size); 3890 delegate_->UpdatePreferredSize(this, new_size);
3888 } 3891 }
3889 3892
3890 } // namespace content 3893 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698