| 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 return DID_HANDLE; | 805 return DID_HANDLE; |
| 806 } | 806 } |
| 807 case cc::InputHandler::SCROLL_UNKNOWN: | 807 case cc::InputHandler::SCROLL_UNKNOWN: |
| 808 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: { | 808 case cc::InputHandler::SCROLL_ON_MAIN_THREAD: { |
| 809 TRACE_EVENT_INSTANT0("input,rail", | 809 TRACE_EVENT_INSTANT0("input,rail", |
| 810 "InputHandlerProxy::HandleGestureFling::" | 810 "InputHandlerProxy::HandleGestureFling::" |
| 811 "scroll_on_main_thread", | 811 "scroll_on_main_thread", |
| 812 TRACE_EVENT_SCOPE_THREAD); | 812 TRACE_EVENT_SCOPE_THREAD); |
| 813 gesture_scroll_on_impl_thread_ = false; | 813 gesture_scroll_on_impl_thread_ = false; |
| 814 fling_may_be_active_on_main_thread_ = true; | 814 fling_may_be_active_on_main_thread_ = true; |
| 815 client_->DidStartFlinging(); | |
| 816 return DID_NOT_HANDLE; | 815 return DID_NOT_HANDLE; |
| 817 } | 816 } |
| 818 case cc::InputHandler::SCROLL_IGNORED: { | 817 case cc::InputHandler::SCROLL_IGNORED: { |
| 819 TRACE_EVENT_INSTANT0( | 818 TRACE_EVENT_INSTANT0( |
| 820 "input,rail", | 819 "input,rail", |
| 821 "InputHandlerProxy::HandleGestureFling::ignored", | 820 "InputHandlerProxy::HandleGestureFling::ignored", |
| 822 TRACE_EVENT_SCOPE_THREAD); | 821 TRACE_EVENT_SCOPE_THREAD); |
| 823 gesture_scroll_on_impl_thread_ = false; | 822 gesture_scroll_on_impl_thread_ = false; |
| 824 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { | 823 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { |
| 825 // We still pass the curve to the main thread if there's nothing | 824 // We still pass the curve to the main thread if there's nothing |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 // we may not want to discard the entire touch sequence. Note this | 884 // we may not want to discard the entire touch sequence. Note this |
| 886 // code is explicitly after the assignment of the |touch_start_result_| | 885 // code is explicitly after the assignment of the |touch_start_result_| |
| 887 // so the touch moves are not sent to the main thread un-necessarily. | 886 // so the touch moves are not sent to the main thread un-necessarily. |
| 888 if (result == DROP_EVENT && | 887 if (result == DROP_EVENT && |
| 889 input_handler_->GetEventListenerProperties( | 888 input_handler_->GetEventListenerProperties( |
| 890 cc::EventListenerClass::kTouchEndOrCancel) != | 889 cc::EventListenerClass::kTouchEndOrCancel) != |
| 891 cc::EventListenerProperties::kNone) { | 890 cc::EventListenerProperties::kNone) { |
| 892 result = DID_HANDLE_NON_BLOCKING; | 891 result = DID_HANDLE_NON_BLOCKING; |
| 893 } | 892 } |
| 894 | 893 |
| 894 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; |
| 895 if (result == DID_NOT_HANDLE && is_fling_on_impl) |
| 896 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; |
| 897 |
| 895 return result; | 898 return result; |
| 896 } | 899 } |
| 897 | 900 |
| 898 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( | 901 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( |
| 899 const blink::WebTouchEvent& touch_event) { | 902 const blink::WebTouchEvent& touch_event) { |
| 900 if (touch_start_result_ != kEventDispositionUndefined) | 903 if (touch_start_result_ != kEventDispositionUndefined) |
| 901 return static_cast<EventDisposition>(touch_start_result_); | 904 return static_cast<EventDisposition>(touch_start_result_); |
| 902 return DID_NOT_HANDLE; | 905 return DID_NOT_HANDLE; |
| 903 } | 906 } |
| 904 | 907 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 "InputHandlerProxy::scrollBy::AbortFling", | 1323 "InputHandlerProxy::scrollBy::AbortFling", |
| 1321 TRACE_EVENT_SCOPE_THREAD); | 1324 TRACE_EVENT_SCOPE_THREAD); |
| 1322 // If we got a DID_NOT_HANDLE, that means we need to deliver wheels on the | 1325 // If we got a DID_NOT_HANDLE, that means we need to deliver wheels on the |
| 1323 // main thread. In this case we need to schedule a commit and transfer the | 1326 // main thread. In this case we need to schedule a commit and transfer the |
| 1324 // fling curve over to the main thread and run the rest of the wheels from | 1327 // fling curve over to the main thread and run the rest of the wheels from |
| 1325 // there. This can happen when flinging a page that contains a scrollable | 1328 // there. This can happen when flinging a page that contains a scrollable |
| 1326 // subarea that we can't scroll on the thread if the fling starts outside | 1329 // subarea that we can't scroll on the thread if the fling starts outside |
| 1327 // the subarea but then is flung "under" the pointer. | 1330 // the subarea but then is flung "under" the pointer. |
| 1328 client_->TransferActiveWheelFlingAnimation(fling_parameters_); | 1331 client_->TransferActiveWheelFlingAnimation(fling_parameters_); |
| 1329 fling_may_be_active_on_main_thread_ = true; | 1332 fling_may_be_active_on_main_thread_ = true; |
| 1330 client_->DidStartFlinging(); | |
| 1331 CancelCurrentFlingWithoutNotifyingClient(); | 1333 CancelCurrentFlingWithoutNotifyingClient(); |
| 1332 break; | 1334 break; |
| 1335 default: |
| 1336 NOTREACHED(); |
| 1337 return false; |
| 1333 } | 1338 } |
| 1334 | 1339 |
| 1335 return false; | 1340 return false; |
| 1336 } | 1341 } |
| 1337 | 1342 |
| 1338 bool InputHandlerProxy::scrollBy(const WebFloatSize& increment, | 1343 bool InputHandlerProxy::scrollBy(const WebFloatSize& increment, |
| 1339 const WebFloatSize& velocity) { | 1344 const WebFloatSize& velocity) { |
| 1340 WebFloatSize clipped_increment; | 1345 WebFloatSize clipped_increment; |
| 1341 WebFloatSize clipped_velocity; | 1346 WebFloatSize clipped_velocity; |
| 1342 if (!disallow_horizontal_fling_scroll_) { | 1347 if (!disallow_horizontal_fling_scroll_) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 // is made asynchronously, to minimize divergence between main thread and | 1416 // is made asynchronously, to minimize divergence between main thread and |
| 1412 // impl thread event handling paths. | 1417 // impl thread event handling paths. |
| 1413 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1418 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1414 FROM_HERE, | 1419 FROM_HERE, |
| 1415 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1420 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
| 1416 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1421 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1417 scroll_result)); | 1422 scroll_result)); |
| 1418 } | 1423 } |
| 1419 | 1424 |
| 1420 } // namespace ui | 1425 } // namespace ui |
| OLD | NEW |