tor-browser

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

opacity-zero-layout-and-visible.html (1023B)


      1 <!DOCTYPE html>
      2 <title>Layout Instability: opacity:0</title>
      3 <link rel="help" href="https://wicg.github.io/layout-instability/" />
      4 <div id="target" style="position: absolute; top: 0; width: 200px; height: 200px; opacity: 0; background: blue"></div>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="resources/util.js"></script>
      8 <script>
      9 
     10 promise_test(async () => {
     11  const watcher = new ScoreWatcher;
     12 
     13  // Wait for the initial render to complete.
     14  await waitForAnimationFrames(2);
     15 
     16  // Shift target, for which no shift should be reported because it's not visible.
     17  target.style.top = '200px';
     18  target.style.opacity = 0.9;
     19 
     20  await waitForAnimationFrames(2);
     21  assert_equals(watcher.score, 0);
     22 
     23  // Shift again, for which shift should be reported.
     24  target.style.top = '300px';
     25 
     26  await watcher.promise;
     27  const expectedScore = computeExpectedScore(200 * (200 + 100), 100);
     28  assert_equals(watcher.score, expectedScore);
     29 }, 'opacity:0');
     30 
     31 </script>