summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/canvas-partial-invalidation-zoomed.html
blob: a3b0d8d663bbf828c3798946f9c0feb1809c9fec (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
<!DOCTYPE html>
<html>
<body style="zoom: 1.5">
  <p>An all green square should appear below</p>
  <canvas id="A" width=300 height=300></canvas>
  <script type="text/javascript" charset="utf-8">
    if (window.testRunner)
        testRunner.waitUntilDone();
    var context;

    window.onload = function() {
      context = document.getElementById("A").getContext("2d");
      context.fillStyle = 'red';
      context.fillRect(1, 1, 298, 298);
      requestAnimationFrame(doUpdate1);
    }

    function doUpdate1() {
      context.fillStyle = 'red';
      context.fillRect(1, 1, 298, 298);
      // We need to chain 2 rAFs because the first rAF may be called
      // before the initial presentation.
      requestAnimationFrame(doUpdate2);
    }

    function doUpdate2() {
      context.fillStyle = 'green';
      context.fillRect(1, 1, 298, 298);
      testRunner.notifyDone();
    }
    
  </script>
</body>
</html>