From 7fb2bbfc8936daa710d438b2420cb3fd262861db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 8 Sep 2026 10:48:27 +0000 Subject: [PATCH] Bug 2070008 - Don't ignore XUL window position on GTK. r=stransky This ifdef has been there basically since forever (bug 49802). But session-restore will just call moveTo anyways as appropriate, and we haven't seen major issues with that, so we should probably be fine. Differential Revision: https://phabricator.services.mozilla.com/D324127 --- xpfe/appshell/AppWindow.cpp | 20 ++----- xpfe/appshell/test/chrome.toml | 4 ++ ...g2070008_independent_window_position.xhtml | 56 +++++++++++++++++++ xpfe/appshell/test/window_bug2070008.xhtml | 9 +++ 4 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 xpfe/appshell/test/test_bug2070008_independent_window_position.xhtml create mode 100644 xpfe/appshell/test/window_bug2070008.xhtml diff --git a/xpfe/appshell/AppWindow.cpp b/xpfe/appshell/AppWindow.cpp index 19a1440a5fdb..ff293fde9f5a 100644 --- a/xpfe/appshell/AppWindow.cpp +++ b/xpfe/appshell/AppWindow.cpp @@ -2436,21 +2436,13 @@ void AppWindow::SizeShell() { specHeight += windowDiff.height; } - bool positionSet = !mIgnoreXULPosition; nsCOMPtr parentWindow(do_QueryReferent(mParentWindow)); -#if defined(XP_UNIX) && !defined(XP_MACOSX) - // don't override WM placement on unix for independent, top-level windows - // (however, we think the benefits of intelligent dependent window placement - // trump that override.) - if (!parentWindow) positionSet = false; -#endif - if (positionSet) { - // We have to do this before sizing the window, because sizing depends - // on the resolution of the screen we're on. But positioning needs to - // know the size so that it can constrain to screen bounds.... as an - // initial guess here, we'll use the specified size (if any). - positionSet = LoadPositionFromXUL(specWidth, specHeight); - } + // We have to do this before sizing the window, because sizing depends + // on the resolution of the screen we're on. But positioning needs to + // know the size so that it can constrain to screen bounds.... as an + // initial guess here, we'll use the specified size (if any). + bool positionSet = + !mIgnoreXULPosition && LoadPositionFromXUL(specWidth, specHeight); if (gotSize) { SetSpecifiedSize(specWidth, specHeight); diff --git a/xpfe/appshell/test/chrome.toml b/xpfe/appshell/test/chrome.toml index 79403a7a4500..62b199ffef52 100644 --- a/xpfe/appshell/test/chrome.toml +++ b/xpfe/appshell/test/chrome.toml @@ -1,3 +1,7 @@ [DEFAULT] +["test_bug2070008_independent_window_position.xhtml"] +skip-if = ["os == 'linux' && display == 'wayland'"] # Wayland compositors place toplevels themselves. +support-files = ["window_bug2070008.xhtml"] + ["test_windowlessBrowser.xhtml"] diff --git a/xpfe/appshell/test/test_bug2070008_independent_window_position.xhtml b/xpfe/appshell/test/test_bug2070008_independent_window_position.xhtml new file mode 100644 index 000000000000..2585cdd1d0f2 --- /dev/null +++ b/xpfe/appshell/test/test_bug2070008_independent_window_position.xhtml @@ -0,0 +1,56 @@ + + + + + + + + + diff --git a/xpfe/appshell/test/window_bug2070008.xhtml b/xpfe/appshell/test/window_bug2070008.xhtml new file mode 100644 index 000000000000..f04bcc269fd6 --- /dev/null +++ b/xpfe/appshell/test/window_bug2070008.xhtml @@ -0,0 +1,9 @@ + + +