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.document.html (1796B)


      1 <!doctype HTML>
      2 <html lang="tr" 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 inherits the document 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 
     32    function runTest() {
     33      let test_font = new FontFace(
     34        // Lato-Medium is a font with language specific ligatures.
     35        "Lato-Medium",
     36        "url(/fonts/Lato-Medium.ttf)"
     37      );
     38 
     39      test_font.load().then((font) => {
     40        document.fonts.add(font);
     41        drawText('tr');
     42        document.documentElement.setAttribute('lang', 'en');
     43        drawText('en');
     44        takeScreenshot();
     45      });
     46    }
     47  </script>
     48  <body onload="runTest()">
     49    <canvas lang="tr" id="canvas-tr" width="300" height="100">
     50      Browser does not support HTML5 Canvas.
     51    </canvas>
     52    <canvas lang="en" id="canvas-en" width="300" height="100">
     53      Browser does not support HTML5 Canvas.
     54    </canvas>
     55  </body>
     56 </html>