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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( | 316 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
317 const WebMouseWheelEvent& wheel_event) { | 317 const WebMouseWheelEvent& wheel_event) { |
318 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; | 318 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; |
319 cc::InputHandlerScrollResult scroll_result; | 319 cc::InputHandlerScrollResult scroll_result; |
320 | 320 |
321 if (wheel_event.scrollByPage) { | 321 if (wheel_event.scrollByPage) { |
322 // TODO(jamesr): We don't properly handle scroll by page in the compositor | 322 // TODO(jamesr): We don't properly handle scroll by page in the compositor |
323 // thread, so punt it to the main thread. http://crbug.com/236639 | 323 // thread, so punt it to the main thread. http://crbug.com/236639 |
324 result = DID_NOT_HANDLE; | 324 result = DID_NOT_HANDLE; |
325 } else if (wheel_event.modifiers & WebInputEvent::ControlKey) { | 325 } else if (!wheel_event.canScroll) { |
326 // Wheel events involving the control key never trigger scrolling, only | 326 // Wheel events with |canScroll| == false will not trigger scrolling, |
327 // event handlers. Forward to the main thread. | 327 // only event handlers. Forward to the main thread. |
328 result = DID_NOT_HANDLE; | 328 result = DID_NOT_HANDLE; |
329 } else if (smooth_scroll_enabled_) { | 329 } else if (smooth_scroll_enabled_) { |
330 cc::InputHandler::ScrollStatus scroll_status = | 330 cc::InputHandler::ScrollStatus scroll_status = |
331 input_handler_->ScrollAnimated( | 331 input_handler_->ScrollAnimated( |
332 gfx::Point(wheel_event.x, wheel_event.y), | 332 gfx::Point(wheel_event.x, wheel_event.y), |
333 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); | 333 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); |
334 switch (scroll_status) { | 334 switch (scroll_status) { |
335 case cc::InputHandler::ScrollStarted: | 335 case cc::InputHandler::ScrollStarted: |
336 result = DID_HANDLE; | 336 result = DID_HANDLE; |
337 break; | 337 break; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 924 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
925 // Return true in this case to prevent early fling termination. | 925 // Return true in this case to prevent early fling termination. |
926 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 926 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
927 std::abs(clipped_increment.height) < kScrollEpsilon) | 927 std::abs(clipped_increment.height) < kScrollEpsilon) |
928 return true; | 928 return true; |
929 | 929 |
930 return did_scroll; | 930 return did_scroll; |
931 } | 931 } |
932 | 932 |
933 } // namespace content | 933 } // namespace content |
OLD | NEW |