LibWeb: Ignore non-box element while collecting abspos nodes for layout

All abspos boxes are expected to be blockified, so we are certain that
we can ignore non-box elements when collecting abspos nodes for layout.

Fixes a crash caused by an attempt to cast a BreakNode to a Box while
performing abspos layout.
This commit is contained in:
Aliaksandr Kalenik 2025-03-25 23:44:41 +00:00 committed by Jelle Raaijmakers
commit 275985ff3d
Notes: github-actions[bot] 2025-03-26 00:18:54 +00:00
3 changed files with 18 additions and 1 deletions

View file

@ -1329,7 +1329,7 @@ void Document::update_layout(UpdateLayoutReason reason)
});
// 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([&](auto& child) {
m_layout_root->for_each_in_inclusive_subtree_of_type<Layout::Box>([&](auto& child) {
if (!child.is_absolutely_positioned())
return TraversalDecision::Continue;
if (auto* containing_block = child.containing_block()) {