helper_doubletap_zoom_scrolled_overflowhidden.html (2151B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=2100"/> 6 <title>Check that double tapping when the page is overflow hidden and has been scrolled down by js works</title> 7 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 8 <script type="application/javascript" src="apz_test_utils.js"></script> 9 <script src="/tests/SimpleTest/paint_listener.js"></script> 10 <script type="application/javascript"> 11 12 async function test() { 13 let useTouchpad = (location.search == "?touchpad"); 14 15 var resolution = await getResolution(); 16 ok(resolution > 0, 17 "The initial_resolution is " + resolution + ", which is some sane value"); 18 19 // instant scroll down 20 window.scrollTo({ 21 top: window.innerHeight * 2 - 50, 22 left: 0, 23 behavior: 'auto' 24 }); 25 26 await promiseApzFlushedRepaints(); 27 28 let scrollPos = window.scrollY; 29 ok(scrollPos > window.innerHeight + 100, "window scrolled down"); 30 31 info("window.scrollY " + window.scrollY); 32 33 info("window.innerHeight " + window.innerHeight); 34 35 info("document.documentElement.scrollHeight " + document.documentElement.scrollHeight); 36 37 let target = document.getElementById("target"); 38 39 // Check that double-tapping once zooms in 40 info("sending double tap"); 41 await doubleTapOn(target, 10, 10, useTouchpad); 42 var prev_resolution = resolution; 43 resolution = await getResolution(); 44 ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); 45 46 ok(window.scrollY > window.innerHeight + 100, "window is still scrolled down"); 47 ok(Math.abs(window.scrollY - scrollPos) < 2, "window didnt scroll"); 48 info("window.scrollY " + window.scrollY); 49 } 50 51 waitUntilApzStable() 52 .then(test) 53 .then(subtestDone, subtestFailed); 54 55 </script> 56 <style> 57 html, body { 58 overflow: hidden; 59 } 60 .spacer { 61 background-color: #eee; 62 63 height: 200vh; 64 } 65 .rect { 66 background-color: #aaa; 67 width: 100px; 68 height: 100px; 69 } 70 </style> 71 </head> 72 <body> 73 74 <div class="spacer"> 75 </div> 76 <div id="target" class="rect"> 77 </div> 78 <div class="spacer"> 79 </div> 80 81 </body> 82 </html>