fix: BrowserView and <webview> should be transparent by default (#40866)
This commit is contained in:
parent
0672f59f26
commit
84ba0c6c7d
1 changed files with 5 additions and 3 deletions
|
@ -3778,15 +3778,17 @@ void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::SetBackgroundColor(absl::optional<SkColor> maybe_color) {
|
void WebContents::SetBackgroundColor(absl::optional<SkColor> maybe_color) {
|
||||||
web_contents()->SetPageBaseBackgroundColor(maybe_color);
|
SkColor color = maybe_color.value_or(type_ == Type::kWebView ||
|
||||||
|
type_ == Type::kBrowserView
|
||||||
|
? SK_ColorTRANSPARENT
|
||||||
|
: SK_ColorWHITE);
|
||||||
|
web_contents()->SetPageBaseBackgroundColor(color);
|
||||||
|
|
||||||
content::RenderFrameHost* rfh = web_contents()->GetPrimaryMainFrame();
|
content::RenderFrameHost* rfh = web_contents()->GetPrimaryMainFrame();
|
||||||
if (!rfh)
|
if (!rfh)
|
||||||
return;
|
return;
|
||||||
content::RenderWidgetHostView* rwhv = rfh->GetView();
|
content::RenderWidgetHostView* rwhv = rfh->GetView();
|
||||||
if (rwhv) {
|
if (rwhv) {
|
||||||
SkColor color =
|
|
||||||
maybe_color.value_or(IsGuest() ? SK_ColorTRANSPARENT : SK_ColorWHITE);
|
|
||||||
rwhv->SetBackgroundColor(color);
|
rwhv->SetBackgroundColor(color);
|
||||||
static_cast<content::RenderWidgetHostViewBase*>(rwhv)
|
static_cast<content::RenderWidgetHostViewBase*>(rwhv)
|
||||||
->SetContentBackgroundColor(color);
|
->SetContentBackgroundColor(color);
|
||||||
|
|
Loading…
Reference in a new issue