Skip to content

Commit

Permalink
Fix variable redefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Feb 18, 2025
1 parent 895e8fc commit 15ab3c4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
19 changes: 19 additions & 0 deletions tests/layout/test_flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,3 +1716,22 @@ def test_flex_auto_break_before():
body, = html.children
article, = body.children
assert article.height == 2


@assert_no_logs
def test_flex_grow_in_flex_column():
page, = render_pages('''
<html style="width: 14px">
<body style="display: flex; flex-direction: column;
border: 1px solid; padding: 1px">
<main style="flex: 1 1 auto; min-height: 0">
<div style="height: 5px">
''')
html, = page.children
body, = html.children
main, = body.children
_, div, _ = main.children
assert body.height == div.height == 5
assert body.width == div.width == 10
assert body.margin_width() == 14
assert body.margin_height() == 9
8 changes: 4 additions & 4 deletions weasyprint/layout/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block, page_i
else:
main_flex_direction = None
if main == 'width':
containing_block = (available_main_space, parent_box.height)
child_containing_block = (available_main_space, parent_box.height)
else:
containing_block = (parent_box.width, available_main_space)
percent.resolve_percentages(child, containing_block, main_flex_direction)
child_containing_block = (parent_box.width, available_main_space)
percent.resolve_percentages(child, child_containing_block, main_flex_direction)
if child.is_table_wrapper:
table_wrapper_width(context, child, containing_block)
table_wrapper_width(context, child, child_containing_block)
child.position_x = position_x
child.position_y = position_y
if child.style['min_width'] == 'auto':
Expand Down

0 comments on commit 15ab3c4

Please sign in to comment.