From 46a754867631fdb59326fdd7d29fe62b853fc28b Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 24 May 2024 10:04:37 +0200 Subject: [PATCH] Remove more placeholders, again and again --- tests/draw/test_absolute.py | 52 +++++++++++++++++++++++++++++++++++++ weasyprint/layout/block.py | 8 +++--- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/tests/draw/test_absolute.py b/tests/draw/test_absolute.py index b25e498db..61ebda7e0 100644 --- a/tests/draw/test_absolute.py +++ b/tests/draw/test_absolute.py @@ -399,6 +399,58 @@ def test_absolute_split_11(assert_pixels): ''') +@assert_no_logs +def test_absolute_split_12(assert_pixels): + assert_pixels(''' + BBBBBB__ + BBBBBB__ + ________ + ________ + ________ + ________ + ________ + ________ + BB______ + BB______ + BBRR____ + BBRR____ + BBRRRR__ + BBRRRR__ + BBRRRRRR + BBRRRRRR + ''', ''' + + aaa +
+ a +
x
xx
xxx
+
+ a
+ a
+ a +
+ ''') + + @pytest.mark.xfail @assert_no_logs def test_absolute_next_page(assert_pixels): diff --git a/weasyprint/layout/block.py b/weasyprint/layout/block.py index 2c352ef00..e9535f0b1 100644 --- a/weasyprint/layout/block.py +++ b/weasyprint/layout/block.py @@ -302,6 +302,7 @@ def _break_line(context, box, line, new_children, lines_iterator, if over_orphans < 0 and not page_is_empty: # Reached the bottom of the page before we had # enough lines for orphans, cancel the whole box. + remove_placeholders(context, line.children, absolute_boxes, fixed_boxes) return True, False, resume_at # How many lines we need on the next page to satisfy widows # -1 for the current line. @@ -313,6 +314,7 @@ def _break_line(context, box, line, new_children, lines_iterator, break if needed > over_orphans and not page_is_empty: # Total number of lines < orphans + widows + remove_placeholders(context, line.children, absolute_boxes, fixed_boxes) return True, False, resume_at if needed and needed <= over_orphans: # Remove lines to keep them for the next page @@ -765,10 +767,8 @@ def block_container_layout(context, box, bottom_space, skip_stack, if (box_is_fragmented and avoid_page_break(box.style['break_inside'], context) and not page_is_empty): - for footnote in all_footnotes: - context.unlayout_footnote(footnote) - return ( - None, None, {'break': 'any', 'page': None}, [], False, max_lines) + remove_placeholders(context, new_children, absolute_boxes, fixed_boxes) + return None, None, {'break': 'any', 'page': None}, [], False, max_lines for key, value in broken_out_of_flow.items(): context.broken_out_of_flow[key] = value