From 239ba7d905283c78b6ba4320575562aaa13220f8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 22 Nov 2021 01:38:05 +0100 Subject: [PATCH] fix: BrowserView setBackgroundColor needs two calls (#31863) --- shell/browser/api/electron_api_browser_view.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/browser/api/electron_api_browser_view.cc b/shell/browser/api/electron_api_browser_view.cc index ff5a42581445..7193c00fa1c5 100644 --- a/shell/browser/api/electron_api_browser_view.cc +++ b/shell/browser/api/electron_api_browser_view.cc @@ -155,11 +155,12 @@ gfx::Rect BrowserView::GetBounds() { } void BrowserView::SetBackgroundColor(const std::string& color_name) { - if (!web_contents()) - return; + view_->SetBackgroundColor(ParseHexColor(color_name)); - auto* wc = web_contents()->web_contents(); - wc->SetPageBaseBackgroundColor(ParseHexColor(color_name)); + if (web_contents()) { + auto* wc = web_contents()->web_contents(); + wc->SetPageBaseBackgroundColor(ParseHexColor(color_name)); + } } v8::Local BrowserView::GetWebContents(v8::Isolate* isolate) {