Loading core/java/android/webkit/WebSettings.java +11 −2 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class WebSettings { private boolean mUseDoubleTree = false; private boolean mUseWideViewport = false; private boolean mUseFixedViewport = false; private int mMaxFixedViewportWidth = WebView.DEFAULT_VIEWPORT_WIDTH; private boolean mSupportMultipleWindows = false; private boolean mShrinksStandaloneImagesToFit = false; private long mMaximumDecodedImageSize = 0; // 0 means default Loading Loading @@ -324,8 +325,9 @@ public class WebSettings { // Detect tablet device for fixed viewport mode. final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); mUseFixedViewport = (metrics.density == 1.0f && (metrics.widthPixels >= 800 ||metrics.heightPixels >= 800)); final int landscapeWidth = Math.max(metrics.widthPixels, metrics.heightPixels); mUseFixedViewport = (metrics.density == 1.0f && landscapeWidth >= 800); mMaxFixedViewportWidth = (int) (landscapeWidth * 1.25); if (sLockForLocaleSettings == null) { sLockForLocaleSettings = new Object(); Loading Loading @@ -1515,6 +1517,13 @@ public class WebSettings { return mUseFixedViewport; } /** * Returns maximum fixed viewport width. */ /* package */ int getMaxFixedViewportWidth() { return mMaxFixedViewportWidth; } /** * Returns whether private browsing is enabled. */ Loading core/java/android/webkit/WebView.java +1 −1 Original line number Diff line number Diff line Loading @@ -667,7 +667,7 @@ public class WebView extends AbsoluteLayout // If the site doesn't use the viewport meta tag to specify the viewport, // use DEFAULT_VIEWPORT_WIDTH as the default viewport width static final int DEFAULT_VIEWPORT_WIDTH = 1040; static final int DEFAULT_VIEWPORT_WIDTH = 980; // normally we try to fit the content to the minimum preferred width // calculated by the Webkit. To avoid the bad behavior when some site's Loading core/java/android/webkit/WebViewCore.java +8 −1 Original line number Diff line number Diff line Loading @@ -1706,7 +1706,7 @@ final class WebViewCore { } } else if (mViewportWidth > 0) { if (mSettings.getUseFixedViewport()) { // Use website specified viewport width. // Use website specified or desired fixed viewport width. width = mViewportWidth; } else { width = Math.max(w, mViewportWidth); Loading Loading @@ -1827,6 +1827,13 @@ final class WebViewCore { } if (mInitialViewState != null) { draw.mViewState = mInitialViewState; if (mViewportWidth == -1 && mSettings.getUseFixedViewport() && mSettings.getUseWideViewPort()) { // Use website's initial preferred width as the fixed viewport width. mViewportWidth = Math.min(mSettings.getMaxFixedViewportWidth(), draw.mMinPrefWidth); draw.mViewState.mViewportWidth = mViewportWidth; } mInitialViewState = null; } if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID"); Loading Loading
core/java/android/webkit/WebSettings.java +11 −2 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class WebSettings { private boolean mUseDoubleTree = false; private boolean mUseWideViewport = false; private boolean mUseFixedViewport = false; private int mMaxFixedViewportWidth = WebView.DEFAULT_VIEWPORT_WIDTH; private boolean mSupportMultipleWindows = false; private boolean mShrinksStandaloneImagesToFit = false; private long mMaximumDecodedImageSize = 0; // 0 means default Loading Loading @@ -324,8 +325,9 @@ public class WebSettings { // Detect tablet device for fixed viewport mode. final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); mUseFixedViewport = (metrics.density == 1.0f && (metrics.widthPixels >= 800 ||metrics.heightPixels >= 800)); final int landscapeWidth = Math.max(metrics.widthPixels, metrics.heightPixels); mUseFixedViewport = (metrics.density == 1.0f && landscapeWidth >= 800); mMaxFixedViewportWidth = (int) (landscapeWidth * 1.25); if (sLockForLocaleSettings == null) { sLockForLocaleSettings = new Object(); Loading Loading @@ -1515,6 +1517,13 @@ public class WebSettings { return mUseFixedViewport; } /** * Returns maximum fixed viewport width. */ /* package */ int getMaxFixedViewportWidth() { return mMaxFixedViewportWidth; } /** * Returns whether private browsing is enabled. */ Loading
core/java/android/webkit/WebView.java +1 −1 Original line number Diff line number Diff line Loading @@ -667,7 +667,7 @@ public class WebView extends AbsoluteLayout // If the site doesn't use the viewport meta tag to specify the viewport, // use DEFAULT_VIEWPORT_WIDTH as the default viewport width static final int DEFAULT_VIEWPORT_WIDTH = 1040; static final int DEFAULT_VIEWPORT_WIDTH = 980; // normally we try to fit the content to the minimum preferred width // calculated by the Webkit. To avoid the bad behavior when some site's Loading
core/java/android/webkit/WebViewCore.java +8 −1 Original line number Diff line number Diff line Loading @@ -1706,7 +1706,7 @@ final class WebViewCore { } } else if (mViewportWidth > 0) { if (mSettings.getUseFixedViewport()) { // Use website specified viewport width. // Use website specified or desired fixed viewport width. width = mViewportWidth; } else { width = Math.max(w, mViewportWidth); Loading Loading @@ -1827,6 +1827,13 @@ final class WebViewCore { } if (mInitialViewState != null) { draw.mViewState = mInitialViewState; if (mViewportWidth == -1 && mSettings.getUseFixedViewport() && mSettings.getUseWideViewPort()) { // Use website's initial preferred width as the fixed viewport width. mViewportWidth = Math.min(mSettings.getMaxFixedViewportWidth(), draw.mMinPrefWidth); draw.mViewState.mViewportWidth = mViewportWidth; } mInitialViewState = null; } if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID"); Loading