mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
LibWeb: Move absolute positioning up to FormattingContext
It seems like both BFC and IFC can have absolutely positioned children. It's a bit strange, but consider the following HTML: <html><body>foobar<img style="position: absolute"></body></html> In such a document, the <img> element is an absolutely positioned child of a block-level element (<body>) with no block-level children. An IFC is established for <body>, and needs to handle layout for <img>.
This commit is contained in:
parent
4c98d00bef
commit
0ecefbff57
5 changed files with 281 additions and 215 deletions
|
@ -95,8 +95,10 @@ void InlineFormattingContext::run(Box&, LayoutMode layout_mode)
|
|||
containing_block().line_boxes().clear();
|
||||
containing_block().for_each_child([&](auto& child) {
|
||||
ASSERT(child.is_inline());
|
||||
if (child.is_absolutely_positioned())
|
||||
if (is<Box>(child) && child.is_absolutely_positioned()) {
|
||||
layout_absolutely_positioned_element(downcast<Box>(child));
|
||||
return;
|
||||
}
|
||||
|
||||
child.split_into_lines(*this, layout_mode);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue