Loading core/java/android/webkit/WebView.java +11 −1 Original line number Diff line number Diff line Loading @@ -557,6 +557,9 @@ public class WebView extends AbsoluteLayout // sending the same dimensions more than once. int mLastWidthSent; int mLastHeightSent; // Since view height sent to webkit could be fixed to avoid relayout, this // value records the last sent actual view height. int mLastActualHeightSent; private int mContentWidth; // cache of value from WebViewCore private int mContentHeight; // cache of value from WebViewCore Loading Loading @@ -2574,6 +2577,7 @@ public class WebView extends AbsoluteLayout int mWidth; int mHeight; float mHeightWidthRatio; int mActualViewHeight; int mTextWrapWidth; int mAnchorX; int mAnchorY; Loading @@ -2595,6 +2599,7 @@ public class WebView extends AbsoluteLayout int viewWidth = getViewWidth(); int newWidth = Math.round(viewWidth * mZoomManager.getInvScale()); // This height could be fixed and be different from actual visible height. int viewHeight = getViewHeightWithTitle() - getTitleHeight(); int newHeight = Math.round(viewHeight * mZoomManager.getInvScale()); // Make the ratio more accurate than (newHeight / newWidth), since the Loading @@ -2612,12 +2617,16 @@ public class WebView extends AbsoluteLayout newHeight = 0; heightWidthRatio = 0; } // Actual visible height. int actualViewHeight = getViewHeight(); // Avoid sending another message if the dimensions have not changed. if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force) { if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force || actualViewHeight != mLastActualHeightSent) { ViewSizeData data = new ViewSizeData(); data.mWidth = newWidth; data.mHeight = newHeight; data.mHeightWidthRatio = heightWidthRatio; data.mActualViewHeight = actualViewHeight; data.mTextWrapWidth = Math.round(viewWidth / mZoomManager.getTextWrapScale()); data.mScale = mZoomManager.getScale(); data.mIgnoreHeight = mZoomManager.isFixedLengthAnimationInProgress() Loading @@ -2627,6 +2636,7 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage(EventHub.VIEW_SIZE_CHANGED, data); mLastWidthSent = newWidth; mLastHeightSent = newHeight; mLastActualHeightSent = actualViewHeight; mZoomManager.clearDocumentAnchor(); return true; } Loading core/java/android/webkit/WebViewCore.java +10 −11 Original line number Diff line number Diff line Loading @@ -1177,13 +1177,7 @@ final class WebViewCore { break; case VIEW_SIZE_CHANGED: { WebView.ViewSizeData data = (WebView.ViewSizeData) msg.obj; viewSizeChanged(data.mWidth, data.mHeight, data.mHeightWidthRatio, data.mTextWrapWidth, data.mScale, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); viewSizeChanged((WebView.ViewSizeData) msg.obj); break; } case SET_SCROLL_OFFSET: Loading Loading @@ -1817,8 +1811,11 @@ 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, float heightWidthRatio, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { private void viewSizeChanged(WebView.ViewSizeData data) { int w = data.mWidth; int h = data.mHeight; int textwrapWidth = data.mTextWrapWidth; float scale = data.mScale; if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h + "; textwrapWidth=" + textwrapWidth + "; scale=" + scale); Loading Loading @@ -1865,11 +1862,13 @@ final class WebViewCore { } 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, h, anchorX, anchorY, ignoreHeight); 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; Loading Loading
core/java/android/webkit/WebView.java +11 −1 Original line number Diff line number Diff line Loading @@ -557,6 +557,9 @@ public class WebView extends AbsoluteLayout // sending the same dimensions more than once. int mLastWidthSent; int mLastHeightSent; // Since view height sent to webkit could be fixed to avoid relayout, this // value records the last sent actual view height. int mLastActualHeightSent; private int mContentWidth; // cache of value from WebViewCore private int mContentHeight; // cache of value from WebViewCore Loading Loading @@ -2574,6 +2577,7 @@ public class WebView extends AbsoluteLayout int mWidth; int mHeight; float mHeightWidthRatio; int mActualViewHeight; int mTextWrapWidth; int mAnchorX; int mAnchorY; Loading @@ -2595,6 +2599,7 @@ public class WebView extends AbsoluteLayout int viewWidth = getViewWidth(); int newWidth = Math.round(viewWidth * mZoomManager.getInvScale()); // This height could be fixed and be different from actual visible height. int viewHeight = getViewHeightWithTitle() - getTitleHeight(); int newHeight = Math.round(viewHeight * mZoomManager.getInvScale()); // Make the ratio more accurate than (newHeight / newWidth), since the Loading @@ -2612,12 +2617,16 @@ public class WebView extends AbsoluteLayout newHeight = 0; heightWidthRatio = 0; } // Actual visible height. int actualViewHeight = getViewHeight(); // Avoid sending another message if the dimensions have not changed. if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force) { if (newWidth != mLastWidthSent || newHeight != mLastHeightSent || force || actualViewHeight != mLastActualHeightSent) { ViewSizeData data = new ViewSizeData(); data.mWidth = newWidth; data.mHeight = newHeight; data.mHeightWidthRatio = heightWidthRatio; data.mActualViewHeight = actualViewHeight; data.mTextWrapWidth = Math.round(viewWidth / mZoomManager.getTextWrapScale()); data.mScale = mZoomManager.getScale(); data.mIgnoreHeight = mZoomManager.isFixedLengthAnimationInProgress() Loading @@ -2627,6 +2636,7 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage(EventHub.VIEW_SIZE_CHANGED, data); mLastWidthSent = newWidth; mLastHeightSent = newHeight; mLastActualHeightSent = actualViewHeight; mZoomManager.clearDocumentAnchor(); return true; } Loading
core/java/android/webkit/WebViewCore.java +10 −11 Original line number Diff line number Diff line Loading @@ -1177,13 +1177,7 @@ final class WebViewCore { break; case VIEW_SIZE_CHANGED: { WebView.ViewSizeData data = (WebView.ViewSizeData) msg.obj; viewSizeChanged(data.mWidth, data.mHeight, data.mHeightWidthRatio, data.mTextWrapWidth, data.mScale, data.mAnchorX, data.mAnchorY, data.mIgnoreHeight); viewSizeChanged((WebView.ViewSizeData) msg.obj); break; } case SET_SCROLL_OFFSET: Loading Loading @@ -1817,8 +1811,11 @@ 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, float heightWidthRatio, int textwrapWidth, float scale, int anchorX, int anchorY, boolean ignoreHeight) { private void viewSizeChanged(WebView.ViewSizeData data) { int w = data.mWidth; int h = data.mHeight; int textwrapWidth = data.mTextWrapWidth; float scale = data.mScale; if (DebugFlags.WEB_VIEW_CORE) { Log.v(LOGTAG, "viewSizeChanged w=" + w + "; h=" + h + "; textwrapWidth=" + textwrapWidth + "; scale=" + scale); Loading Loading @@ -1865,11 +1862,13 @@ final class WebViewCore { } 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, h, anchorX, anchorY, ignoreHeight); 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; Loading