helper_scrollby_bug1531796.html (961B)
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>Test that scrollBy() doesn't scroll more than it should</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 const maxSteps = 20; 14 let scrollPerStep = 40; 15 for (let step = 0; step < maxSteps; step++) { 16 window.scrollBy(0, scrollPerStep); 17 await promiseFrame(); 18 } 19 is(window.scrollY, maxSteps * scrollPerStep, "Scrolled by the expected amount"); 20 } 21 22 waitUntilApzStable() 23 .then(test) 24 .then(subtestDone, subtestFailed); 25 26 </script> 27 <style> 28 body { 29 height: 5000px; 30 background: linear-gradient(red, black); 31 } 32 </style> 33 </head> 34 <body> 35 </body> 36 </html>