OLD | NEW |
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 Loading... |
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 may change zoom. On Mac, | 1336 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this |
1337 // this isn't done for two reasons: | 1337 // 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_ && event.wheelTicksY && | 1342 if (delegate_ && |
| 1343 event.wheelTicksY && |
1343 (event.modifiers & blink::WebInputEvent::ControlKey) && | 1344 (event.modifiers & blink::WebInputEvent::ControlKey) && |
1344 !event.canScroll) { | 1345 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad |
| 1346 // gestures, which are regrettably easy to trigger accidentally. |
| 1347 !event.hasPreciseScrollingDeltas) { |
1345 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1348 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
1346 return true; | 1349 return true; |
1347 } | 1350 } |
1348 #endif | 1351 #endif |
1349 return false; | 1352 return false; |
1350 } | 1353 } |
1351 | 1354 |
1352 bool WebContentsImpl::PreHandleGestureEvent( | 1355 bool WebContentsImpl::PreHandleGestureEvent( |
1353 const blink::WebGestureEvent& event) { | 1356 const blink::WebGestureEvent& event) { |
1354 return delegate_ && delegate_->PreHandleGestureEvent(this, event); | 1357 return delegate_ && delegate_->PreHandleGestureEvent(this, event); |
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4375 node->render_manager()->ResumeResponseDeferredAtStart(); | 4378 node->render_manager()->ResumeResponseDeferredAtStart(); |
4376 } | 4379 } |
4377 | 4380 |
4378 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4381 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4379 force_disable_overscroll_content_ = force_disable; | 4382 force_disable_overscroll_content_ = force_disable; |
4380 if (view_) | 4383 if (view_) |
4381 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4384 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4382 } | 4385 } |
4383 | 4386 |
4384 } // namespace content | 4387 } // namespace content |
OLD | NEW |