@@ -20,7 +20,8 @@ def get_box_model(
2020 styles : StylesBase ,
2121 container : Size ,
2222 viewport : Size ,
23- fraction_unit : Fraction ,
23+ width_fraction : Fraction ,
24+ height_fraction : Fraction ,
2425 get_content_width : Callable [[Size , Size ], int ],
2526 get_content_height : Callable [[Size , Size , int ], int ],
2627) -> BoxModel :
@@ -30,6 +31,8 @@ def get_box_model(
3031 styles (StylesBase): Styles object.
3132 container (Size): The size of the widget container.
3233 viewport (Size): The viewport size.
34+ width_fraction (Fraction): A fraction used for 1 `fr` unit on the width dimension.
35+ height_fraction (Fraction):A fraction used for 1 `fr` unit on the height dimension.
3336 get_auto_width (Callable): A callable which accepts container size and parent size and returns a width.
3437 get_auto_height (Callable): A callable which accepts container size and parent size and returns a height.
3538
@@ -63,22 +66,22 @@ def get_box_model(
6366 # An explicit width
6467 styles_width = styles .width
6568 content_width = styles_width .resolve_dimension (
66- sizing_container - styles .margin .totals , viewport , fraction_unit
69+ sizing_container - styles .margin .totals , viewport , width_fraction
6770 )
6871 if is_border_box and styles_width .excludes_border :
6972 content_width -= gutter .width
7073
7174 if styles .min_width is not None :
7275 # Restrict to minimum width, if set
7376 min_width = styles .min_width .resolve_dimension (
74- content_container , viewport , fraction_unit
77+ content_container , viewport , width_fraction
7578 )
7679 content_width = max (content_width , min_width )
7780
7881 if styles .max_width is not None :
7982 # Restrict to maximum width, if set
8083 max_width = styles .max_width .resolve_dimension (
81- content_container , viewport , fraction_unit
84+ content_container , viewport , width_fraction
8285 )
8386 if is_border_box :
8487 max_width -= gutter .width
@@ -98,22 +101,22 @@ def get_box_model(
98101 styles_height = styles .height
99102 # Explicit height set
100103 content_height = styles_height .resolve_dimension (
101- sizing_container - styles .margin .totals , viewport , fraction_unit
104+ sizing_container - styles .margin .totals , viewport , height_fraction
102105 )
103106 if is_border_box and styles_height .excludes_border :
104107 content_height -= gutter .height
105108
106109 if styles .min_height is not None :
107110 # Restrict to minimum height, if set
108111 min_height = styles .min_height .resolve_dimension (
109- content_container , viewport , fraction_unit
112+ content_container , viewport , height_fraction
110113 )
111114 content_height = max (content_height , min_height )
112115
113116 if styles .max_height is not None :
114117 # Restrict maximum height, if set
115118 max_height = styles .max_height .resolve_dimension (
116- content_container , viewport , fraction_unit
119+ content_container , viewport , height_fraction
117120 )
118121 content_height = min (content_height , max_height )
119122
0 commit comments