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

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: Created 7 years, 5 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 5fbdb712b91ad720796602a447406f556a0e78a4..367c45e0893a85fe321d84a7a1c46d5631a7386e 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
@@ -86,6 +86,8 @@ class ContentViewGestureHandler implements LongPressDelegate {
// will be mistakenly fired.
private boolean mIgnoreSingleTap;
+ private boolean mDoubleTapZoomEnabled = true;
klobag.chromium 2013/07/10 18:26:21 This should be set by "mListener instanceof Gestur
johnme 2013/07/10 19:19:16 Done (though that should always be true, as mListe
+
// Does native think we are scrolling? True from right before we
// send the first scroll event until the last finger is raised.
// Call nativeScrollBegin() when setting this to true, and use
@@ -275,11 +277,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
* Show the zoom picker UI.
*/
public void invokeZoomPicker();
-
- /**
- * @return Whether changing the page scale is not possible on the current page.
- */
- public boolean hasFixedPageScale();
}
ContentViewGestureHandler(
@@ -423,6 +420,11 @@ class ContentViewGestureHandler implements LongPressDelegate {
mIgnoreSingleTap = true;
return true;
}
+
+ if (!mDoubleTapZoomEnabled && !mLongPressDetector.isInLongPress()) {
+ return onSingleTapConfirmed(e);
+ }
+
// This is a hack to address the issue where user hovers
// over a link for longer than DOUBLE_TAP_TIMEOUT, then
// onSingleTapConfirmed() is not triggered. But we still
@@ -438,18 +440,6 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
setClickXAndY((int) x, (int) y);
return true;
- } else if (mMotionEventDelegate.hasFixedPageScale()) {
- // If page is not user scalable, we don't need to wait
- // for double tap timeout.
- float x = e.getX();
- float y = e.getY();
- mExtraParamBundle.clear();
- mExtraParamBundle.putBoolean(SHOW_PRESS, mShowPressIsCalled);
- if (sendMotionEventAsGesture(GESTURE_SINGLE_TAP_CONFIRMED, e,
- mExtraParamBundle)) {
- mIgnoreSingleTap = true;
- }
- setClickXAndY((int) x, (int) y);
} else {
// Notify Blink about this tapUp event anyway,
// when none of the above conditions applied.
@@ -520,6 +510,23 @@ class ContentViewGestureHandler implements LongPressDelegate {
}
}
+ public void setDoubleTapZoomEnabled(boolean enable) {
+ if (enable == mDoubleTapZoomEnabled) {
+ return;
+ }
+
+ GestureDetector.OnDoubleTapListener listener = null;
+ if (enable && mListener instanceof GestureDetector.OnDoubleTapListener) {
+ listener = (GestureDetector.OnDoubleTapListener)mListener;
+ }
+ mGestureDetector.setOnDoubleTapListener(listener);
+ mDoubleTapZoomEnabled = enable;
+
+ // Clean up state, in particular, prevent GestureDetector from getting
+ // left with mIsDoubleTapping == true but mDoubleTapListener == null.
+ resetGestureHandlers();
+ }
+
/**
* @return LongPressDetector handling setting up timers for and canceling LongPress gestures.
*/

Powered by Google App Engine
This is Rietveld 408576698