helper_no_scalable_with_initial_scale.html (1546B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, minimum-scale=0.25, initial-scale=0.5, user-scalable=no"> 6 <title>Tests that the layout viewport is not expanted to the minimum scale size if user-scalable=no is specified</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: hidden; 12 margin: 0; 13 } 14 div { 15 position: absolute; 16 } 17 </style> 18 </head> 19 <body> 20 <div style="width: 400%; height: 400%; background: red;"></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 let receivedScrollEvent = false; 30 window.visualViewport.addEventListener("scroll", () => { 31 receivedScrollEvent = true; 32 }, { once: true }); 33 34 await waitUntilApzStable(); 35 36 // Waits two frames to get a chance to deliver scroll events. 37 await promiseFrame(); 38 await promiseFrame(); 39 40 ok(!receivedScrollEvent, "Scroll should never happen"); 41 is(visualViewport.offsetLeft, 0, 42 "The visual viewport offset should not be moved"); 43 } 44 45 waitUntilApzStable().then(test).then(subtestDone, subtestFailed); 46 </script> 47 </body> 48 </html>