| 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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 : client_(client), | 251 : client_(client), |
| 252 input_handler_(input_handler), | 252 input_handler_(input_handler), |
| 253 deferred_fling_cancel_time_seconds_(0), | 253 deferred_fling_cancel_time_seconds_(0), |
| 254 synchronous_input_handler_(nullptr), | 254 synchronous_input_handler_(nullptr), |
| 255 allow_root_animate_(true), | 255 allow_root_animate_(true), |
| 256 #ifndef NDEBUG | 256 #ifndef NDEBUG |
| 257 expect_scroll_update_end_(false), | 257 expect_scroll_update_end_(false), |
| 258 #endif | 258 #endif |
| 259 gesture_scroll_on_impl_thread_(false), | 259 gesture_scroll_on_impl_thread_(false), |
| 260 gesture_pinch_on_impl_thread_(false), | 260 gesture_pinch_on_impl_thread_(false), |
| 261 scroll_sequence_ignored_(false), |
| 261 fling_may_be_active_on_main_thread_(false), | 262 fling_may_be_active_on_main_thread_(false), |
| 262 disallow_horizontal_fling_scroll_(false), | 263 disallow_horizontal_fling_scroll_(false), |
| 263 disallow_vertical_fling_scroll_(false), | 264 disallow_vertical_fling_scroll_(false), |
| 264 has_fling_animation_started_(false), | 265 has_fling_animation_started_(false), |
| 265 smooth_scroll_enabled_(false), | 266 smooth_scroll_enabled_(false), |
| 266 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), | 267 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), |
| 267 touchpad_and_wheel_scroll_latching_enabled_( | 268 touchpad_and_wheel_scroll_latching_enabled_( |
| 268 touchpad_and_wheel_scroll_latching_enabled), | 269 touchpad_and_wheel_scroll_latching_enabled), |
| 269 touch_result_(kEventDispositionUndefined), | 270 touch_result_(kEventDispositionUndefined), |
| 270 mouse_wheel_result_(kEventDispositionUndefined), | 271 mouse_wheel_result_(kEventDispositionUndefined), |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 "InputHandlerProxy::handle_input gesture scroll", | 850 "InputHandlerProxy::handle_input gesture scroll", |
| 850 TRACE_EVENT_SCOPE_THREAD); | 851 TRACE_EVENT_SCOPE_THREAD); |
| 851 gesture_scroll_on_impl_thread_ = true; | 852 gesture_scroll_on_impl_thread_ = true; |
| 852 result = DID_HANDLE; | 853 result = DID_HANDLE; |
| 853 break; | 854 break; |
| 854 case cc::InputHandler::SCROLL_UNKNOWN: | 855 case cc::InputHandler::SCROLL_UNKNOWN: |
| 855 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: | 856 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: |
| 856 result = DID_NOT_HANDLE; | 857 result = DID_NOT_HANDLE; |
| 857 break; | 858 break; |
| 858 case cc::InputHandler::SCROLL_IGNORED: | 859 case cc::InputHandler::SCROLL_IGNORED: |
| 860 scroll_sequence_ignored_ = true; |
| 859 result = DROP_EVENT; | 861 result = DROP_EVENT; |
| 860 break; | 862 break; |
| 861 } | 863 } |
| 862 if (scroll_elasticity_controller_ && result != DID_NOT_HANDLE) | 864 if (scroll_elasticity_controller_ && result != DID_NOT_HANDLE) |
| 863 HandleScrollElasticityOverscroll(gesture_event, | 865 HandleScrollElasticityOverscroll(gesture_event, |
| 864 cc::InputHandlerScrollResult()); | 866 cc::InputHandlerScrollResult()); |
| 865 | 867 |
| 866 return result; | 868 return result; |
| 867 } | 869 } |
| 868 | 870 |
| 869 InputHandlerProxy::EventDisposition | 871 InputHandlerProxy::EventDisposition |
| 870 InputHandlerProxy::HandleGestureScrollUpdate( | 872 InputHandlerProxy::HandleGestureScrollUpdate( |
| 871 const WebGestureEvent& gesture_event) { | 873 const WebGestureEvent& gesture_event) { |
| 872 #ifndef NDEBUG | 874 #ifndef NDEBUG |
| 873 DCHECK(expect_scroll_update_end_); | 875 DCHECK(expect_scroll_update_end_); |
| 874 #endif | 876 #endif |
| 877 |
| 878 if (scroll_sequence_ignored_) |
| 879 return DROP_EVENT; |
| 880 |
| 875 if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_) | 881 if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_) |
| 876 return DID_NOT_HANDLE; | 882 return DID_NOT_HANDLE; |
| 877 | 883 |
| 878 cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event); | 884 cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event); |
| 879 gfx::Point scroll_point(gesture_event.x, gesture_event.y); | 885 gfx::Point scroll_point(gesture_event.x, gesture_event.y); |
| 880 gfx::Vector2dF scroll_delta(-gesture_event.data.scroll_update.delta_x, | 886 gfx::Vector2dF scroll_delta(-gesture_event.data.scroll_update.delta_x, |
| 881 -gesture_event.data.scroll_update.delta_y); | 887 -gesture_event.data.scroll_update.delta_y); |
| 882 | 888 |
| 883 if (ShouldAnimate(gesture_event.data.scroll_update.delta_units != | 889 if (ShouldAnimate(gesture_event.data.scroll_update.delta_units != |
| 884 blink::WebGestureEvent::ScrollUnits::kPixels)) { | 890 blink::WebGestureEvent::ScrollUnits::kPixels)) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 expect_scroll_update_end_ = false; | 932 expect_scroll_update_end_ = false; |
| 927 #endif | 933 #endif |
| 928 if (ShouldAnimate(gesture_event.data.scroll_end.delta_units != | 934 if (ShouldAnimate(gesture_event.data.scroll_end.delta_units != |
| 929 blink::WebGestureEvent::ScrollUnits::kPixels)) { | 935 blink::WebGestureEvent::ScrollUnits::kPixels)) { |
| 930 // Do nothing if the scroll is being animated; the scroll animation will | 936 // Do nothing if the scroll is being animated; the scroll animation will |
| 931 // generate the ScrollEnd when it is done. | 937 // generate the ScrollEnd when it is done. |
| 932 } else { | 938 } else { |
| 933 cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event); | 939 cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event); |
| 934 input_handler_->ScrollEnd(&scroll_state); | 940 input_handler_->ScrollEnd(&scroll_state); |
| 935 } | 941 } |
| 942 |
| 943 if (scroll_sequence_ignored_) { |
| 944 scroll_sequence_ignored_ = false; |
| 945 return DROP_EVENT; |
| 946 } |
| 947 |
| 936 if (!gesture_scroll_on_impl_thread_) | 948 if (!gesture_scroll_on_impl_thread_) |
| 937 return DID_NOT_HANDLE; | 949 return DID_NOT_HANDLE; |
| 938 | 950 |
| 939 if (scroll_elasticity_controller_) | 951 if (scroll_elasticity_controller_) |
| 940 HandleScrollElasticityOverscroll(gesture_event, | 952 HandleScrollElasticityOverscroll(gesture_event, |
| 941 cc::InputHandlerScrollResult()); | 953 cc::InputHandlerScrollResult()); |
| 942 | 954 |
| 943 gesture_scroll_on_impl_thread_ = false; | 955 gesture_scroll_on_impl_thread_ = false; |
| 944 return DID_HANDLE; | 956 return DID_HANDLE; |
| 945 } | 957 } |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1673 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1662 scroll_result)); | 1674 scroll_result)); |
| 1663 } | 1675 } |
| 1664 | 1676 |
| 1665 void InputHandlerProxy::SetTickClockForTesting( | 1677 void InputHandlerProxy::SetTickClockForTesting( |
| 1666 std::unique_ptr<base::TickClock> tick_clock) { | 1678 std::unique_ptr<base::TickClock> tick_clock) { |
| 1667 tick_clock_ = std::move(tick_clock); | 1679 tick_clock_ = std::move(tick_clock); |
| 1668 } | 1680 } |
| 1669 | 1681 |
| 1670 } // namespace ui | 1682 } // namespace ui |
| OLD | NEW |