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
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
ba997ad41b
commit
7fb2bbfc89
@@ -2436,21 +2436,13 @@ void AppWindow::SizeShell() {
|
||||
specHeight += windowDiff.height;
|
||||
}
|
||||
|
||||
bool positionSet = !mIgnoreXULPosition;
|
||||
nsCOMPtr<nsIAppWindow> 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);
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=2070008
|
||||
-->
|
||||
<window title="Mozilla Bug 2070008"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2070008">Mozilla Bug 2070008</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
add_task(async function test_independent_window_respects_xul_position() {
|
||||
const kX = 132;
|
||||
const kY = 97;
|
||||
|
||||
let win = Services.ww.openWindow(
|
||||
null,
|
||||
"window_bug2070008.xhtml",
|
||||
null,
|
||||
"chrome,dialog=no,resizable",
|
||||
null
|
||||
);
|
||||
|
||||
await new Promise(resolve => {
|
||||
win.addEventListener("load", resolve, { once: true });
|
||||
});
|
||||
|
||||
// The screenX/Y attributes are in desktop pixels, but window.screenX/Y are
|
||||
// in CSS pixels.
|
||||
let cssToDesktopScale = win.devicePixelRatio / win.desktopToDeviceScale;
|
||||
|
||||
is(Math.round(win.screenX * cssToDesktopScale), kX,
|
||||
"Independent window should respect the requested screenX");
|
||||
is(Math.round(win.screenY * cssToDesktopScale), kY,
|
||||
"Independent window should respect the requested screenY");
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
windowtype="test:bug2070008-window-position"
|
||||
title="Bug 2070008 window position test"
|
||||
screenX="132"
|
||||
screenY="97"
|
||||
width="200"
|
||||
height="200">
|
||||
</window>
|
||||
Reference in New Issue
Block a user