From 5c4e995f942ab92da4572e6c8e4cb0a276ccf9b9 Mon Sep 17 00:00:00 2001 From: Lucie Anglade Date: Mon, 11 Nov 2024 12:50:30 +0100 Subject: [PATCH] Only fix alignment for out-of-flow cell chidren. Related to #2216. Fix #2293. --- weasyprint/layout/table.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/weasyprint/layout/table.py b/weasyprint/layout/table.py index 2a8992c83..6b7f29aa5 100644 --- a/weasyprint/layout/table.py +++ b/weasyprint/layout/table.py @@ -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: