fix: BrowserView setBackgroundColor() (#31844)

This commit is contained in:
Shelley Vohr
2021-11-15 19:32:56 +01:00
committed by GitHub
parent 11ea44925b
commit 1f23e83ef9
2 changed files with 7 additions and 2 deletions

View File

@@ -155,7 +155,11 @@ gfx::Rect BrowserView::GetBounds() {
}
void BrowserView::SetBackgroundColor(const std::string& color_name) {
view_->SetBackgroundColor(ParseHexColor(color_name));
if (!web_contents())
return;
auto* wc = web_contents()->web_contents();
wc->SetPageBaseBackgroundColor(ParseHexColor(color_name));
}
v8::Local<v8::Value> BrowserView::GetWebContents(v8::Isolate* isolate) {

View File

@@ -1404,8 +1404,9 @@ void WebContents::HandleNewRenderFrame(
&color_name)) {
web_contents()->SetPageBaseBackgroundColor(ParseHexColor(color_name));
} else {
bool guest = IsGuest() || type_ == Type::kBrowserView;
web_contents()->SetPageBaseBackgroundColor(
IsGuest() ? absl::make_optional(SK_ColorTRANSPARENT) : absl::nullopt);
guest ? absl::make_optional(SK_ColorTRANSPARENT) : absl::nullopt);
}
// When a page base background color is set, transparency needs to be