Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-contain/content-visibility/content-visibility-canvas.html - WPT Dashboard Interop Dashboard
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Content Visibility: hidden canvas</title>
<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com">
<link rel="match" href="content-visibility-canvas-ref.html">
<meta name="assert" content="content-visibility hidden canvas element does not paint replaced content">
<script src="/common/reftest-wait.js"></script>
<style>
canvas {
width: 200px;
height: 200px;
background: green;
border: 1px solid black;
}
.hidden {
content-visibility: hidden;
}
</style>
<canvas id="canvas">
</canvas>
<script>
async function runTest() {
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, canvas.width, canvas.height);
canvas.classList.add("hidden");
requestAnimationFrame(takeScreenshot);
}
window.onload = () => {
requestAnimationFrame(() => {
requestAnimationFrame(runTest);
});
};
</script>
</html>