For example, paint/invalidation/absolute-display-block-to-none.html:
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
document.getElementById('absolute').style.display = 'none';
}
onload = runRepaintAndPixelTest;
</script>
When an absolute positioned element is set display:none, we should not invalidate the whole body.
<div id="absolute" style="position: absolute; width: 100px; height: 100px; top: 100px; left: 100px; background-color: red"></div>
We should invalidate the disappeared absolute-position object only, but we actually invalidate the whole HTML because we no longer create subsequence for HTML whose PaintLayerStackingNode becomes a leaf:
current display item list: [
{
"subsequence": "client: 0x33f91da14010 LayoutView #document",
"chunks": [
{
"chunk": "client: 0x33f91da14010 LayoutView #document",
"displayItems": [
{
"index": 0,
"type": 213,
"visualRect": "0,0 800x600"
}
]
},
{
"subsequence": "client: 0x33f91da140e8 LayoutBlockFlow HTML",
"chunks": [
{
"chunk": "client: 0x33f91da140e8 LayoutBlockFlow HTML",
"displayItems": [
{
"index": 1,
"type": 213,
"visualRect": "8,8 621x19"
},
{
"index": 2,
"clientIsAlive": false,
"type": 12,
"visualRect": "100,100 100x100"
}
]
}
]
}
]
}
]
new display item list: [
{
"subsequence": "client: 0x33f91da14010 LayoutView #document",
"chunks": [
{
"chunk": "client: 0x33f91da14010 LayoutView #document",
"displayItems": [
{
"index": 0,
"clientDebugName": "LayoutView #document",
"type": 16,
"visualRect": "0,0 800x600"
},
{
"index": 1,
"clientDebugName": "InlineTextBox 'When an absolute positioned element is set display:none, we should not invalidate the whole body.'",
"type": 4,
"visualRect": "8,8 621x19"
}
]
}
]
}
]
We invalidate the whole HTML because the chunk created for its subsequence disappeared.
One simple fix is to create subsequence for leaf PaintLayerStackingNode if we created subsequence for it in the previous paint. However, this won't work for over invalidation caused by new subsequences.
Comment 1 by bugdroid1@chromium.org
, Aug 24 2017