Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html class=reftest-wait>
<title>Canvas.drawElementImage should draw iframes</title>
<link rel="help" href="https://github.com/WICG/html-in-canvas">
<link rel="match" href="iframe-ref.html">
<script src="/common/reftest-wait.js"></script>
<canvas id="canvas" width="100" height="100" layoutsubtree>
<div id="target" style="width: 200px; height: 200px;">
<iframe style="width: 200px; height: 200px; border: none;"
srcdoc='<!doctype html><style>* { margin: 0; }</style><div style="width: 300px; height: 300px; background: green;"></div>'>
</iframe>
</div>
</canvas>
<script>
onload = () => {
canvas.onpaint = () => {
const ctx = canvas.getContext('2d');
ctx.reset();
ctx.drawElementImage(target, 0, 0);
takeScreenshot();
}
canvas.requestPaint();
}
</script>
</html>