@@ -109,7 +109,7 @@ def _block_content_width(context, box, function, outer):
109109
110110 for value in ('padding_left' , 'padding_right' ):
111111 style_value = box .style [value ]
112- if style_value != 'auto' :
112+ if style_value != 'auto' and not check_math ( style_value ) :
113113 if style_value .unit .lower () == 'px' :
114114 width -= style_value .value
115115 else :
@@ -175,7 +175,7 @@ def margin_width(box, width, left=True, right=True):
175175 (['margin_right' , 'padding_right' ] if right else [])
176176 ):
177177 style_value = box .style [value ]
178- if style_value != 'auto' :
178+ if style_value != 'auto' and not check_math ( style_value ) :
179179 if style_value .unit .lower () == 'px' :
180180 width += style_value .value
181181 else :
@@ -263,7 +263,7 @@ def inline_max_content_width(context, box, outer=True, is_line_start=False):
263263def column_group_content_width (context , box ):
264264 """Return the *-content width for a ``TableColumnGroupBox``."""
265265 width = box .style ['width' ]
266- if width == 'auto' or width .unit == '%' :
266+ if width == 'auto' or check_math ( width ) or width .unit == '%' :
267267 width = 0
268268 else :
269269 assert width .unit .lower () == 'px'
@@ -597,21 +597,22 @@ def get_percentage_contribution(origin_cell, origin, max_content_width):
597597 # Define constrainedness
598598 constrainedness = [False for i in range (grid_width )]
599599 for i in range (grid_width ):
600- if (column_groups [i ] and column_groups [i ].style ['width' ] != 'auto' and
601- column_groups [i ].style ['width' ].unit != '%' ):
602- constrainedness [i ] = True
603- continue
604- if (columns [i ] and columns [i ].style ['width' ] != 'auto' and
605- columns [i ].style ['width' ].unit != '%' ):
606- constrainedness [i ] = True
607- continue
608- for cell in zipped_grid [i ]:
609- if (cell and cell .colspan == 1 and
610- cell .style ['width' ] != 'auto' and
611- not check_math (cell .style ['width' ]) and
612- cell .style ['width' ].unit != '%' ):
600+ if column_groups [i ]:
601+ width = column_groups [i ].style ['width' ]
602+ if width != 'auto' and not check_math (width ) and width .unit != '%' :
613603 constrainedness [i ] = True
614- break
604+ continue
605+ if columns [i ]:
606+ width = columns [i ].style ['width' ]
607+ if width != 'auto' and not check_math (width ) and width .unit != '%' :
608+ constrainedness [i ] = True
609+ continue
610+ for cell in zipped_grid [i ]:
611+ if cell and cell .colspan == 1 :
612+ width = cell .style ['width' ]
613+ if width != 'auto' and not check_math (width ) and width .unit != '%' :
614+ constrainedness [i ] = True
615+ break
615616
616617 intrinsic_percentages = [
617618 min (percentage , 100 - sum (intrinsic_percentages [:i ]))
0 commit comments