tor-browser

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

inline-flow-shift-vertical-rl.html (1602B)


      1 <!DOCTYPE html>
      2 <title>Layout Instability: vertical-rl inline/text movement is detected</title>
      3 <link rel="help" href="https://wicg.github.io/layout-instability/" />
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="resources/util.js"></script>
      7 <body style="writing-mode: vertical-rl">
      8 <div style="height: 200px; font-size: 20px; line-height: 25px">
      9  1AAAAAAA<br>
     10  2AAAAAAA<br>
     11  3AAAAAAA<br>
     12  <div id="inline-block" style="display: inline-block; width: 50px">4AAAAAAA</div><br>
     13  5AAAAAAA<br>
     14  6AAAAAAA<br>
     15  7AAAAAAA<br>
     16 </div>
     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  const inline_block = document.querySelector("#inline-block");
     27  inline_block.style.width = '100px';
     28 
     29  // The lines below the inline-block are shifted down by 50px.
     30  // The implementation may measure the real width of the shifted text
     31  // or use the available width (i.e. width of the containing block).
     32  // Also tolerate extra 10% error.
     33  const text_width = inline_block.offsetWidth;
     34  const expectedScoreMin = computeExpectedScore(text_width * (20 * 3 + 50), 50) * 0.9;
     35  const expectedScoreMax = computeExpectedScore(200 * (25 * 3 + 50), 50) * 1.1;
     36 
     37  // Observer fires after the frame is painted.
     38  assert_equals(watcher.score, 0);
     39  await watcher.promise;
     40  assert_between_exclusive(watcher.score, expectedScoreMin, expectedScoreMax);
     41 }, 'Vertical-rl inline flow movement.');
     42 
     43 </script>
     44 </body>