@@ -2212,33 +2212,34 @@ def _resolve_extrema(
2212
2212
2213
2213
styles = self .styles
2214
2214
margin = styles .margin
2215
- is_border_box = styles .box_sizing == "border-box"
2216
- gutter = styles .gutter
2215
+ container -= margin .totals
2216
+ if styles .box_sizing == "border-box" :
2217
+ gutter_width , gutter_height = styles .gutter .totals
2218
+ else :
2219
+ gutter_width = gutter_height = 0
2217
2220
2218
2221
if styles .min_width is not None :
2219
- min_width = styles .min_width .resolve (
2220
- container - margin .totals , viewport , width_fraction
2222
+ min_width = (
2223
+ styles .min_width .resolve (container , viewport , width_fraction )
2224
+ - gutter_width
2221
2225
)
2222
- if is_border_box :
2223
- min_width -= gutter .width
2226
+
2224
2227
if styles .max_width is not None :
2225
- max_width = styles .max_width .resolve (
2226
- container - margin .totals , viewport , width_fraction
2228
+ max_width = (
2229
+ styles .max_width .resolve (container , viewport , width_fraction )
2230
+ - gutter_width
2227
2231
)
2228
- if is_border_box :
2229
- max_width -= gutter .width
2230
2232
if styles .min_height is not None :
2231
- min_height = styles .min_height .resolve (
2232
- container - margin .totals , viewport , height_fraction
2233
+ min_height = (
2234
+ styles .min_height .resolve (container , viewport , height_fraction )
2235
+ - gutter_height
2233
2236
)
2234
- if is_border_box :
2235
- min_height -= gutter .height
2237
+
2236
2238
if styles .max_height is not None :
2237
- max_height = styles .max_height .resolve (
2238
- container - margin .totals , viewport , height_fraction
2239
+ max_height = (
2240
+ styles .max_height .resolve (container , viewport , height_fraction )
2241
+ - gutter_height
2239
2242
)
2240
- if is_border_box :
2241
- max_height -= gutter .height
2242
2243
2243
2244
extrema = Extrema (min_width , max_width , min_height , max_height )
2244
2245
return extrema
0 commit comments