Skip to content

Commit

Permalink
Draw background behind absolutely positioned replaced boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Oct 16, 2023
1 parent ff3b417 commit 23cfc77
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/draw/test_absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,26 @@ def test_fixed_in_inline(assert_pixels):
</style>
<p>a a</p> a a <div>a</div>
''')


@assert_no_logs
def test_absolute_image_background(assert_pixels):
assert_pixels('''
____
_RBB
_BBB
_BBB
''', '''
<style>
@page {
size: 4px;
}
img {
background: blue;
position: absolute;
top: 1px;
left: 1px;
}
</style>
<img src="pattern-transparent.svg" />
''')
3 changes: 3 additions & 0 deletions tests/resources/pattern-transparent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions weasyprint/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def draw_stacking_context(stream, stacking_context):
# Point 7
for block in [box] + stacking_context.blocks_and_cells:
if isinstance(block, boxes.ReplacedBox):
draw_background(stream, block.background)
draw_border(stream, block)
draw_replacedbox(stream, block)
elif block.children:
Expand Down

0 comments on commit 23cfc77

Please sign in to comment.