Skip to content

Commit

Permalink
Don’t crash with absolute flex boxes
Browse files Browse the repository at this point in the history
Fix #1536.
  • Loading branch information
liZe committed Jan 10, 2022
1 parent a1ff9d4 commit 72d05e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/layout/test_flex.py
Expand Up @@ -542,3 +542,12 @@ def test_flex_undefined_percentage_height_multiple_lines():
<div style="width: 100%">a</div>
<div style="width: 100%">b</div>
</div>''')


@assert_no_logs
def test_flex_absolute():
# Regression test for https://github.com/Kozea/WeasyPrint/issues/1536
page, = render_pages('''
<div style="display: flex; position: absolute">
<div>a</div>
</div>''')
4 changes: 2 additions & 2 deletions weasyprint/layout/absolute.py
Expand Up @@ -305,8 +305,8 @@ def absolute_box_layout(context, box, containing_block, fixed_boxes,
bottom_space, skip_stack)
elif isinstance(box, boxes.FlexContainerBox):
new_box, resume_at = absolute_flex(
context, box, containing_block, fixed_boxes,
bottom_space, skip_stack, original_containing_block)
context, box, original_containing_block, fixed_boxes,
bottom_space, skip_stack, containing_block)
else:
assert isinstance(box, boxes.BlockReplacedBox)
new_box = absolute_replaced(context, box, containing_block)
Expand Down

0 comments on commit 72d05e3

Please sign in to comment.