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

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

Issue 181833003: [Android] Out with the Android GR, in with the new unified C++ GR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and rebase Created 6 years, 10 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_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::

Powered by Google App Engine
This is Rietveld 408576698