Skip to content

Commit 9ce6547

Browse files
committed
Fix default vertical position of out-of-flow split elements
Fix #1673.
1 parent 76d174f commit 9ce6547

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

tests/draw/test_float.py

+39
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,42 @@ def test_float_split_10(assert_pixels):
659659
<div>bbbbb bbbbb</div>
660660
<div class="split">aa aa</div>
661661
<div>bbb bbb</div>''')
662+
663+
664+
@assert_no_logs
665+
def test_float_split_11(assert_pixels):
666+
assert_pixels('''
667+
________________
668+
_BBBBBBBBBB_____
669+
_BBBBBBBBBB_____
670+
_BBBBBBBBBB_____
671+
_BBBBBBBBBB_____
672+
________________
673+
________________
674+
________________
675+
_BBBB___________
676+
_BBBB___________
677+
_rrrrrrrrrrrrrr_
678+
_rrrrrrrrrrrrrr_
679+
________________
680+
________________
681+
''', '''
682+
<style>
683+
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
684+
@page {
685+
margin: 1px;
686+
size: 16px 7px;
687+
}
688+
body {
689+
color: red;
690+
font-family: weasyprint;
691+
font-size: 2px;
692+
line-height: 1;
693+
}
694+
div.split {
695+
color: blue;
696+
float: right;
697+
}
698+
</style>
699+
<div class="split">aaaaa aaaaa aa</div>
700+
bbbbbbb''')

weasyprint/layout/page.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def make_page(context, root_box, page_type, resume_at, page_number,
567567
out_of_flow_boxes = []
568568
broken_out_of_flow = []
569569
for box, containing_block, skip_stack in context.broken_out_of_flow:
570-
box.position_y = 0
570+
box.position_y = root_box.content_box_y()
571571
if box.is_floated():
572572
out_of_flow_box, out_of_flow_resume_at = float_layout(
573573
context, box, containing_block, positioned_boxes,

0 commit comments

Comments
 (0)