helper_bug1326290.html (2017B)
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>Dragging the mouse on a inactive scrollframe's scrollbar</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 <style> 11 #scrollable { 12 overflow: scroll; 13 height: 200px; 14 width: 200px; 15 } 16 .content { 17 width: 1000px; 18 height: 2000px; 19 } 20 </style> 21 <script type="text/javascript"> 22 23 async function test() { 24 var scrollableDiv = document.getElementById("scrollable"); 25 let scrollPromise = new Promise(resolve => { 26 scrollableDiv.addEventListener("scroll", resolve, {once: true}); 27 }); 28 29 var dragFinisher = await promiseVerticalScrollbarDrag(scrollableDiv); 30 if (!dragFinisher) { 31 ok(true, "No scrollbar, can't do this test"); 32 return; 33 } 34 35 // the events above might be stuck in APZ input queue for a bit until the 36 // layer is activated, so we wait here until the scroll event listener is 37 // triggered. 38 await scrollPromise; 39 40 await dragFinisher(); 41 42 // Flush everything just to be safe 43 await promiseOnlyApzControllerFlushed(); 44 45 // After dragging the scrollbar 20px on a 200px-high scrollable div, we should 46 // have scrolled approx 10% of the 2000px high content. There might have been 47 // scroll arrows and such so let's just have a minimum bound of 50px to be safe. 48 ok(scrollableDiv.scrollTop > 50, "Scrollbar drag resulted in a scroll position of " + scrollableDiv.scrollTop); 49 } 50 51 waitUntilApzStable() 52 .then(test) 53 .then(subtestDone, subtestFailed); 54 55 </script> 56 </head> 57 <body> 58 <div id="scrollable"> 59 <div class="content">Some content inside the inactive scrollframe</div> 60 </div> 61 <div class="content">Some content to ensure the root scrollframe is scrollable and the overflow:scroll div remains inactive</div> 62 </body> 63 </html>