summaryrefslogtreecommitdiffstats
path: root/android_webview/java
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 23:21:33 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 23:21:33 +0000
commitd01b2a644559414d0c4632f3829f3165e4054d84 (patch)
tree48843cb49f78c4c4541ce0def3e9c2dc0f0b0e1a /android_webview/java
parent6ffe7a770dcaa9ded997ccc55619d4b18c257d43 (diff)
downloadchromium_src-d01b2a644559414d0c4632f3829f3165e4054d84.zip
chromium_src-d01b2a644559414d0c4632f3829f3165e4054d84.tar.gz
chromium_src-d01b2a644559414d0c4632f3829f3165e4054d84.tar.bz2
Use contents size for android_webview layout size.
Currently android_webview uses RenderView::preferredSize (which is based off of documentElement.height) to drive the android.view.View layout size. WebViewClassic would use content size for that purpose which meant that absolute-positioned elements can cause the Classic WebView to grow. This CL makes AwContents use the contents size for driving layout. BUG=286336 Review URL: https://chromiumcodereview.appspot.com/23899004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/java')
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java9
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java16
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java9
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java20
4 files changed, 7 insertions, 47 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 700b9c1..edc8f94 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -495,8 +495,7 @@ public class AwContents {
mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPScale();
mLayoutSizer.setDelegate(new AwLayoutSizerDelegate());
mLayoutSizer.setDIPScale(mDIPScale);
- mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient,
- mLayoutSizer.getPreferredSizeChangedListener(), mContainerView);
+ mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient, mContainerView);
mContentsClientBridge = new AwContentsClientBridge(contentsClient);
mZoomControls = new AwZoomControls(this);
mIoThreadClient = new IoThreadClientImpl();
@@ -1792,6 +1791,12 @@ public class AwContents {
}
@CalledByNative
+ private void onWebLayoutContentsSizeChanged(int widthCss, int heightCss) {
+ // This change notification comes from the renderer thread, not from the cc/ impl thread.
+ mLayoutSizer.onContentSizeChanged(widthCss, heightCss);
+ }
+
+ @CalledByNative
private void scrollContainerViewTo(int x, int y) {
mScrollOffsetManager.scrollContainerViewTo(x, y);
}
diff --git a/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java b/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java
index bee46a1..d3b42d5 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java
@@ -68,22 +68,6 @@ public class AwLayoutSizer {
}
/**
- * This is used to register the AwLayoutSizer to preferred content size change notifications in
- * the AwWebContentsDelegate.
- * NOTE: The preferred size notifications come in from the Renderer main thread and might be
- * out of sync with the content size as seen by the InProcessViewRenderer (and Compositor).
- */
- public AwWebContentsDelegateAdapter.PreferredSizeChangedListener
- getPreferredSizeChangedListener() {
- return new AwWebContentsDelegateAdapter.PreferredSizeChangedListener() {
- @Override
- public void updatePreferredSize(int widthCss, int heightCss) {
- onContentSizeChanged(widthCss, heightCss);
- }
- };
- }
-
- /**
* Postpone requesting layouts till unfreezeLayoutRequests is called.
*/
public void freezeLayoutRequests() {
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java
index d26fd9a..1768adc 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java
@@ -33,15 +33,6 @@ public abstract class AwWebContentsDelegate extends WebContentsDelegateAndroid {
@CalledByNative
public abstract void activateContents();
- /**
- * Report a change in the preferred size.
- * @param width preferred width in CSS pixels.
- * @param height scroll height of the document element in CSS pixels.
- */
- @CalledByNative
- public void updatePreferredSize(int widthCss, int heightCss) {
- }
-
// Call in response to a prior runFileChooser call.
protected static native void nativeFilesSelectedInChooser(int processId, int renderId,
int mode_flags, String[] filePath);
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
index 7e3512d..15ed6f7 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
@@ -24,27 +24,12 @@ import org.chromium.content.browser.ContentViewCore;
class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
private static final String TAG = "AwWebContentsDelegateAdapter";
- /**
- * Listener definition for a callback to be invoked when the preferred size of the page
- * contents changes.
- */
- public interface PreferredSizeChangedListener {
- /**
- * Called when the preferred size of the page contents changes.
- * @see AwWebContentsDelegate#updatePreferredSize
- */
- void updatePreferredSize(int width, int height);
- }
-
final AwContentsClient mContentsClient;
- final PreferredSizeChangedListener mPreferredSizeChangedListener;
final View mContainerView;
public AwWebContentsDelegateAdapter(AwContentsClient contentsClient,
- PreferredSizeChangedListener preferredSizeChangedListener,
View containerView) {
mContentsClient = contentsClient;
- mPreferredSizeChangedListener = preferredSizeChangedListener;
mContainerView = containerView;
}
@@ -202,9 +187,4 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
public void activateContents() {
mContentsClient.onRequestFocus();
}
-
- @Override
- public void updatePreferredSize(int width, int height) {
- mPreferredSizeChangedListener.updatePreferredSize(width, height);
- }
}