tor-browser

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

transform.html (1100B)


      1 <!DOCTYPE html>
      2 <title>Layout Instability: shift inside a transformed container</title>
      3 <link rel="help" href="https://wicg.github.io/layout-instability/" />
      4 <style>
      5 
      6 body { margin: 0; }
      7 #container { transform: translateX(-300px) translateY(-40px); }
      8 #shifter { position: relative; width: 600px; height: 140px; background: blue; }
      9 
     10 </style>
     11 <div id="container">
     12  <div id="shifter"></div>
     13 </div>
     14 <script src="/resources/testharness.js"></script>
     15 <script src="/resources/testharnessreport.js"></script>
     16 <script src="resources/util.js"></script>
     17 <script>
     18 
     19 promise_test(async () => {
     20  const watcher = new ScoreWatcher;
     21 
     22  // Wait for the initial render to complete.
     23  await waitForAnimationFrames(2);
     24 
     25  // Modify the position of the div.
     26  document.querySelector("#shifter").style = "top: 60px";
     27 
     28  // The shifter has size 600 x 140, but the container's transform
     29  // reduces its viewport overlap.
     30  const expectedScore = computeExpectedScore(
     31      (600 - 300) * (140 - 40 + 60), 60);
     32 
     33  await watcher.promise;
     34  assert_equals(watcher.score, expectedScore);
     35 }, 'Transformed container.');
     36 
     37 </script>