Skip to content

Commit

Permalink
fix: <webview> background transparency (#31701)
Browse files Browse the repository at this point in the history
Co-authored-by: Milan Burda <miburda@microsoft.com>
  • Loading branch information
miniak and Milan Burda authored Nov 5, 2021
1 parent f74d89b commit 3e0a2ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shell/browser/api/electron_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1405,14 +1405,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);
}
}
Expand Down

0 comments on commit 3e0a2ed

Please sign in to comment.