tor-browser

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

translate-change.html (1150B)


      1 <!DOCTYPE html>
      2 <title>Layout Instability: no layout shift for change of individual transform property</title>
      3 <link rel="help" href="https://wicg.github.io/layout-instability/" />
      4 <style>
      5 body { margin: 0; }
      6 #transformed { position: relative; translate: 20px 0; width: 100px; height: 100px; background: blue; }
      7 #child { width: 400px; height: 400px; }
      8 </style>
      9 <div id="transformed">
     10  <div id="child"></div>
     11 </div>
     12 <script src="/resources/testharness.js"></script>
     13 <script src="/resources/testharnessreport.js"></script>
     14 <script src="resources/util.js"></script>
     15 <script>
     16 
     17 promise_test(async () => {
     18  const watcher = new ScoreWatcher;
     19 
     20  // Wait for the initial render to complete.
     21  await waitForAnimationFrames(2);
     22 
     23  // Modify the transform, for which no shift should be reported.
     24  document.querySelector("#transformed").style = "translate: 0 100px";
     25  // Change size of child, for which no shift should be reported, either.
     26  document.querySelector("#child").style = "width: 300px";
     27 
     28  await waitForAnimationFrames(2);
     29  // No shift should be reported.
     30  assert_equals(watcher.score, 0);
     31 }, 'no layout shift for transform change');
     32 
     33 </script>