mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: Fix compositor recycling when creating new BrowserView (6-1-x) (#21396)
Backport of #21372. This also backports a tiny bit of #19988. Notes: Fix flicker when switching between BrowserViews after creating new BrowserView
This commit is contained in:
committed by
Samuel Attard
parent
9743d70131
commit
5c0319e00e
@@ -330,6 +330,12 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
||||
// Whether to enable DevTools.
|
||||
options.Get("devTools", &enable_devtools_);
|
||||
|
||||
// BrowserViews are not attached to a window initially so they should start
|
||||
// off as hidden. This is also important for compositor recycling. See:
|
||||
// https://github.com/electron/electron/pull/21372
|
||||
bool initially_shown = type_ != Type::BROWSER_VIEW;
|
||||
options.Get(options::kShow, &initially_shown);
|
||||
|
||||
// Obtain the session.
|
||||
std::string partition;
|
||||
mate::Handle<api::Session> session;
|
||||
@@ -382,6 +388,7 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
||||
#endif
|
||||
} else {
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
params.initially_hidden = !initially_shown;
|
||||
web_contents = content::WebContents::Create(params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user