Commit 906eb05f authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: moves top/bottom views to ContentViewRenderView

Prior to this top/bottom views were parented to ContentView. ContentView
uses an accessibility implementation that doesn't work with views, meaning
any views added to ContentView are not accessible.

BUG=1075585
TEST=none

Change-Id: I010f72bc1f26cca8b88159609f1b17b275af0775
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186734Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766455}
parent f6e8cd8a
...@@ -34,13 +34,16 @@ public final class BrowserViewController ...@@ -34,13 +34,16 @@ public final class BrowserViewController
WebContentsGestureStateTracker.OnGestureStateChangedListener, WebContentsGestureStateTracker.OnGestureStateChangedListener,
ModalDialogManager.ModalDialogManagerObserver { ModalDialogManager.ModalDialogManagerObserver {
private final ContentViewRenderView mContentViewRenderView; private final ContentViewRenderView mContentViewRenderView;
// Child of mContentViewRenderView. Be very careful adding Views to this, as any Views are not
// accessible (ContentView provides it's own accessible implementation that interacts with
// WebContents).
private final ContentView mContentView; private final ContentView mContentView;
// Child of mContentView, holds top-view from client. // Child of mContentViewRenderView, holds top-view from client.
private final BrowserControlsContainerView mTopControlsContainerView; private final BrowserControlsContainerView mTopControlsContainerView;
// Child of mContentView, holds bottom-view from client. // Child of mContentViewRenderView, holds bottom-view from client.
private final BrowserControlsContainerView mBottomControlsContainerView; private final BrowserControlsContainerView mBottomControlsContainerView;
// Other child of mContentView, which holds views that sit on top of the web contents, such as // Other child of mContentViewRenderView, which holds views that sit on top of the web contents,
// tab modal dialogs. // such as tab modal dialogs.
private final FrameLayout mWebContentsOverlayView; private final FrameLayout mWebContentsOverlayView;
private final FragmentWindowAndroid mWindowAndroid; private final FragmentWindowAndroid mWindowAndroid;
...@@ -73,23 +76,24 @@ public final class BrowserViewController ...@@ -73,23 +76,24 @@ public final class BrowserViewController
mContentView = ContentView.createContentView( mContentView = ContentView.createContentView(
context, mTopControlsContainerView.getEventOffsetHandler()); context, mTopControlsContainerView.getEventOffsetHandler());
mContentViewRenderView.addView(mContentView, mContentViewRenderView.addView(mContentView,
new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.UNSPECIFIED_GRAVITY)); RelativeLayout.LayoutParams.MATCH_PARENT));
mContentView.addView(mTopControlsContainerView, mContentViewRenderView.addView(mTopControlsContainerView,
new RelativeLayout.LayoutParams( new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
RelativeLayout.LayoutParams bottomControlsContainerViewParams = RelativeLayout.LayoutParams bottomControlsContainerViewParams =
new RelativeLayout.LayoutParams( new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
bottomControlsContainerViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); bottomControlsContainerViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mContentView.addView(mBottomControlsContainerView, bottomControlsContainerViewParams); mContentViewRenderView.addView(
mBottomControlsContainerView, bottomControlsContainerViewParams);
mWebContentsOverlayView = new FrameLayout(context); mWebContentsOverlayView = new FrameLayout(context);
RelativeLayout.LayoutParams overlayParams = RelativeLayout.LayoutParams overlayParams =
new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0); new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
overlayParams.addRule(RelativeLayout.BELOW, mTopControlsContainerView.getId()); overlayParams.addRule(RelativeLayout.BELOW, mTopControlsContainerView.getId());
overlayParams.addRule(RelativeLayout.ABOVE, mBottomControlsContainerView.getId()); overlayParams.addRule(RelativeLayout.ABOVE, mBottomControlsContainerView.getId());
mContentView.addView(mWebContentsOverlayView, overlayParams); mContentViewRenderView.addView(mWebContentsOverlayView, overlayParams);
mWindowAndroid.setAnimationPlaceholderView(mWebContentsOverlayView); mWindowAndroid.setAnimationPlaceholderView(mWebContentsOverlayView);
mModalDialogManager = new ModalDialogManager( mModalDialogManager = new ModalDialogManager(
......
...@@ -17,6 +17,7 @@ import android.view.ViewGroup; ...@@ -17,6 +17,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
...@@ -41,7 +42,7 @@ import java.util.ArrayList; ...@@ -41,7 +42,7 @@ import java.util.ArrayList;
* visually seamless. * visually seamless.
*/ */
@JNINamespace("weblayer") @JNINamespace("weblayer")
public class ContentViewRenderView extends FrameLayout { public class ContentViewRenderView extends RelativeLayout {
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({MODE_SURFACE_VIEW, MODE_SURFACE_VIEW}) @IntDef({MODE_SURFACE_VIEW, MODE_SURFACE_VIEW})
public @interface Mode {} public @interface Mode {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment