Bug 1823350 - Unify how we identify PiP windows on Linux/Windows. r=mconley,stransky

Also explicitly use titlebar=no on the PIP window, since we really don't
want a titlebar.

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

Differential Revision: https://phabricator.services.mozilla.com/D172992
This commit is contained in:
Emilio Cobos Álvarez 2023-03-21 14:36:19 +00:00
parent b8a3f6aaf8
commit 6eec2e9f70
2 changed files with 5 additions and 21 deletions

View File

@ -18,12 +18,8 @@ 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,titlebar=no,alwaysontop,lockaspectratio,resizable,dialog";
const WINDOW_TYPE = "Toolkit:PictureInPicture";
const PIP_ENABLED_PREF = "media.videocontrols.picture-in-picture.enabled";
const TOGGLE_ENABLED_PREF =

View File

@ -579,8 +579,8 @@ 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 |
@ -588,19 +588,7 @@ nsresult nsAppShellService::JustCreateTopWindow(
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)) {