tor-browser

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

transform-013.html (1489B)


      1 <!DOCTYPE html>
      2 <title>Animated anchor transform</title>
      3 <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
      4 <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#determining-position">
      5 <style>
      6  #anchor {
      7    anchor-name: --a;
      8    width: 200px;
      9    height: 200px;
     10    translate: 0;
     11    background: hotpink;
     12  }
     13  #anchored {
     14    position: absolute;
     15    position-anchor: --a;
     16    position-area: bottom right;
     17    width: 100%;
     18    height: 100%;
     19    background: cyan;
     20  }
     21  @keyframes anim {
     22    from { translate: 0; }
     23    to { translate: 100px; }
     24  }
     25 </style>
     26 <div style="contain:layout; width:300px; height:400px;">
     27  <div id="anchor"></div>
     28  <div id="anchored"></div>
     29 </div>
     30 
     31 <script src="/resources/testharness.js"></script>
     32 <script src="/resources/testharnessreport.js"></script>
     33 <script>
     34  const done = Promise.withResolvers();
     35  let got_halfway = false;
     36  const observer = new ResizeObserver((entries)=> {
     37    assert_equals(entries.length, 1);
     38    const inlineSize = entries[0].contentBoxSize[0].inlineSize;
     39    if (inlineSize > 30 && inlineSize < 70) {
     40      got_halfway = true;
     41      done.resolve();
     42    }
     43  });
     44  anchor.onanimationend = ()=> { done.reject(); }
     45 
     46  promise_test(async t => {
     47    anchor.style.animation = "3000ms linear anim";
     48    observer.observe(anchored);
     49    try { await done.promise; } catch(e) {}
     50    assert_true(got_halfway, "animation frame somewhere in the middle");
     51  }, "Animation being updated");
     52 </script>