Skip to content

Commit

Permalink
Only fix alignment for out-of-flow cell chidren.
Browse files Browse the repository at this point in the history
Related to #2216.
Fix #2293.
  • Loading branch information
grewn0uille committed Nov 11, 2024
1 parent 43f5dfa commit 5c4e995
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions weasyprint/layout/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,14 @@ def group_layout(group, position_y, bottom_space, page_is_empty, skip_stack):
cell.computed_height - cell.content_height)
if vertical_align_shift > 0:
for child in cell.children:
child_shift = child.margin_height()
if cell.vertical_align == 'middle':
child_shift /= 2
child.translate(dy=vertical_align_shift - child_shift)
if child.is_in_normal_flow():
child.translate(dy=vertical_align_shift)
else:
# Out-of-flow children are not in cell.content_height.
child_shift = child.margin_height()
if cell.vertical_align == 'middle':
child_shift /= 2
child.translate(dy=vertical_align_shift - child_shift)

next_position_y = row.position_y + row.height
if resume_at is None:
Expand Down

0 comments on commit 5c4e995

Please sign in to comment.