viewport_helpers.js (928B)
1 function scaleRatio(scale) { 2 return { 3 set: [ 4 ["layout.css.devPixelsPerPx", "" + scale], 5 ["dom.meta-viewport.enabled", true], 6 ], 7 }; 8 } 9 10 function getViewportInfo(aDisplayWidth, aDisplayHeight) { 11 let defaultZoom = {}, 12 allowZoom = {}, 13 minZoom = {}, 14 maxZoom = {}, 15 width = {}, 16 height = {}, 17 autoSize = {}; 18 19 let cwu = SpecialPowers.getDOMWindowUtils(window); 20 cwu.getViewportInfo( 21 aDisplayWidth, 22 aDisplayHeight, 23 defaultZoom, 24 allowZoom, 25 minZoom, 26 maxZoom, 27 width, 28 height, 29 autoSize 30 ); 31 return { 32 defaultZoom: defaultZoom.value, 33 minZoom: minZoom.value, 34 maxZoom: maxZoom.value, 35 width: width.value, 36 height: height.value, 37 autoSize: autoSize.value, 38 allowZoom: allowZoom.value, 39 }; 40 } 41 42 function fuzzeq(a, b, msg) { 43 // eslint-disable-next-line mozilla/no-comparison-or-assignment-inside-ok 44 ok(Math.abs(a - b) < 1e-6, msg); 45 }