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

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

Issue 18850005: Disable double tap zoom on mobile sites, to remove 300ms click delay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 2ccf09bb4166257089adeb5c709153c5df5d0a6b..a680c9823e2a5198f97fca9f9ba0447bd16c0985 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
@@ -155,8 +155,9 @@ class ContentViewGestureHandler implements LongPressDelegate {
private boolean mSentGestureNeedsVSync;
private long mLastVSyncGestureTimeMs;
- // If the page scale is fixed, double tap gesture detection can be disabled.
- private boolean mHasFixedPageScale;
+ // The page's viewport and scale sometimes allow us to disable double tap gesture detection,
+ // according to the logic in ContentViewCore.onRenderCoordinatesUpdated().
+ private boolean mShouldDisableDoubleTap;
// Incremented and decremented when the methods onTouchEvent() and confirmTouchEvent() start
// and finish execution, respectively. This provides accounting for synchronous calls to
@@ -980,7 +981,7 @@ class ContentViewGestureHandler implements LongPressDelegate {
// then |event| will have been recycled. Only start the timer if the sent event has
// not yet been confirmed.
if (!mJavaScriptIsConsumingGesture
- && !mHasFixedPageScale
+ && !mShouldDisableDoubleTap
&& event == mPendingMotionEvents.peekFirst()
&& event.getAction() != MotionEvent.ACTION_UP
&& event.getAction() != MotionEvent.ACTION_CANCEL) {
@@ -1221,8 +1222,8 @@ class ContentViewGestureHandler implements LongPressDelegate {
/**
* Update whether double-tap gestures are supported. This allows
- * double-tap gesture suppression independent of whether or not the page
- * scale is fixed.
+ * double-tap gesture suppression independent of whether or not the page's
+ * viewport and scale would normally prevent double-tap.
* Note: This should never be called while a double-tap gesture is in progress.
* @param supportDoubleTap Whether double-tap gestures are supported.
*/
@@ -1236,20 +1237,19 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
/**
- * Update whether the current page has a fixed page scale.
- * A fixed page scale will suppress double-tap gesture detection, allowing
- * for rapid and responsive single-tap gestures.
- * @param hasFixedPageScale Whether the page scale is fixed.
+ * Update whether double-tap gesture detection should be suppressed due to
+ * the viewport or scale of the current page. Suppressing double-tap gesture
+ * detection allows for rapid and responsive single-tap gestures.
+ * @param shouldDisableDoubleTap Whether double-tap should be suppressed.
*/
- public void updateHasFixedPageScale(boolean hasFixedPageScale) {
- if (mHasFixedPageScale == hasFixedPageScale) return;
- mHasFixedPageScale = hasFixedPageScale;
+ public void updateShouldDisableDoubleTap(boolean shouldDisableDoubleTap) {
+ if (mShouldDisableDoubleTap == shouldDisableDoubleTap) return;
+ mShouldDisableDoubleTap = shouldDisableDoubleTap;
updateDoubleTapListener();
}
private boolean isDoubleTapDisabled() {
- return mDoubleTapMode == DOUBLE_TAP_MODE_DISABLED ||
- mHasFixedPageScale;
+ return mDoubleTapMode == DOUBLE_TAP_MODE_DISABLED || mShouldDisableDoubleTap;
}
private boolean isDoubleTapActive() {

Powered by Google App Engine
This is Rietveld 408576698