Loading core/java/android/webkit/WebViewCore.java +32 −26 Original line number Diff line number Diff line Loading @@ -1814,7 +1814,34 @@ final class WebViewCore { Log.w(LOGTAG, "skip viewSizeChanged as w is 0"); return; } int width = w; int width = calculateWindowWidth(w, textwrapWidth); int height = h; if (width != w) { float heightWidthRatio = data.mHeightWidthRatio; float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, data.mActualViewHeight > 0 ? data.mActualViewHeight : h, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); mCurrentViewWidth = w; mCurrentViewHeight = h; mCurrentViewScale = scale; if (needInvalidate) { // ensure {@link #webkitDraw} is called as we were blocking in // {@link #contentDraw} when mCurrentViewWidth is 0 if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "viewSizeChanged"); contentDraw(); } mEventHub.sendMessage(Message.obtain(null, EventHub.UPDATE_CACHE_AND_TEXT_ENTRY)); } // Calculate width to be used in webkit window. private int calculateWindowWidth(int viewWidth, int textwrapWidth) { int width = viewWidth; if (mSettings.getUseWideViewPort()) { if (mViewportWidth == -1) { if (mSettings.getLayoutAlgorithm() == Loading @@ -1833,7 +1860,7 @@ final class WebViewCore { * In the worse case, the native width will be adjusted when * next zoom or screen orientation change happens. */ width = Math.min(WebView.sMaxViewportWidth, Math.max(w, width = Math.min(WebView.sMaxViewportWidth, Math.max(viewWidth, Math.max(WebView.DEFAULT_VIEWPORT_WIDTH, nativeGetContentMinPrefWidth()))); } Loading @@ -1842,7 +1869,7 @@ final class WebViewCore { // Use website specified or desired fixed viewport width. width = mViewportWidth; } else { width = Math.max(w, mViewportWidth); width = Math.max(viewWidth, mViewportWidth); } } else if (mSettings.getUseFixedViewport()) { width = mWebView.getViewWidth(); Loading @@ -1850,28 +1877,7 @@ final class WebViewCore { width = textwrapWidth; } } int height = h; if (width != w) { float heightWidthRatio = data.mHeightWidthRatio; float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, data.mActualViewHeight > 0 ? data.mActualViewHeight : h, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); mCurrentViewWidth = w; mCurrentViewHeight = h; mCurrentViewScale = scale; if (needInvalidate) { // ensure {@link #webkitDraw} is called as we were blocking in // {@link #contentDraw} when mCurrentViewWidth is 0 if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "viewSizeChanged"); contentDraw(); } mEventHub.sendMessage(Message.obtain(null, EventHub.UPDATE_CACHE_AND_TEXT_ENTRY)); return width; } private void sendUpdateTextEntry() { Loading Loading @@ -2370,7 +2376,7 @@ final class WebViewCore { // to syncing an incorrect height. data.mHeight = mCurrentViewHeight == 0 ? Math.round(mWebView.getViewHeight() / data.mScale) : mCurrentViewHeight * data.mWidth / viewportWidth; : Math.round((float) mCurrentViewHeight * data.mWidth / viewportWidth); data.mTextWrapWidth = Math.round(webViewWidth / mInitialViewState.mTextWrapScale); data.mIgnoreHeight = false; Loading Loading
core/java/android/webkit/WebViewCore.java +32 −26 Original line number Diff line number Diff line Loading @@ -1814,7 +1814,34 @@ final class WebViewCore { Log.w(LOGTAG, "skip viewSizeChanged as w is 0"); return; } int width = w; int width = calculateWindowWidth(w, textwrapWidth); int height = h; if (width != w) { float heightWidthRatio = data.mHeightWidthRatio; float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, data.mActualViewHeight > 0 ? data.mActualViewHeight : h, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); mCurrentViewWidth = w; mCurrentViewHeight = h; mCurrentViewScale = scale; if (needInvalidate) { // ensure {@link #webkitDraw} is called as we were blocking in // {@link #contentDraw} when mCurrentViewWidth is 0 if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "viewSizeChanged"); contentDraw(); } mEventHub.sendMessage(Message.obtain(null, EventHub.UPDATE_CACHE_AND_TEXT_ENTRY)); } // Calculate width to be used in webkit window. private int calculateWindowWidth(int viewWidth, int textwrapWidth) { int width = viewWidth; if (mSettings.getUseWideViewPort()) { if (mViewportWidth == -1) { if (mSettings.getLayoutAlgorithm() == Loading @@ -1833,7 +1860,7 @@ final class WebViewCore { * In the worse case, the native width will be adjusted when * next zoom or screen orientation change happens. */ width = Math.min(WebView.sMaxViewportWidth, Math.max(w, width = Math.min(WebView.sMaxViewportWidth, Math.max(viewWidth, Math.max(WebView.DEFAULT_VIEWPORT_WIDTH, nativeGetContentMinPrefWidth()))); } Loading @@ -1842,7 +1869,7 @@ final class WebViewCore { // Use website specified or desired fixed viewport width. width = mViewportWidth; } else { width = Math.max(w, mViewportWidth); width = Math.max(viewWidth, mViewportWidth); } } else if (mSettings.getUseFixedViewport()) { width = mWebView.getViewWidth(); Loading @@ -1850,28 +1877,7 @@ final class WebViewCore { width = textwrapWidth; } } int height = h; if (width != w) { float heightWidthRatio = data.mHeightWidthRatio; float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, data.mActualViewHeight > 0 ? data.mActualViewHeight : h, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); mCurrentViewWidth = w; mCurrentViewHeight = h; mCurrentViewScale = scale; if (needInvalidate) { // ensure {@link #webkitDraw} is called as we were blocking in // {@link #contentDraw} when mCurrentViewWidth is 0 if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "viewSizeChanged"); contentDraw(); } mEventHub.sendMessage(Message.obtain(null, EventHub.UPDATE_CACHE_AND_TEXT_ENTRY)); return width; } private void sendUpdateTextEntry() { Loading Loading @@ -2370,7 +2376,7 @@ final class WebViewCore { // to syncing an incorrect height. data.mHeight = mCurrentViewHeight == 0 ? Math.round(mWebView.getViewHeight() / data.mScale) : mCurrentViewHeight * data.mWidth / viewportWidth; : Math.round((float) mCurrentViewHeight * data.mWidth / viewportWidth); data.mTextWrapWidth = Math.round(webViewWidth / mInitialViewState.mTextWrapScale); data.mIgnoreHeight = false; Loading