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 gfx::Point(touch_event.touches[i].position.x, | 805 gfx::Point(touch_event.touches[i].position.x, |
806 touch_event.touches[i].position.y))) { | 806 touch_event.touches[i].position.y))) { |
807 result = DID_NOT_HANDLE; | 807 result = DID_NOT_HANDLE; |
808 break; | 808 break; |
809 } | 809 } |
810 } | 810 } |
811 | 811 |
812 // If |result| is DROP_EVENT it wasn't processed above. | 812 // If |result| is DROP_EVENT it wasn't processed above. |
813 if (result == DROP_EVENT) { | 813 if (result == DROP_EVENT) { |
814 switch (input_handler_->GetEventListenerProperties( | 814 switch (input_handler_->GetEventListenerProperties( |
815 cc::EventListenerClass::kTouch)) { | 815 cc::EventListenerClass::kTouchStartOrMove)) { |
816 case cc::EventListenerProperties::kPassive: | 816 case cc::EventListenerProperties::kPassive: |
817 result = DID_HANDLE_NON_BLOCKING; | 817 result = DID_HANDLE_NON_BLOCKING; |
818 break; | 818 break; |
819 case cc::EventListenerProperties::kBlocking: | 819 case cc::EventListenerProperties::kBlocking: |
820 // The touch area rects above already have checked whether it hits | 820 // The touch area rects above already have checked whether it hits |
821 // a blocking region. Since it does not the event can be dropped. | 821 // a blocking region. Since it does not the event can be dropped. |
822 result = DROP_EVENT; | 822 result = DROP_EVENT; |
823 break; | 823 break; |
824 case cc::EventListenerProperties::kBlockingAndPassive: | 824 case cc::EventListenerProperties::kBlockingAndPassive: |
825 // There is at least one passive listener that needs to possibly | 825 // There is at least one passive listener that needs to possibly |
(...skipping 10 matching lines...) Expand all Loading... |
836 } | 836 } |
837 } | 837 } |
838 | 838 |
839 // Merge |touch_start_result_| and |result| so the result has the highest | 839 // Merge |touch_start_result_| and |result| so the result has the highest |
840 // priority value according to the sequence; (DROP_EVENT, | 840 // priority value according to the sequence; (DROP_EVENT, |
841 // DID_HANDLE_NON_BLOCKING, DID_NOT_HANDLE). | 841 // DID_HANDLE_NON_BLOCKING, DID_NOT_HANDLE). |
842 if (touch_start_result_ == kEventDispositionUndefined || | 842 if (touch_start_result_ == kEventDispositionUndefined || |
843 touch_start_result_ == DROP_EVENT || result == DID_NOT_HANDLE) | 843 touch_start_result_ == DROP_EVENT || result == DID_NOT_HANDLE) |
844 touch_start_result_ = result; | 844 touch_start_result_ = result; |
845 | 845 |
| 846 // If |result| is still DROP_EVENT look at the touch end handler as |
| 847 // we may not want to discard the entire touch sequence. Note this |
| 848 // code is explicitly after the assignment of the |touch_start_result_| |
| 849 // so the touch moves are not sent to the main thread un-necessarily. |
| 850 if (result == DROP_EVENT && |
| 851 input_handler_->GetEventListenerProperties( |
| 852 cc::EventListenerClass::kTouchEndOrCancel) != |
| 853 cc::EventListenerProperties::kNone) { |
| 854 result = DID_HANDLE_NON_BLOCKING; |
| 855 } |
| 856 |
846 return result; | 857 return result; |
847 } | 858 } |
848 | 859 |
849 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( | 860 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( |
850 const blink::WebTouchEvent& touch_event) { | 861 const blink::WebTouchEvent& touch_event) { |
851 if (touch_start_result_ != kEventDispositionUndefined) | 862 if (touch_start_result_ != kEventDispositionUndefined) |
852 return static_cast<EventDisposition>(touch_start_result_); | 863 return static_cast<EventDisposition>(touch_start_result_); |
853 return DID_NOT_HANDLE; | 864 return DID_NOT_HANDLE; |
854 } | 865 } |
855 | 866 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 // is made asynchronously, to minimize divergence between main thread and | 1356 // is made asynchronously, to minimize divergence between main thread and |
1346 // impl thread event handling paths. | 1357 // impl thread event handling paths. |
1347 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1358 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1348 FROM_HERE, | 1359 FROM_HERE, |
1349 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1360 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
1350 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1361 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1351 scroll_result)); | 1362 scroll_result)); |
1352 } | 1363 } |
1353 | 1364 |
1354 } // namespace ui | 1365 } // namespace ui |
OLD | NEW |