| 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 browser_plugin_embedder_->HandleKeyboardEvent(event)) { | 1336 browser_plugin_embedder_->HandleKeyboardEvent(event)) { |
| 1337 return; | 1337 return; |
| 1338 } | 1338 } |
| 1339 if (delegate_) | 1339 if (delegate_) |
| 1340 delegate_->HandleKeyboardEvent(this, event); | 1340 delegate_->HandleKeyboardEvent(this, event); |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 bool WebContentsImpl::HandleWheelEvent( | 1343 bool WebContentsImpl::HandleWheelEvent( |
| 1344 const blink::WebMouseWheelEvent& event) { | 1344 const blink::WebMouseWheelEvent& event) { |
| 1345 #if !defined(OS_MACOSX) | 1345 #if !defined(OS_MACOSX) |
| 1346 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this | 1346 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, |
| 1347 // isn't done for two reasons: | 1347 // this isn't done for two reasons: |
| 1348 // -the OS already has a gesture to do this through pinch-zoom | 1348 // -the OS already has a gesture to do this through pinch-zoom |
| 1349 // -if a user starts an inertial scroll, let's go, and presses control | 1349 // -if a user starts an inertial scroll, let's go, and presses control |
| 1350 // (i.e. control+tab) then the OS's buffered scroll events will come in | 1350 // (i.e. control+tab) then the OS's buffered scroll events will come in |
| 1351 // with control key set which isn't what the user wants | 1351 // with control key set which isn't what the user wants |
| 1352 if (delegate_ && | 1352 if (delegate_ && event.wheelTicksY && |
| 1353 event.wheelTicksY && | |
| 1354 (event.modifiers & blink::WebInputEvent::ControlKey) && | 1353 (event.modifiers & blink::WebInputEvent::ControlKey) && |
| 1355 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad | 1354 !event.canScroll) { |
| 1356 // gestures, which are regrettably easy to trigger accidentally. | |
| 1357 !event.hasPreciseScrollingDeltas) { | |
| 1358 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1355 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
| 1359 return true; | 1356 return true; |
| 1360 } | 1357 } |
| 1361 #endif | 1358 #endif |
| 1362 return false; | 1359 return false; |
| 1363 } | 1360 } |
| 1364 | 1361 |
| 1365 bool WebContentsImpl::PreHandleGestureEvent( | 1362 bool WebContentsImpl::PreHandleGestureEvent( |
| 1366 const blink::WebGestureEvent& event) { | 1363 const blink::WebGestureEvent& event) { |
| 1367 return delegate_ && delegate_->PreHandleGestureEvent(this, event); | 1364 return delegate_ && delegate_->PreHandleGestureEvent(this, event); |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4402 node->render_manager()->ResumeResponseDeferredAtStart(); | 4399 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4403 } | 4400 } |
| 4404 | 4401 |
| 4405 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4402 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4406 force_disable_overscroll_content_ = force_disable; | 4403 force_disable_overscroll_content_ = force_disable; |
| 4407 if (view_) | 4404 if (view_) |
| 4408 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4405 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4409 } | 4406 } |
| 4410 | 4407 |
| 4411 } // namespace content | 4408 } // namespace content |
| OLD | NEW |