Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf-8">
<head>
<title>HTML5 Canvas Test: The direction attribute in offscreen canvas</title>
<link rel="match" href="canvas.2d.offscreen.direction-ref.html" />
<link rel="author" href="mailto:schenney@chromium.org"/>
<meta name="assert" content="An offscreen canvas respects the direction text attribute." />
<script src="/common/reftest-wait.js"></script>
<script type="text/javascript">
function runTest()
{
var canvas = document.getElementById("canvas1");
var bitmap_ctx = canvas.getContext("bitmaprenderer");
var offscreen = new OffscreenCanvas(300, 150);
var offscreen_ctx = offscreen.getContext('2d');
offscreen_ctx.font = "25px serif";
offscreen_ctx.direction = "rtl";
offscreen_ctx.fillText("ABC!", 60, 50);
const bitmap = offscreen.transferToImageBitmap();
bitmap_ctx.transferFromImageBitmap(bitmap);
requestAnimationFrame(() => requestAnimationFrame(() => takeScreenshot()));
}
</script>
</head>
<body onload="runTest()">
<canvas id="canvas1" width="300" height="150">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>