<!DOCTYPE HTML>
<html>
<head>
<style>
#container {
width: 100px;
height: 100px;
border: 3px solid black;
overflow: scroll;
}
#container::-webkit-scrollbar {
display: none;
}
canvas {
background-color: gray;
border: 1px solid black;
will-change: transform;
}
</style>
<script src="../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.internals) {
internals.settings.setPreferCompositingToLCDTextEnabled(true);
internals.runtimeFlags.accelerated2dCanvasEnabled = true;
}
function doTest() {
var canvas = document.getElementById("canvas");
var context = canvas.getContext('2d');
context.fillStyle = 'green';
context.fillRect(0, 0, 150, 100);
// The resize should clear the canvas to be fully transparent.
runAfterLayoutAndPaint(() => { canvas.height = 200; }, true);
}
window.onload = doTest;
</script>
</head>
<body>
<div id="container">
<canvas id="canvas" width="50" height="50"></canvas>
</div>
</body>
</html>