Skip to content

Commit

Permalink
fix: <webview> background transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Burda committed Nov 4, 2021
1 parent 98bab0c commit 71395d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shell/browser/api/electron_api_web_contents.cc
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() ? 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 71395d7

Please sign in to comment.