mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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:
parent
51555dea7c
commit
44cf418975
Notes:
sideshowbarker
2024-07-18 02:47:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/44cf418975
@ -315,12 +315,15 @@ JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Docume
|
||||
if (display.is_flow_inside())
|
||||
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
||||
if (display.is_flex_inside())
|
||||
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
|
||||
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
|
||||
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", display.to_deprecated_string());
|
||||
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
||||
}
|
||||
|
||||
if (display.is_flow_inside() || display.is_flow_root_inside() || display.is_flex_inside() || display.is_grid_inside())
|
||||
if (display.is_flex_inside())
|
||||
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
|
||||
|
||||
if (display.is_flow_inside() || display.is_flow_root_inside() || display.is_grid_inside())
|
||||
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
|
||||
|
||||
TODO();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user