clip-negative-bottom-margin.html (1020B)
1 <!DOCTYPE html> 2 <title>Layout Instability: clip with negative bottom margin</title> 3 <link rel="help" href="https://wicg.github.io/layout-instability/" /> 4 <style> 5 6 #scroller { overflow: scroll; width: 200px; height: 500px; } 7 #space { height: 1000px; margin-bottom: -500px; } 8 #j { width: 150px; height: 150px; background: yellow; } 9 10 </style> 11 <div id='scroller'> 12 <div id='space'></div> 13 <div id='j'></div> 14 </div> 15 <script src="/resources/testharness.js"></script> 16 <script src="/resources/testharnessreport.js"></script> 17 <script src="resources/util.js"></script> 18 <script> 19 20 promise_test(async () => { 21 const watcher = new ScoreWatcher; 22 23 // Wait for the initial render to complete. 24 await waitForAnimationFrames(2); 25 26 // Increase j's top margin by 100px. Since j is fully clipped by the scroller, 27 // this should not generate a shift. 28 document.querySelector("#j").style.marginTop = "100px"; 29 30 await waitForAnimationFrames(3); 31 assert_equals(watcher.score, 0); 32 }, "Clip with negative bottom margin."); 33 34 </script>