Skip to content

Commit 23cfc77

Browse files
committed
Draw background behind absolutely positioned replaced boxes
1 parent ff3b417 commit 23cfc77

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

tests/draw/test_absolute.py

+23
Original file line numberDiff line numberDiff line change
@@ -770,3 +770,26 @@ def test_fixed_in_inline(assert_pixels):
770770
</style>
771771
<p>a a</p> a a <div>a</div>
772772
''')
773+
774+
775+
@assert_no_logs
776+
def test_absolute_image_background(assert_pixels):
777+
assert_pixels('''
778+
____
779+
_RBB
780+
_BBB
781+
_BBB
782+
''', '''
783+
<style>
784+
@page {
785+
size: 4px;
786+
}
787+
img {
788+
background: blue;
789+
position: absolute;
790+
top: 1px;
791+
left: 1px;
792+
}
793+
</style>
794+
<img src="pattern-transparent.svg" />
795+
''')
+3
Loading

weasyprint/draw.py

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def draw_stacking_context(stream, stacking_context):
156156
# Point 7
157157
for block in [box] + stacking_context.blocks_and_cells:
158158
if isinstance(block, boxes.ReplacedBox):
159+
draw_background(stream, block.background)
159160
draw_border(stream, block)
160161
draw_replacedbox(stream, block)
161162
elif block.children:

0 commit comments

Comments
 (0)