| <html> |
| <head> |
| <title>Ensure correct behavior of createPattern with video elements.</title> |
| <style type="text/css"> |
| video { |
| display: none; |
| } |
| </style> |
| </head> |
| <body> |
| <canvas id="canvas"></canvas> |
| <video id="video"></video> |
| <script> |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| var length = 150; |
| var canvas = document.getElementById("canvas"); |
| canvas.setAttribute("width", length); |
| canvas.setAttribute("height", length); |
| var ctx = canvas.getContext("2d"); |
| |
| var video = document.getElementById("video"); |
| video.requestVideoFrameCallback(drawImageToCanvas); |
| video.src = "resources/canvas_video.webm"; |
| video.play(); |
| |
| function drawImageToCanvas() { |
| ctx.fillStyle = "blue"; |
| ctx.fillRect(0, 0, length, length); |
| ctx.fillStyle = ctx.createPattern(video, "no-repeat"); |
| ctx.fillRect(0, 0, length, length); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| </script> |
| </body> |
| </html> |