diff --git a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc index dbed46d56e..d60675f31f 100644 --- a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc +++ b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc @@ -133,4 +133,14 @@ void ElectronDesktopWindowTreeHostWin::OnNativeThemeUpdated( } } +bool ElectronDesktopWindowTreeHostWin::ShouldWindowContentsBeTransparent() + const { + // Window should be marked as opaque if no transparency setting has been set, + // otherwise videos rendered in the window will trigger a DirectComposition + // redraw for every frame. + // https://github.com/electron/electron/pull/39895 + return native_window_view_->GetOpacity() < 1.0 || + native_window_view_->transparent(); +} + } // namespace electron diff --git a/shell/browser/ui/win/electron_desktop_window_tree_host_win.h b/shell/browser/ui/win/electron_desktop_window_tree_host_win.h index 1901cad02f..2c627ceeb0 100644 --- a/shell/browser/ui/win/electron_desktop_window_tree_host_win.h +++ b/shell/browser/ui/win/electron_desktop_window_tree_host_win.h @@ -40,6 +40,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin, // ui::NativeThemeObserver: void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override; + bool ShouldWindowContentsBeTransparent() const override; private: raw_ptr native_window_view_; // weak ref