Skip to content

Commit

Permalink
Remove placeholders when pre-rendering columns
Browse files Browse the repository at this point in the history
Related to #1707.
  • Loading branch information
liZe committed Aug 18, 2022
1 parent ac92cac commit 22d6362
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion weasyprint/layout/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def columns_layout(context, box, bottom_space, skip_stack, containing_block,
"""Lay out a multi-column ``box``."""
from .block import (
block_box_layout, block_level_layout, block_level_width,
collapse_margin)
collapse_margin, remove_placeholders)

# Implementation of the multi-column pseudo-algorithm:
# https://www.w3.org/TR/css-multicol-1/#pseudo-algorithm
Expand Down Expand Up @@ -185,6 +185,7 @@ def create_column_box(children):
context.excluded_shapes.pop()

consumed_heights = []
new_boxes = []
for i in range(count):
# Render the column
new_box, resume_at, next_page, _, _, _ = block_box_layout(
Expand All @@ -197,6 +198,7 @@ def create_column_box(children):
# We didn't render anything, retry.
column_skip_stack = {0: None}
break
new_boxes.append(new_box)
column_skip_stack = resume_at

in_flow_children = [
Expand All @@ -220,6 +222,7 @@ def create_column_box(children):
if child.is_in_normal_flow():
next_box_size = child.margin_height()
break
remove_placeholders(context, [next_box], [], [])
else:
consumed_height = empty_space = next_box_size = 0

Expand All @@ -244,6 +247,8 @@ def create_column_box(children):
if resume_at is None:
break

remove_placeholders(context, new_boxes, [], [])

if forced_end_probing:
break

Expand Down

0 comments on commit 22d6362

Please sign in to comment.