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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 if (!touchpad_and_wheel_scroll_latching_enabled_ && | 986 if (!touchpad_and_wheel_scroll_latching_enabled_ && |
987 gesture_event.source_device == blink::kWebGestureDeviceTouchpad) { | 987 gesture_event.source_device == blink::kWebGestureDeviceTouchpad) { |
988 scroll_state.set_is_ending(true); | 988 scroll_state.set_is_ending(true); |
989 input_handler_->ScrollEnd(&scroll_state); | 989 input_handler_->ScrollEnd(&scroll_state); |
990 } | 990 } |
991 | 991 |
992 const float vx = gesture_event.data.fling_start.velocity_x; | 992 const float vx = gesture_event.data.fling_start.velocity_x; |
993 const float vy = gesture_event.data.fling_start.velocity_y; | 993 const float vy = gesture_event.data.fling_start.velocity_y; |
994 current_fling_velocity_ = gfx::Vector2dF(vx, vy); | 994 current_fling_velocity_ = gfx::Vector2dF(vx, vy); |
995 DCHECK(!current_fling_velocity_.IsZero()); | 995 DCHECK(!current_fling_velocity_.IsZero()); |
996 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 996 fling_curve_ = client_->CreateFlingAnimationCurve( |
997 gesture_event.source_device, WebFloatPoint(vx, vy), | 997 gesture_event.source_device, WebFloatPoint(vx, vy), blink::WebSize()); |
998 blink::WebSize())); | |
999 disallow_horizontal_fling_scroll_ = !vx; | 998 disallow_horizontal_fling_scroll_ = !vx; |
1000 disallow_vertical_fling_scroll_ = !vy; | 999 disallow_vertical_fling_scroll_ = !vy; |
1001 TRACE_EVENT_ASYNC_BEGIN2("input,benchmark,rail", | 1000 TRACE_EVENT_ASYNC_BEGIN2("input,benchmark,rail", |
1002 "InputHandlerProxy::HandleGestureFling::started", | 1001 "InputHandlerProxy::HandleGestureFling::started", |
1003 this, "vx", vx, "vy", vy); | 1002 this, "vx", vx, "vy", vy); |
1004 // Note that the timestamp will only be used to kickstart the animation if | 1003 // Note that the timestamp will only be used to kickstart the animation if |
1005 // its sufficiently close to the timestamp of the first call |Animate()|. | 1004 // its sufficiently close to the timestamp of the first call |Animate()|. |
1006 has_fling_animation_started_ = false; | 1005 has_fling_animation_started_ = false; |
1007 fling_parameters_.start_time = gesture_event.TimeStampSeconds(); | 1006 fling_parameters_.start_time = gesture_event.TimeStampSeconds(); |
1008 fling_parameters_.delta = WebFloatPoint(vx, vy); | 1007 fling_parameters_.delta = WebFloatPoint(vx, vy); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 current_fling_velocity_ += new_fling_velocity; | 1228 current_fling_velocity_ += new_fling_velocity; |
1230 else | 1229 else |
1231 current_fling_velocity_ = new_fling_velocity; | 1230 current_fling_velocity_ = new_fling_velocity; |
1232 | 1231 |
1233 WebFloatPoint velocity(current_fling_velocity_.x(), | 1232 WebFloatPoint velocity(current_fling_velocity_.x(), |
1234 current_fling_velocity_.y()); | 1233 current_fling_velocity_.y()); |
1235 deferred_fling_cancel_time_seconds_ = 0; | 1234 deferred_fling_cancel_time_seconds_ = 0; |
1236 disallow_horizontal_fling_scroll_ = !velocity.x; | 1235 disallow_horizontal_fling_scroll_ = !velocity.x; |
1237 disallow_vertical_fling_scroll_ = !velocity.y; | 1236 disallow_vertical_fling_scroll_ = !velocity.y; |
1238 last_fling_boost_event_ = WebGestureEvent(); | 1237 last_fling_boost_event_ = WebGestureEvent(); |
1239 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 1238 fling_curve_ = client_->CreateFlingAnimationCurve( |
1240 gesture_event.source_device, velocity, blink::WebSize())); | 1239 gesture_event.source_device, velocity, blink::WebSize()); |
1241 fling_parameters_.start_time = gesture_event.TimeStampSeconds(); | 1240 fling_parameters_.start_time = gesture_event.TimeStampSeconds(); |
1242 fling_parameters_.delta = velocity; | 1241 fling_parameters_.delta = velocity; |
1243 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); | 1242 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |
1244 fling_parameters_.global_point = | 1243 fling_parameters_.global_point = |
1245 WebPoint(gesture_event.global_x, gesture_event.global_y); | 1244 WebPoint(gesture_event.global_x, gesture_event.global_y); |
1246 | 1245 |
1247 TRACE_EVENT_INSTANT2("input", | 1246 TRACE_EVENT_INSTANT2("input", |
1248 fling_boosted ? "InputHandlerProxy::FlingBoosted" | 1247 fling_boosted ? "InputHandlerProxy::FlingBoosted" |
1249 : "InputHandlerProxy::FlingReplaced", | 1248 : "InputHandlerProxy::FlingReplaced", |
1250 TRACE_EVENT_SCOPE_THREAD, | 1249 TRACE_EVENT_SCOPE_THREAD, |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1644 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1646 scroll_result)); | 1645 scroll_result)); |
1647 } | 1646 } |
1648 | 1647 |
1649 void InputHandlerProxy::SetTickClockForTesting( | 1648 void InputHandlerProxy::SetTickClockForTesting( |
1650 std::unique_ptr<base::TickClock> tick_clock) { | 1649 std::unique_ptr<base::TickClock> tick_clock) { |
1651 tick_clock_ = std::move(tick_clock); | 1650 tick_clock_ = std::move(tick_clock); |
1652 } | 1651 } |
1653 | 1652 |
1654 } // namespace ui | 1653 } // namespace ui |
OLD | NEW |