LibWeb: Reset a vector of contained abspos before collecting them again

Fixes a bug when a vector with contained absolutely positioned boxes
keeps growing, resulting in more duplicated work on each subsequent
layout.
This commit is contained in:
Aliaksandr Kalenik 2024-09-13 16:35:31 +02:00 committed by Andreas Kling
commit 6199870528
Notes: github-actions[bot] 2024-09-13 14:49:41 +00:00
2 changed files with 5 additions and 0 deletions

View file

@ -1132,6 +1132,10 @@ void Document::update_layout()
}
// Assign each box that establishes a formatting context a list of absolutely positioned children it should take care of during layout
m_layout_root->for_each_in_inclusive_subtree_of_type<Layout::Box>([&](auto& child) {
child.clear_contained_abspos_children();
return TraversalDecision::Continue;
});
m_layout_root->for_each_in_inclusive_subtree([&](auto& child) {
if (!child.is_absolutely_positioned())
return TraversalDecision::Continue;