Chromium Code Reviews| 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. |
| */ |