Skip to content

Commit 08e2617

Browse files
authored
fix: broken OSR transparent option (electron#32885)
1 parent 41b2945 commit 08e2617

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

shell/browser/api/electron_api_web_contents.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,12 @@ WebContents::WebContents(v8::Isolate* isolate,
767767
#if BUILDFLAG(ENABLE_OSR)
768768
}
769769
} else if (IsOffScreen()) {
770-
bool transparent = false;
771-
options.Get(options::kTransparent, &transparent);
770+
// webPreferences does not have a transparent option, so if the window needs
771+
// to be transparent, that will be set at electron_api_browser_window.cc#L57
772+
// and we then need to pull it back out and check it here.
773+
std::string background_color;
774+
options.GetHidden(options::kBackgroundColor, &background_color);
775+
bool transparent = ParseHexColor(background_color) == SK_ColorTRANSPARENT;
772776

773777
content::WebContents::CreateParams params(session->browser_context());
774778
auto* view = new OffScreenWebContentsView(

0 commit comments

Comments
 (0)