Index: content/browser/renderer_host/input/touch_disposition_gesture_filter.cc |
diff --git a/content/browser/renderer_host/input/touch_disposition_gesture_filter.cc b/content/browser/renderer_host/input/touch_disposition_gesture_filter.cc |
index 36de573810acd82f49292c4dc797bc485433b556..3fb27cd4fe815ce855dea8f1c9355633aa53a892 100644 |
--- a/content/browser/renderer_host/input/touch_disposition_gesture_filter.cc |
+++ b/content/browser/renderer_host/input/touch_disposition_gesture_filter.cc |
@@ -105,7 +105,8 @@ TouchDispositionGestureFilter::TouchDispositionGestureFilter( |
TouchDispositionGestureFilterClient* client) |
: client_(client), |
needs_tap_ending_event_(false), |
- needs_fling_ending_event_(false) { |
+ needs_fling_ending_event_(false), |
+ needs_scroll_ending_event_(false) { |
DCHECK(client_); |
} |
@@ -146,6 +147,7 @@ void TouchDispositionGestureFilter::OnTouchEventAck( |
if (Head().IsEmpty()) { |
CancelTapIfNecessary(); |
CancelFlingIfNecessary(); |
+ EndScrollIfNecessary(); |
last_event_of_type_dropped_.clear(); |
sequences_.pop(); |
} |
@@ -194,6 +196,8 @@ void TouchDispositionGestureFilter::FilterAndSendPacket( |
} |
void TouchDispositionGestureFilter::SendGesture(const WebGestureEvent& event) { |
+ // TODO(jdduke): Factor out gesture stream reparation code into a standalone |
+ // utility class. |
switch (event.type) { |
case WebInputEvent::GestureLongTap: |
CancelTapIfNecessary(); |
@@ -212,10 +216,16 @@ void TouchDispositionGestureFilter::SendGesture(const WebGestureEvent& event) { |
case WebInputEvent::GestureScrollBegin: |
CancelTapIfNecessary(); |
CancelFlingIfNecessary(); |
+ EndScrollIfNecessary(); |
+ needs_scroll_ending_event_ = true; |
+ break; |
+ case WebInputEvent::GestureScrollEnd: |
+ needs_scroll_ending_event_ = false; |
break; |
case WebInputEvent::GestureFlingStart: |
CancelFlingIfNecessary(); |
needs_fling_ending_event_ = true; |
+ needs_scroll_ending_event_ = false; |
break; |
case WebInputEvent::GestureFlingCancel: |
needs_fling_ending_event_ = false; |
@@ -242,6 +252,14 @@ void TouchDispositionGestureFilter::CancelFlingIfNecessary() { |
DCHECK(!needs_fling_ending_event_); |
} |
+void TouchDispositionGestureFilter::EndScrollIfNecessary() { |
+ if (!needs_scroll_ending_event_) |
+ return; |
+ |
+ SendGesture(CreateGesture(WebInputEvent::GestureScrollEnd)); |
+ DCHECK(!needs_scroll_ending_event_); |
+} |
+ |
// TouchDispositionGestureFilter::GestureSequence |
TouchDispositionGestureFilter::GestureSequence::GestureHandlingState:: |