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

Unified Diff: content/renderer/input/main_thread_event_queue.cc

Issue 2788203002: Adjust cancelabilty of touchmoves that are queued when scroll start occurs (Closed)
Patch Set: Created 3 years, 9 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/renderer/input/main_thread_event_queue.cc
diff --git a/content/renderer/input/main_thread_event_queue.cc b/content/renderer/input/main_thread_event_queue.cc
index 7e179487ceced850f7a532607a3ca1532cb7bb8e..5a2dd1e3cb7d0d9a1d31ae8ddfdbeb8ddd450618 100644
--- a/content/renderer/input/main_thread_event_queue.cc
+++ b/content/renderer/input/main_thread_event_queue.cc
@@ -22,10 +22,10 @@ class QueuedClosure : public MainThreadEventQueueTask {
~QueuedClosure() override {}
- CoalesceResult CoalesceWith(
+ NotifyResult NotifyEventWillBeQueued(
const MainThreadEventQueueTask& other_task) override {
- return other_task.IsWebInputEvent() ? CoalesceResult::KeepSearching
- : CoalesceResult::CannotCoalesce;
+ return other_task.IsWebInputEvent() ? NotifyResult::KeepIterating
+ : NotifyResult::Stop;
}
bool IsWebInputEvent() const override { return false; }
@@ -61,18 +61,24 @@ class QueuedWebInputEvent : public ScopedWebInputEventWithLatencyInfo,
~QueuedWebInputEvent() override {}
- CoalesceResult CoalesceWith(
- const MainThreadEventQueueTask& other_item) override {
- if (!other_item.IsWebInputEvent())
- return CoalesceResult::CannotCoalesce;
+ NotifyResult NotifyEventWillBeQueued(
+ const MainThreadEventQueueTask& other_task) override {
+ if (!other_task.IsWebInputEvent())
+ return NotifyResult::Stop;
const QueuedWebInputEvent& other_event =
- static_cast<const QueuedWebInputEvent&>(other_item);
+ static_cast<const QueuedWebInputEvent&>(other_task);
+ if (other_event.event().type() ==
+ blink::WebInputEvent::TouchScrollStarted) {
+ HandleTouchScrollStartQueued();
+ return NotifyResult::KeepIterating;
+ }
+
if (!event().isSameEventClass(other_event.event()))
- return CoalesceResult::KeepSearching;
+ return NotifyResult::KeepIterating;
if (!ScopedWebInputEventWithLatencyInfo::CanCoalesceWith(other_event))
- return CoalesceResult::CannotCoalesce;
+ return NotifyResult::Stop;
// If this event was blocking push the event id to the blocking
// list before updating the dispatch_type of this event.
@@ -89,7 +95,7 @@ class QueuedWebInputEvent : public ScopedWebInputEventWithLatencyInfo,
dispatch_type_ = other_event.dispatch_type_;
originally_cancelable_ = other_event.originally_cancelable_;
- return CoalesceResult::Coalesced;
+ return NotifyResult::CoalescedEvent;
}
bool IsWebInputEvent() const override { return true; }
@@ -150,6 +156,20 @@ class QueuedWebInputEvent : public ScopedWebInputEventWithLatencyInfo,
bool originallyCancelable() const { return originally_cancelable_; }
private:
+ void HandleTouchScrollStartQueued() {
+ // A TouchScrollStart will queued after this touch move which will make all
+ // previous touch moves that are queued uncancelable.
+ if (event().type() == blink::WebInputEvent::TouchMove) {
+ blink::WebTouchEvent& touch_event =
+ static_cast<blink::WebTouchEvent&>(event());
+ if (touch_event.dispatchType ==
+ blink::WebInputEvent::DispatchType::Blocking) {
+ touch_event.dispatchType =
+ blink::WebInputEvent::DispatchType::EventNonBlocking;
+ }
+ }
+ }
+
const std::deque<uint32_t>& blockingCoalescedEventIds() const {
return blocking_coalesced_event_ids_;
}

Powered by Google App Engine
This is Rietveld 408576698