mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-03 23:48:07 +03:00
Correctly detect empty split lines at the end of tables
The previous detection was failing when some cells were empty (or fully rendered) and when the current rendering position was not overflowing the page. In this case, the line with empty cells was rendered and was visible for example when cells had padding.
This commit is contained in:
parent
3bd9a8e014
commit
cb9540ba3b
@ -1198,3 +1198,40 @@ def test_tables_20(assert_pixels):
|
||||
<col></col><col></col>
|
||||
<tbody><tr></tr><tr><td></td></tr></tbody>
|
||||
<tfoot></tfoot>''')
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
def test_tables_21(assert_pixels):
|
||||
assert_pixels('''
|
||||
_________________________
|
||||
_rrrrrrrrrrrrrrrrrrrrrrr_
|
||||
_rBBBBBBBBBBrBBBBBBBBBBr_
|
||||
_rBKKKKKKBBBrBKKKKKKBBBr_
|
||||
_rBKKKKKKBBBrBKKKKKKBBBr_
|
||||
_rBBBBBBBBBBrBBBBBBBBBBr_
|
||||
_rrrrrrrrrrrrrrrrrrrrrrr_
|
||||
_________________________
|
||||
_________________________
|
||||
_________________________
|
||||
_________________________
|
||||
_________________________
|
||||
_rrrrrrrrrrrrrrrrrrrrrrr_
|
||||
_rBBBBBBBBBBrBBBBBBBBBBr_
|
||||
_rBKKKKKKBBBrBBBBBBBBBBr_
|
||||
_rBKKKKKKBBBrBBBBBBBBBBr_
|
||||
_rBBBBBBBBBBrBBBBBBBBBBr_
|
||||
_rrrrrrrrrrrrrrrrrrrrrrr_
|
||||
_________________________
|
||||
_________________________
|
||||
_________________________
|
||||
_________________________
|
||||
''', '''
|
||||
<style>
|
||||
@font-face { src: url(weasyprint.otf); font-family: weasyprint }
|
||||
@page { size: 25px 11px; margin: 1px }
|
||||
table { border-collapse: collapse; font: 2px weasyprint; width: 100% }
|
||||
td { background: blue; padding: 1px; border: 1px solid red }
|
||||
</style>
|
||||
<table>
|
||||
<tr><td>abc</td><td>abc</td></tr>
|
||||
<tr><td>abc</td><td></td></tr>''')
|
||||
|
@ -272,17 +272,11 @@ def table_layout(context, table, bottom_space, skip_stack, containing_block,
|
||||
# Break if one cell was broken
|
||||
break_cell = False
|
||||
if resume_at:
|
||||
values, = list(resume_at.values())
|
||||
if len(row.children) == len(values):
|
||||
for cell_resume_at in values.values():
|
||||
if cell_resume_at != {0: None}:
|
||||
break_cell = True
|
||||
break
|
||||
else:
|
||||
# No cell was displayed, give up row
|
||||
next_position_y = inf
|
||||
page_is_empty = False
|
||||
resume_at = None
|
||||
if all(child.empty for child in row.children):
|
||||
# No cell was displayed, give up row
|
||||
next_position_y = inf
|
||||
page_is_empty = False
|
||||
resume_at = None
|
||||
else:
|
||||
break_cell = True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user