From f79a7d6ae4119439f28f428670c42e76cda25334 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Thu, 5 Oct 2023 11:52:21 -0700 Subject: [PATCH] fix: fix vibrancy applying without transparency --- .../browser/api/electron_api_browser_window.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 99a61fa29f240..e23e40a7f1e80 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -42,11 +42,27 @@ BrowserWindow::BrowserWindow(gin::Arguments* args, auto web_preferences = gin_helper::Dictionary::CreateEmpty(isolate); options.Get(options::kWebPreferences, &web_preferences); + bool transparent = false; + options.Get(options::kTransparent, &transparent); + + std::string vibrancy_type; +#if BUILDFLAG(IS_MAC) + options.Get(options::kVibrancyType, &vibrancy_type); +#endif + +#if BUILDFLAG(IS_WIN) + const std::string& bg_material = background_material(); +#endif + // Copy the backgroundColor to webContents. std::string color; if (options.Get(options::kBackgroundColor, &color)) { web_preferences.SetHidden(options::kBackgroundColor, color); - } else if (window_->IsTranslucent()) { +#if BUILDFLAG(IS_WIN) + } else if (!bg_material.empty() && bg_material != "none") { +#else + } else if (!vibrancy_type.empty() || transparent) { +#endif // 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.