diff options
author | The Android Automerger <android-build@android.com> | 2010-01-27 17:40:14 -0800 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2010-01-27 17:40:14 -0800 |
commit | 0cccec0a9bdc59700a4720daf5ac5f4c86b6ed14 (patch) | |
tree | e70f92b02e712520a106a689d3a46ce2f08ca911 | |
parent | 1800fe985a27f7e2ed3c9fda9fc8ae3042901c0b (diff) | |
parent | 769ed21c33c3629411eb3bbf924de45737a18067 (diff) | |
download | base-eclair-release.tar.gz |
Merge branch 'eclair' into eclair-releaseandroid-2.1_r2eclair-release
-rw-r--r-- | core/java/android/webkit/WebView.java | 70 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 14 | ||||
-rw-r--r-- | docs/html/index.jd | 2 | ||||
-rw-r--r-- | docs/html/mwc2010/index.html | 2 |
4 files changed, 58 insertions, 30 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index ab1841e140d7..ecee0d0f4c34 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -467,6 +467,7 @@ public class WebView extends AbsoluteLayout static final int UPDATE_TEXT_ENTRY_MSG_ID = 15; static final int WEBCORE_INITIALIZED_MSG_ID = 16; static final int UPDATE_TEXTFIELD_TEXT_MSG_ID = 17; + static final int UPDATE_ZOOM_RANGE = 18; static final int MOVE_OUT_OF_PLUGIN = 19; static final int CLEAR_TEXT_ENTRY = 20; static final int UPDATE_TEXT_SELECTION_MSG_ID = 21; @@ -497,7 +498,7 @@ public class WebView extends AbsoluteLayout "UPDATE_TEXT_ENTRY_MSG_ID", // = 15; "WEBCORE_INITIALIZED_MSG_ID", // = 16; "UPDATE_TEXTFIELD_TEXT_MSG_ID", // = 17; - "18", // = 18; + "UPDATE_ZOOM_RANGE", // = 18; "MOVE_OUT_OF_PLUGIN", // = 19; "CLEAR_TEXT_ENTRY", // = 20; "UPDATE_TEXT_SELECTION_MSG_ID", // = 21; @@ -5315,6 +5316,14 @@ public class WebView extends AbsoluteLayout case SPAWN_SCROLL_TO_MSG_ID: spawnContentScrollTo(msg.arg1, msg.arg2); break; + case UPDATE_ZOOM_RANGE: { + WebViewCore.RestoreState restoreState + = (WebViewCore.RestoreState) msg.obj; + // mScrollX contains the new minPrefWidth + updateZoomRange(restoreState, getViewWidth(), + restoreState.mScrollX, false); + break; + } case NEW_PICTURE_MSG_ID: { WebSettings settings = mWebViewCore.getSettings(); // called for new content @@ -5326,32 +5335,8 @@ public class WebView extends AbsoluteLayout WebViewCore.RestoreState restoreState = draw.mRestoreState; if (restoreState != null) { mInZoomOverview = false; - if (restoreState.mMinScale == 0) { - if (restoreState.mMobileSite) { - if (draw.mMinPrefWidth > - Math.max(0, draw.mViewPoint.x)) { - mMinZoomScale = (float) viewWidth - / draw.mMinPrefWidth; - mMinZoomScaleFixed = false; - mInZoomOverview = useWideViewport && - settings.getLoadWithOverviewMode(); - } else { - mMinZoomScale = restoreState.mDefaultScale; - mMinZoomScaleFixed = true; - } - } else { - mMinZoomScale = DEFAULT_MIN_ZOOM_SCALE; - mMinZoomScaleFixed = false; - } - } else { - mMinZoomScale = restoreState.mMinScale; - mMinZoomScaleFixed = true; - } - if (restoreState.mMaxScale == 0) { - mMaxZoomScale = DEFAULT_MAX_ZOOM_SCALE; - } else { - mMaxZoomScale = restoreState.mMaxScale; - } + updateZoomRange(restoreState, viewSize.x, + draw.mMinPrefWidth, true); if (mInitialScaleInPercent > 0) { setNewZoomScale(mInitialScaleInPercent / 100.0f, mInitialScaleInPercent != mTextWrapScale * 100, @@ -5822,6 +5807,37 @@ public class WebView extends AbsoluteLayout new InvokeListBox(array, enabledArray, selectedArray)); } + private void updateZoomRange(WebViewCore.RestoreState restoreState, + int viewWidth, int minPrefWidth, boolean updateZoomOverview) { + if (restoreState.mMinScale == 0) { + if (restoreState.mMobileSite) { + if (minPrefWidth > Math.max(0, viewWidth)) { + mMinZoomScale = (float) viewWidth / minPrefWidth; + mMinZoomScaleFixed = false; + if (updateZoomOverview) { + WebSettings settings = getSettings(); + mInZoomOverview = settings.getUseWideViewPort() && + settings.getLoadWithOverviewMode(); + } + } else { + mMinZoomScale = restoreState.mDefaultScale; + mMinZoomScaleFixed = true; + } + } else { + mMinZoomScale = DEFAULT_MIN_ZOOM_SCALE; + mMinZoomScaleFixed = false; + } + } else { + mMinZoomScale = restoreState.mMinScale; + mMinZoomScaleFixed = true; + } + if (restoreState.mMaxScale == 0) { + mMaxZoomScale = DEFAULT_MAX_ZOOM_SCALE; + } else { + mMaxZoomScale = restoreState.mMaxScale; + } + } + /* * Request a dropdown menu for a listbox with single selection or a single * <select> element. diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index e46d731c7d46..6aae794bf13b 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -1931,7 +1931,19 @@ final class WebViewCore { } // if mViewportWidth is 0, it means device-width, always update. - if (mViewportWidth != 0 && !updateRestoreState) return; + if (mViewportWidth != 0 && !updateRestoreState) { + RestoreState restoreState = new RestoreState(); + restoreState.mMinScale = mViewportMinimumScale / 100.0f; + restoreState.mMaxScale = mViewportMaximumScale / 100.0f; + restoreState.mDefaultScale = adjust; + // as mViewportWidth is not 0, it is not mobile site. + restoreState.mMobileSite = false; + // for non-mobile site, we don't need minPrefWidth, set it as 0 + restoreState.mScrollX = 0; + Message.obtain(mWebView.mPrivateHandler, + WebView.UPDATE_ZOOM_RANGE, restoreState).sendToTarget(); + return; + } // now notify webview // webViewWidth refers to the width in the view system diff --git a/docs/html/index.jd b/docs/html/index.jd index e12a00a5d60d..e3bf685df530 100644 --- a/docs/html/index.jd +++ b/docs/html/index.jd @@ -13,7 +13,7 @@ home=true <!-- total max width is 520px --> <img src="/assets/images/home/Android_Dev_Lab_l.png" alt="Android developer labs" width="100px" style="padding-left:78px;padding-right:46px;padding-bottom: 8px;"/> <div id="announcement" style="width:275px"> -<p>We're hosting the next Android Developer Lab in Barcelona at <a href="http://www.mobileworldcongress.com/index.htm">Mobile World Congress »</a> on Wednesday February 17th at <a href="http://www.mobileworldcongress.com/exhibition/app_planet.htm">App Planet »</a>, located in Hall 7. Come visit us to attend a technical presentation, talk to our Android developer relations team, and meet other members of the developer community.</p><p>Check the Android Developers blog for more information soon!</p> +<p>We're hosting the next Android Developer Lab in Barcelona at <a href="http://www.mobileworldcongress.com/index.htm">Mobile World Congress »</a> on Wednesday February 17th at <a href="http://www.mobileworldcongress.com/exhibition/app_planet.htm">App Planet »</a>, located in Hall 7. Come visit us to attend a technical presentation, talk to our Android developer relations team, and meet other members of the developer community.</p><p><a href="http://sites.google.com/site/androidmwc/home">Learn more »</a></p> <!--<p><a href="http://android-developers.blogspot.com/2009/11/bring-your-lab-coats.html">Learn more »</a></p>--> </div> <!-- end annoucement --> </div> <!-- end annoucement-block --> diff --git a/docs/html/mwc2010/index.html b/docs/html/mwc2010/index.html index 22319a27bcb6..c91386f91070 100644 --- a/docs/html/mwc2010/index.html +++ b/docs/html/mwc2010/index.html @@ -1,7 +1,7 @@ <html> <head> <title>Redirecting...</title> -<meta http-equiv="refresh" content="0;url=/index.html"> +<meta http-equiv="refresh" content="0;url=http://sites.google.com/site/androidmwc/home"> </head> <body> </body> |