content-visibility-045.html (1209B)
1 <!doctype HTML> 2 <html class="reftest-wait"> 3 <meta charset="utf8"> 4 <title>Content Visibility: auto subtree becomes hidden in the viewport</title> 5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 7 <link rel="match" href="container-ref.html"> 8 <meta name="assert" content="content-visibility:auto subtree becomes hidden and so stops painting"> 9 <script src="/common/reftest-wait.js"></script> 10 11 <style> 12 #container { 13 width: 150px; 14 height: 150px; 15 background: lightblue; 16 } 17 #child { 18 width: 50px; 19 height: 50px; 20 background: red; 21 } 22 .auto { content-visibility: auto; } 23 .hidden { content-visibility: hidden; } 24 25 </style> 26 27 <div id=container class=auto> 28 Test fails if you see this text or a red box. 29 <div id=child></div> 30 </div> 31 32 <script> 33 34 function runTest() { 35 document.getElementById("container").classList.remove("auto"); 36 document.getElementById("container").classList.add("hidden"); 37 38 requestAnimationFrame(takeScreenshot); 39 } 40 41 window.onload = requestAnimationFrame(() => { 42 requestAnimationFrame(() => { 43 requestAnimationFrame(() => { 44 runTest(); 45 }); 46 }); 47 }); 48 49 </script> 50 </html>