def block_replaced_box_layout(context, box, containing_block):
    """Lay out the block :class:`boxes.ReplacedBox` ``box``."""
    from .block import block_level_width
    from .float import avoid_collisions

    box = box.copy()
    if box.style['width'] == box.style['height'] == 'auto':
        computed_margins = box.margin_left, box.margin_right
        block_replaced_width.without_min_max(
            box, containing_block)
        replaced_box_height.without_min_max(box)
        min_max_auto_replaced(box)
        box.margin_left, box.margin_right = computed_margins
        block_level_width.without_min_max(box, containing_block)
    else:
        block_replaced_width(box, containing_block)
        replaced_box_height(box)

    # Don't collide with floats
    # https://www.w3.org/TR/CSS21/visuren.html#floats
    box.position_x, box.position_y, _ = avoid_collisions(
        context, box, containing_block, outer=False)
    resume_at = None
    next_page = {'break': 'any', 'page': None}
    adjoining_margins = []
    collapsing_through = False
    return box, resume_at, next_page, adjoining_margins, collapsing_through
Lay out the block :class:`boxes.ReplacedBox` ``box``.
weasyprint/layout/replaced.py