@@ -1098,14 +1098,18 @@ def _get_box_model(
10981098
10991099 if styles .min_width is not None :
11001100 # Restrict to minimum width, if set
1101- min_width = styles .min_width .resolve (container , viewport , width_fraction )
1101+ min_width = styles .min_width .resolve (
1102+ container - margin .totals , viewport , width_fraction
1103+ )
11021104 if is_border_box :
11031105 min_width -= gutter .width
11041106 content_width = max (content_width , min_width , Fraction (0 ))
11051107
11061108 if styles .max_width is not None :
11071109 # Restrict to maximum width, if set
1108- max_width = styles .max_width .resolve (container , viewport , width_fraction )
1110+ max_width = styles .max_width .resolve (
1111+ container - margin .totals , viewport , width_fraction
1112+ )
11091113 if is_border_box :
11101114 max_width -= gutter .width
11111115 content_width = min (content_width , max_width )
@@ -1138,14 +1142,18 @@ def _get_box_model(
11381142
11391143 if styles .min_height is not None :
11401144 # Restrict to minimum height, if set
1141- min_height = styles .min_height .resolve (container , viewport , height_fraction )
1145+ min_height = styles .min_height .resolve (
1146+ container - margin .totals , viewport , height_fraction
1147+ )
11421148 if is_border_box :
11431149 min_height -= gutter .height
11441150 content_height = max (content_height , min_height , Fraction (0 ))
11451151
11461152 if styles .max_height is not None :
11471153 # Restrict maximum height, if set
1148- max_height = styles .max_height .resolve (container , viewport , height_fraction )
1154+ max_height = styles .max_height .resolve (
1155+ container - margin .totals , viewport , height_fraction
1156+ )
11491157 if is_border_box :
11501158 max_height -= gutter .height
11511159 content_height = min (content_height , max_height )
0 commit comments