summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-canvas.html
blob: fe469489528c45797b8ff68bfc739c39cefdf7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!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="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
<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>