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

Unified Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and non-const ref passed back Created 4 years, 8 months 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: content/browser/renderer_host/input/touch_event_queue.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index b92b24aaa23e6efba589c23ce32705ab4feaeef7..7fb04c5d5986087819c4c205e8a1c764bec6077d 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -45,7 +45,7 @@ TouchEventWithLatencyInfo ObtainCancelEventForTouchEvent(
bool ShouldTouchTriggerTimeout(const WebTouchEvent& event) {
return (event.type == WebInputEvent::TouchStart ||
event.type == WebInputEvent::TouchMove) &&
- WebInputEventTraits::ShouldBlockEventStream(event) && event.cancelable;
+ event.dispatchType == WebInputEvent::Blocking;
}
// Compare all properties of touch points to determine the state.
@@ -509,6 +509,7 @@ void TouchEventQueue::PrependTouchScrollNotification() {
touch.event.type = WebInputEvent::TouchScrollStarted;
touch.event.uniqueTouchEventId = 0;
touch.event.touchesLength = 0;
+ touch.event.dispatchType = WebInputEvent::EventNonBlocking;
auto it = touch_queue_.begin();
DCHECK(it != touch_queue_.end());
@@ -634,7 +635,9 @@ void TouchEventQueue::ForwardNextEventToRenderer() {
if (pending_async_touchmove_) {
if (pending_async_touchmove_->CanCoalesceWith(touch)) {
pending_async_touchmove_->CoalesceWith(touch);
- pending_async_touchmove_->event.cancelable = !send_touch_events_async_;
+ pending_async_touchmove_->event.dispatchType =
+ send_touch_events_async_ ? WebInputEvent::EventNonBlocking
+ : WebInputEvent::Blocking;
touch = *pending_async_touchmove_;
pending_async_touchmove_.reset();
} else {
@@ -647,7 +650,7 @@ void TouchEventQueue::ForwardNextEventToRenderer() {
// platform scrolling and JS pinching. Touchend events, however, remain
// uncancelable, mitigating the risk of jank when transitioning to a fling.
if (send_touch_events_async_ && touch.event.type != WebInputEvent::TouchStart)
- touch.event.cancelable = false;
+ touch.event.dispatchType = WebInputEvent::EventNonBlocking;
SendTouchEventImmediately(&touch);
}
@@ -656,7 +659,7 @@ void TouchEventQueue::FlushPendingAsyncTouchmove() {
DCHECK(!dispatching_touch_);
std::unique_ptr<TouchEventWithLatencyInfo> touch =
std::move(pending_async_touchmove_);
- touch->event.cancelable = false;
+ touch->event.dispatchType = WebInputEvent::EventNonBlocking;
touch_queue_.push_front(new CoalescedWebTouchEvent(*touch, true));
SendTouchEventImmediately(touch.get());
}
@@ -825,7 +828,7 @@ void TouchEventQueue::SendTouchEventImmediately(
// timeout should not be started and the count also should not be increased.
if (dispatching_touch_) {
if (touch->event.type == WebInputEvent::TouchMove &&
- !touch->event.cancelable) {
+ touch->event.dispatchType != WebInputEvent::Blocking) {
// When we send out a uncancelable touch move, we increase the count and
// we do not process input event ack any more, we will just ack to client
// and wait for the ack from render. Also we will remove it from the front

Powered by Google App Engine
This is Rietveld 408576698