Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/manual/draw-element-image/scroller-crash.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class=reftest-wait>
<title>Canvas.drawElementImage should not crash when drawing scrollers</title>
<script src="/common/reftest-wait.js"></script>
<style>
#target {
width: 100px;
height: 100px;
}
#scroller {
width: 100px;
height: 100px;
overflow: scroll;
scrollbar-gutter: stable;
}
#scroller::-webkit-scrollbar {
width: 16px;
height: 16px;
}
#contents {
width: 200px;
height: 200px;
background: green;
}
</style>
<canvas id="canvas" width="200" height="200" layoutsubtree>
<div id="target">
<div id="scroller">
<div id="contents"></div>
</div>
</div>
</canvas>
<script>
canvas.onpaint = () => {
const ctx = canvas.getContext('2d');
ctx.reset();
ctx.drawElementImage(target, 0, 0);
takeScreenshot();
}
canvas.requestPaint();
</script>
</html>