Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table row height calculation to use cell's border-height #2039

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading