fix: ensure child window transparency works (#28054)
* fix: ensure child window transparency works Windows opened via window.open and intecepted via setWindowOpenHandler or the `new-window` event should (a) have the correct background color and (b) that background color should be transparent if specified. The changes in api_web_contents fix (a) and the changes in web_contents_preferences fix (b). Notes: Child windows with specified background colors or transpency now work as intended * fix: set background_color in blink prefs apply logic * chore: update for PR comments
This commit is contained in:
parent
102a3740ea
commit
089ac8180f
6 changed files with 59 additions and 17 deletions
|
@ -1057,6 +1057,16 @@ void WebContents::AddNewContents(
|
|||
v8::HandleScope handle_scope(isolate);
|
||||
auto api_web_contents =
|
||||
CreateAndTake(isolate, std::move(new_contents), Type::kBrowserWindow);
|
||||
|
||||
// We call RenderFrameCreated here as at this point the empty "about:blank"
|
||||
// render frame has already been created. If the window never navigates again
|
||||
// RenderFrameCreated won't be called and certain prefs like
|
||||
// "kBackgroundColor" will not be applied.
|
||||
auto* frame = api_web_contents->MainFrame();
|
||||
if (frame) {
|
||||
api_web_contents->HandleNewRenderFrame(frame);
|
||||
}
|
||||
|
||||
if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
|
||||
initial_rect.x(), initial_rect.y(), initial_rect.width(),
|
||||
initial_rect.height(), tracker->url, tracker->frame_name,
|
||||
|
@ -1346,7 +1356,7 @@ void WebContents::BeforeUnloadFired(bool proceed,
|
|||
// there are two virtual functions named BeforeUnloadFired.
|
||||
}
|
||||
|
||||
void WebContents::RenderFrameCreated(
|
||||
void WebContents::HandleNewRenderFrame(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
auto* rwhv = render_frame_host->GetView();
|
||||
if (!rwhv)
|
||||
|
@ -1375,6 +1385,11 @@ void WebContents::RenderFrameCreated(
|
|||
WebFrameMain::RenderFrameCreated(render_frame_host);
|
||||
}
|
||||
|
||||
void WebContents::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
HandleNewRenderFrame(render_frame_host);
|
||||
}
|
||||
|
||||
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
|
||||
// This event is necessary for tracking any states with respect to
|
||||
// intermediate render view hosts aka speculative render view hosts. Currently
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue