tor-browser

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

canvas.2d.offscreen.transferred.lang.inherit.html (1742B)


      1 <!doctype HTML>
      2 <html lang="en-US" class="reftest-wait">
      3  <meta charset="utf-8">
      4  <title>HTML5 Canvas Test: The lang attribute inherits from the canvas in a transferred offscreen</title>
      5  <link rel="match" href="canvas.2d.offscreen.lang-ref.html" />
      6  <link rel="author" href="mailto:schenney@chromium.org"/>
      7  <link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/>
      8  <meta name="assert" content="An offscreen transferred from a canvas element inherits the canvas language." />
      9  <script src="/common/reftest-wait.js"></script>
     10  <style>
     11    #canvas-tr {
     12      position: absolute;
     13      top: 10px;
     14      left: 10px;
     15    }
     16    #canvas-en {
     17      position: absolute;
     18      top: 120px;
     19      left: 10px;
     20    }
     21  </style>
     22  <script type="text/javascript">
     23    function drawText(language) {
     24      var canvas = document.getElementById('canvas-' + language);
     25      var ctx = canvas.transferControlToOffscreen().getContext('2d');
     26 
     27      // The default for lang is inherit
     28      ctx.font = '25px Lato-Medium';
     29      ctx.fillText('fi', 5, 50);
     30    }
     31    function runTest() {
     32      let test_font = new FontFace(
     33        // Lato-Medium is a font with language specific ligatures.
     34        "Lato-Medium",
     35        "url(/fonts/Lato-Medium.ttf)"
     36      );
     37 
     38      test_font.load().then((font) => {
     39        document.fonts.add(font);
     40        drawText('tr');
     41        drawText('en');
     42        takeScreenshot();
     43      });
     44    }
     45  </script>
     46  <body onload="runTest()">
     47    <canvas lang="tr" id="canvas-tr" width="300" height="100">
     48      Browser does not support HTML5 Canvas.
     49    </canvas>
     50    <canvas lang="en" id="canvas-en" width="300" height="100">
     51      Browser does not support HTML5 Canvas.
     52    </canvas>
     53  </body>
     54 </html>