<!DOCTYPE html>
<style>
/* To ensure full viewport repaint when viewport is resized. */
body {
background-image: linear-gradient(red, blue);
background-attachment: fixed;
margin: 0;
}
#container {
width: 200px;
height: 200px;
border: 1px solid black;
overflow: scroll;
}
#child {
width: 100px;
height: 100px;
}
</style>
<script src="../resources/text-based-repaint.js" type="text/javascript"></script>
<script>
function repaintTest() {
// Invalidation of horizontal scrollbar should be tracked.
document.getElementById('child').style.width = '2000px';
}
window.onload = async function() {
// Trigger a full viewport repaint to test if scrollbar damages are cleared
// even if we shortcut children invalidations.
var resizePromise = new Promise(resolve => window.onresize = resolve);
window.resizeTo(1000, 600);
await resizePromise;
// Invalidation of vertical scrollbar before the repaint test should not be tracked during repaintTest().
document.getElementById('child').style.height = '2000px';
runRepaintAndPixelTest();
};
</script>
<div style="height: 50px">
Tests if scrollbar damage flag is cleared during a full viewport invalidation.
Passes if the result repaint rects contain the horizontal scrollbar but not the vertical scrollbar.
</div>
<div id="container">
<div id="child"></div>
</div>