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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 1074553002: [Android] Properly filter GestureFlingCancel events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 38886f9d6d36195114d9847c44fc5546112cc6c0..609534029faf8d29647bbb542c404bcf2bf188f7 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -552,36 +552,42 @@ void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event,
}
}
-bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) {
+InputEventAckState ContentViewCoreImpl::FilterInputEvent(
+ const blink::WebInputEvent& event) {
if (event.type != WebInputEvent::GestureTap &&
event.type != WebInputEvent::GestureDoubleTap &&
event.type != WebInputEvent::GestureLongTap &&
event.type != WebInputEvent::GestureLongPress &&
- event.type != WebInputEvent::GestureFlingCancel)
- return false;
+ event.type != WebInputEvent::GestureFlingCancel) {
+ return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
+ }
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
if (j_obj.is_null())
- return false;
+ return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
if (event.type == WebInputEvent::GestureFlingCancel) {
// If no fling is active, either in the compositor or externally-driven,
// there's no need to explicitly cancel the fling.
bool may_need_fling_cancel =
Java_ContentViewCore_isScrollInProgress(env, j_obj.obj());
- return !may_need_fling_cancel;
+ return may_need_fling_cancel ? INPUT_EVENT_ACK_STATE_NOT_CONSUMED
+ : INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
}
const blink::WebGestureEvent& gesture =
static_cast<const blink::WebGestureEvent&>(event);
int gesture_type = ToGestureEventType(event.type);
- return Java_ContentViewCore_filterTapOrPressEvent(env,
- j_obj.obj(),
- gesture_type,
- gesture.x * dpi_scale(),
- gesture.y * dpi_scale());
+ if (Java_ContentViewCore_filterTapOrPressEvent(env,
+ j_obj.obj(),
+ gesture_type,
+ gesture.x * dpi_scale(),
+ gesture.y * dpi_scale())) {
+ return INPUT_EVENT_ACK_STATE_CONSUMED;
+ }
+ return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
// TODO(jdduke): Also report double-tap UMA, crbug/347568.
}
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698