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
WebContentsGestureStateTracker.OnGestureStateChangedListener,
ModalDialogManager.ModalDialogManagerObserver {
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;
// Child of mContentView, holds top-view from client.
// Child of mContentViewRenderView, holds top-view from client.
private final BrowserControlsContainerView mTopControlsContainerView;
// Child of mContentView, holds bottom-view from client.
// Child of mContentViewRenderView, holds bottom-view from client.
private final BrowserControlsContainerView mBottomControlsContainerView;
// Other child of mContentView, which holds views that sit on top of the web contents, such as
// tab modal dialogs.
// Other child of mContentViewRenderView, which holds views that sit on top of the web contents,
// such as tab modal dialogs.
private final FrameLayout mWebContentsOverlayView;
private final FragmentWindowAndroid mWindowAndroid;
......@@ -73,23 +76,24 @@ public final class BrowserViewController
mContentView = ContentView.createContentView(
context, mTopControlsContainerView.getEventOffsetHandler());
mContentViewRenderView.addView(mContentView,
new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.UNSPECIFIED_GRAVITY));
mContentView.addView(mTopControlsContainerView,
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT));
mContentViewRenderView.addView(mTopControlsContainerView,
new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
RelativeLayout.LayoutParams bottomControlsContainerViewParams =
new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
bottomControlsContainerViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mContentView.addView(mBottomControlsContainerView, bottomControlsContainerViewParams);
mContentViewRenderView.addView(
mBottomControlsContainerView, bottomControlsContainerViewParams);
mWebContentsOverlayView = new FrameLayout(context);
RelativeLayout.LayoutParams overlayParams =
new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
overlayParams.addRule(RelativeLayout.BELOW, mTopControlsContainerView.getId());
overlayParams.addRule(RelativeLayout.ABOVE, mBottomControlsContainerView.getId());
mContentView.addView(mWebContentsOverlayView, overlayParams);
mContentViewRenderView.addView(mWebContentsOverlayView, overlayParams);
mWindowAndroid.setAnimationPlaceholderView(mWebContentsOverlayView);
mModalDialogManager = new ModalDialogManager(
......
......@@ -17,6 +17,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.ValueCallback;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import androidx.annotation.IntDef;
......@@ -41,7 +42,7 @@ import java.util.ArrayList;
* visually seamless.
*/
@JNINamespace("weblayer")
public class ContentViewRenderView extends FrameLayout {
public class ContentViewRenderView extends RelativeLayout {
@Retention(RetentionPolicy.SOURCE)
@IntDef({MODE_SURFACE_VIEW, MODE_SURFACE_VIEW})
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