fix: <webview> background transparency (#31727)

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
trop[bot]
2021-11-05 20:09:30 -07:00
committed by GitHub
parent b763478ae5
commit 27fb917577

View File

@@ -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);
}
}