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

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: Add unit tests 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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 browser_plugin_embedder_->HandleKeyboardEvent(event)) { 1326 browser_plugin_embedder_->HandleKeyboardEvent(event)) {
1327 return; 1327 return;
1328 } 1328 }
1329 if (delegate_) 1329 if (delegate_)
1330 delegate_->HandleKeyboardEvent(this, event); 1330 delegate_->HandleKeyboardEvent(this, event);
1331 } 1331 }
1332 1332
1333 bool WebContentsImpl::HandleWheelEvent( 1333 bool WebContentsImpl::HandleWheelEvent(
1334 const blink::WebMouseWheelEvent& event) { 1334 const blink::WebMouseWheelEvent& event) {
1335 #if !defined(OS_MACOSX) 1335 #if !defined(OS_MACOSX)
1336 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this 1336 // On platforms other than Mac, control+mousewheel may change zoom. On Mac,
1337 // isn't done for two reasons: 1337 // this isn't done for two reasons:
1338 // -the OS already has a gesture to do this through pinch-zoom 1338 // -the OS already has a gesture to do this through pinch-zoom
1339 // -if a user starts an inertial scroll, let's go, and presses control 1339 // -if a user starts an inertial scroll, let's go, and presses control
1340 // (i.e. control+tab) then the OS's buffered scroll events will come in 1340 // (i.e. control+tab) then the OS's buffered scroll events will come in
1341 // with control key set which isn't what the user wants 1341 // with control key set which isn't what the user wants
1342 if (delegate_ && 1342 if (delegate_ && event.wheelTicksY &&
1343 event.wheelTicksY &&
1344 (event.modifiers & blink::WebInputEvent::ControlKey) && 1343 (event.modifiers & blink::WebInputEvent::ControlKey) &&
1345 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad 1344 !event.canScroll) {
1346 // gestures, which are regrettably easy to trigger accidentally.
1347 !event.hasPreciseScrollingDeltas) {
1348 delegate_->ContentsZoomChange(event.wheelTicksY > 0); 1345 delegate_->ContentsZoomChange(event.wheelTicksY > 0);
1349 return true; 1346 return true;
1350 } 1347 }
1351 #endif 1348 #endif
1352 return false; 1349 return false;
1353 } 1350 }
1354 1351
1355 bool WebContentsImpl::PreHandleGestureEvent( 1352 bool WebContentsImpl::PreHandleGestureEvent(
1356 const blink::WebGestureEvent& event) { 1353 const blink::WebGestureEvent& event) {
1357 return delegate_ && delegate_->PreHandleGestureEvent(this, event); 1354 return delegate_ && delegate_->PreHandleGestureEvent(this, event);
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
4361 node->render_manager()->ResumeResponseDeferredAtStart(); 4358 node->render_manager()->ResumeResponseDeferredAtStart();
4362 } 4359 }
4363 4360
4364 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4361 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4365 force_disable_overscroll_content_ = force_disable; 4362 force_disable_overscroll_content_ = force_disable;
4366 if (view_) 4363 if (view_)
4367 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4364 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4368 } 4365 }
4369 4366
4370 } // namespace content 4367 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698