canvas.2d.offscreen.direction.html (1287B)
1 <!doctype HTML> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The direction attribute in offscreen canvas</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 canvas respects the direction text attribute." /> 9 <script src="/common/reftest-wait.js"></script> 10 <script type="text/javascript"> 11 function runTest() { 12 var canvas = document.getElementById("canvas1"); 13 var bitmap_ctx = canvas.getContext("bitmaprenderer"); 14 15 var offscreen = new OffscreenCanvas(300, 150); 16 var offscreen_ctx = offscreen.getContext('2d'); 17 18 offscreen_ctx.font = "25px serif"; 19 offscreen_ctx.direction = "rtl"; 20 offscreen_ctx.fillText("ABC!", 60, 50); 21 22 const bitmap = offscreen.transferToImageBitmap(); 23 bitmap_ctx.transferFromImageBitmap(bitmap); 24 25 requestAnimationFrame(() => requestAnimationFrame(() => takeScreenshot())); 26 } 27 </script> 28 <body onload="runTest()"> 29 <canvas id="canvas1" width="300" height="150"> 30 Browser does not support HTML5 Canvas. 31 </canvas> 32 </body> 33 </html>