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

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

Issue 739013008: Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 browser_plugin_embedder_->HandleKeyboardEvent(event)) { 1318 browser_plugin_embedder_->HandleKeyboardEvent(event)) {
1319 return; 1319 return;
1320 } 1320 }
1321 if (delegate_) 1321 if (delegate_)
1322 delegate_->HandleKeyboardEvent(this, event); 1322 delegate_->HandleKeyboardEvent(this, event);
1323 } 1323 }
1324 1324
1325 bool WebContentsImpl::HandleWheelEvent( 1325 bool WebContentsImpl::HandleWheelEvent(
1326 const blink::WebMouseWheelEvent& event) { 1326 const blink::WebMouseWheelEvent& event) {
1327 #if !defined(OS_MACOSX) 1327 #if !defined(OS_MACOSX)
1328 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this 1328 // On platforms other than Mac, control+mousewheel may changes zoom. On Mac,
tdresser 2014/12/02 15:37:38 may changes -> may change
lanwei 2014/12/02 22:28:06 Done.
1329 // isn't done for two reasons: 1329 // this isn't done for two reasons:
1330 // -the OS already has a gesture to do this through pinch-zoom 1330 // -the OS already has a gesture to do this through pinch-zoom
1331 // -if a user starts an inertial scroll, let's go, and presses control 1331 // -if a user starts an inertial scroll, let's go, and presses control
1332 // (i.e. control+tab) then the OS's buffered scroll events will come in 1332 // (i.e. control+tab) then the OS's buffered scroll events will come in
1333 // with control key set which isn't what the user wants 1333 // with control key set which isn't what the user wants
1334 if (delegate_ && 1334 if (delegate_ &&
1335 event.wheelTicksY && 1335 event.wheelTicksY &&
1336 (event.modifiers & blink::WebInputEvent::ControlKey) && 1336 (event.modifiers & blink::WebInputEvent::ControlKey) &&
1337 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad 1337 !event.canScroll) {
1338 // gestures, which are regrettably easy to trigger accidentally.
1339 !event.hasPreciseScrollingDeltas) {
1340 delegate_->ContentsZoomChange(event.wheelTicksY > 0); 1338 delegate_->ContentsZoomChange(event.wheelTicksY > 0);
1341 return true; 1339 return true;
1342 } 1340 }
1343 #endif 1341 #endif
1344 return false; 1342 return false;
1345 } 1343 }
1346 1344
1347 bool WebContentsImpl::PreHandleGestureEvent( 1345 bool WebContentsImpl::PreHandleGestureEvent(
1348 const blink::WebGestureEvent& event) { 1346 const blink::WebGestureEvent& event) {
1349 return delegate_ && delegate_->PreHandleGestureEvent(this, event); 1347 return delegate_ && delegate_->PreHandleGestureEvent(this, event);
(...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after
4351 node->render_manager()->ResumeResponseDeferredAtStart(); 4349 node->render_manager()->ResumeResponseDeferredAtStart();
4352 } 4350 }
4353 4351
4354 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4352 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4355 force_disable_overscroll_content_ = force_disable; 4353 force_disable_overscroll_content_ = force_disable;
4356 if (view_) 4354 if (view_)
4357 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4355 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4358 } 4356 }
4359 4357
4360 } // namespace content 4358 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698