mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: <webview> background transparency (#31727)
Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
@@ -1401,14 +1401,15 @@ void WebContents::HandleNewRenderFrame(
|
||||
&color_name)) {
|
||||
web_contents()->SetPageBaseBackgroundColor(ParseHexColor(color_name));
|
||||
} else {
|
||||
web_contents()->SetPageBaseBackgroundColor(absl::nullopt);
|
||||
web_contents()->SetPageBaseBackgroundColor(
|
||||
IsGuest() ? absl::make_optional(SK_ColorTRANSPARENT) : absl::nullopt);
|
||||
}
|
||||
|
||||
// When a page base background color is set, transparency needs to be
|
||||
// explicitly set by calling
|
||||
// RenderWidgetHostOwnerDelegate::SetBackgroundOpaque(false).
|
||||
// RenderWidgetHostViewBase::SetBackgroundColor() will do this for us.
|
||||
if (web_preferences->IsEnabled(options::kTransparent)) {
|
||||
if (web_preferences->IsEnabled(options::kTransparent) || IsGuest()) {
|
||||
rwhv->SetBackgroundColor(SK_ColorTRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user