From 944a4b5ce98bedf62e0591f4af2237ef0913a1b2 Mon Sep 17 00:00:00 2001 From: Alexander Gitter Date: Sun, 14 Jan 2024 19:03:42 +0100 Subject: [PATCH] Fix table row height calculation to use cell's border-height Fixes #1968 --- tests/layout/test_table.py | 18 ++++++++++++++++++ weasyprint/layout/table.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/layout/test_table.py b/tests/layout/test_table.py index 2832ef8c1..5c36a08ae 100644 --- a/tests/layout/test_table.py +++ b/tests/layout/test_table.py @@ -1865,6 +1865,24 @@ def test_table_row_height_3(): assert row2.height == 0 +@assert_no_logs +def test_table_row_height_4(): + # A row cannot be shorter than the border-height of its tallest cell + page, = render_pages(''' + + + + +
+ ''') + html, = page.children + body, = html.children + wrapper, = body.children + table, = wrapper.children + row_group, = table.children + assert row_group.height == 12 + + @assert_no_logs def test_table_vertical_align(assert_pixels): assert_pixels(''' diff --git a/weasyprint/layout/table.py b/weasyprint/layout/table.py index ca9d8d9cc..727646062 100644 --- a/weasyprint/layout/table.py +++ b/weasyprint/layout/table.py @@ -244,7 +244,7 @@ def group_layout(group, position_y, bottom_space, page_is_empty, row.height = max(row_bottom_y - row.position_y, 0) else: row.height = max(row.height, max( - row_cell.height for row_cell in ending_cells)) + row_cell.border_height() for row_cell in ending_cells)) row_bottom_y = row.position_y + row.height else: row_bottom_y = row.position_y