mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
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:
parent
6612d2b316
commit
0ab0b6dae2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user