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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 | 286 |
287 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( | 287 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
288 const WebMouseWheelEvent& wheel_event) { | 288 const WebMouseWheelEvent& wheel_event) { |
289 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; | 289 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; |
290 cc::InputHandlerScrollResult scroll_result; | 290 cc::InputHandlerScrollResult scroll_result; |
291 | 291 |
292 if (wheel_event.scrollByPage) { | 292 if (wheel_event.scrollByPage) { |
293 // TODO(jamesr): We don't properly handle scroll by page in the compositor | 293 // TODO(jamesr): We don't properly handle scroll by page in the compositor |
294 // thread, so punt it to the main thread. http://crbug.com/236639 | 294 // thread, so punt it to the main thread. http://crbug.com/236639 |
295 result = DID_NOT_HANDLE; | 295 result = DID_NOT_HANDLE; |
296 } else if (wheel_event.modifiers & WebInputEvent::ControlKey) { | 296 } else if (!wheel_event.canScroll) { |
297 // Wheel events involving the control key never trigger scrolling, only | 297 // Wheel events involving the control key with canScroll false will not |
tdresser
2014/12/02 15:37:38
I don't think you need to reference both the contr
lanwei
2014/12/02 22:28:06
Done.
| |
298 // event handlers. Forward to the main thread. | 298 // trigger scrolling, only event handlers. Forward to the main thread. |
299 result = DID_NOT_HANDLE; | 299 result = DID_NOT_HANDLE; |
300 } else if (smooth_scroll_enabled_) { | 300 } else if (smooth_scroll_enabled_) { |
301 cc::InputHandler::ScrollStatus scroll_status = | 301 cc::InputHandler::ScrollStatus scroll_status = |
302 input_handler_->ScrollAnimated( | 302 input_handler_->ScrollAnimated( |
303 gfx::Point(wheel_event.x, wheel_event.y), | 303 gfx::Point(wheel_event.x, wheel_event.y), |
304 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); | 304 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); |
305 switch (scroll_status) { | 305 switch (scroll_status) { |
306 case cc::InputHandler::ScrollStarted: | 306 case cc::InputHandler::ScrollStarted: |
307 result = DID_HANDLE; | 307 result = DID_HANDLE; |
308 break; | 308 break; |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 887 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
888 // Return true in this case to prevent early fling termination. | 888 // Return true in this case to prevent early fling termination. |
889 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 889 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
890 std::abs(clipped_increment.height) < kScrollEpsilon) | 890 std::abs(clipped_increment.height) < kScrollEpsilon) |
891 return true; | 891 return true; |
892 | 892 |
893 return did_scroll; | 893 return did_scroll; |
894 } | 894 } |
895 | 895 |
896 } // namespace content | 896 } // namespace content |
OLD | NEW |