Skip to content

Commit

Permalink
Don’t duplicate column when container is split on multiple pages
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jun 7, 2024
1 parent 9e9f690 commit d9d7f62
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/layout/test_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,3 +1057,29 @@ def test_columns_regression_6():
</style>
<div style="columns: 2; column-width: 100px; width: 10px">abc def</div>
''')


@assert_no_logs
def test_columns_regression_7():
page1, page2 = render_pages('''
<style>
@page { size: 50px 10px }
body { font-size: 2px; line-height: 1 }
</style>
<div style="height: 8px"></div>
<div style="column-count: 2">
<div>a</div>
<div style="break-inside: avoid">b<br>c<br>d</div>
</div>
''')
html, = page1.children
body, = html.children
div, = body.children
assert div.position_y == 0
assert not div.children
html, = page2.children
body, = html.children
div, = body.children
column1, column2 = div.children
assert column1.position_y == 0
assert column2.position_y == 0
1 change: 1 addition & 0 deletions weasyprint/layout/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def columns_layout(context, box, bottom_space, skip_stack, containing_block,
containing_block, original_page_is_empty, absolute_boxes,
fixed_boxes, None, discard=False, max_lines=None))
if new_child is None:
columns = []
break_page = True
break
next_page = column_next_page
Expand Down

0 comments on commit d9d7f62

Please sign in to comment.