mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Blocks can have non-block (but non-inline) parents
We were messing up the box tree for tables by hoisting cells up to become children of the table row group (instead of the table row.) Table rows are non-block boxes, and it's fine for them to have cell (block) children. Fixes #4225.
This commit is contained in:
parent
9cdc16535c
commit
d4b2e89875
Notes:
sideshowbarker
2024-07-19 01:12:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d4b2e898750
1 changed files with 4 additions and 4 deletions
|
@ -115,15 +115,15 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node)
|
|||
insertion_point.append_child(*layout_node);
|
||||
insertion_point.set_children_are_inline(true);
|
||||
} else {
|
||||
// Blocks can't be inserted into an inline parent, so find the nearest block ancestor.
|
||||
auto& nearest_block_ancestor = [&]() -> Layout::Node& {
|
||||
// Blocks can't be inserted into an inline parent, so find the nearest non-inline ancestor.
|
||||
auto& nearest_non_inline_ancestor = [&]() -> Layout::Node& {
|
||||
for (ssize_t i = m_parent_stack.size() - 1; i >= 0; --i) {
|
||||
if (m_parent_stack[i]->is_block())
|
||||
if (!m_parent_stack[i]->is_inline())
|
||||
return *m_parent_stack[i];
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}();
|
||||
auto& insertion_point = insertion_parent_for_block_node(nearest_block_ancestor, *layout_node);
|
||||
auto& insertion_point = insertion_parent_for_block_node(nearest_non_inline_ancestor, *layout_node);
|
||||
insertion_point.append_child(*layout_node);
|
||||
insertion_point.set_children_are_inline(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue