Skip to content

Commit d9d7f62

Browse files
committed
Don’t duplicate column when container is split on multiple pages
1 parent 9e9f690 commit d9d7f62

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/layout/test_column.py

+26
Original file line numberDiff line numberDiff line change
@@ -1057,3 +1057,29 @@ def test_columns_regression_6():
10571057
</style>
10581058
<div style="columns: 2; column-width: 100px; width: 10px">abc def</div>
10591059
''')
1060+
1061+
1062+
@assert_no_logs
1063+
def test_columns_regression_7():
1064+
page1, page2 = render_pages('''
1065+
<style>
1066+
@page { size: 50px 10px }
1067+
body { font-size: 2px; line-height: 1 }
1068+
</style>
1069+
<div style="height: 8px"></div>
1070+
<div style="column-count: 2">
1071+
<div>a</div>
1072+
<div style="break-inside: avoid">b<br>c<br>d</div>
1073+
</div>
1074+
''')
1075+
html, = page1.children
1076+
body, = html.children
1077+
div, = body.children
1078+
assert div.position_y == 0
1079+
assert not div.children
1080+
html, = page2.children
1081+
body, = html.children
1082+
div, = body.children
1083+
column1, column2 = div.children
1084+
assert column1.position_y == 0
1085+
assert column2.position_y == 0

weasyprint/layout/column.py

+1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def columns_layout(context, box, bottom_space, skip_stack, containing_block,
306306
containing_block, original_page_is_empty, absolute_boxes,
307307
fixed_boxes, None, discard=False, max_lines=None))
308308
if new_child is None:
309+
columns = []
309310
break_page = True
310311
break
311312
next_page = column_next_page

0 commit comments

Comments
 (0)