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

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

Issue 1003023002: Signal input flush when all flings have terminated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test compile Created 5 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/browser/renderer_host/input/gesture_event_queue.cc
diff --git a/content/browser/renderer_host/input/gesture_event_queue.cc b/content/browser/renderer_host/input/gesture_event_queue.cc
index a13fde15a429ec47c2b6eaa59361171706eb0bad..c7028f8a375eaef3f4f29b63f682a4d4f37d9424 100644
--- a/content/browser/renderer_host/input/gesture_event_queue.cc
+++ b/content/browser/renderer_host/input/gesture_event_queue.cc
@@ -62,7 +62,7 @@ GestureEventQueue::GestureEventQueue(
TouchpadTapSuppressionControllerClient* touchpad_client,
const Config& config)
: client_(client),
- fling_in_progress_(false),
+ active_fling_count_(0),
scrolling_in_progress_(false),
ignore_next_ack_(false),
touchpad_tap_suppression_controller_(
@@ -92,8 +92,6 @@ void GestureEventQueue::QueueEvent(
bool GestureEventQueue::ShouldDiscardFlingCancelEvent(
const GestureEventWithLatencyInfo& gesture_event) const {
- if (coalesced_gesture_events_.empty() && fling_in_progress_)
- return false;
GestureQueue::const_reverse_iterator it =
coalesced_gesture_events_.rbegin();
while (it != coalesced_gesture_events_.rend()) {
@@ -103,7 +101,9 @@ bool GestureEventQueue::ShouldDiscardFlingCancelEvent(
return true;
it++;
}
- return true;
+ // If there are no fling-affecting events in the queue, and there's still an
+ // active fling in the renderer, the cancel event should not be dropped.
+ return !active_fling_count_;
}
bool GestureEventQueue::ShouldForwardForBounceReduction(
@@ -175,12 +175,6 @@ bool GestureEventQueue::ShouldForwardForTapSuppression(
void GestureEventQueue::QueueAndForwardIfNecessary(
const GestureEventWithLatencyInfo& gesture_event) {
switch (gesture_event.event.type) {
- case WebInputEvent::GestureFlingCancel:
- fling_in_progress_ = false;
- break;
- case WebInputEvent::GestureFlingStart:
- fling_in_progress_ = true;
- break;
case WebInputEvent::GesturePinchUpdate:
case WebInputEvent::GestureScrollUpdate:
QueueScrollOrPinchAndForwardIfNecessary(gesture_event);
@@ -204,6 +198,11 @@ void GestureEventQueue::ProcessGestureAck(InputEventAckState ack_result,
return;
}
+ if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED &&
+ type == blink::WebInputEvent::GestureFlingStart) {
+ ++active_fling_count_;
+ }
+
// It's possible that the ack for the second event in an in-flight, coalesced
// Gesture{Scroll,Pinch}Update pair is received prior to the first event ack.
// TODO(jdduke): Unify GSU/GPU pairs into a single event, crbug.com/359115.
@@ -269,8 +268,9 @@ TouchpadTapSuppressionController*
return &touchpad_tap_suppression_controller_;
}
-void GestureEventQueue::FlingHasBeenHalted() {
- fling_in_progress_ = false;
+void GestureEventQueue::DidStopFlinging() {
+ DCHECK_GE(active_fling_count_, 0);
+ --active_fling_count_;
}
void GestureEventQueue::ForwardGestureEvent(

Powered by Google App Engine
This is Rietveld 408576698