1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 08:27:22 +03:00

Don't crash when small columns are wrapped in absolute blocks

Fix #897.
This commit is contained in:
Guillaume Ayoub 2019-09-04 16:20:07 +02:00
parent fb62571f86
commit 4dc0b119f6
2 changed files with 25 additions and 0 deletions

View File

@ -158,6 +158,11 @@ def columns_layout(context, box, max_position_y, skip_stack, containing_block,
context, column_box, box.content_box_y() + height, context, column_box, box.content_box_y() + height,
column_skip_stack, containing_block, device_size, column_skip_stack, containing_block, device_size,
page_is_empty, [], [], []) page_is_empty, [], [], [])
if new_box is None:
# We didn't render anything. Give up and use the max
# content height.
height *= count
continue
column_skip_stack = resume_at column_skip_stack = resume_at
# Get the empty space at the bottom of the column box # Get the empty space at the bottom of the column box

View File

@ -360,3 +360,23 @@ def test_columns_regression_3():
assert div1.children[0].children[0].text == 'B1' assert div1.children[0].children[0].text == 'B1'
assert div2.children[0].children[0].text == 'B2' assert div2.children[0].children[0].text == 'B2'
assert div3.children[0].children[0].text == 'B3' assert div3.children[0].children[0].text == 'B3'
@assert_no_logs
def test_columns_regression_4():
# Regression test #3 for https://github.com/Kozea/WeasyPrint/issues/897
page, = render_pages('''
<div style="position:absolute">
<div style="column-count:2">
<div>a</div>
</div>
</div>
''')
html, = page.children
body, = html.children
div, = body.children
assert div.position_y == 0
column1, = div.children
assert column1.position_y == 0
div1, = column1.children
assert div1.position_y == 0