| 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 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 browser_plugin_embedder_->HandleKeyboardEvent(event)) { | 1321 browser_plugin_embedder_->HandleKeyboardEvent(event)) { |
| 1322 return; | 1322 return; |
| 1323 } | 1323 } |
| 1324 if (delegate_) | 1324 if (delegate_) |
| 1325 delegate_->HandleKeyboardEvent(this, event); | 1325 delegate_->HandleKeyboardEvent(this, event); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 bool WebContentsImpl::HandleWheelEvent( | 1328 bool WebContentsImpl::HandleWheelEvent( |
| 1329 const blink::WebMouseWheelEvent& event) { | 1329 const blink::WebMouseWheelEvent& event) { |
| 1330 #if !defined(OS_MACOSX) | 1330 #if !defined(OS_MACOSX) |
| 1331 // On platforms other than Mac, control+mousewheel changes zoom. On Mac, this | 1331 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, |
| 1332 // isn't done for two reasons: | 1332 // this isn't done for two reasons: |
| 1333 // -the OS already has a gesture to do this through pinch-zoom | 1333 // -the OS already has a gesture to do this through pinch-zoom |
| 1334 // -if a user starts an inertial scroll, let's go, and presses control | 1334 // -if a user starts an inertial scroll, let's go, and presses control |
| 1335 // (i.e. control+tab) then the OS's buffered scroll events will come in | 1335 // (i.e. control+tab) then the OS's buffered scroll events will come in |
| 1336 // with control key set which isn't what the user wants | 1336 // with control key set which isn't what the user wants |
| 1337 if (delegate_ && | 1337 if (delegate_ && event.wheelTicksY && |
| 1338 event.wheelTicksY && | |
| 1339 (event.modifiers & blink::WebInputEvent::ControlKey) && | 1338 (event.modifiers & blink::WebInputEvent::ControlKey) && |
| 1340 // Avoid adjusting the zoom in response to two-finger-scrolling touchpad | 1339 !event.canScroll) { |
| 1341 // gestures, which are regrettably easy to trigger accidentally. | |
| 1342 !event.hasPreciseScrollingDeltas) { | |
| 1343 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1340 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
| 1344 return true; | 1341 return true; |
| 1345 } | 1342 } |
| 1346 #endif | 1343 #endif |
| 1347 return false; | 1344 return false; |
| 1348 } | 1345 } |
| 1349 | 1346 |
| 1350 bool WebContentsImpl::PreHandleGestureEvent( | 1347 bool WebContentsImpl::PreHandleGestureEvent( |
| 1351 const blink::WebGestureEvent& event) { | 1348 const blink::WebGestureEvent& event) { |
| 1352 return delegate_ && delegate_->PreHandleGestureEvent(this, event); | 1349 return delegate_ && delegate_->PreHandleGestureEvent(this, event); |
| (...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |