browser_ImageDocument_svg_zoom.js (1139B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 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>`; 7 8 function test_once() { 9 return BrowserTestUtils.withNewTab(URL, async browser => { 10 return await SpecialPowers.spawn(browser, [], async function () { 11 const rect = content.document.documentElement.getBoundingClientRect(); 12 info( 13 `${rect.width}x${rect.height}, ${content.innerWidth}x${content.innerHeight}` 14 ); 15 is( 16 Math.round(rect.height), 17 content.innerHeight, 18 "Should fill the viewport and not overflow" 19 ); 20 }); 21 }); 22 } 23 24 add_task(async function test_with_no_text_zoom() { 25 await test_once(); 26 }); 27 28 add_task(async function test_with_text_zoom() { 29 let dpi = window.devicePixelRatio; 30 31 await SpecialPowers.pushPrefEnv({ set: [["ui.textScaleFactor", 200]] }); 32 Assert.greater( 33 window.devicePixelRatio, 34 dpi, 35 "DPI should change as a result of the pref flip" 36 ); 37 38 return test_once(); 39 });