def replaced_min_content_width(box, outer=True):
    """Return the min-content width for an ``InlineReplacedBox``."""
    width = box.style['width']
    if width == 'auto':
        height = box.style['height']
        if height == 'auto' or height.unit == '%':
            height = 'auto'
        else:
            assert height.unit == 'px'
            height = height.value
        if (box.style['max_width'] != 'auto' and
                box.style['max_width'].unit == '%'):
            # See https://drafts.csswg.org/css-sizing/#intrinsic-contribution
            width = 0
        else:
            image = box.replacement
            intrinsic_width, intrinsic_height, intrinsic_ratio = (
                image.get_intrinsic_size(
                    box.style['image_resolution'], box.style['font_size']))
            if intrinsic_ratio and not intrinsic_width and not intrinsic_height:
                width = 0
            else:
                width, _ = default_image_sizing(
                    intrinsic_width, intrinsic_height, intrinsic_ratio, 'auto',
                    height, default_width=300, default_height=150)
    elif box.style['width'].unit == '%':
        # See https://drafts.csswg.org/css-sizing/#intrinsic-contribution
        width = 0
    else:
        assert width.unit == 'px'
        width = width.value
    return adjust(box, outer, width)
Return the min-content width for an ``InlineReplacedBox``.
weasyprint/layout/preferred.py