helper_position_fixed_scroll_handoff-1.html (2019B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>APZ overscroll handoff for fixed elements</title> 5 <script type="application/javascript" src="apz_test_utils.js"></script> 6 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 7 <script src="/tests/SimpleTest/paint_listener.js"></script> 8 <meta name="viewport" content="width=device-width"/> 9 <style> 10 html, body { 11 height: 100%; 12 overflow: hidden; 13 } 14 15 #main { 16 height: 100%; 17 overflow: auto; 18 } 19 20 #spacer { 21 height: 5000px; 22 } 23 24 #fixed { 25 position: fixed; 26 top: 50%; 27 left: 0; 28 width: 100%; 29 height: 100px; 30 background: red; 31 overflow: auto; 32 } 33 34 #long { 35 height: 250px; 36 width: 50%; 37 position: absolute; 38 background: green; 39 top: 0; 40 left: 25%; 41 } 42 </style> 43 </head> 44 <body> 45 <div id="main"> 46 <div id="spacer"> 47 </div> 48 <div id="fixed"> 49 <div id="long"> 50 </div> 51 </div> 52 </div> 53 </body> 54 <script type="application/javascript"> 55 56 async function test() { 57 // Scroll to the bottom of the fixed position element that should not 58 // allow overscroll handoff. 59 fixed.scrollTop = fixed.scrollHeight; 60 61 // After scrolling to bottom tick the refresh driver. 62 await promiseFrame(); 63 64 info("Start: fixed=" + fixed.scrollTop + " main=" + main.scrollTop); 65 66 // Async scroll the fixed element by 200 pixels using the mouse-wheel. 67 // This should not handoff the overscroll. 68 await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200); 69 70 // Make sure scrolling that has happened is propagated to the main thread. 71 await promiseApzFlushedRepaints(); 72 73 // Try another gesture to ensure the overscroll handoff runs. 74 await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200); 75 await promiseApzFlushedRepaints(); 76 77 info("After scroll: fixed=" + fixed.scrollTop + " main=" + main.scrollTop); 78 79 // Ensure that the main element has not scrolled. 80 is(main.scrollTop, 0, "The overscroll should not handoff"); 81 } 82 83 waitUntilApzStable() 84 .then(test) 85 .then(subtestDone, subtestFailed); 86 87 </script> 88 </html>