| 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 } | 828 } |
| 829 return DROP_EVENT; | 829 return DROP_EVENT; |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 return DID_NOT_HANDLE; | 832 return DID_NOT_HANDLE; |
| 833 } | 833 } |
| 834 | 834 |
| 835 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( | 835 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( |
| 836 const blink::WebTouchEvent& touch_event) { | 836 const blink::WebTouchEvent& touch_event) { |
| 837 EventDisposition result = DROP_EVENT; | 837 EventDisposition result = DROP_EVENT; |
| 838 bool maybe_passive_due_to_fling = false; |
| 838 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 839 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
| 839 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) | 840 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) |
| 840 continue; | 841 continue; |
| 841 if (input_handler_->DoTouchEventsBlockScrollAt( | 842 cc::EventListenerProperties event_result = |
| 843 input_handler_->EventListenerTypeForTouchStartAt( |
| 842 gfx::Point(touch_event.touches[i].position.x, | 844 gfx::Point(touch_event.touches[i].position.x, |
| 843 touch_event.touches[i].position.y))) { | 845 touch_event.touches[i].position.y)); |
| 846 if (event_result != cc::EventListenerProperties::kNone) { |
| 847 maybe_passive_due_to_fling = |
| 848 event_result == |
| 849 cc::EventListenerProperties::kBlockingAndMaybePassiveDueToFling; |
| 844 result = DID_NOT_HANDLE; | 850 result = DID_NOT_HANDLE; |
| 845 break; | 851 break; |
| 846 } | 852 } |
| 847 } | 853 } |
| 848 | 854 |
| 849 // If |result| is DROP_EVENT it wasn't processed above. | 855 // If |result| is DROP_EVENT it wasn't processed above. |
| 850 if (result == DROP_EVENT) { | 856 if (result == DROP_EVENT) { |
| 851 switch (input_handler_->GetEventListenerProperties( | 857 switch (input_handler_->GetEventListenerProperties( |
| 852 cc::EventListenerClass::kTouchStartOrMove)) { | 858 cc::EventListenerClass::kTouchStartOrMove)) { |
| 853 case cc::EventListenerProperties::kPassive: | 859 case cc::EventListenerProperties::kPassive: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 // code is explicitly after the assignment of the |touch_start_result_| | 891 // code is explicitly after the assignment of the |touch_start_result_| |
| 886 // so the touch moves are not sent to the main thread un-necessarily. | 892 // so the touch moves are not sent to the main thread un-necessarily. |
| 887 if (result == DROP_EVENT && | 893 if (result == DROP_EVENT && |
| 888 input_handler_->GetEventListenerProperties( | 894 input_handler_->GetEventListenerProperties( |
| 889 cc::EventListenerClass::kTouchEndOrCancel) != | 895 cc::EventListenerClass::kTouchEndOrCancel) != |
| 890 cc::EventListenerProperties::kNone) { | 896 cc::EventListenerProperties::kNone) { |
| 891 result = DID_HANDLE_NON_BLOCKING; | 897 result = DID_HANDLE_NON_BLOCKING; |
| 892 } | 898 } |
| 893 | 899 |
| 894 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; | 900 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; |
| 895 if (result == DID_NOT_HANDLE && is_fling_on_impl) | 901 if (is_fling_on_impl && maybe_passive_due_to_fling) |
| 896 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; | 902 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; |
| 897 | 903 |
| 898 return result; | 904 return result; |
| 899 } | 905 } |
| 900 | 906 |
| 901 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( | 907 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( |
| 902 const blink::WebTouchEvent& touch_event) { | 908 const blink::WebTouchEvent& touch_event) { |
| 903 if (touch_start_result_ != kEventDispositionUndefined) | 909 if (touch_start_result_ != kEventDispositionUndefined) |
| 904 return static_cast<EventDisposition>(touch_start_result_); | 910 return static_cast<EventDisposition>(touch_start_result_); |
| 905 return DID_NOT_HANDLE; | 911 return DID_NOT_HANDLE; |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 // is made asynchronously, to minimize divergence between main thread and | 1422 // is made asynchronously, to minimize divergence between main thread and |
| 1417 // impl thread event handling paths. | 1423 // impl thread event handling paths. |
| 1418 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1424 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1419 FROM_HERE, | 1425 FROM_HERE, |
| 1420 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1426 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
| 1421 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1427 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1422 scroll_result)); | 1428 scroll_result)); |
| 1423 } | 1429 } |
| 1424 | 1430 |
| 1425 } // namespace ui | 1431 } // namespace ui |
| OLD | NEW |