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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 "InputHandlerProxy::ExtendBoostedFlingTimeout", | 1033 "InputHandlerProxy::ExtendBoostedFlingTimeout", |
1034 TRACE_EVENT_SCOPE_THREAD); | 1034 TRACE_EVENT_SCOPE_THREAD); |
1035 deferred_fling_cancel_time_seconds_ = | 1035 deferred_fling_cancel_time_seconds_ = |
1036 event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds; | 1036 event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds; |
1037 last_fling_boost_event_ = event; | 1037 last_fling_boost_event_ = event; |
1038 } | 1038 } |
1039 | 1039 |
1040 void InputHandlerProxy::Animate(base::TimeTicks time) { | 1040 void InputHandlerProxy::Animate(base::TimeTicks time) { |
1041 // If using synchronous animate, then only expect Animate attempts started by | 1041 // If using synchronous animate, then only expect Animate attempts started by |
1042 // the synchronous system. Don't let the InputHandler try to Animate also. | 1042 // the synchronous system. Don't let the InputHandler try to Animate also. |
1043 DCHECK(!input_handler_->IsCurrentlyScrollingInnerViewport() || | 1043 DCHECK(!input_handler_->IsCurrentlyScrollingViewport() || |
1044 allow_root_animate_); | 1044 allow_root_animate_); |
1045 | 1045 |
1046 if (scroll_elasticity_controller_) | 1046 if (scroll_elasticity_controller_) |
1047 scroll_elasticity_controller_->Animate(time); | 1047 scroll_elasticity_controller_->Animate(time); |
1048 | 1048 |
1049 if (!fling_curve_) | 1049 if (!fling_curve_) |
1050 return; | 1050 return; |
1051 | 1051 |
1052 last_fling_animate_time_ = time; | 1052 last_fling_animate_time_ = time; |
1053 double monotonic_time_sec = InSecondsF(time); | 1053 double monotonic_time_sec = InSecondsF(time); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } | 1238 } |
1239 | 1239 |
1240 return had_fling_animation; | 1240 return had_fling_animation; |
1241 } | 1241 } |
1242 | 1242 |
1243 void InputHandlerProxy::RequestAnimation() { | 1243 void InputHandlerProxy::RequestAnimation() { |
1244 // When a SynchronousInputHandler is present, root flings should go through | 1244 // When a SynchronousInputHandler is present, root flings should go through |
1245 // it to allow it to control when or if the root fling is animated. Non-root | 1245 // it to allow it to control when or if the root fling is animated. Non-root |
1246 // flings always go through the normal InputHandler. | 1246 // flings always go through the normal InputHandler. |
1247 if (synchronous_input_handler_ && | 1247 if (synchronous_input_handler_ && |
1248 input_handler_->IsCurrentlyScrollingInnerViewport()) | 1248 input_handler_->IsCurrentlyScrollingViewport()) |
1249 synchronous_input_handler_->SetNeedsSynchronousAnimateInput(); | 1249 synchronous_input_handler_->SetNeedsSynchronousAnimateInput(); |
1250 else | 1250 else |
1251 input_handler_->SetNeedsAnimateInput(); | 1251 input_handler_->SetNeedsAnimateInput(); |
1252 } | 1252 } |
1253 | 1253 |
1254 bool InputHandlerProxy::TouchpadFlingScroll( | 1254 bool InputHandlerProxy::TouchpadFlingScroll( |
1255 const WebFloatSize& increment) { | 1255 const WebFloatSize& increment) { |
1256 InputHandlerProxy::EventDisposition disposition; | 1256 InputHandlerProxy::EventDisposition disposition; |
1257 cc::EventListenerProperties properties = | 1257 cc::EventListenerProperties properties = |
1258 input_handler_->GetEventListenerProperties( | 1258 input_handler_->GetEventListenerProperties( |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 // is made asynchronously, to minimize divergence between main thread and | 1391 // is made asynchronously, to minimize divergence between main thread and |
1392 // impl thread event handling paths. | 1392 // impl thread event handling paths. |
1393 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1393 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1394 FROM_HERE, | 1394 FROM_HERE, |
1395 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1395 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
1396 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1396 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1397 scroll_result)); | 1397 scroll_result)); |
1398 } | 1398 } |
1399 | 1399 |
1400 } // namespace ui | 1400 } // namespace ui |
OLD | NEW |