wpt / css / css-contain / content-visibility / content-visibility-098.html

Status: FAIL | Duration: 10ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-contain/content-visibility/content-visibility-098.html

<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Content Visibility: auto subtree becomes hidden in the viewport</title>
<link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.org">
<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
<link rel="match" href="container-ref.html">
<meta name="assert" content="content-visibility:auto subtree becomes hidden (through both c-v and visibility properties) and so stops painting">
<script src="/common/reftest-wait.js"></script>

<style>
#container {
  width: 150px;
  height: 150px;
  background: lightblue;
}
#child {
  width: 50px;
  height: 50px;
  background: red;
}
#autocontainer { content-visibility: auto; }

</style>

<div id=container>
  <div id="autocontainer">
    Test fails if you see this text or a red box.
    <div id=child></div>
  </div>
</div>

<script>

function runTest() {
  document.getElementById("autocontainer").classList.remove("auto");
  document.getElementById("autocontainer").classList.add("hidden");
  document.getElementById("autocontainer").style.visibility = "hidden";

  requestAnimationFrame(takeScreenshot);
}

window.onload = requestAnimationFrame(() => {
  requestAnimationFrame(() => {
    requestAnimationFrame(() => {
      runTest();
    });
  });
});

</script>
</html>

/css/css-contain/content-visibility/container-ref.html

<!doctype HTML>
<html>
<meta charset="utf8">
<title>CSS Content Visibility: container (reference)</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">

<style>
#container {
  width: 150px;
  height: 150px;
  background: lightblue;
}
</style>

<div id=container></div>