helper_iframe_pan.html (1767B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width; initial-scale=1.0"> 6 <title>Sanity panning test for scrollable div</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 var outer = document.getElementById("outer"); 14 var transformEndPromise = promiseTransformEnd(); 15 16 await synthesizeNativeTouchDrag(outer.contentDocument.body, 10, 100, 0, -50); 17 dump("Finished native drag, waiting for transform-end observer...\n"); 18 19 await transformEndPromise; 20 21 dump("Transform complete; flushing repaints...\n"); 22 await promiseOnlyApzControllerFlushed(outer.contentWindow); 23 24 var outerScroll = outer.contentWindow.scrollY; 25 if (getPlatform() == "windows") { 26 // On windows, because we run this test with native event synthesization, 27 // Windows can end up eating the first touchmove which can result in the 28 // scroll amount being slightly smaller than 50px. See bug 1388955. 29 dump("iframe scrolled " + outerScroll + "px"); 30 ok(outerScroll > 45, "iframe scrolled at least 45 px"); 31 ok(outerScroll <= 50, "iframe scrolled at most 50 px"); 32 } else { 33 is(outerScroll, 50, "check that the iframe scrolled"); 34 } 35 } 36 37 waitUntilApzStable() 38 .then(test) 39 .then(subtestDone); 40 41 </script> 42 </head> 43 <body> 44 <iframe id="outer" style="height: 250px; border: solid 1px black" srcdoc="<body style='height:5000px'>"></iframe> 45 <div style="height: 5000px; background-color: lightgreen;"> 46 This div makes the top-level page scrollable. 47 </div> 48 </body> 49 </html>