fune/dom/html/test/browser_ImageDocument_svg_zoom.js
Emilio Cobos Álvarez 5b3d95fe9f Bug 1889244 - Truncate rather than round inner sizes. r=dholbert
This should allow us to work on bug 1647356 and co again, and prevents
undesired scrollbars like those from bug 1648265. It should also be more
compatible (seems like my comment in
https://github.com/w3c/csswg-drafts/issues/5260 still holds).

Differential Revision: https://phabricator.services.mozilla.com/D206434
2024-04-03 10:42:54 +00:00

39 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const URL = `data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="green"/></svg>`;
function test_once() {
return BrowserTestUtils.withNewTab(URL, async browser => {
return await SpecialPowers.spawn(browser, [], async function () {
const rect = content.document.documentElement.getBoundingClientRect();
info(
`${rect.width}x${rect.height}, ${content.innerWidth}x${content.innerHeight}`
);
is(
Math.trunc(rect.height),
content.innerHeight,
"Should fill the viewport and not overflow"
);
});
});
}
add_task(async function test_with_no_text_zoom() {
await test_once();
});
add_task(async function test_with_text_zoom() {
let dpi = window.devicePixelRatio;
await SpecialPowers.pushPrefEnv({ set: [["ui.textScaleFactor", 200]] });
Assert.greater(
window.devicePixelRatio,
dpi,
"DPI should change as a result of the pref flip"
);
return test_once();
});