Skip to content

Commit

Permalink
Fix default vertical position of out-of-flow split elements
Browse files Browse the repository at this point in the history
Fix #1673.
  • Loading branch information
liZe committed Jul 7, 2022
1 parent 76d174f commit 9ce6547
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions tests/draw/test_float.py
Expand Up @@ -659,3 +659,42 @@ def test_float_split_10(assert_pixels):
<div>bbbbb bbbbb</div>
<div class="split">aa aa</div>
<div>bbb bbb</div>''')


@assert_no_logs
def test_float_split_11(assert_pixels):
assert_pixels('''
________________
_BBBBBBBBBB_____
_BBBBBBBBBB_____
_BBBBBBBBBB_____
_BBBBBBBBBB_____
________________
________________
________________
_BBBB___________
_BBBB___________
_rrrrrrrrrrrrrr_
_rrrrrrrrrrrrrr_
________________
________________
''', '''
<style>
@font-face {src: url(weasyprint.otf); font-family: weasyprint}
@page {
margin: 1px;
size: 16px 7px;
}
body {
color: red;
font-family: weasyprint;
font-size: 2px;
line-height: 1;
}
div.split {
color: blue;
float: right;
}
</style>
<div class="split">aaaaa aaaaa aa</div>
bbbbbbb''')
2 changes: 1 addition & 1 deletion weasyprint/layout/page.py
Expand Up @@ -567,7 +567,7 @@ def make_page(context, root_box, page_type, resume_at, page_number,
out_of_flow_boxes = []
broken_out_of_flow = []
for box, containing_block, skip_stack in context.broken_out_of_flow:
box.position_y = 0
box.position_y = root_box.content_box_y()
if box.is_floated():
out_of_flow_box, out_of_flow_resume_at = float_layout(
context, box, containing_block, positioned_boxes,
Expand Down

0 comments on commit 9ce6547

Please sign in to comment.