From 321af7d8339475bfcf9041a1f1d764cf7b42e1ad Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 16 Nov 2021 16:05:07 +0100 Subject: [PATCH] fix: BrowserView setBackgroundColor needs two calls --- 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 ff5a42581445b..7193c00fa1c5e 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) {