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

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: fling layer 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 : false;
844 result = DID_NOT_HANDLE; 851 result = DID_NOT_HANDLE;
845 break; 852 break;
846 } 853 }
847 } 854 }
848 855
849 // If |result| is DROP_EVENT it wasn't processed above. 856 // If |result| is DROP_EVENT it wasn't processed above.
850 if (result == DROP_EVENT) { 857 if (result == DROP_EVENT) {
851 switch (input_handler_->GetEventListenerProperties( 858 switch (input_handler_->GetEventListenerProperties(
852 cc::EventListenerClass::kTouchStartOrMove)) { 859 cc::EventListenerClass::kTouchStartOrMove)) {
853 case cc::EventListenerProperties::kPassive: 860 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_| 892 // 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. 893 // so the touch moves are not sent to the main thread un-necessarily.
887 if (result == DROP_EVENT && 894 if (result == DROP_EVENT &&
888 input_handler_->GetEventListenerProperties( 895 input_handler_->GetEventListenerProperties(
889 cc::EventListenerClass::kTouchEndOrCancel) != 896 cc::EventListenerClass::kTouchEndOrCancel) !=
890 cc::EventListenerProperties::kNone) { 897 cc::EventListenerProperties::kNone) {
891 result = DID_HANDLE_NON_BLOCKING; 898 result = DID_HANDLE_NON_BLOCKING;
892 } 899 }
893 900
894 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_; 901 bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_;
895 if (result == DID_NOT_HANDLE && is_fling_on_impl) 902 if (result == DID_NOT_HANDLE && is_fling_on_impl &&
903 maybe_passive_due_to_fling)
896 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING; 904 result = DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING;
897 905
898 return result; 906 return result;
899 } 907 }
900 908
901 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove( 909 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchMove(
902 const blink::WebTouchEvent& touch_event) { 910 const blink::WebTouchEvent& touch_event) {
903 if (touch_start_result_ != kEventDispositionUndefined) 911 if (touch_start_result_ != kEventDispositionUndefined)
904 return static_cast<EventDisposition>(touch_start_result_); 912 return static_cast<EventDisposition>(touch_start_result_);
905 return DID_NOT_HANDLE; 913 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 1424 // is made asynchronously, to minimize divergence between main thread and
1417 // impl thread event handling paths. 1425 // impl thread event handling paths.
1418 base::ThreadTaskRunnerHandle::Get()->PostTask( 1426 base::ThreadTaskRunnerHandle::Get()->PostTask(
1419 FROM_HERE, 1427 FROM_HERE,
1420 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, 1428 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult,
1421 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1429 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1422 scroll_result)); 1430 scroll_result));
1423 } 1431 }
1424 1432
1425 } // namespace ui 1433 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698