diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/button-image-only.txt b/Tests/LibWeb/Layout/expected/block-and-inline/button-image-only.txt new file mode 100644 index 0000000000..b8e0ecd662 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/block-and-inline/button-image-only.txt @@ -0,0 +1,28 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x419.203125 children: inline + line 0 width: 430, height: 419.203125, bottom: 419.203125, baseline: 422 + frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 420x415.203125] + BlockContainer \ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index aca6b2caa3..c52bbfe49c 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -389,12 +389,17 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: static_cast(cell_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableCell }); static_cast(cell_computed_values).set_vertical_align(CSS::VerticalAlign::Middle); + auto row_computed_values = parent.computed_values().clone_inherited_values(); + static_cast(row_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableRow }); + auto table_wrapper = parent.heap().template allocate_without_realm(parent.document(), nullptr, move(table_computed_values)); auto cell_wrapper = parent.heap().template allocate_without_realm(parent.document(), nullptr, move(cell_computed_values)); + auto row_wrapper = parent.heap().template allocate_without_realm(parent.document(), nullptr, move(row_computed_values)); cell_wrapper->set_line_height(parent.line_height()); cell_wrapper->set_font(parent.font()); cell_wrapper->set_children_are_inline(parent.children_are_inline()); + row_wrapper->set_children_are_inline(false); Vector> sequence; for (auto child = parent.first_child(); child; child = child->next_sibling()) { @@ -406,7 +411,8 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: cell_wrapper->append_child(*node); } - table_wrapper->append_child(*cell_wrapper); + row_wrapper->append_child(*cell_wrapper); + table_wrapper->append_child(*row_wrapper); parent.append_child(*table_wrapper); }