summaryrefslogtreecommitdiffstats
path: root/dom/base/test/viewport_helpers.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/base/test/viewport_helpers.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dom/base/test/viewport_helpers.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/dom/base/test/viewport_helpers.js b/dom/base/test/viewport_helpers.js
new file mode 100644
index 0000000000..a89b4f16dc
--- /dev/null
+++ b/dom/base/test/viewport_helpers.js
@@ -0,0 +1,45 @@
+function scaleRatio(scale) {
+ return {
+ set: [
+ ["layout.css.devPixelsPerPx", "" + scale],
+ ["apz.allow_zooming", true],
+ ["dom.meta-viewport.enabled", true],
+ ],
+ };
+}
+
+function getViewportInfo(aDisplayWidth, aDisplayHeight) {
+ let defaultZoom = {},
+ allowZoom = {},
+ minZoom = {},
+ maxZoom = {},
+ width = {},
+ height = {},
+ autoSize = {};
+
+ let cwu = SpecialPowers.getDOMWindowUtils(window);
+ cwu.getViewportInfo(
+ aDisplayWidth,
+ aDisplayHeight,
+ defaultZoom,
+ allowZoom,
+ minZoom,
+ maxZoom,
+ width,
+ height,
+ autoSize
+ );
+ return {
+ defaultZoom: defaultZoom.value,
+ minZoom: minZoom.value,
+ maxZoom: maxZoom.value,
+ width: width.value,
+ height: height.value,
+ autoSize: autoSize.value,
+ allowZoom: allowZoom.value,
+ };
+}
+
+function fuzzeq(a, b, msg) {
+ ok(Math.abs(a - b) < 1e-6, msg);
+}