Loading core/java/android/webkit/WebView.java +8 −1 Original line number Diff line number Diff line Loading @@ -2572,6 +2572,7 @@ public class WebView extends AbsoluteLayout static class ViewSizeData { int mWidth; int mHeight; float mHeightWidthRatio; int mTextWrapWidth; int mAnchorX; int mAnchorY; Loading @@ -2593,7 +2594,11 @@ public class WebView extends AbsoluteLayout int viewWidth = getViewWidth(); int newWidth = Math.round(viewWidth * mZoomManager.getInvScale()); int newHeight = Math.round((getViewHeightWithTitle() - getTitleHeight()) * mZoomManager.getInvScale()); int viewHeight = getViewHeightWithTitle() - getTitleHeight(); int newHeight = Math.round(viewHeight * mZoomManager.getInvScale()); // Make the ratio more accurate than (newHeight / newWidth), since the // latter both are calculated and rounded. float heightWidthRatio = (float) viewHeight / viewWidth; /* * Because the native side may have already done a layout before the * View system was able to measure us, we have to send a height of 0 to Loading @@ -2604,12 +2609,14 @@ public class WebView extends AbsoluteLayout */ if (newWidth > mLastWidthSent && mWrapContent) { newHeight = 0; heightWidthRatio = 0; } // Avoid sending another message if the dimensions have not changed. if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force) { ViewSizeData data = new ViewSizeData(); data.mWidth = newWidth; data.mHeight = newHeight; data.mHeightWidthRatio = heightWidthRatio; data.mTextWrapWidth = Math.round(viewWidth / mZoomManager.getTextWrapScale()); data.mScale = mZoomManager.getScale(); data.mIgnoreHeight = mZoomManager.isFixedLengthAnimationInProgress() Loading core/java/android/webkit/WebViewCore.java +9 −3 Original line number Diff line number Diff line Loading @@ -1180,6 +1180,7 @@ final class WebViewCore { WebView.ViewSizeData data = (WebView.ViewSizeData) msg.obj; viewSizeChanged(data.mWidth, data.mHeight, data.mHeightWidthRatio, data.mTextWrapWidth, data.mScale, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); Loading Loading @@ -1816,8 +1817,8 @@ final class WebViewCore { private float mCurrentViewScale = 1.0f; // notify webkit that our virtual view size changed size (after inv-zoom) private void viewSizeChanged(int w, int h, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { private void viewSizeChanged(int w, int h, float heightWidthRatio, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h + "; textwrapWidth=" + textwrapWidth + "; scale=" + scale); Loading Loading @@ -1862,7 +1863,12 @@ final class WebViewCore { width = textwrapWidth; } } nativeSetSize(width, width == w ? h : Math.round((float) width * h / w), int height = h; if (width != w) { float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, h, anchorX, anchorY, ignoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); Loading Loading
core/java/android/webkit/WebView.java +8 −1 Original line number Diff line number Diff line Loading @@ -2572,6 +2572,7 @@ public class WebView extends AbsoluteLayout static class ViewSizeData { int mWidth; int mHeight; float mHeightWidthRatio; int mTextWrapWidth; int mAnchorX; int mAnchorY; Loading @@ -2593,7 +2594,11 @@ public class WebView extends AbsoluteLayout int viewWidth = getViewWidth(); int newWidth = Math.round(viewWidth * mZoomManager.getInvScale()); int newHeight = Math.round((getViewHeightWithTitle() - getTitleHeight()) * mZoomManager.getInvScale()); int viewHeight = getViewHeightWithTitle() - getTitleHeight(); int newHeight = Math.round(viewHeight * mZoomManager.getInvScale()); // Make the ratio more accurate than (newHeight / newWidth), since the // latter both are calculated and rounded. float heightWidthRatio = (float) viewHeight / viewWidth; /* * Because the native side may have already done a layout before the * View system was able to measure us, we have to send a height of 0 to Loading @@ -2604,12 +2609,14 @@ public class WebView extends AbsoluteLayout */ if (newWidth > mLastWidthSent && mWrapContent) { newHeight = 0; heightWidthRatio = 0; } // Avoid sending another message if the dimensions have not changed. if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force) { ViewSizeData data = new ViewSizeData(); data.mWidth = newWidth; data.mHeight = newHeight; data.mHeightWidthRatio = heightWidthRatio; data.mTextWrapWidth = Math.round(viewWidth / mZoomManager.getTextWrapScale()); data.mScale = mZoomManager.getScale(); data.mIgnoreHeight = mZoomManager.isFixedLengthAnimationInProgress() Loading
core/java/android/webkit/WebViewCore.java +9 −3 Original line number Diff line number Diff line Loading @@ -1180,6 +1180,7 @@ final class WebViewCore { WebView.ViewSizeData data = (WebView.ViewSizeData) msg.obj; viewSizeChanged(data.mWidth, data.mHeight, data.mHeightWidthRatio, data.mTextWrapWidth, data.mScale, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); Loading Loading @@ -1816,8 +1817,8 @@ final class WebViewCore { private float mCurrentViewScale = 1.0f; // notify webkit that our virtual view size changed size (after inv-zoom) private void viewSizeChanged(int w, int h, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { private void viewSizeChanged(int w, int h, float heightWidthRatio, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h + "; textwrapWidth=" + textwrapWidth + "; scale=" + scale); Loading Loading @@ -1862,7 +1863,12 @@ final class WebViewCore { width = textwrapWidth; } } nativeSetSize(width, width == w ? h : Math.round((float) width * h / w), int height = h; if (width != w) { float ratio = (heightWidthRatio > 0) ? heightWidthRatio : (float) h / w; height = Math.round(ratio * width); } nativeSetSize(width, height, textwrapWidth, scale, w, h, anchorX, anchorY, ignoreHeight); // Remember the current width and height boolean needInvalidate = (mCurrentViewWidth == 0); Loading