tor-browser

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

custom-highlight-dynamic-font-metrics-001.html (1393B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>CSS Highlight API Test: </title>
      4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
      5 <link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling">
      6 <link rel="match" href="custom-highlight-font-metrics-001-ref.html">
      7 <meta name="assert" value="fonts relative units take the correct values, with correct cascade">
      8 <meta name="fuzzy" content="0-80;0-4">
      9 <head>
     10  <style>
     11    :root {
     12      font-size: 8px;
     13    }
     14    div {
     15      margin: 50px;
     16      font-size: 10px;
     17    }
     18    ::highlight(highlight1) {
     19      text-underline-offset: 0.5em;
     20      text-decoration-line: underline;
     21      text-decoration-color: green;
     22      text-decoration-thickness: 0.25rem;
     23    }
     24  </style>
     25 </head>
     26 <body>
     27  <div id="h1">Font relative units with 40px font</div>
     28  <div id="h2">Font relative units with 20px font</div>
     29  <script>
     30    let r1 = new Range();
     31    r1.setStart(h1, 0);
     32    r1.setEnd(h1, 1);
     33    let r2 = new Range();
     34    r2.setStart(h2, 0);
     35    r2.setEnd(h2, 1);
     36    CSS.highlights.set("highlight1", new Highlight(r1, r2));
     37    requestAnimationFrame(() => {
     38      requestAnimationFrame(() => {
     39        h1.style.fontSize = '40px';
     40        h2.style.fontSize = '20px';
     41        document.documentElement.style.fontSize = '16px';
     42        requestAnimationFrame(() => takeScreenshot());
     43      });
     44    });
     45  </script>
     46 </body>
     47 </html>