Use real fixed viewport, and let the content width be the overview width.
issue: 3003933 Change-Id: I679fe1d5736daf0e8cee746dee53558943796833
This commit is contained in:
@ -1817,7 +1817,6 @@ final class WebViewCore {
|
||||
int mScrollX;
|
||||
int mScrollY;
|
||||
boolean mMobileSite;
|
||||
int mViewportWidth;
|
||||
}
|
||||
|
||||
static class DrawData {
|
||||
@ -1859,15 +1858,6 @@ final class WebViewCore {
|
||||
}
|
||||
if (mInitialViewState != null) {
|
||||
draw.mViewState = mInitialViewState;
|
||||
if (mViewportWidth == -1 && mSettings.getUseFixedViewport() &&
|
||||
mSettings.getUseWideViewPort()) {
|
||||
final int fixedViewportMargin = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.fixed_viewport_margin);
|
||||
// Use website's initial preferred width as the fixed viewport width.
|
||||
mViewportWidth = Math.min(mSettings.getMaxFixedViewportWidth(),
|
||||
draw.mMinPrefWidth + 2 * fixedViewportMargin);
|
||||
draw.mViewState.mViewportWidth = mViewportWidth;
|
||||
}
|
||||
mInitialViewState = null;
|
||||
}
|
||||
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID");
|
||||
@ -2201,7 +2191,6 @@ final class WebViewCore {
|
||||
mInitialViewState.mScrollX = mRestoredX;
|
||||
mInitialViewState.mScrollY = mRestoredY;
|
||||
mInitialViewState.mMobileSite = (0 == mViewportWidth);
|
||||
mInitialViewState.mViewportWidth = mViewportWidth;
|
||||
if (mRestoredScale > 0) {
|
||||
mInitialViewState.mViewScale = mRestoredScale / 100.0f;
|
||||
if (mRestoredTextWrapScale > 0) {
|
||||
|
@ -778,12 +778,6 @@ class ZoomManager {
|
||||
} else {
|
||||
mMaxZoomScale = viewState.mMaxScale;
|
||||
}
|
||||
if (viewState.mViewportWidth > 0 &&
|
||||
mWebView.getSettings().getUseFixedViewport() &&
|
||||
mWebView.getSettings().getUseWideViewPort()) {
|
||||
// Use website specified viewport width.
|
||||
setZoomOverviewWidth(viewState.mViewportWidth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -793,15 +787,19 @@ class ZoomManager {
|
||||
public void onNewPicture(WebViewCore.DrawData drawData) {
|
||||
final int viewWidth = mWebView.getViewWidth();
|
||||
|
||||
if (!mWebView.getSettings().getUseFixedViewport()
|
||||
&& mWebView.getSettings().getUseWideViewPort()) {
|
||||
// limit mZoomOverviewWidth upper bound to
|
||||
// sMaxViewportWidth so that if the page doesn't behave
|
||||
// well, the WebView won't go insane. limit the lower
|
||||
// bound to match the default scale for mobile sites.
|
||||
setZoomOverviewWidth(Math.min(WebView.sMaxViewportWidth,
|
||||
if (mWebView.getSettings().getUseWideViewPort()) {
|
||||
if (!mWebView.getSettings().getUseFixedViewport()) {
|
||||
// limit mZoomOverviewWidth upper bound to
|
||||
// sMaxViewportWidth so that if the page doesn't behave
|
||||
// well, the WebView won't go insane. limit the lower
|
||||
// bound to match the default scale for mobile sites.
|
||||
setZoomOverviewWidth(Math.min(WebView.sMaxViewportWidth,
|
||||
Math.max((int) (viewWidth * mInvDefaultScale),
|
||||
Math.max(drawData.mMinPrefWidth, drawData.mViewPoint.x))));
|
||||
} else {
|
||||
final int contentWidth = drawData.mWidthHeight.x;
|
||||
setZoomOverviewWidth(Math.min(WebView.sMaxViewportWidth, contentWidth));
|
||||
}
|
||||
}
|
||||
|
||||
final float zoomOverviewScale = getZoomOverviewScale();
|
||||
|
Reference in New Issue
Block a user