multi-clip-visual-rect.html (1200B)
1 <!DOCTYPE html> 2 <title>Layout Instability: multi clip visual rect</title> 3 <link rel="help" href="https://wicg.github.io/layout-instability/" /> 4 <style> 5 6 body { margin: 0; } 7 #outer { width: 200px; height: 600px; overflow: hidden; } 8 #inner { width: 300px; height: 150px; overflow: hidden; } 9 #j { position: relative; width: 300px; height: 600px; background: blue; } 10 11 </style> 12 <div id='outer'><div id='inner'><div id='j'></div></div></div> 13 <script src="/resources/testharness.js"></script> 14 <script src="/resources/testharnessreport.js"></script> 15 <script src="resources/util.js"></script> 16 <script> 17 18 promise_test(async () => { 19 const watcher = new ScoreWatcher; 20 21 // Wait for the initial render to complete. 22 await waitForAnimationFrames(2); 23 24 document.querySelector("#j").style.top = "-200px"; 25 26 // Note that, while the element moves up 200px, its visibility is 27 // clipped at 0px,150px height, so the additional 200px of vertical 28 // move distance is not included in the score. 29 // (clip width 200) * (clip height 150) 30 const expectedScore = computeExpectedScore(200 * 150, 200); 31 32 await watcher.promise; 33 assert_equals(watcher.score, expectedScore); 34 }, "Multi clip visual rect."); 35 36 </script>