Skip to content

Commit dfb0b51

Browse files
committed
Force to render empty container when floats break
Related to #2571.
1 parent cca36cf commit dfb0b51

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

tests/draw/test_float.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,3 +905,55 @@ def test_float_split_clear_empty(assert_pixels):
905905
</style>
906906
<div>bb bb bb bb bb</div>
907907
<article></article>''')
908+
909+
910+
@assert_no_logs
911+
def test_float_split_large_parent(assert_pixels):
912+
assert_pixels('''
913+
BBBB
914+
BBBB
915+
BBBB
916+
BBBB
917+
GGGG
918+
919+
BBBB
920+
BBBB
921+
BBBB
922+
BBBB
923+
GGGG
924+
925+
BBBB
926+
BBBB
927+
GGGG
928+
GGGG
929+
GGGG
930+
931+
rrrr
932+
rrrr
933+
GGGG
934+
GGGG
935+
GGGG
936+
''', '''
937+
<style>
938+
@page {
939+
size: 4px 5px;
940+
}
941+
body {
942+
color: red;
943+
font: 2px / 1 weasyprint;
944+
}
945+
section {
946+
background: lime;
947+
height: 100px;
948+
}
949+
div {
950+
color: blue;
951+
float: left;
952+
}
953+
article {
954+
clear: left;
955+
}
956+
</style>
957+
<section>
958+
<div>bb bb bb bb bb</div>
959+
<article>aa</article>''')

weasyprint/layout/page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def make_page(context, root_box, page_type, resume_at, page_number,
667667
parent.force_fragmentation = True
668668
root_box, _, _, _, _, _ = block_level_layout(
669669
context, initial_root_box, 0, initial_resume_at, initial_containing_block,
670-
page_is_empty, positioned_boxes, positioned_boxes, adjoining_margins)
670+
True, positioned_boxes, positioned_boxes, adjoining_margins)
671671
resume_at = initial_resume_at
672672
root_box.children = out_of_flow_boxes + root_box.children
673673

0 commit comments

Comments
 (0)