diff --git a/Tests/LibWeb/Layout/expected/table/table-fixup-font-size-and-line-height.txt b/Tests/LibWeb/Layout/expected/table/table-fixup-font-size-and-line-height.txt
new file mode 100644
index 0000000000..6af26289fc
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/table/table-fixup-font-size-and-line-height.txt
@@ -0,0 +1,20 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer at (0,0) content-size 800x116 [BFC] children: not-inline
+ BlockContainer
at (8,8) content-size 784x100 children: not-inline
+ TableWrapper <(anonymous)> at (8,8) content-size 69.078125x100 [BFC] children: not-inline
+ Box at (8,8) content-size 69.078125x100 table-box [TFC] children: inline
+ Box <(anonymous)> at (8,8) content-size 69.078125x100 table-row children: inline
+ BlockContainer <(anonymous)> at (8,8) content-size 69.078125x100 table-cell [BFC] children: inline
+ line 0 width: 69.078125, height: 100, bottom: 100, baseline: 59
+ frag 0 from TextNode start: 0, length: 5, rect: [8,8 69.078125x100]
+ "hello"
+ TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600]
+ PaintableWithLines (BlockContainer) [0,0 800x116]
+ PaintableWithLines (BlockContainer) [8,8 784x100]
+ PaintableWithLines (TableWrapper(anonymous)) [8,8 69.078125x100]
+ PaintableBox (Box
) [8,8 69.078125x100]
+ PaintableBox (Box(anonymous)) [8,8 69.078125x100]
+ PaintableWithLines (BlockContainer(anonymous)) [8,8 69.078125x100]
+ TextPaintable (TextNode<#text>)
diff --git a/Tests/LibWeb/Layout/input/table/table-fixup-font-size-and-line-height.html b/Tests/LibWeb/Layout/input/table/table-fixup-font-size-and-line-height.html
new file mode 100644
index 0000000000..3091391459
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/table/table-fixup-font-size-and-line-height.html
@@ -0,0 +1,8 @@
+
hello
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 06c4e34401..e020ab393f 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -585,6 +585,7 @@ static void wrap_in_anonymous(Vector
>& sequence, Node* nearest_
}
wrapper->set_children_are_inline(parent.children_are_inline());
wrapper->set_line_height(parent.line_height());
+ wrapper->set_font(parent.font());
if (nearest_sibling)
parent.insert_before(*wrapper, *nearest_sibling);
else
@@ -664,13 +665,15 @@ Vector> TreeBuilder::generate_missing_parents(NodeWithStyle& roo
auto* nearest_sibling = table_box->next_sibling();
auto& parent = *table_box->parent();
- CSS::ComputedValues wrapper_computed_values;
+ CSS::ComputedValues wrapper_computed_values = table_box->computed_values().clone_inherited_values();
table_box->transfer_table_box_computed_values_to_wrapper_computed_values(wrapper_computed_values);
auto wrapper = parent.heap().allocate_without_realm(parent.document(), nullptr, move(wrapper_computed_values));
parent.remove_child(*table_box);
wrapper->append_child(*table_box);
+ wrapper->set_font(parent.font());
+ wrapper->set_line_height(parent.line_height());
if (nearest_sibling)
parent.insert_before(*wrapper, *nearest_sibling);
@@ -705,6 +708,8 @@ static void fixup_row(Box& row_box, TableGrid const& table_grid, size_t row_inde
// Ensure that the cell (with zero content height) will have the same height as the row by setting vertical-align to middle.
cell_computed_values.set_vertical_align(CSS::VerticalAlign::Middle);
auto cell_box = row_box.heap().template allocate_without_realm(row_box.document(), nullptr, cell_computed_values);
+ cell_box->set_font(row_box.font());
+ cell_box->set_line_height(row_box.line_height());
row_box.append_child(cell_box);
}
}