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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.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/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index e39393d77b2bf560d17f65b407633f8537ee986e..4b2711004d59442329cce8ce44283865f51316f0 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -1364,11 +1364,6 @@ import java.util.Map;
x, y, computeHorizontalScrollOffset(), computeVerticalScrollOffset());
}
- @Override
- public boolean hasFixedPageScale() {
- return mRenderCoordinates.hasFixedPageScale();
- }
-
private void hidePopupDialog() {
SelectPopupDialog.hide(this);
hideHandles();
@@ -2203,6 +2198,8 @@ import java.util.Map;
if (needUpdateZoomControls) mZoomControlsDelegate.updateZoomControls();
if (contentOffsetChanged) updateHandleScreenPositions();
+ updateDoubleTapZoomEnabled();
+
// Update offsets for fullscreen.
final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
final float controlsOffsetPix = controlsOffsetYCss * deviceScale;
@@ -2216,6 +2213,26 @@ import java.util.Map;
}
}
+ private void updateDoubleTapZoomEnabled() {
+ float pageScale = mRenderCoordinates.getPageScaleFactor();
+ float contentWidthCss = mRenderCoordinates.getContentWidthCss();
+ float windowWidthDp = pageScale * mRenderCoordinates.getLastFrameViewportWidthCss();
+
+ float minScale = mRenderCoordinates.getMinPageScaleFactor();
+ float maxScale = mRenderCoordinates.getMaxPageScaleFactor();
+
+ // We disable double-tap zoom for pages that have a width=device-width
+ // or narrower viewport (indicating that this is a mobile-optimized or
+ // responsive website), as long as the user has not pinch-zoomed in by
+ // more than 10% (in which case they might reasonably expect to be able
+ // to zoom back out using double-tap zoom).
+ // It is also disabled for pages that disallow the user from zooming in
+ // or out (even if they don't have a device-width or narrower viewport).
+ boolean enable = (contentWidthCss > windowWidthDp || pageScale >= 1.1f * minScale)
+ && minScale != maxScale;
+ mContentViewGestureHandler.setDoubleTapZoomEnabled(enable);
+ }
+
@SuppressWarnings("unused")
@CalledByNative
private void updateImeAdapter(int nativeImeAdapterAndroid, int textInputType,

Powered by Google App Engine
This is Rietveld 408576698