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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 } | 928 } |
929 return DROP_EVENT; | 929 return DROP_EVENT; |
930 } | 930 } |
931 } | 931 } |
932 return DID_NOT_HANDLE; | 932 return DID_NOT_HANDLE; |
933 } | 933 } |
934 | 934 |
935 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( | 935 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( |
936 const blink::WebTouchEvent& touch_event) { | 936 const blink::WebTouchEvent& touch_event) { |
937 EventDisposition result = DROP_EVENT; | 937 EventDisposition result = DROP_EVENT; |
| 938 bool is_touching_scrolling_layer = false; |
938 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 939 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
939 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) | 940 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) |
940 continue; | 941 continue; |
941 if (input_handler_->DoTouchEventsBlockScrollAt( | 942 cc::InputHandler::TouchStartEventListenerType event_listener_type = |
| 943 input_handler_->EventListenerTypeForTouchStartAt( |
942 gfx::Point(touch_event.touches[i].position.x, | 944 gfx::Point(touch_event.touches[i].position.x, |
943 touch_event.touches[i].position.y))) { | 945 touch_event.touches[i].position.y)); |
| 946 if (event_listener_type != |
| 947 cc::InputHandler::TouchStartEventListenerType::NO_HANDLER) { |
| 948 is_touching_scrolling_layer = |
| 949 event_listener_type == cc::InputHandler::TouchStartEventListenerType:: |
| 950 HANDLER_ON_SCROLLING_LAYER; |
944 result = DID_NOT_HANDLE; | 951 result = DID_NOT_HANDLE; |
945 break; | 952 break; |
946 } | 953 } |
947 } | 954 } |
948 | 955 |
949 // If |result| is DROP_EVENT it wasn't processed above. | 956 // If |result| is DROP_EVENT it wasn't processed above. |
950 if (result == DROP_EVENT) { | 957 if (result == DROP_EVENT) { |
951 switch (input_handler_->GetEventListenerProperties( | 958 switch (input_handler_->GetEventListenerProperties( |
952 cc::EventListenerClass::kTouchStartOrMove)) { | 959 cc::EventListenerClass::kTouchStartOrMove)) { |
953 case cc::EventListenerProperties::kPassive: | 960 case cc::EventListenerProperties::kPassive: |
(...skipping 30 matching lines...) Expand all Loading... |
984 // we may not want to discard the entire touch sequence. Note this | 991 // we may not want to discard the entire touch sequence. Note this |
985 // code is explicitly after the assignment of the |touch_start_result_| | 992 // code is explicitly after the assignment of the |touch_start_result_| |
986 // so the touch moves are not sent to the main thread un-necessarily. | 993 // so the touch moves are not sent to the main thread un-necessarily. |
987 if (result == DROP_EVENT && | 994 if (result == DROP_EVENT && |
988 input_handler_->GetEventListenerProperties( | 995 input_handler_->GetEventListenerProperties( |
989 cc::EventListenerClass::kTouchEndOrCancel) != | 996 cc::EventListenerClass::kTouchEndOrCancel) != |
990 cc::EventListenerProperties::kNone) { | 997 cc::EventListenerProperties::kNone) { |
991 result = DID_HANDLE_NON_BLOCKING; | 998 result = DID_HANDLE_NON_BLOCKING; |
992 } | 999 } |
993 | 1000 |
994 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; | 1001 bool is_flinging_on_impl = |
995 if (result == DID_NOT_HANDLE && is_fling_on_impl) | 1002 fling_curve_ && !fling_may_be_active_on_main_thread_; |
| 1003 if (is_flinging_on_impl && is_touching_scrolling_layer) |
996 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; | 1004 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; |
997 | 1005 |
998 return result; | 1006 return result; |
999 } | 1007 } |
1000 | 1008 |
1001 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( | 1009 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( |
1002 const blink::WebTouchEvent& touch_event) { | 1010 const blink::WebTouchEvent& touch_event) { |
1003 if (touch_start_result_ != kEventDispositionUndefined) | 1011 if (touch_start_result_ != kEventDispositionUndefined) |
1004 return static_cast<EventDisposition>(touch_start_result_); | 1012 return static_cast<EventDisposition>(touch_start_result_); |
1005 return DID_NOT_HANDLE; | 1013 return DID_NOT_HANDLE; |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1533 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1526 scroll_result)); | 1534 scroll_result)); |
1527 } | 1535 } |
1528 | 1536 |
1529 void InputHandlerProxy::SetTickClockForTesting( | 1537 void InputHandlerProxy::SetTickClockForTesting( |
1530 std::unique_ptr<base::TickClock> tick_clock) { | 1538 std::unique_ptr<base::TickClock> tick_clock) { |
1531 tick_clock_ = std::move(tick_clock); | 1539 tick_clock_ = std::move(tick_clock); |
1532 } | 1540 } |
1533 | 1541 |
1534 } // namespace ui | 1542 } // namespace ui |
OLD | NEW |