diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 15:19:02 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 15:19:02 +0000 |
commit | e7c5b164531f6f447839bd958056c6845aaa232b (patch) | |
tree | 71468b0f0d78170dcb5aaa803aaad2eb8d04befc /android_webview/java | |
parent | e1920eaf5b053691b3db3e6ec28538faa0fe7e1d (diff) | |
download | chromium_src-e7c5b164531f6f447839bd958056c6845aaa232b.zip chromium_src-e7c5b164531f6f447839bd958056c6845aaa232b.tar.gz chromium_src-e7c5b164531f6f447839bd958056c6845aaa232b.tar.bz2 |
[android] Plumb through page scale to the InProcessViewRenderer.
The InProcessViewRenderer needs to know the current pageScale so
that it can correctly convert phsical <-> CSS pixels.
BUG=b/9756394
TEST=AndroidWebViewTest
Android-only change, trybots are happy with it.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/18242011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211401 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index ab05434..61257ea 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -325,10 +325,15 @@ public class AwContents { //-------------------------------------------------------------------------------------------- // NOTE: This content size change notification comes from the compositor and reflects the size // of the content on screen (but not neccessarily in the renderer main thread). - private class AwContentSizeChangeListener implements ContentViewCore.ContentSizeChangeListener { + private class AwContentUpdateFrameInfoListener + implements ContentViewCore.UpdateFrameInfoListener { @Override - public void onContentSizeChanged(int widthPix, int heightPix) { + public void onFrameInfoUpdated(float widthCss, float heightCss, float pageScaleFactor) { + int widthPix = (int) Math.floor(widthCss * mDIPScale * pageScaleFactor); + int heightPix = (int) Math.floor(heightCss * mDIPScale * pageScaleFactor); mScrollOffsetManager.setContentSize(widthPix, heightPix); + + nativeSetDisplayedPageScaleFactor(mNativeAwContents, pageScaleFactor); } } @@ -504,7 +509,7 @@ public class AwContents { nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge, mIoThreadClient, mInterceptNavigationDelegate); mContentsClient.installWebContentsObserver(mContentViewCore); - mContentViewCore.setContentSizeChangeListener(new AwContentSizeChangeListener()); + mContentViewCore.setUpdateFrameInfoListener(new AwContentUpdateFrameInfoListener()); mSettings.setWebContents(nativeWebContents); nativeSetDipScale(mNativeAwContents, (float) mDIPScale); } @@ -1531,9 +1536,9 @@ public class AwContents { } @CalledByNative - private void onPageScaleFactorChanged(float pageScaleFactor) { + private void onWebLayoutPageScaleFactorChanged(float webLayoutPageScaleFactor) { // This change notification comes from the renderer thread, not from the cc/ impl thread. - mLayoutSizer.onPageScaleChanged(pageScaleFactor); + mLayoutSizer.onPageScaleChanged(webLayoutPageScaleFactor); } @CalledByNative @@ -1644,6 +1649,8 @@ public class AwContents { private native void nativeOnAttachedToWindow(int nativeAwContents, int w, int h); private native void nativeOnDetachedFromWindow(int nativeAwContents); private native void nativeSetDipScale(int nativeAwContents, float dipScale); + private native void nativeSetDisplayedPageScaleFactor(int nativeAwContents, + float pageScaleFactor); // Returns null if save state fails. private native byte[] nativeGetOpaqueState(int nativeAwContents); |