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

LibWeb: Make flex containers be Layout::Box

Flex containers were incorrectly represented as BlockContainer before,
which would make some CSS layout algorithms do the wrong thing.
This commit is contained in:
Andreas Kling 2023-01-23 15:03:45 +01:00
parent 51555dea7c
commit 44cf418975
2 changed files with 8 additions and 3 deletions

View file

@ -65,8 +65,10 @@ bool Node::can_contain_boxes_with_position_absolute() const
static Box const* nearest_ancestor_capable_of_forming_a_containing_block(Node const& node)
{
for (auto const* ancestor = node.parent(); ancestor; ancestor = ancestor->parent()) {
if (ancestor->is_block_container())
if (ancestor->is_block_container()
|| ancestor->display().is_flex_inside()) {
return verify_cast<Box>(ancestor);
}
}
return nullptr;
}