summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shimeng (Simon) Wang <swang@google.com> 2011-06-09 13:51:55 -0700
committer Shimeng (Simon) Wang <swang@google.com> 2011-06-09 13:51:55 -0700
commit136c20b88e14fffe570cdbd67fa7d227ab34bf1f (patch)
tree6fd4f08aa244c46108de3d881467b64bc64ccc5e
parent0df77e6d4283ee0ab2e636419b7e8c1a191371da (diff)
Better handle double tap for smooth reflow and zoom.
In case it's the first time to reflow or the page is in zoom overview mode, let the reflow and zoom happen at the same time to avoid the need of double tapping twice. Also fix the viewport width to webview's original width for mobile site. issue: 4482888 Change-Id: Ic7c73a9eb3f75fd68322f7f4da14141126e75ad8
-rw-r--r--core/java/android/webkit/WebViewCore.java2
-rw-r--r--core/java/android/webkit/ZoomManager.java11
2 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 16e457103fa6..2e84a9a20c84 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1903,7 +1903,7 @@ public final class WebViewCore {
width = mViewportWidth;
} else {
// For mobile web site.
- width = viewWidth;
+ width = mWebView.getViewWidth();
}
}
return width;
diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java
index 780339143620..fe6fb2f33f39 100644
--- a/core/java/android/webkit/ZoomManager.java
+++ b/core/java/android/webkit/ZoomManager.java
@@ -634,8 +634,17 @@ class ZoomManager {
} else {
newTextWrapScale = mActualScale;
}
+ final boolean firstTimeReflow = !exceedsMinScaleIncrement(mActualScale, mTextWrapScale);
+ if (firstTimeReflow || mInZoomOverview) {
+ // In case first time reflow or in zoom overview mode, let reflow and zoom
+ // happen at the same time.
+ mTextWrapScale = newTextWrapScale;
+ }
if (settings.isNarrowColumnLayout()
- && exceedsMinScaleIncrement(mTextWrapScale, newTextWrapScale)) {
+ && exceedsMinScaleIncrement(mTextWrapScale, newTextWrapScale)
+ && !firstTimeReflow
+ && !mInZoomOverview) {
+ // Reflow only.
mTextWrapScale = newTextWrapScale;
refreshZoomScale(true);
} else if (!mInZoomOverview && willScaleTriggerZoom(getZoomOverviewScale())) {