Skip to content

Commit

Permalink
Bug 1823350 - Unify how we identify PiP windows on Linux/Windows. r=m…
Browse files Browse the repository at this point in the history
…conley,stransky

This way we don't end up without titlebars in other alwaysontop windows.

Differential Revision: https://phabricator.services.mozilla.com/D172992
  • Loading branch information
emilio committed Mar 20, 2023
1 parent 82623a7 commit 2838780
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
7 changes: 1 addition & 6 deletions toolkit/components/pictureinpicture/PictureInPicture.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
import { Rect, Point } from "resource://gre/modules/Geometry.sys.mjs";

const PLAYER_URI = "chrome://global/content/pictureinpicture/player.xhtml";
var PLAYER_FEATURES =
"chrome,titlebar=yes,alwaysontop,lockaspectratio,resizable";
/* Don't use dialog on Gtk as it adds extra border and titlebar to PIP window */
if (!AppConstants.MOZ_WIDGET_GTK) {
PLAYER_FEATURES += ",dialog";
}
const PLAYER_FEATURES = "chrome,alwaysontop,lockaspectratio,resizable,dialog";
const WINDOW_TYPE = "Toolkit:PictureInPicture";
const PIP_ENABLED_PREF = "media.videocontrols.picture-in-picture.enabled";
const TOGGLE_ENABLED_PREF =
Expand Down
18 changes: 3 additions & 15 deletions xpfe/appshell/nsAppShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,28 +579,16 @@ nsresult nsAppShellService::JustCreateTopWindow(
if (aChromeMask & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW)
widgetInitData.mHasRemoteContent = true;

#ifdef MOZ_WIDGET_GTK
// Linux/Gtk PIP window support. It's Chrome Toplevel window, always on top
#if defined(MOZ_WIDGET_GTK) || defined(XP_WIN)
// Windows/Gtk PIP window support. It's Chrome dialog window, always on top
// and without any bar.
uint32_t pipMask = nsIWebBrowserChrome::CHROME_ALWAYS_ON_TOP |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME |
nsIWebBrowserChrome::CHROME_WINDOW_RESIZE;
uint32_t barMask = nsIWebBrowserChrome::CHROME_MENUBAR |
nsIWebBrowserChrome::CHROME_TOOLBAR |
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
nsIWebBrowserChrome::CHROME_STATUSBAR;
if (widgetInitData.mWindowType == widget::WindowType::TopLevel &&
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
widgetInitData.mPIPWindow = true;
}
#elif defined(XP_WIN)
// Windows PIP window support. It's Chrome dialog window, always on top
// and without any bar.
uint32_t pipMask = nsIWebBrowserChrome::CHROME_ALWAYS_ON_TOP |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
uint32_t barMask = nsIWebBrowserChrome::CHROME_MENUBAR |
nsIWebBrowserChrome::CHROME_TOOLBAR |
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
nsIWebBrowserChrome::CHROME_TITLEBAR |
nsIWebBrowserChrome::CHROME_STATUSBAR;
if (widgetInitData.mWindowType == widget::WindowType::Dialog &&
((aChromeMask & pipMask) == pipMask) && !(aChromeMask & barMask)) {
Expand Down

0 comments on commit 2838780

Please sign in to comment.