diff --git a/weasyprint/layout/blocks.py b/weasyprint/layout/blocks.py index 7c8dc0e3c..942a5aa56 100644 --- a/weasyprint/layout/blocks.py +++ b/weasyprint/layout/blocks.py @@ -143,6 +143,7 @@ def block_replaced_width(box, containing_block, device_size): def block_replaced_box_layout(box, containing_block, device_size): """Lay out the block :class:`boxes.ReplacedBox` ``box``.""" + box = box.copy() if box.style['width'] == 'auto' and box.style['height'] == 'auto': computed_margins = box.margin_left, box.margin_right block_replaced_width.without_min_max( diff --git a/weasyprint/layout/inlines.py b/weasyprint/layout/inlines.py index 9e4375232..4381bae35 100644 --- a/weasyprint/layout/inlines.py +++ b/weasyprint/layout/inlines.py @@ -482,6 +482,7 @@ def atomic_box(context, box, position_x, skip_stack, containing_block, device_size, absolute_boxes, fixed_boxes): """Compute the width and the height of the atomic ``box``.""" if isinstance(box, boxes.ReplacedBox): + box = box.copy() if getattr(box, 'is_list_marker', False): image_marker_layout(box) else: diff --git a/weasyprint/tests/test_draw/test_image.py b/weasyprint/tests/test_draw/test_image.py index fab55bd86..facc68a34 100644 --- a/weasyprint/tests/test_draw/test_image.py +++ b/weasyprint/tests/test_draw/test_image.py @@ -72,6 +72,25 @@ _ + _ + _ + _ + _ + _ + _ + _, _ + _ + _ + _ + _ + _ + _ + _, ] +table = [ + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + r + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + + _ + _ + r + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + B + B + B + B + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, + _ + _ + _ + _ + _ + _ + _ + _, +] @assert_no_logs @@ -198,6 +217,52 @@ def test_images_page_break():
''') +@assert_no_logs +def test_image_repeat_inline(): + # Test regression: https://github.com/Kozea/WeasyPrint/issues/808 + assert_pixels('image_page_repeat_inline', 8, 2 * 8, table, ''' + + + + + + + + + +
''') + + +@assert_no_logs +def test_image_repeat_block(): + # Test regression: https://github.com/Kozea/WeasyPrint/issues/808 + assert_pixels('image_page_repeat_block', 8, 2 * 8, table, ''' + + + + + + + + + +
''') + + @assert_no_logs def test_images_padding(): # Regression test: padding used to be ignored on images