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

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: Rewrite, taking into account crrev.com/27043004 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
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a7da5bc527bc7450f9f1531519e47ec208285838..d973bcab6a1dbc528688296ac2d4b43d1d55ef34 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
@@ -1461,7 +1461,22 @@ public class ContentViewCore
private void onRenderCoordinatesUpdated() {
if (mContentViewGestureHandler == null) return;
- mContentViewGestureHandler.updateHasFixedPageScale(mRenderCoordinates.hasFixedPageScale());
+
+ float minScale = mRenderCoordinates.getMinPageScaleFactor();
+ float maxScale = mRenderCoordinates.getMaxPageScaleFactor();
+ float pageScale = mRenderCoordinates.getPageScaleFactor();
+ float contentWidthCss = mRenderCoordinates.getContentWidthCss();
+ float windowWidthDp = pageScale * mRenderCoordinates.getLastFrameViewportWidthCss();
+ // 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 disable = (contentWidthCss <= windowWidthDp && pageScale < 1.1f * minScale)
aelias_OOO_until_Jul13 2013/10/22 23:43:26 I don't like the "pageScale < 1.1f * minScale" con
jdduke (slow) 2013/10/22 23:57:49 I'd have to agree on this, all or nothing will sav
johnme 2013/10/23 11:46:07 After thinking about this for a little more, I agr
+ || minScale == maxScale;
+ mContentViewGestureHandler.updateShouldDisableDoubleTap(disable);
jdduke (slow) 2013/10/22 14:15:08 So the user can double-tap to zoom out, but then d
johnme 2013/10/22 15:57:58 Double-tap toggles between "overview zoom level" a
}
private void hidePopupDialog() {
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698