def resolve_one_percentage(box, property_name, refer_to):
    """Set a used length value from a computed length value.

    ``refer_to`` is the length for 100%. If ``refer_to`` is not a number, it
    just replaces percentages.

    """
    # box.style has computed values
    value = box.style[property_name]
    # box attributes are used values
    percent = percentage(value, refer_to)
    setattr(box, property_name, percent)
    if property_name in ('min_width', 'min_height') and percent == 'auto':
        setattr(box, property_name, 0)
Set a used length value from a computed length value.

``refer_to`` is the length for 100%. If ``refer_to`` is not a number, it
just replaces percentages.
weasyprint/layout/percent.py