LibWeb: Invalidate style *and* layout when removing a DOM node

It's not enough to invalidate only layout, since changes to the DOM tree
may also cause different selectors to apply.

This brings Acid3 back to a score of 100/100. The problem was that a
:last-child selector wasn't rechecked after removing a node that was
previously the last child of its parent.

Regression from f36cbd3b65.
This commit is contained in:
Andreas Kling 2023-05-06 08:41:31 +02:00 committed by Jelle Raaijmakers
parent cbdb5f926c
commit eff783a6d2
Notes: sideshowbarker 2024-07-17 01:23:08 +09:00

View file

@ -659,6 +659,9 @@ void Node::remove(bool suppress_observers)
// 21. Run the children changed steps for parent.
parent->children_changed();
// Since the tree structure has changed, we need to invalidate both style and layout.
// In the future, we should find a way to only invalidate the parts that actually need it.
document().invalidate_style();
document().invalidate_layout();
}