Bug 1489214 - Set the position of the early blank window with the screenX/Y attributes rather than with the left/top features to avoid broken CSS <-> device pixel conversions in mixed DPI environments, r=mconley.

This commit is contained in:
Florian Quèze 2018-09-12 17:36:29 +02:00
Родитель 6612d2b316
Коммит 0ab0b6dae2
1 изменённых файлов: 4 добавлений и 11 удалений

Просмотреть файл

@ -319,12 +319,9 @@ let ACTORS = {
if (!width || !height)
return;
let screenX = getValue("screenX");
let screenY = getValue("screenY");
let browserWindowFeatures =
"chrome,all,dialog=no,extrachrome,menubar,resizable,scrollbars,status," +
"location,toolbar,personalbar," +
`left=${screenX},top=${screenY}`;
"location,toolbar,personalbar";
let win = Services.ww.openWindow(null, "about:blank", null,
browserWindowFeatures, null);
@ -333,15 +330,11 @@ let ACTORS = {
win.windowUtils.setChromeMargin(0, 2, 2, 2);
}
if (AppConstants.platform != "macosx") {
// On Windows/Linux the position is in device pixels rather than CSS pixels.
let scale = win.devicePixelRatio;
if (scale > 1)
win.moveTo(screenX / scale, screenY / scale);
}
let docElt = win.document.documentElement;
docElt.setAttribute("screenX", getValue("screenX"));
docElt.setAttribute("screenY", getValue("screenY"));
// The sizemode="maximized" attribute needs to be set before first paint.
let docElt = win.document.documentElement;
let sizemode = getValue("sizemode");
if (sizemode == "maximized") {
docElt.setAttribute("sizemode", sizemode);