@@ -1071,18 +1071,14 @@ def _get_box_model(
10711071
10721072 # Container minus padding and border
10731073 content_container = container - gutter .totals
1074- # The container including the content
1075- sizing_container = content_container if is_border_box else container
10761074
10771075 if styles .width is None :
10781076 # No width specified, fill available space
10791077 content_width = Fraction (content_container .width - margin .width )
10801078 elif is_auto_width :
10811079 # When width is auto, we want enough space to always fit the content
10821080 content_width = Fraction (
1083- self .get_content_width (
1084- content_container - styles .margin .totals , viewport
1085- )
1081+ self .get_content_width (content_container - margin .totals , viewport )
10861082 )
10871083 if styles .scrollbar_gutter == "stable" and styles .overflow_x == "auto" :
10881084 content_width += styles .scrollbar_size_vertical
@@ -1095,15 +1091,15 @@ def _get_box_model(
10951091 # An explicit width
10961092 styles_width = styles .width
10971093 content_width = styles_width .resolve (
1098- sizing_container - styles . margin .totals , viewport , width_fraction
1094+ container - margin .totals , viewport , width_fraction
10991095 )
1100- if is_border_box and styles_width . excludes_border :
1096+ if is_border_box :
11011097 content_width -= gutter .width
11021098
11031099 if styles .min_width is not None :
11041100 # Restrict to minimum width, if set
11051101 min_width = styles .min_width .resolve (
1106- content_container , viewport , width_fraction
1102+ container - margin . totals , viewport , width_fraction
11071103 )
11081104 if is_border_box :
11091105 min_width -= gutter .width
@@ -1112,7 +1108,7 @@ def _get_box_model(
11121108 if styles .max_width is not None :
11131109 # Restrict to maximum width, if set
11141110 max_width = styles .max_width .resolve (
1115- content_container , viewport , width_fraction
1111+ container - margin . totals , viewport , width_fraction
11161112 )
11171113 if is_border_box :
11181114 max_width -= gutter .width
@@ -1139,15 +1135,15 @@ def _get_box_model(
11391135 styles_height = styles .height
11401136 # Explicit height set
11411137 content_height = styles_height .resolve (
1142- sizing_container - styles . margin .totals , viewport , height_fraction
1138+ container - margin .totals , viewport , height_fraction
11431139 )
1144- if is_border_box and styles_height . excludes_border :
1140+ if is_border_box :
11451141 content_height -= gutter .height
11461142
11471143 if styles .min_height is not None :
11481144 # Restrict to minimum height, if set
11491145 min_height = styles .min_height .resolve (
1150- content_container , viewport , height_fraction
1146+ container - margin . totals , viewport , height_fraction
11511147 )
11521148 if is_border_box :
11531149 min_height -= gutter .height
@@ -1156,7 +1152,7 @@ def _get_box_model(
11561152 if styles .max_height is not None :
11571153 # Restrict maximum height, if set
11581154 max_height = styles .max_height .resolve (
1159- content_container , viewport , height_fraction
1155+ container - margin . totals , viewport , height_fraction
11601156 )
11611157 if is_border_box :
11621158 max_height -= gutter .height
0 commit comments