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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java

Issue 25552003: Enable TouchEvent suppression on scroll for all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test cleanup Created 7 years, 2 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/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
index deffcc65589b2b79b42b1dc22150840d5a3bccca..82624c1758bdbb897b7fed33e77bb338a65640bc 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
@@ -107,13 +107,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
private boolean mPinchInProgress = false;
- // Tracks whether a touch cancel event has been sent as a result of switching
- // into scrolling or pinching mode.
- private boolean mTouchCancelEventSent = false;
-
- // Last cancelled touch event as a result of scrolling or pinching.
- private MotionEvent mLastCancelledEvent = null;
-
private static final int DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout();
//On single tap this will store the x, y coordinates of the touch.
@@ -977,8 +970,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
if (type == TouchPoint.CONVERSION_ERROR) return EVENT_NOT_FORWARDED;
if (!mTouchScrolling && !mPinchInProgress) {
- mTouchCancelEventSent = false;
-
if (mMotionEventDelegate.sendTouchEvent(event.getEventTime(), type, pts)) {
// If confirmTouchEvent() is called synchronously with respect to sendTouchEvent(),
// then |event| will have been recycled. Only start the timer if the sent event has
@@ -991,18 +982,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
return EVENT_FORWARDED_TO_NATIVE;
}
- } else if (!mTouchCancelEventSent) {
- mTouchCancelEventSent = true;
-
- MotionEvent previousCancelEvent = mLastCancelledEvent;
- mLastCancelledEvent = event;
-
- if (mMotionEventDelegate.sendTouchEvent(event.getEventTime(),
- TouchPoint.TOUCH_EVENT_TYPE_CANCEL, pts)) {
- return EVENT_CONVERTED_TO_CANCEL;
- } else {
- mLastCancelledEvent = previousCancelEvent;
- }
}
return EVENT_NOT_FORWARDED;
}
@@ -1082,12 +1061,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
MotionEvent ackedEvent = mPendingMotionEvents.removeFirst();
- if (ackedEvent == mLastCancelledEvent) {
- // The event is canceled, just drain all the pending events until next
- // touch down.
- ackResult = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
- TraceEvent.instant("confirmTouchEvent:CanceledEvent");
- }
switch (ackResult) {
case INPUT_EVENT_ACK_STATE_UNKNOWN:
// This should never get sent.
@@ -1150,9 +1123,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
private void recycleEvent(MotionEvent event) {
- if (event == mLastCancelledEvent) {
- mLastCancelledEvent = null;
- }
event.recycle();
}
@@ -1217,14 +1187,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
/**
* This is for testing only.
- * @return Whether the motion event is cancelled.
- */
- boolean isEventCancelledForTesting(MotionEvent event) {
- return event != null && event == mLastCancelledEvent;
- }
-
- /**
- * This is for testing only.
* @return The number of motion events on the pending motion events queue.
*/
int getNumberOfPendingMotionEventsForTesting() {

Powered by Google App Engine
This is Rietveld 408576698