helper_minimum_scale_1_0.html (1399B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=200, minimum-scale=1.0, initial-scale=2.0"> 6 <title>Tests that the layout viewport is expanted to the minimum scale size (minimim-scale >= 1.0)</title> 7 <script type="application/javascript" src="apz_test_utils.js"></script> 8 <script src="/tests/SimpleTest/paint_listener.js"></script> 9 <style> 10 html,body { 11 overflow-x: hidden; 12 margin: 0; 13 } 14 div { 15 position: absolute; 16 } 17 </style> 18 </head> 19 <body> 20 <div style="width: 200%; height: 200%; background-color: green"></div> 21 <div style="width: 100%; height: 100%; background-color: blue"></div> 22 <script type="application/javascript"> 23 const utils = SpecialPowers.getDOMWindowUtils(window); 24 25 async function test() { 26 utils.scrollToVisual(100, 0, utils.UPDATE_TYPE_MAIN_THREAD, 27 utils.SCROLL_MODE_INSTANT); 28 29 const promiseForVisualViewportScroll = new Promise(resolve => { 30 window.visualViewport.addEventListener("scroll", () => { 31 resolve(); 32 }, { once: true }); 33 }); 34 35 await waitUntilApzStable(); 36 37 await promiseForVisualViewportScroll; 38 39 is(visualViewport.offsetLeft, 100, 40 "The visual viewport offset should be moved"); 41 } 42 43 waitUntilApzStable().then(test).then(subtestDone, subtestFailed); 44 </script> 45 </body> 46 </html>