Skip to content

Commit

Permalink
Use correct containing block to render waiting children
Browse files Browse the repository at this point in the history
Fix #2275.
  • Loading branch information
liZe committed Feb 4, 2025
1 parent caaa1a4 commit 9a8a71b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions tests/layout/test_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,3 +1102,17 @@ def test_bidi_position_x_invariant():
assert block_ltr.position_x == block_rtl.position_x
assert line_ltr.position_x == line_rtl.position_x
assert text_ltr.position_x == text_rtl.position_x


@assert_no_logs
def test_nested_waiting_children_width():
# Regression test for https://github.com/Kozea/WeasyPrint/issues/2275
page, = render_pages(
'<body style="width: 3em; font-family: weasyprint">'
'<b><i style="width: 100%">a b</i>c')
html, = page.children
body, = html.children
line1, line2 = body.children
assert line1.children[0].children[0].children[0].text == 'a'
assert line2.children[0].children[0].children[0].text == 'b'
assert line2.children[0].children[1].text == 'c'
2 changes: 1 addition & 1 deletion weasyprint/layout/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def split_inline_box(context, box, position_x, max_x, bottom_space, skip_stack,

if new_position_x > max_x and not trailing_whitespace:
previous_resume_at = _break_waiting_children(
context, box, max_x, bottom_space, initial_skip_stack,
context, containing_block, max_x, bottom_space, initial_skip_stack,
absolute_boxes, fixed_boxes, line_placeholders,
waiting_floats, line_children, children, waiting_children)
if previous_resume_at:
Expand Down

0 comments on commit 9a8a71b

Please sign in to comment.