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