Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ui/events/blink/input_handler_proxy.cc

Issue 2471523002: Make touch events uncancelable during fling when they are on the current active scroll layer (Closed)
Patch Set: rename both functions Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_->DoTouchHandlersBlockScrollAt(
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::kBlockingAndPassiveDueToFling
850 ? true
bokan 2016/11/15 22:42:40 No need for ? true : false
lanwei 2016/11/16 21:13:29 Done.
851 : false;
844 result = DID_NOT_HANDLE; 852 result = DID_NOT_HANDLE;
845 break; 853 break;
846 } 854 }
847 } 855 }
848 856
849 // If |result| is DROP_EVENT it wasn't processed above. 857 // If |result| is DROP_EVENT it wasn't processed above.
850 if (result == DROP_EVENT) { 858 if (result == DROP_EVENT) {
851 switch (input_handler_->GetEventListenerProperties( 859 switch (input_handler_->GetEventListenerProperties(
852 cc::EventListenerClass::kTouchStartOrMove)) { 860 cc::EventListenerClass::kTouchStartOrMove)) {
853 case cc::EventListenerProperties::kPassive: 861 case cc::EventListenerProperties::kPassive:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 // code is explicitly after the assignment of the |touch_start_result_| 893 // 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. 894 // so the touch moves are not sent to the main thread un-necessarily.
887 if (result == DROP_EVENT && 895 if (result == DROP_EVENT &&
888 input_handler_->GetEventListenerProperties( 896 input_handler_->GetEventListenerProperties(
889 cc::EventListenerClass::kTouchEndOrCancel) != 897 cc::EventListenerClass::kTouchEndOrCancel) !=
890 cc::EventListenerProperties::kNone) { 898 cc::EventListenerProperties::kNone) {
891 result = DID_HANDLE_NON_BLOCKING; 899 result = DID_HANDLE_NON_BLOCKING;
892 } 900 }
893 901
894 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; 902 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_;
895 if (result == DID_NOT_HANDLE && is_fling_on_impl) 903 if (result == DID_NOT_HANDLE && is_fling_on_impl &&
904 maybe_passive_due_to_fling)
896 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; 905 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING;
897 906
898 return result; 907 return result;
899 } 908 }
900 909
901 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( 910 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove(
902 const blink::WebTouchEvent& touch_event) { 911 const blink::WebTouchEvent& touch_event) {
903 if (touch_start_result_ != kEventDispositionUndefined) 912 if (touch_start_result_ != kEventDispositionUndefined)
904 return static_cast<EventDisposition>(touch_start_result_); 913 return static_cast<EventDisposition>(touch_start_result_);
905 return DID_NOT_HANDLE; 914 return DID_NOT_HANDLE;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 // is made asynchronously, to minimize divergence between main thread and 1425 // is made asynchronously, to minimize divergence between main thread and
1417 // impl thread event handling paths. 1426 // impl thread event handling paths.
1418 base::ThreadTaskRunnerHandle::Get()->PostTask( 1427 base::ThreadTaskRunnerHandle::Get()->PostTask(
1419 FROM_HERE, 1428 FROM_HERE,
1420 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, 1429 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult,
1421 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1430 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1422 scroll_result)); 1431 scroll_result));
1423 } 1432 }
1424 1433
1425 } // namespace ui 1434 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698