tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

content-visibility-animation-becomes-visible.html (1531B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <title>Test that making a content-visibility: hidden subtree visible restarts animations in it</title>
      4 <link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.com">
      5 <link rel="help" href="https://drafts.csswg.org/css-contain-2/">
      6 <link rel="match" href="content-visibility-animation-becomes-visible-ref.html">
      7 <meta name="assert" content="animations in content-visibility: hidden subtree should restart once visible">
      8 
      9 <script src="/common/reftest-wait.js"></script>
     10 
     11 <style>
     12 #container {
     13  content-visibility: hidden;
     14 }
     15 @keyframes fade {
     16  from { opacity: 0; transform: none; }
     17  to { opacity: 1; transform: translate(100px); }
     18 }
     19 #target {
     20  background: green;
     21  height: 100px;
     22  width: 100px;
     23 }
     24 .animate {
     25  animation: fade 1s linear 1 alternate;
     26  animation-fill-mode: forwards;
     27 }
     28 </style>
     29 <body>
     30  <div id="container"></div>
     31 </body>
     32 
     33 <script>
     34 function createAnimatingElement(name) {
     35  const container = document.getElementById('container');
     36  const target = document.createElement('div');
     37  container.appendChild(target);
     38  target.id = 'target';
     39  target.className = name;
     40  return target;
     41 }
     42 
     43 function runTest() {
     44  const container = document.getElementById('container');
     45  const target = createAnimatingElement('animate');
     46  container.style.contentVisibility = "visible";
     47  const listener = (e) => {
     48    takeScreenshot();
     49  };
     50 
     51  target.addEventListener("animationend", listener);
     52 }
     53 window.onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
     54 </script>