OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( | 318 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
319 const WebMouseWheelEvent& wheel_event) { | 319 const WebMouseWheelEvent& wheel_event) { |
320 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; | 320 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; |
321 cc::InputHandlerScrollResult scroll_result; | 321 cc::InputHandlerScrollResult scroll_result; |
322 | 322 |
323 if (wheel_event.scrollByPage) { | 323 if (wheel_event.scrollByPage) { |
324 // TODO(jamesr): We don't properly handle scroll by page in the compositor | 324 // TODO(jamesr): We don't properly handle scroll by page in the compositor |
325 // thread, so punt it to the main thread. http://crbug.com/236639 | 325 // thread, so punt it to the main thread. http://crbug.com/236639 |
326 result = DID_NOT_HANDLE; | 326 result = DID_NOT_HANDLE; |
327 } else if (wheel_event.modifiers & WebInputEvent::ControlKey) { | 327 } else if (!wheel_event.canScroll) { |
328 // Wheel events involving the control key never trigger scrolling, only | 328 // Wheel events with |canScroll| == false will not trigger scrolling, |
329 // event handlers. Forward to the main thread. | 329 // only event handlers. Forward to the main thread. |
330 result = DID_NOT_HANDLE; | 330 result = DID_NOT_HANDLE; |
331 } else if (smooth_scroll_enabled_) { | 331 } else if (smooth_scroll_enabled_) { |
332 cc::InputHandler::ScrollStatus scroll_status = | 332 cc::InputHandler::ScrollStatus scroll_status = |
333 input_handler_->ScrollAnimated( | 333 input_handler_->ScrollAnimated( |
334 gfx::Point(wheel_event.x, wheel_event.y), | 334 gfx::Point(wheel_event.x, wheel_event.y), |
335 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); | 335 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); |
336 switch (scroll_status) { | 336 switch (scroll_status) { |
337 case cc::InputHandler::ScrollStarted: | 337 case cc::InputHandler::ScrollStarted: |
338 result = DID_HANDLE; | 338 result = DID_HANDLE; |
339 break; | 339 break; |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 918 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
919 // Return true in this case to prevent early fling termination. | 919 // Return true in this case to prevent early fling termination. |
920 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 920 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
921 std::abs(clipped_increment.height) < kScrollEpsilon) | 921 std::abs(clipped_increment.height) < kScrollEpsilon) |
922 return true; | 922 return true; |
923 | 923 |
924 return did_scroll; | 924 return did_scroll; |
925 } | 925 } |
926 | 926 |
927 } // namespace content | 927 } // namespace content |
OLD | NEW |