OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/run-after-layout-and-paint.js"></script> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <style> |
| 6 body { height: 1000px } |
| 7 div { height: 100px } |
| 8 </style> |
| 9 <div id="block1">abc</div> |
| 10 <div id="block2">def</div> |
| 11 <script> |
| 12 // This test verifies that reading window.scrollY forces any pending scroll |
| 13 // anchoring adjustment to occur before computing the return value. |
| 14 async_test((t) => { |
| 15 scrollTo(0, 150); |
| 16 runAfterLayoutAndPaint(() => { |
| 17 // Queue scroll anchoring adjustment. |
| 18 document.querySelector("#block1").style.height = "200px"; |
| 19 |
| 20 // Reading scrollY should force both the layout and the adjustment to |
| 21 // occur synchronously. |
| 22 var y = scrollY; |
| 23 |
| 24 assert_equals(y, 250); |
| 25 t.done(); |
| 26 }); |
| 27 }, 'Reading scroll position forces scroll anchoring adjustment.'); |
| 28 </script> |
OLD | NEW |