Skip to content

Commit

Permalink
Merge pull request #2039 from alexandergitter/fix-1968
Browse files Browse the repository at this point in the history
Fix table row height calculation to use cell's border-height
  • Loading branch information
grewn0uille authored Jan 26, 2024
2 parents ae2a2df + 944a4b5 commit 7d8fcb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions tests/layout/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('''
<table style="border-spacing: 0;">
<tr style="height: 4px;">
<td style="border: 1px solid; padding: 5px;"></td>
</tr>
</table>
''')
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('''
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d8fcb5

Please sign in to comment.