diff options
Diffstat (limited to '')
-rw-r--r-- | dom/base/test/meta_viewport/viewport_helpers.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dom/base/test/meta_viewport/viewport_helpers.js b/dom/base/test/meta_viewport/viewport_helpers.js new file mode 100644 index 0000000000..d4d346b5d0 --- /dev/null +++ b/dom/base/test/meta_viewport/viewport_helpers.js @@ -0,0 +1,44 @@ +function scaleRatio(scale) { + return { + set: [ + ["layout.css.devPixelsPerPx", "" + scale], + ["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); +} |