mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: BrowserView setBackgroundColor() (#31844)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user