canvas.2d.offscreen.transferred.direction.inherit.document.html (1229B)
1 <!doctype HTML> 2 <html dir="rtl" class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The direction attribute inherits from the document</title> 5 <link rel="match" href="canvas.2d.offscreen.direction-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 dir when the canvas element has none." /> 9 <script src="/common/reftest-wait.js"></script> 10 <script type="text/javascript"> 11 function runTest() 12 { 13 var canvas = document.getElementById("canvas1"); 14 var ctx = canvas.transferControlToOffscreen().getContext("2d"); 15 16 // The default for direction is inherit 17 ctx.font = "25px serif"; 18 ctx.fillText("ABC!", 60, 50); 19 20 requestAnimationFrame(() => requestAnimationFrame(() => takeScreenshot())); 21 } 22 </script> 23 <style> 24 canvas { 25 position: absolute; 26 top: 8px; 27 left: 8px; 28 } 29 </style> 30 <body onload="runTest()"> 31 <canvas id="canvas1" width="300" height="150"> 32 Browser does not support HTML5 Canvas. 33 </canvas> 34 </body> 35 </html>