fix: ensure that reloads retain modified window background colors (#19973)

This commit is contained in:
trop[bot]
2019-08-27 07:50:39 -07:00
committed by Shelley Vohr
parent bb631892b2
commit a5ed8fb65e

View File

@@ -309,6 +309,16 @@ void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
auto* view = web_contents()->GetRenderWidgetHostView();
if (view)
view->SetBackgroundColor(ParseHexColor(color_name));
// Also update the web preferences object otherwise the view will be reset on
// the next load URL call
if (api_web_contents_) {
auto* web_preferences =
WebContentsPreferences::From(api_web_contents_->web_contents());
if (web_preferences) {
web_preferences->preference()->SetStringKey(options::kBackgroundColor,
color_name);
}
}
}
void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {