am 51b97011: cherry-pick 4a4f9886a7 into froyo
Merge commit '51b97011b73c10b832ea4ad10637f761802e125d' into kraken
* commit '51b97011b73c10b832ea4ad10637f761802e125d':
cherry-pick 4a4f9886a7 into froyo
This commit is contained in:
@@ -6239,7 +6239,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
case UPDATE_ZOOM_RANGE: {
|
case UPDATE_ZOOM_RANGE: {
|
||||||
WebViewCore.RestoreState restoreState
|
WebViewCore.RestoreState restoreState
|
||||||
= (WebViewCore.RestoreState) msg.obj;
|
= (WebViewCore.RestoreState) msg.obj;
|
||||||
// mScrollX contains the new minPrefWidth
|
// mScrollX contains the new contentWidth
|
||||||
updateZoomRange(restoreState, getViewWidth(),
|
updateZoomRange(restoreState, getViewWidth(),
|
||||||
restoreState.mScrollX, false);
|
restoreState.mScrollX, false);
|
||||||
break;
|
break;
|
||||||
@@ -6262,7 +6262,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
boolean hasRestoreState = restoreState != null;
|
boolean hasRestoreState = restoreState != null;
|
||||||
if (hasRestoreState) {
|
if (hasRestoreState) {
|
||||||
updateZoomRange(restoreState, viewSize.x,
|
updateZoomRange(restoreState, viewSize.x,
|
||||||
draw.mMinPrefWidth, true);
|
draw.mWidthHeight.x, true);
|
||||||
if (!mDrawHistory) {
|
if (!mDrawHistory) {
|
||||||
mInZoomOverview = false;
|
mInZoomOverview = false;
|
||||||
|
|
||||||
@@ -6324,10 +6324,12 @@ public class WebView extends AbsoluteLayout
|
|||||||
// sMaxViewportWidth so that if the page doesn't behave
|
// sMaxViewportWidth so that if the page doesn't behave
|
||||||
// well, the WebView won't go insane. limit the lower
|
// well, the WebView won't go insane. limit the lower
|
||||||
// bound to match the default scale for mobile sites.
|
// bound to match the default scale for mobile sites.
|
||||||
|
// we choose the content width to be mZoomOverviewWidth.
|
||||||
|
// this works for most of the sites. But some sites may
|
||||||
|
// cause the page layout wider than it needs.
|
||||||
mZoomOverviewWidth = Math.min(sMaxViewportWidth, Math
|
mZoomOverviewWidth = Math.min(sMaxViewportWidth, Math
|
||||||
.max((int) (viewWidth / mDefaultScale), Math
|
.max((int) (viewWidth / mDefaultScale),
|
||||||
.max(draw.mMinPrefWidth,
|
draw.mWidthHeight.x));
|
||||||
draw.mViewPoint.x)));
|
|
||||||
}
|
}
|
||||||
if (!mMinZoomScaleFixed) {
|
if (!mMinZoomScaleFixed) {
|
||||||
mMinZoomScale = (float) viewWidth / mZoomOverviewWidth;
|
mMinZoomScale = (float) viewWidth / mZoomOverviewWidth;
|
||||||
@@ -6976,12 +6978,13 @@ public class WebView extends AbsoluteLayout
|
|||||||
new InvokeListBox(array, enabledArray, selectedArray));
|
new InvokeListBox(array, enabledArray, selectedArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// viewWidth/contentWidth/updateZoomOverview are only used for mobile sites
|
||||||
private void updateZoomRange(WebViewCore.RestoreState restoreState,
|
private void updateZoomRange(WebViewCore.RestoreState restoreState,
|
||||||
int viewWidth, int minPrefWidth, boolean updateZoomOverview) {
|
int viewWidth, int contentWidth, boolean updateZoomOverview) {
|
||||||
if (restoreState.mMinScale == 0) {
|
if (restoreState.mMinScale == 0) {
|
||||||
if (restoreState.mMobileSite) {
|
if (restoreState.mMobileSite) {
|
||||||
if (minPrefWidth > Math.max(0, viewWidth)) {
|
if (contentWidth > Math.max(0, viewWidth)) {
|
||||||
mMinZoomScale = (float) viewWidth / minPrefWidth;
|
mMinZoomScale = (float) viewWidth / contentWidth;
|
||||||
mMinZoomScaleFixed = false;
|
mMinZoomScaleFixed = false;
|
||||||
if (updateZoomOverview) {
|
if (updateZoomOverview) {
|
||||||
WebSettings settings = getSettings();
|
WebSettings settings = getSettings();
|
||||||
|
|||||||
@@ -1705,7 +1705,6 @@ final class WebViewCore {
|
|||||||
Region mInvalRegion;
|
Region mInvalRegion;
|
||||||
Point mViewPoint;
|
Point mViewPoint;
|
||||||
Point mWidthHeight;
|
Point mWidthHeight;
|
||||||
int mMinPrefWidth;
|
|
||||||
RestoreState mRestoreState; // only non-null if it is for the first
|
RestoreState mRestoreState; // only non-null if it is for the first
|
||||||
// picture set after the first layout
|
// picture set after the first layout
|
||||||
boolean mFocusSizeChanged;
|
boolean mFocusSizeChanged;
|
||||||
@@ -1725,13 +1724,6 @@ final class WebViewCore {
|
|||||||
// layout.
|
// layout.
|
||||||
draw.mFocusSizeChanged = nativeFocusBoundsChanged();
|
draw.mFocusSizeChanged = nativeFocusBoundsChanged();
|
||||||
draw.mViewPoint = new Point(mCurrentViewWidth, mCurrentViewHeight);
|
draw.mViewPoint = new Point(mCurrentViewWidth, mCurrentViewHeight);
|
||||||
if (mSettings.getUseWideViewPort()) {
|
|
||||||
draw.mMinPrefWidth = Math.max(
|
|
||||||
mViewportWidth == -1 ? WebView.DEFAULT_VIEWPORT_WIDTH
|
|
||||||
: (mViewportWidth == 0 ? mCurrentViewWidth
|
|
||||||
: mViewportWidth),
|
|
||||||
nativeGetContentMinPrefWidth());
|
|
||||||
}
|
|
||||||
if (mRestoreState != null) {
|
if (mRestoreState != null) {
|
||||||
draw.mRestoreState = mRestoreState;
|
draw.mRestoreState = mRestoreState;
|
||||||
mRestoreState = null;
|
mRestoreState = null;
|
||||||
@@ -2085,7 +2077,7 @@ final class WebViewCore {
|
|||||||
restoreState.mDefaultScale = adjust;
|
restoreState.mDefaultScale = adjust;
|
||||||
// as mViewportWidth is not 0, it is not mobile site.
|
// as mViewportWidth is not 0, it is not mobile site.
|
||||||
restoreState.mMobileSite = false;
|
restoreState.mMobileSite = false;
|
||||||
// for non-mobile site, we don't need minPrefWidth, set it as 0
|
// for non-mobile site, we don't need contentWidth, set it as 0
|
||||||
restoreState.mScrollX = 0;
|
restoreState.mScrollX = 0;
|
||||||
Message.obtain(mWebView.mPrivateHandler,
|
Message.obtain(mWebView.mPrivateHandler,
|
||||||
WebView.UPDATE_ZOOM_RANGE, restoreState).sendToTarget();
|
WebView.UPDATE_ZOOM_RANGE, restoreState).sendToTarget();
|
||||||
|
|||||||
Reference in New Issue
Block a user