1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:27:34 +00:00

LibWeb: Prune old paintable pointers from layout tree after relayout

When text paintables shift around in the tree due to line wrapping,
we may end up in a situation where some text node does not generate
a paintable (due to being all whitespace, for example), even though
in the previous layout pass, it *did* generate a paintable.

To prevent holding on to old paintables in such cases, we now do a
pass in LayoutState::commit() where we explicitly detach all old
paintables from the layout tree.
This commit is contained in:
Andreas Kling 2023-08-29 16:27:16 +02:00
parent 390da2985f
commit 6d7a2f5cc9
3 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,13 @@
<!doctype html><style>
* {
border: 1px solid black;
}
div { display: inline-block; }
</style><body><div>xxxxxxxxxxxxxxxxxxxx</div> <div>yyyyyyyyyyyyyyyyyyy</div>
<script>
document.body.offsetWidth
document.body.style.width = "500px";
document.body.offsetWidth
document.body.style.width = "200px";
document.body.offsetWidth
</script>