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

Unified 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: clean up code 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/input_handler_proxy.cc
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 01d2544ceebb997e47f6822a2eea07fb510480f0..54d506e89c58db93fc3c3d8b0e3781fbbe77c7b5 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -797,7 +797,6 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = false;
fling_may_be_active_on_main_thread_ = true;
- client_->DidStartFlinging();
return DID_NOT_HANDLE;
}
case cc::InputHandler::SCROLL_IGNORED: {
@@ -821,12 +820,14 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart(
const blink::WebTouchEvent& touch_event) {
EventDisposition result = DROP_EVENT;
+ cc::InputHandler::TouchStartHitResult hit_result =
+ cc::InputHandler::TouchStartHitResult::SAME_LAYER;
for (size_t i = 0; i < touch_event.touchesLength; ++i) {
if (touch_event.touches[i].state != WebTouchPoint::StatePressed)
continue;
- if (input_handler_->DoTouchEventsBlockScrollAt(
- gfx::Point(touch_event.touches[i].position.x,
- touch_event.touches[i].position.y))) {
+ hit_result = input_handler_->DoTouchEventsBlockScrollAt(gfx::Point(
+ touch_event.touches[i].position.x, touch_event.touches[i].position.y));
+ if (hit_result != cc::InputHandler::HANDLER) {
result = DID_NOT_HANDLE;
break;
}
@@ -876,7 +877,14 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart(
cc::EventListenerProperties::kNone) {
result = DID_HANDLE_NON_BLOCKING;
}
+ bool is_fling_on_impl = fling_curve_ && !fling_may_be_active_on_main_thread_;
+ bool touch_on_active_scroll_layer =
+ hit_result == cc::InputHandler::TouchStartHitResult::SAME_LAYER;
+ if (result == DID_NOT_HANDLE && touch_on_active_scroll_layer &&
+ is_fling_on_impl) {
+ result = DID_NOT_HANDLE_NON_BLOCKING;
+ }
return result;
}
@@ -1301,6 +1309,7 @@ bool InputHandlerProxy::TouchpadFlingScroll(
case DROP_EVENT:
break;
case DID_NOT_HANDLE:
+ case DID_NOT_HANDLE_NON_BLOCKING:
TRACE_EVENT_INSTANT0("input",
"InputHandlerProxy::scrollBy::AbortFling",
TRACE_EVENT_SCOPE_THREAD);
@@ -1312,7 +1321,6 @@ bool InputHandlerProxy::TouchpadFlingScroll(
// the subarea but then is flung "under" the pointer.
client_->TransferActiveWheelFlingAnimation(fling_parameters_);
fling_may_be_active_on_main_thread_ = true;
- client_->DidStartFlinging();
CancelCurrentFlingWithoutNotifyingClient();
break;
}

Powered by Google App Engine
This is Rietveld 408576698