Skip to content

Commit

Permalink
Don’t use absolute parent’s skip stack to render absolute child
Browse files Browse the repository at this point in the history
Related to #2134.
  • Loading branch information
liZe committed May 11, 2024
1 parent 05a9ad2 commit ed249da
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
51 changes: 51 additions & 0 deletions tests/draw/test_absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,3 +793,54 @@ def test_absolute_image_background(assert_pixels):
</style>
<img src="pattern-transparent.svg" />
''')


@assert_no_logs
def test_absolute_in_absolute_break(assert_pixels):
# Test regression: https://github.com/Kozea/WeasyPrint/issues/2134
assert_pixels('''
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
BBBB
RRRR
RRRR
RRRR
RRRR
RRRR
____
____
____
''', '''
<style>
@page {
size: 4px 5px;
}
body {
font-size: 2px;
line-height: 1;
}
div {
position: absolute;
width: 100%;
}
</style>
<div style="background: blue">
<br><br><br><br>
<div style="background: red">
<br><br>
</div>
</div>
<br><br><br><br><br><br><br>
''')
2 changes: 1 addition & 1 deletion weasyprint/layout/absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def absolute_block(context, box, containing_block, fixed_boxes, bottom_space,
for child_placeholder in absolute_boxes:
absolute_layout(
context, child_placeholder, new_box, fixed_boxes, bottom_space,
skip_stack)
skip_stack=None)

if translate_box_width:
translate_x -= new_box.width
Expand Down

0 comments on commit ed249da

Please sign in to comment.