| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
|
| index 80b3593f3b1d798dce4770b6e686a07776b7ebf5..24cb72a529e1df09bf0d9d2904fb70e9d7c9c898 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java
|
| @@ -20,8 +20,8 @@ import org.chromium.ui.base.WindowAndroid;
|
|
|
| /***
|
| * This view is used by a ContentView to render its content.
|
| - * Call {@link #setCurrentContentViewCore(ContentViewCore)} with the contentViewCore that should be
|
| - * managing the view.
|
| + * Call {@link #setCurrentContent(ContentViewCore, ViewRoot)} to associate this class
|
| + * with the content to be rendered.
|
| * Note that only one ContentViewCore can be shown at a time.
|
| */
|
| @JNINamespace("content")
|
| @@ -32,6 +32,7 @@ public class ContentViewRenderView extends FrameLayout {
|
|
|
| private final SurfaceView mSurfaceView;
|
| protected ContentViewCore mContentViewCore;
|
| + private ViewRoot mViewRoot;
|
|
|
| /**
|
| * Constructs a new ContentViewRenderView.
|
| @@ -71,8 +72,8 @@ public class ContentViewRenderView extends FrameLayout {
|
| assert mNativeContentViewRenderView != 0;
|
| nativeSurfaceChanged(mNativeContentViewRenderView,
|
| format, width, height, holder.getSurface());
|
| - if (mContentViewCore != null) {
|
| - getViewRoot().onPhysicalBackingSizeChanged(width, height);
|
| + if (mViewRoot != null) {
|
| + mViewRoot.onPhysicalBackingSizeChanged(width, height);
|
| }
|
| }
|
|
|
| @@ -94,10 +95,6 @@ public class ContentViewRenderView extends FrameLayout {
|
| mSurfaceView.setVisibility(VISIBLE);
|
| }
|
|
|
| - private ViewRoot getViewRoot() {
|
| - return mContentViewCore.getWindowAndroid().getViewRoot();
|
| - }
|
| -
|
| /**
|
| * Sets the background color of the surface view. This method is necessary because the
|
| * background color of ContentViewRenderView itself is covered by the background of
|
| @@ -127,12 +124,13 @@ public class ContentViewRenderView extends FrameLayout {
|
| mNativeContentViewRenderView = 0;
|
| }
|
|
|
| - public void setCurrentContentViewCore(ContentViewCore contentViewCore) {
|
| + public void setCurrentContent(ContentViewCore contentViewCore, ViewRoot viewRoot) {
|
| assert mNativeContentViewRenderView != 0;
|
| mContentViewCore = contentViewCore;
|
| + mViewRoot = viewRoot;
|
|
|
| - if (mContentViewCore != null) {
|
| - getViewRoot().onPhysicalBackingSizeChanged(getWidth(), getHeight());
|
| + if (mContentViewCore != null && mViewRoot != null) {
|
| + mViewRoot.onPhysicalBackingSizeChanged(getWidth(), getHeight());
|
| nativeSetCurrentWebContents(
|
| mNativeContentViewRenderView, mContentViewCore.getWebContents());
|
| } else {
|
|
|