content-visibility-with-top-layer-006.html (1615B)
1 <!doctype html> 2 <meta charset="utf8"> 3 <title>CSS Content Visibility: offscreen c-v auto content is relevant when in top layer</title> 4 <link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 6 <meta name="assert" content="offscreen c-v auto content is relevant when in top layer"> 7 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/common/rendering-utils.js"></script> 11 12 <style> 13 #inner { 14 content-visibility: auto; 15 contain-intrinsic-size: 100px 100px; 16 } 17 </style> 18 19 <dialog id="dialog"> 20 <div id="spacer" style="height: 100000px;"></div> 21 <div id="inner"> 22 <div style="height: 200px; width: 200px;">content</div> 23 </div> 24 </dialog> 25 26 <script> 27 promise_test(async () => { 28 dialog.show(); 29 // It takes at least one frame to determine the proximity to the viewport. 30 await waitForAtLeastOneFrame(); 31 assert_equals(inner.getBoundingClientRect().height, 100); 32 33 dialog.close(); 34 dialog.showModal(); 35 36 // Even though the element with `content-visibility: auto` has an ancestor 37 // in the top layer, this element is not in the top layer list (although 38 // it's in the top layer stacking context). This means it should not be 39 // relevant to the user, because it is nevertheless not onscreen. 40 // It takes at least one frame to determine the proximity to the viewport. 41 await waitForAtLeastOneFrame(); 42 assert_equals(inner.getBoundingClientRect().height, 100); 43 dialog.close(); 44 }); 45 </script>