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
|
@ -253,22 +253,6 @@ void RendererClientBase::RenderFrameCreated(
|
|||
// DidCreateDocumentElement event.
|
||||
new ElectronApiServiceImpl(render_frame, this);
|
||||
|
||||
content::RenderView* render_view = render_frame->GetRenderView();
|
||||
if (render_frame->IsMainFrame() && render_view) {
|
||||
blink::WebView* webview = render_view->GetWebView();
|
||||
if (webview) {
|
||||
auto prefs = render_frame->GetBlinkPreferences();
|
||||
if (prefs.guest_instance_id) { // webview.
|
||||
webview->SetBaseBackgroundColor(SK_ColorTRANSPARENT);
|
||||
} else { // normal window.
|
||||
std::string name = prefs.background_color;
|
||||
SkColor color =
|
||||
name.empty() ? SK_ColorTRANSPARENT : ParseHexColor(name);
|
||||
webview->SetBaseBackgroundColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
auto* dispatcher = extensions_renderer_client_->GetDispatcher();
|
||||
// ExtensionFrameHelper destroys itself when the RenderFrame is destroyed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue