From 65eef944ab35ca85be178615ffc32834d430f4e3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 29 Nov 2020 22:37:15 +0100 Subject: [PATCH] LibWeb: Auto-size table box height to fit all the rows This is just a hack until we implement the full 'height' property for tables. :^) --- Libraries/LibWeb/Layout/TableFormattingContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Libraries/LibWeb/Layout/TableFormattingContext.cpp index b448ad5bf6d..988b859488c 100644 --- a/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -51,6 +51,8 @@ void TableFormattingContext::run(LayoutMode) { compute_width(context_box()); + float total_content_height = 0; + context_box().for_each_child_of_type([&](auto& box) { compute_width(box); auto column_count = box.column_count(); @@ -70,9 +72,12 @@ void TableFormattingContext::run(LayoutMode) }); box.set_height(content_height); + + total_content_height += content_height; }); - compute_height(context_box()); + // FIXME: This is a total hack, we should respect the 'height' property. + context_box().set_height(total_content_height); } void TableFormattingContext::calculate_column_widths(Box& row, Vector& column_widths)