Index: content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java b/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java |
index 6c98320fa3ff96b6f8bf36fdcdd906423896d6bb..3a52db4015a8f56f8b68f8c3cc3a5b6458158e83 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/third_party/GestureDetector.java |
@@ -225,6 +225,7 @@ public class GestureDetector { |
private OnDoubleTapListener mDoubleTapListener; |
private boolean mStillDown; |
+ private boolean mDeferConfirmSingleTap; |
private boolean mInLongPress; |
private boolean mAlwaysInTapRegion; |
private boolean mAlwaysInBiggerTapRegion; |
@@ -281,8 +282,12 @@ public class GestureDetector { |
case TAP: |
// If the user's finger is still down, do not count it as a tap |
- if (mDoubleTapListener != null && !mStillDown) { |
- mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent); |
+ if (mDoubleTapListener != null) { |
+ if (!mStillDown) { |
+ mDoubleTapListener.onSingleTapConfirmed(mCurrentDownEvent); |
+ } else { |
+ mDeferConfirmSingleTap = true; |
+ } |
} |
break; |
@@ -555,7 +560,8 @@ public class GestureDetector { |
mAlwaysInBiggerTapRegion = true; |
mStillDown = true; |
mInLongPress = false; |
- |
+ mDeferConfirmSingleTap = false; |
+ |
if (mIsLongpressEnabled) { |
mHandler.removeMessages(LONG_PRESS); |
mHandler.sendEmptyMessageAtTime(LONG_PRESS, mCurrentDownEvent.getDownTime() |
@@ -608,6 +614,9 @@ public class GestureDetector { |
mInLongPress = false; |
} else if (mAlwaysInTapRegion) { |
handled = mListener.onSingleTapUp(ev); |
+ if (mDeferConfirmSingleTap && mDoubleTapListener != null) { |
+ mDoubleTapListener.onSingleTapConfirmed(ev); |
+ } |
} else { |
// A fling must travel the minimum tap distance |
@@ -634,6 +643,7 @@ public class GestureDetector { |
mVelocityTracker = null; |
} |
mIsDoubleTapping = false; |
+ mDeferConfirmSingleTap = false; |
mHandler.removeMessages(SHOW_PRESS); |
mHandler.removeMessages(LONG_PRESS); |
break; |
@@ -661,6 +671,7 @@ public class GestureDetector { |
mStillDown = false; |
mAlwaysInTapRegion = false; |
mAlwaysInBiggerTapRegion = false; |
+ mDeferConfirmSingleTap = false; |
if (mInLongPress) { |
mInLongPress = false; |
} |
@@ -673,6 +684,7 @@ public class GestureDetector { |
mIsDoubleTapping = false; |
mAlwaysInTapRegion = false; |
mAlwaysInBiggerTapRegion = false; |
+ mDeferConfirmSingleTap = false; |
if (mInLongPress) { |
mInLongPress = false; |
} |
@@ -695,6 +707,7 @@ public class GestureDetector { |
private void dispatchLongPress() { |
mHandler.removeMessages(TAP); |
+ mDeferConfirmSingleTap = false; |
mInLongPress = true; |
mListener.onLongPress(mCurrentDownEvent); |
} |