1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibWeb: Make InlineLevelIterator emit absolutely positioned items

Note that we don't put absolutely positioned items on a line! This is
just so that IFC can discover boxes and pass them along to BFC.

This fixes an issue where only direct children of the IFC containing
block were considered for absolute positioning. Now we pick up
absolutely positioned children of nested inline nodes as well.
This commit is contained in:
Andreas Kling 2022-03-07 22:27:09 +01:00
parent 6354a9a030
commit 2dfb617c5b
3 changed files with 11 additions and 9 deletions

View file

@ -75,14 +75,6 @@ void InlineFormattingContext::run(Box const&, LayoutMode layout_mode)
generate_line_boxes(layout_mode);
containing_block().for_each_child([&](auto& child) {
VERIFY(child.is_inline());
if (is<Box>(child) && child.is_absolutely_positioned()) {
parent().add_absolutely_positioned_box(static_cast<Box&>(child));
return;
}
});
float min_line_height = containing_block().line_height();
float max_line_width = 0;
float content_height = 0;
@ -201,6 +193,11 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
line_builder.append_box(box, item.border_start + item.padding_start, item.padding_end + item.border_end);
break;
}
case InlineLevelIterator::Item::Type::AbsolutelyPositionedElement:
if (is<Box>(*item.node))
parent().add_absolutely_positioned_box(static_cast<Layout::Box const&>(*item.node));
break;
case InlineLevelIterator::Item::Type::Text: {
auto& text_node = verify_cast<Layout::TextNode>(*item.node);
line_builder.break_if_needed(layout_mode, item.border_box_width(), item.should_force_break);