Skip to content

Commit 87d9e84

Browse files
committed
Avoid infinite loops when rendering columns
1 parent cf7bff7 commit 87d9e84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

weasyprint/layout/columns.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ def create_column_box(children):
183183
# example when the next box can't be separated from its own
184184
# next box. In this case we don't try to find the real value
185185
# and let the workaround below fix this for us.
186-
if next_box_size - empty_space > 0:
186+
#
187+
# We also want to avoid very small values that may have been
188+
# introduced by rounding errors. As the workaround below at
189+
# least adds 1 pixel for each loop, we can ignore lost spaces
190+
# lower than 1px.
191+
if next_box_size - empty_space > 1:
187192
lost_space = min(lost_space, next_box_size - empty_space)
188193

189194
# Stop if we already rendered the whole content

0 commit comments

Comments
 (0)