Commit 17ca9339 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacPWAs: Ensure correct RenderWidgetHostViewCocoa ordering

A WebContentsViewCocoa can have several RenderWidgetHostViewCocoas
added as subviews. Each view, when added as a subview, in the function
WebContentsViewMac::CreateViewForWidget, is put behind all other
subviews (in contrast to the default behavior of -[NSView addSubview],
which puts the new subview in front).

The analogous code in the app shim, in the function
RenderWidgetHostNSViewBridge::SetParentWebContentsNSView, orders the
subviews in the default way, which does not match the behavior of the
browser.

As a result, the NSView ordering can get messed up, resulting in
un-clickable contents. This is vaguely similar to the issue in
crbug.com/859834, which also involve the login page. The login page
hits these sorts of bugs because RenderWidgetHostViewMacs are added
to a single WebContentsViewMac at the login page.

Bug: 1017446
Change-Id: I11425603b258b47e84c6e3df55ec966cf5246191
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892577Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711237}
parent 191ab5f2
......@@ -72,7 +72,12 @@ void RenderWidgetHostNSViewBridge::SetParentWebContentsNSView(
// done by WebContentsViewMac.
[cocoa_view_ setFrame:[parent_ns_view bounds]];
[cocoa_view_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[parent_ns_view addSubview:cocoa_view_];
// Place the new view below all other views, matching the behavior in
// WebContentsViewMac::CreateViewForWidget.
// https://crbug.com/1017446
[parent_ns_view addSubview:cocoa_view_
positioned:NSWindowBelow
relativeTo:nil];
}
void RenderWidgetHostNSViewBridge::MakeFirstResponder() {
......
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