diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/button-should-have-vertically-aligned-content.txt b/Tests/LibWeb/Layout/expected/block-and-inline/button-should-have-vertically-aligned-content.txt index 2e1d2bbf25..9d6237d5ac 100644 --- a/Tests/LibWeb/Layout/expected/block-and-inline/button-should-have-vertically-aligned-content.txt +++ b/Tests/LibWeb/Layout/expected/block-and-inline/button-should-have-vertically-aligned-content.txt @@ -5,41 +5,39 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline frag 0 from BlockContainer start: 0, length: 0, rect: [22,19 48.6875x178] TextNode <#text> BlockContainer at (22,19) content-size 48.6875x178 inline-block [BFC] children: not-inline - BlockContainer <(anonymous)> at (22,19) content-size 48.6875x0 children: inline - TextNode <#text> - BlockContainer <(anonymous)> at (22,19) content-size 48.6875x0 children: inline - TextNode <#text> - BlockContainer <(anonymous)> at (22,19) content-size 48.6875x0 children: inline - TextNode <#text> TableWrapper <(anonymous)> at (22,19) content-size 48.6875x178 [BFC] children: not-inline BlockContainer <(anonymous)> at (22,19) content-size 48.6875x178 table-box [TFC] children: not-inline Box <(anonymous)> at (22,19) content-size 48.6875x178 table-row children: not-inline BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x157.46875 table-cell [BFC] children: not-inline - BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x157.46875 inline-block [BFC] children: not-inline - BlockContainer at (32,39.265625) content-size 28.6875x17.46875 children: inline - line 0 width: 28.6875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 1, length: 3, rect: [32,39.265625 28.6875x17.46875] - "one" - TextNode <#text> - BlockContainer at (32,76.734375) content-size 28.6875x100 children: inline - line 0 width: 28.4375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 - frag 0 from TextNode start: 1, length: 3, rect: [32,76.734375 28.4375x17.46875] - "two" - TextNode <#text> + BlockContainer <(anonymous)> at (22,29.265625) content-size 48.6875x0 children: inline + TextNode <#text> + BlockContainer at (32,39.265625) content-size 28.6875x17.46875 children: inline + line 0 width: 28.6875, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 1, length: 3, rect: [32,39.265625 28.6875x17.46875] + "one" + TextNode <#text> + BlockContainer <(anonymous)> at (22,66.734375) content-size 48.6875x0 children: inline + TextNode <#text> + BlockContainer at (32,76.734375) content-size 28.6875x100 children: inline + line 0 width: 28.4375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 1, length: 3, rect: [32,76.734375 28.4375x17.46875] + "two" + TextNode <#text> + BlockContainer <(anonymous)> at (22,186.734375) content-size 48.6875x0 children: inline + TextNode <#text> PaintableWithLines (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x200] PaintableWithLines (BlockContainer \ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/block-and-inline/button-with-text-node-label.html b/Tests/LibWeb/Layout/input/block-and-inline/button-with-text-node-label.html new file mode 100644 index 0000000000..29b5ae59c2 --- /dev/null +++ b/Tests/LibWeb/Layout/input/block-and-inline/button-with-text-node-label.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tests/LibWeb/Layout/input/table/table-cell-not-paintable.html b/Tests/LibWeb/Layout/input/table/table-cell-not-paintable.html index 7c3c9971d3..bd104eb111 100644 --- a/Tests/LibWeb/Layout/input/table/table-cell-not-paintable.html +++ b/Tests/LibWeb/Layout/input/table/table-cell-not-paintable.html @@ -1,2 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 6003feb2f8..e9d0905cb0 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -207,6 +207,7 @@ public: Gfx::Font const& font() const { return *m_font; } CSSPixels line_height() const { return m_line_height; } + void set_line_height(CSSPixels line_height) { m_line_height = line_height; } Vector const& background_layers() const { return computed_values().background_layers(); } const CSS::AbstractImageStyleValue* list_style_image() const { return m_list_style_image; } diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 8af309adf9..f4e27dec8a 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -387,6 +387,7 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: auto cell_computed_values = CSS::ComputedValues(); static_cast(cell_computed_values).set_display(CSS::Display { CSS::Display::Internal::TableCell }); static_cast(cell_computed_values).set_vertical_align(CSS::VerticalAlign::Middle); + static_cast(cell_computed_values).set_white_space(CSS::WhiteSpace::Nowrap); auto flow_root_computed_values = CSS::ComputedValues(); static_cast(flow_root_computed_values).set_width(CSS::Size::make_percentage(CSS::Percentage(100))); @@ -394,20 +395,20 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: 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 flow_root_wrapper = parent.heap().template allocate_without_realm(parent.document(), nullptr, move(flow_root_computed_values)); + + cell_wrapper->set_line_height(parent.line_height()); + cell_wrapper->set_children_are_inline(parent.children_are_inline()); Vector> sequence; for (auto child = parent.first_child(); child; child = child->next_sibling()) { - if (!is_ignorable_whitespace(*child)) - sequence.append(*child); + sequence.append(*child); } for (auto& node : sequence) { parent.remove_child(*node); - flow_root_wrapper->append_child(*node); + cell_wrapper->append_child(*node); } - cell_wrapper->append_child(*flow_root_wrapper); table_wrapper->append_child(*cell_wrapper); parent.append_child(*table_wrapper); }