def max_content_width(context, box, outer=True):
    """Return the max-content width for ``box``.

    This is the width by only breaking at forced line breaks.

    """
    if box.is_table_wrapper:
        return table_and_columns_preferred_widths(context, box, outer)[1]
    elif isinstance(box, boxes.TableCellBox):
        return table_cell_min_max_content_width(context, box, outer)[1]
    elif isinstance(box, (boxes.BlockContainerBox, boxes.TableColumnBox)):
        return block_max_content_width(context, box, outer)
    elif isinstance(box, boxes.TableColumnGroupBox):
        return column_group_content_width(context, box)
    elif isinstance(box, (boxes.InlineBox, boxes.LineBox)):
        return inline_max_content_width(context, box, outer, is_line_start=True)
    elif isinstance(box, boxes.ReplacedBox):
        return replaced_max_content_width(box, outer)
    elif isinstance(box, boxes.FlexContainerBox):
        return flex_max_content_width(context, box, outer)
    elif isinstance(box, boxes.GridContainerBox):
        # TODO: Get real grid size.
        return block_max_content_width(context, box, outer)
    else:
        raise TypeError(f'max-content width for {type(box).__name__} not handled yet')
Return the max-content width for ``box``.

This is the width by only breaking at forced line breaks.
weasyprint/layout/preferred.py