| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 const float vx = gesture_event.data.flingStart.velocityX; | 726 const float vx = gesture_event.data.flingStart.velocityX; |
| 727 const float vy = gesture_event.data.flingStart.velocityY; | 727 const float vy = gesture_event.data.flingStart.velocityY; |
| 728 current_fling_velocity_ = gfx::Vector2dF(vx, vy); | 728 current_fling_velocity_ = gfx::Vector2dF(vx, vy); |
| 729 DCHECK(!current_fling_velocity_.IsZero()); | 729 DCHECK(!current_fling_velocity_.IsZero()); |
| 730 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 730 fling_curve_.reset(client_->CreateFlingAnimationCurve( |
| 731 gesture_event.sourceDevice, | 731 gesture_event.sourceDevice, |
| 732 WebFloatPoint(vx, vy), | 732 WebFloatPoint(vx, vy), |
| 733 blink::WebSize())); | 733 blink::WebSize())); |
| 734 disallow_horizontal_fling_scroll_ = !vx; | 734 disallow_horizontal_fling_scroll_ = !vx; |
| 735 disallow_vertical_fling_scroll_ = !vy; | 735 disallow_vertical_fling_scroll_ = !vy; |
| 736 TRACE_EVENT_ASYNC_BEGIN2("input,benchmark", | 736 TRACE_EVENT_ASYNC_BEGIN2("input,benchmark,rail", |
| 737 "InputHandlerProxy::HandleGestureFling::started", | 737 "InputHandlerProxy::HandleGestureFling::started", |
| 738 this, "vx", vx, "vy", vy); | 738 this, "vx", vx, "vy", vy); |
| 739 // Note that the timestamp will only be used to kickstart the animation if | 739 // Note that the timestamp will only be used to kickstart the animation if |
| 740 // its sufficiently close to the timestamp of the first call |Animate()|. | 740 // its sufficiently close to the timestamp of the first call |Animate()|. |
| 741 has_fling_animation_started_ = false; | 741 has_fling_animation_started_ = false; |
| 742 fling_parameters_.startTime = gesture_event.timeStampSeconds; | 742 fling_parameters_.startTime = gesture_event.timeStampSeconds; |
| 743 fling_parameters_.delta = WebFloatPoint(vx, vy); | 743 fling_parameters_.delta = WebFloatPoint(vx, vy); |
| 744 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); | 744 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |
| 745 fling_parameters_.globalPoint = | 745 fling_parameters_.globalPoint = |
| 746 WebPoint(gesture_event.globalX, gesture_event.globalY); | 746 WebPoint(gesture_event.globalX, gesture_event.globalY); |
| 747 fling_parameters_.modifiers = gesture_event.modifiers; | 747 fling_parameters_.modifiers = gesture_event.modifiers; |
| 748 fling_parameters_.sourceDevice = gesture_event.sourceDevice; | 748 fling_parameters_.sourceDevice = gesture_event.sourceDevice; |
| 749 RequestAnimation(); | 749 RequestAnimation(); |
| 750 return DID_HANDLE; | 750 return DID_HANDLE; |
| 751 } | 751 } |
| 752 case cc::InputHandler::SCROLL_UNKNOWN: | 752 case cc::InputHandler::SCROLL_UNKNOWN: |
| 753 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: { | 753 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: { |
| 754 TRACE_EVENT_INSTANT0("input", | 754 TRACE_EVENT_INSTANT0("input,rail", |
| 755 "InputHandlerProxy::HandleGestureFling::" | 755 "InputHandlerProxy::HandleGestureFling::" |
| 756 "scroll_on_main_thread", | 756 "scroll_on_main_thread", |
| 757 TRACE_EVENT_SCOPE_THREAD); | 757 TRACE_EVENT_SCOPE_THREAD); |
| 758 gesture_scroll_on_impl_thread_ = false; | 758 gesture_scroll_on_impl_thread_ = false; |
| 759 fling_may_be_active_on_main_thread_ = true; | 759 fling_may_be_active_on_main_thread_ = true; |
| 760 client_->DidStartFlinging(); | 760 client_->DidStartFlinging(); |
| 761 return DID_NOT_HANDLE; | 761 return DID_NOT_HANDLE; |
| 762 } | 762 } |
| 763 case cc::InputHandler::SCROLL_IGNORED: { | 763 case cc::InputHandler::SCROLL_IGNORED: { |
| 764 TRACE_EVENT_INSTANT0( | 764 TRACE_EVENT_INSTANT0( |
| 765 "input", | 765 "input,rail", |
| 766 "InputHandlerProxy::HandleGestureFling::ignored", | 766 "InputHandlerProxy::HandleGestureFling::ignored", |
| 767 TRACE_EVENT_SCOPE_THREAD); | 767 TRACE_EVENT_SCOPE_THREAD); |
| 768 gesture_scroll_on_impl_thread_ = false; | 768 gesture_scroll_on_impl_thread_ = false; |
| 769 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { | 769 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { |
| 770 // We still pass the curve to the main thread if there's nothing | 770 // We still pass the curve to the main thread if there's nothing |
| 771 // scrollable, in case something | 771 // scrollable, in case something |
| 772 // registers a handler before the curve is over. | 772 // registers a handler before the curve is over. |
| 773 return DID_NOT_HANDLE; | 773 return DID_NOT_HANDLE; |
| 774 } | 774 } |
| 775 return DROP_EVENT; | 775 return DROP_EVENT; |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 // is made asynchronously, to minimize divergence between main thread and | 1340 // is made asynchronously, to minimize divergence between main thread and |
| 1341 // impl thread event handling paths. | 1341 // impl thread event handling paths. |
| 1342 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1342 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1343 FROM_HERE, | 1343 FROM_HERE, |
| 1344 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1344 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
| 1345 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1345 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1346 scroll_result)); | 1346 scroll_result)); |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 } // namespace ui | 1349 } // namespace ui |
| OLD | NEW |