From 789b80e68424e80ca2e7ec46084a70add89b608c Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 6 Sep 2019 11:31:03 +0200 Subject: [PATCH] Only use in flow children to set columns height --- weasyprint/layout/columns.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/weasyprint/layout/columns.py b/weasyprint/layout/columns.py index e04cf4185..4ee8995aa 100644 --- a/weasyprint/layout/columns.py +++ b/weasyprint/layout/columns.py @@ -165,16 +165,23 @@ def create_column_box(children): continue column_skip_stack = resume_at - # Get the empty space at the bottom of the column box - empty_space = height - ( - new_box.children[-1].position_y - box.content_box_y() + - new_box.children[-1].margin_height()) - - # Get the minimum size needed to render the next box - next_box, _, _, _, _ = block_box_layout( - context, column_box, box.content_box_y(), - column_skip_stack, containing_block, True, [], [], []) - next_box_size = next_box.children[0].margin_height() + in_flow_children = [ + child for child in new_box.children + if child.is_in_normal_flow()] + + if in_flow_children: + # Get the empty space at the bottom of the column box + empty_space = height - ( + in_flow_children[-1].position_y - box.content_box_y() + + in_flow_children[-1].margin_height()) + + # Get the minimum size needed to render the next box + next_box, _, _, _, _ = block_box_layout( + context, column_box, box.content_box_y(), + column_skip_stack, containing_block, True, [], [], []) + next_box_size = in_flow_children[0].margin_height() + else: + empty_space = next_box_size = 0 # Append the size needed to render the next box in this # column.