diff options
| author | Grace Kloba <klobag@google.com> | 2009-11-10 15:49:03 -0800 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2009-11-11 20:13:32 -0800 |
| commit | 16efce72428d2677eb7164e9b3b494157d1dc09b (patch) | |
| tree | b484601f1df85f569263a98c65dea9e38f540ab4 /core/java/android/webkit | |
| parent | 532d56034532809da7691059742371c1b4d0656c (diff) | |
| download | frameworks_base-16efce72428d2677eb7164e9b3b494157d1dc09b.zip frameworks_base-16efce72428d2677eb7164e9b3b494157d1dc09b.tar.gz frameworks_base-16efce72428d2677eb7164e9b3b494157d1dc09b.tar.bz2 | |
Honor the mInitialScale set on WebView. This was
lost when we fixed restoring the scale for a new
page.
Fix http://b/issue?id=2251716
Diffstat (limited to 'core/java/android/webkit')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index a8d9f1d..691fa77 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -500,7 +500,7 @@ public class WebView extends AbsoluteLayout private boolean mMinZoomScaleFixed = true; // initial scale in percent. 0 means using default. - private int mInitialScale = 0; + private int mInitialScaleInPercent = 0; // while in the zoom overview mode, the page's width is fully fit to the // current window. The page is alive, in another words, you can click to @@ -1595,7 +1595,7 @@ public class WebView extends AbsoluteLayout * @param scaleInPercent The initial scale in percent. */ public void setInitialScale(int scaleInPercent) { - mInitialScale = scaleInPercent; + mInitialScaleInPercent = scaleInPercent; } /** @@ -3615,6 +3615,13 @@ public class WebView extends AbsoluteLayout mMinZoomScale = Math.min(1.0f, (float) getViewWidth() / (mDrawHistory ? mHistoryPicture.getWidth() : mZoomOverviewWidth)); + if (mInitialScaleInPercent > 0) { + // limit the minZoomScale to the initialScale if it is set + float initialScale = mInitialScaleInPercent / 100.0f; + if (mMinZoomScale > initialScale) { + mMinZoomScale = initialScale; + } + } } // we always force, in case our height changed, in which case we still @@ -4967,7 +4974,9 @@ public class WebView extends AbsoluteLayout WebViewCore.RestoreState restoreState = draw.mRestoreState; if (restoreState != null) { mInZoomOverview = false; - mLastScale = restoreState.mTextWrapScale; + mLastScale = mInitialScaleInPercent > 0 + ? mInitialScaleInPercent / 100.0f + : restoreState.mTextWrapScale; if (restoreState.mMinScale == 0) { if (restoreState.mMobileSite) { if (draw.mMinPrefWidth > |
