Bug 2064683 - Remove CHROME_WINDOW_CLOSE. r=dom-core-reviewers,win-reviewers,sfoster,gstoll,smaug

Nothing sets close=no / close=0, and GTK doesn't even deal with it.

Differential Revision: https://phabricator.services.mozilla.com/D319813
This commit is contained in:
Emilio Cobos Álvarez
2026-08-20 10:06:01 +00:00
committed by ealvarez@mozilla.com
parent 5f0e2f5771
commit 8288f74a11
11 changed files with 7 additions and 42 deletions
@@ -69,7 +69,6 @@ const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
const CHROME_FLAGS_MAP = [
[Ci.nsIWebBrowserChrome.CHROME_TITLEBAR, "titlebar"],
[Ci.nsIWebBrowserChrome.CHROME_WINDOW_CLOSE, "close"],
[Ci.nsIWebBrowserChrome.CHROME_TOOLBAR, "toolbar"],
[Ci.nsIWebBrowserChrome.CHROME_PERSONAL_TOOLBAR, "personalbar"],
[Ci.nsIWebBrowserChrome.CHROME_MENUBAR, "menubar"],
@@ -6,7 +6,7 @@ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const kTaskbarTabsWindowFeatures =
"titlebar,close,toolbar,location,personalbar=no,status,menubar=no,resizable,minimizable,scrollbars";
"titlebar,toolbar,location,personalbar=no,status,menubar=no,resizable,minimizable,scrollbars";
let lazy = {};
@@ -31,7 +31,8 @@ interface nsIWebBrowserChrome : nsISupports
// Bit 1 is free here.
const unsigned long CHROME_WINDOW_CLOSE = 1 << 2;
// Bit 2 is free here.
const unsigned long CHROME_WINDOW_RESIZE = 1 << 3;
// toolbar 'toolbar-menubar' accessible by pressing alt
@@ -56,7 +57,7 @@ interface nsIWebBrowserChrome : nsISupports
const unsigned long CHROME_NO_PERSISTENCE = 1 << 12;
const unsigned long CHROME_ALL =
CHROME_WINDOW_CLOSE | CHROME_WINDOW_RESIZE | CHROME_MENUBAR |
CHROME_WINDOW_RESIZE | CHROME_MENUBAR |
CHROME_TOOLBAR | CHROME_PERSONAL_TOOLBAR | CHROME_SCROLLBARS |
CHROME_TITLEBAR | CHROME_EXTRA;
@@ -114,8 +115,8 @@ interface nsIWebBrowserChrome : nsISupports
const unsigned long CHROME_OPENAS_CHROME = 1 << 31;
const unsigned long CHROME_MINIMAL_POPUP =
CHROME_WINDOW_CLOSE | CHROME_WINDOW_RESIZE | CHROME_WINDOW_MINIMIZE |
CHROME_SCROLLBARS | CHROME_TITLEBAR | CHROME_NO_PERSISTENCE;
CHROME_WINDOW_RESIZE | CHROME_WINDOW_MINIMIZE | CHROME_SCROLLBARS |
CHROME_TITLEBAR | CHROME_NO_PERSISTENCE;
const unsigned long CHROME_DOCUMENT_PICTURE_IN_PICTURE_FLAGS =
CHROME_MINIMAL_POPUP | CHROME_ALWAYS_ON_TOP | CHROME_DOCUMENT_PIP;
@@ -1949,9 +1949,6 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
if (aFeatures.GetBoolWithDefault("titlebar", false, &presenceFlag)) {
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
}
if (aFeatures.GetBoolWithDefault("close", false, &presenceFlag)) {
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
}
if (aFeatures.GetBoolWithDefault("toolbar", false, &presenceFlag)) {
chromeFlags |= nsIWebBrowserChrome::CHROME_TOOLBAR;
}
@@ -2017,10 +2014,6 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
if (!aFeatures.Exists("titlebar")) {
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
}
if (!aFeatures.Exists("close")) {
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
}
if (aDialog && !aFeatures.IsEmpty() && !presenceFlag) {
chromeFlags = nsIWebBrowserChrome::CHROME_DEFAULT;
}
@@ -65,10 +65,6 @@ const DISALLOWED = {
flag: Ci.nsIWebBrowserChrome.CHROME_TITLEBAR,
defaults_to: true,
},
close: {
flag: Ci.nsIWebBrowserChrome.CHROME_WINDOW_CLOSE,
defaults_to: true,
},
resizable: {
flag: Ci.nsIWebBrowserChrome.CHROME_WINDOW_RESIZE,
defaults_to: true,
@@ -86,7 +86,6 @@ const WINDOW_OPEN_FEATURES_PATTERNS = [
];
const WINDOW_CHROME_FLAGS = {
CHROME_WINDOW_CLOSE: true,
CHROME_WINDOW_RESIZE: true,
CHROME_SCROLLBARS: true,
CHROME_TITLEBAR: true,
@@ -97,7 +96,6 @@ const WINDOW_CHROME_FLAGS = {
};
const POPUP_CHROME_FLAGS = {
CHROME_WINDOW_CLOSE: true,
CHROME_WINDOW_RESIZE: true,
CHROME_SCROLLBARS: true,
CHROME_TITLEBAR: true,
-1
View File
@@ -58,7 +58,6 @@ enum class BorderStyle : int16_t {
// minimized separate from their parent
Maximize = 1 << 6, // enables the maxmize button so the user
// can maximize the window
Close = 1 << 7, // show the close button
Default = -1 // whatever the OS wants... i.e. don't do anything
};
+1 -11
View File
@@ -5057,10 +5057,7 @@ static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {
return NSWindowStyleMaskBorderless;
}
unsigned int mask = NSWindowStyleMaskTitled;
if (allOrDefault || aBorderStyle & BorderStyle::Close) {
mask |= NSWindowStyleMaskClosable;
}
unsigned int mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable;
if (allOrDefault || aBorderStyle & BorderStyle::Minimize) {
mask |= NSWindowStyleMaskMiniaturizable;
}
@@ -5089,13 +5086,6 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect,
case WindowType::Invisible:
break;
case WindowType::Popup:
if (aBorderStyle != BorderStyle::Default &&
mBorderStyle & BorderStyle::Title) {
features |= NSWindowStyleMaskTitled;
if (aBorderStyle & BorderStyle::Close) {
features |= NSWindowStyleMaskClosable;
}
}
break;
case WindowType::TopLevel:
case WindowType::Dialog:
-1
View File
@@ -5132,7 +5132,6 @@ gint nsWindow::ConvertBorderStyles(BorderStyle aStyle) {
return -1;
}
// note that we don't handle BorderStyle::Close yet
if (aStyle & BorderStyle::All) w |= GDK_DECOR_ALL;
if (aStyle & BorderStyle::Border) w |= GDK_DECOR_BORDER;
if (aStyle & BorderStyle::ResizeH) w |= GDK_DECOR_RESIZEH;
-7
View File
@@ -1410,13 +1410,6 @@ static DWORD WindowStylesRemovedForBorderStyle(BorderStyle aStyle) {
if (!(aStyle & BorderStyle::Title)) {
toRemove |= WS_DLGFRAME;
}
if (!(aStyle & (BorderStyle::Menu | BorderStyle::Close))) {
// Looks like getting rid of the system menu also does away with the close
// box. So, we only get rid of the system menu and the close box if you
// want neither. How does the Windows "Dialog" window class get just
// closebox and no sysmenu? Who knows.
toRemove |= WS_SYSMENU;
}
if (!(aStyle & BorderStyle::ResizeH)) {
toRemove |= WS_THICKFRAME;
}
-3
View File
@@ -546,9 +546,6 @@ nsresult nsAppShellService::JustCreateTopWindow(
if (aChromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR) {
widgetInitData.mBorderStyle |= BorderStyle::Title;
}
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE) {
widgetInitData.mBorderStyle |= BorderStyle::Close;
}
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
widgetInitData.mResizable = true;
widgetInitData.mBorderStyle |= BorderStyle::ResizeH;