blob: 60bb566320b62dd502ed6d784b346bea9d40719f [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>Test ClearRect works properly if called during the first frame.</title>
</head>
<body>
<canvas id="c" width=100 height=100></canvas>
<script>
var c2 = document.getElementById("c");
var offscreen_canvas = c2.transferControlToOffscreen();
var ctx_o = offscreen_canvas.getContext('2d');
// Since it checks if content retaining |mode_| changes from frame to frame,
// multiple calls to rAF are used to assure the craetion of new frame.
ctx_o.fillRect(5, 5, 50, 50);
ctx_o.clearRect(0, 0, 800, 1000);
window.requestAnimationFrame( dt=> {
ctx_o.fillRect(50, 50, 50, 50);
ctx_o.clearRect(50, 50, 50, 40);
window.requestAnimationFrame(dt => {
ctx_o.fillRect(0, 0, 15, 15);
window.requestAnimationFrame(dt => {
testRunner.notifyDone();
});
});
});
if (window.testRunner) {
testRunner.waitUntilDone();
}
</script>
</body>
</html>