mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: ensure that reloads retain modified window background colors (#19972)
This commit is contained in:
@@ -310,6 +310,17 @@ 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()->SetKey(options::kBackgroundColor,
|
||||
base::Value(color_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {
|
||||
|
||||
Reference in New Issue
Block a user