Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: addressed comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
boliu 2017/01/04 18:58:06 seems like this should be unnecessary, you can get
Jinsuk Kim 2017/01/05 11:03:12 Again, this is how I struggled not to add a new me
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 {

Powered by Google App Engine
This is Rietveld 408576698