From 72135fd0f779b2f9fd6e057ef7fcde7c8f207331 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 14 Feb 2022 11:51:12 +0100 Subject: [PATCH] fix: broken OSR transparent option --- shell/browser/api/electron_api_web_contents.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 85d2e7207efc0..3873591e1dda3 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -767,8 +767,12 @@ WebContents::WebContents(v8::Isolate* isolate, #if BUILDFLAG(ENABLE_OSR) } } else if (IsOffScreen()) { - bool transparent = false; - options.Get(options::kTransparent, &transparent); + // webPreferences does not have a transparent option, so if the window needs + // to be transparent, that will be set at electron_api_browser_window.cc#L57 + // and we then need to pull it back out and check it here. + std::string background_color; + options.GetHidden(options::kBackgroundColor, &background_color); + bool transparent = ParseHexColor(background_color) == SK_ColorTRANSPARENT; content::WebContents::CreateParams params(session->browser_context()); auto* view = new OffScreenWebContentsView(