Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!doctype HTML>
<html dir="rtl" class="reftest-wait">
<meta charset="utf-8">
<head>
<title>HTML5 Canvas Test: The direction attribute inherits from the document</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 transferred from a canvas inherits the document dir when the canvas element has none." />
<script src="/common/reftest-wait.js"></script>
<script type="text/javascript">
function runTest()
{
var canvas = document.getElementById("canvas1");
var ctx = canvas.transferControlToOffscreen().getContext("2d");
// The default for direction is inherit
ctx.font = "25px serif";
ctx.fillText("ABC!", 60, 50);
requestAnimationFrame(() => requestAnimationFrame(() => takeScreenshot()));
}
</script>
<style>
canvas {
position: absolute;
top: 8px;
left: 8px;
}
</style>
</head>
<body onload="runTest()">
<canvas id="canvas1" width="300" height="150">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>