From 86773fbb4ead7d0f64b9670fdb9110758c20fd27 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Thu, 19 Nov 2009 11:25:20 -0800 Subject: [PATCH] If overview width is the same as the current width, don't change the mode when double tap or zoom out. Fix http://b/issue?id=2240785 --- core/java/android/webkit/WebView.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 5f7fdda76c32b..1899a6e146398 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4682,7 +4682,9 @@ public class WebView extends AbsoluteLayout switchOutDrawHistory(); float scale = mActualScale * 0.8f; if (scale < (mMinZoomScale + 0.1f) - && mWebViewCore.getSettings().getUseWideViewPort()) { + && mWebViewCore.getSettings().getUseWideViewPort() + && mZoomOverviewWidth > Math.ceil(getViewWidth() + * mInvActualScale)) { // when zoom out to min scale, switch to overview mode doDoubleTap(); return true; @@ -4829,9 +4831,15 @@ public class WebView extends AbsoluteLayout } settings.setDoubleTapToastCount(0); if (mInZoomOverview) { - // Force the titlebar fully reveal in overview mode - if (mScrollY < getTitleHeight()) mScrollY = 0; - zoomWithPreview((float) getViewWidth() / mZoomOverviewWidth); + float newScale = (float) getViewWidth() / mZoomOverviewWidth; + if (Math.abs(mActualScale - newScale) < 0.01f) { + // reset mInZoomOverview to false if scale doesn't change + mInZoomOverview = false; + } else { + // Force the titlebar fully reveal in overview mode + if (mScrollY < getTitleHeight()) mScrollY = 0; + zoomWithPreview(newScale); + } } else { // mLastTouchX and mLastTouchY are the point in the current viewport int contentX = viewToContentX((int) mLastTouchX + mScrollX);