Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d9019d1

Browse files
committed
Bug 1584492 - Add mPIPWindow to nsWidgetInitData and set it for PIP window on Linux/Gtk, r=mats
Differential Revision: https://phabricator.services.mozilla.com/D47409 --HG-- extra : moz-landing-system : lando
1 parent 99abfe0 commit d9019d1

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

widget/nsWidgetInitData.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ struct nsWidgetInitData {
111111
mSupportTranslucency(false),
112112
mMouseTransparent(false),
113113
mHasRemoteContent(false),
114-
mAlwaysOnTop(false) {}
114+
mAlwaysOnTop(false),
115+
mPIPWindow(false) {}
115116

116117
nsWindowType mWindowType;
117118
nsBorderStyle mBorderStyle;
@@ -137,6 +138,8 @@ struct nsWidgetInitData {
137138
bool mMouseTransparent;
138139
bool mHasRemoteContent;
139140
bool mAlwaysOnTop;
141+
// Is PictureInPicture window
142+
bool mPIPWindow;
140143
};
141144

142145
#endif // nsWidgetInitData_h__

xpfe/appshell/nsAppShellService.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,21 @@ nsresult nsAppShellService::JustCreateTopWindow(
624624
if (aChromeMask & nsIWebBrowserChrome::CHROME_ALWAYS_ON_TOP)
625625
widgetInitData.mAlwaysOnTop = true;
626626

627+
#ifdef MOZ_WIDGET_GTK
628+
// Linux/Gtk PIP window support. It's Chrome Toplevel window, always on top
629+
// and without any bar.
630+
uint32_t pipMask = nsIWebBrowserChrome::CHROME_ALWAYS_ON_TOP |
631+
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
632+
uint32_t barMask = nsIWebBrowserChrome::CHROME_MENUBAR |
633+
nsIWebBrowserChrome::CHROME_TOOLBAR |
634+
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
635+
nsIWebBrowserChrome::CHROME_STATUSBAR;
636+
if (widgetInitData.mWindowType == eWindowType_toplevel &&
637+
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
638+
widgetInitData.mPIPWindow = true;
639+
}
640+
#endif
641+
627642
#ifdef XP_MACOSX
628643
// Mac OS X sheet support
629644
// Adding CHROME_OPENAS_CHROME to sheetMask makes modal windows opened from

0 commit comments

Comments
 (0)