From 9b4cd0dab7d33090f398321c8dd46b9e3076b5ff Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Fri, 28 Apr 2023 00:35:47 +0300 Subject: [PATCH] LibWeb: Consider row computed height in total row min height of table Fixes the issue that currently we do not consider table rows height while calculating min row height even if it is definite value. --- .../Layout/expected/table/row-px-height.txt | 6 ++++++ .../Layout/input/table/row-px-height.html | 17 +++++++++++++++++ .../LibWeb/Layout/TableFormattingContext.cpp | 10 ++++++++++ 3 files changed, 33 insertions(+) create mode 100644 Tests/LibWeb/Layout/expected/table/row-px-height.txt create mode 100644 Tests/LibWeb/Layout/input/table/row-px-height.html diff --git a/Tests/LibWeb/Layout/expected/table/row-px-height.txt b/Tests/LibWeb/Layout/expected/table/row-px-height.txt new file mode 100644 index 0000000000..fa68c787f0 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/row-px-height.txt @@ -0,0 +1,6 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x116 children: not-inline + TableWrapper <(anonymous)> at (8,8) content-size 102x100 children: not-inline + TableBox at (8,8) content-size 102x100 children: not-inline + TableRowBox at (8,8) content-size 102x100 children: not-inline + TableCellBox at (9,9) content-size 100x0 children: not-inline diff --git a/Tests/LibWeb/Layout/input/table/row-px-height.html b/Tests/LibWeb/Layout/input/table/row-px-height.html new file mode 100644 index 0000000000..a19a62cb4b --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/row-px-height.html @@ -0,0 +1,17 @@ + +
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index 0a9dd32306..4d77098045 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -425,6 +425,16 @@ void TableFormattingContext::calculate_row_heights(LayoutMode layout_mode) row.used_height = max(row.used_height, cell_state.border_box_height()); row.baseline = max(row.baseline, cell.baseline); } + + for (auto& row : m_rows) { + auto row_computed_height = row.box->computed_values().height(); + if (row_computed_height.is_length()) { + auto height_of_containing_block = m_state.get(*row.box->containing_block()).content_height(); + auto height_of_containing_block_as_length = CSS::Length::make_px(height_of_containing_block); + auto row_used_height = row_computed_height.resolved(row.box, height_of_containing_block_as_length).to_px(row.box); + row.used_height = max(row.used_height, row_used_height); + } + } } void TableFormattingContext::position_row_boxes(CSSPixels& total_content_height)