LibWeb: Allow anonymous layout boxes to keep their intrinsic size cache

Instead of indiscriminately clearing the cache for all anonymous boxes,
we now only clear it for those that were generated by a non-anonymous
box in need of layout update.

This increases the cache hit rate and allows us to avoid more work.
This commit is contained in:
Andreas Kling 2025-04-19 01:14:53 +02:00 committed by Andreas Kling
commit fa9c463ffd
Notes: github-actions[bot] 2025-04-20 22:32:08 +00:00
3 changed files with 15 additions and 1 deletions

View file

@ -1332,7 +1332,7 @@ void Document::update_layout(UpdateLayoutReason reason)
if (auto dom_node = child.dom_node(); dom_node && dom_node->is_element()) {
child.set_has_size_containment(as<Element>(*dom_node).has_size_containment());
}
if (child.needs_layout_update() || child.is_anonymous()) {
if (child.needs_layout_update()) {
child.reset_cached_intrinsic_sizes();
}
child.clear_contained_abspos_children();