From 1d0f94f6b3f54fc7e3d90ef637baa897322ba5bd Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 21 Oct 2021 21:53:52 +0200 Subject: [PATCH] fix: vibrant window should have transparent background (#31493) --- shell/browser/api/electron_api_browser_window.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 0c7f79f9edd4..5434d713535e 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -37,14 +37,22 @@ BrowserWindow::BrowserWindow(gin::Arguments* args, gin::Dictionary::CreateEmpty(isolate); options.Get(options::kWebPreferences, &web_preferences); - // Copy the backgroundColor to webContents. v8::Local value; bool transparent = false; + options.Get(options::kTransparent, &transparent); + + std::string vibrancy_type; +#if defined(OS_MAC) + options.Get(options::kVibrancyType, &vibrancy_type); +#endif + + // Copy the backgroundColor to webContents. if (options.Get(options::kBackgroundColor, &value)) { web_preferences.SetHidden(options::kBackgroundColor, value); - } else if (options.Get(options::kTransparent, &transparent) && transparent) { - // If the BrowserWindow is transparent, also propagate transparency to the - // WebContents unless a separate backgroundColor has been set. + } else if (!vibrancy_type.empty() || transparent) { + // If the BrowserWindow is transparent or a vibrancy type has been set, + // also propagate transparency to the WebContents unless a separate + // backgroundColor has been set. web_preferences.SetHidden(options::kBackgroundColor, ToRGBAHex(SK_ColorTRANSPARENT)); }