mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-04 07:57:52 +03:00
Resolve border-{...}-width used values during collapsed-borders conflict resolution
This commit is contained in:
parent
fd1dbc7d63
commit
0c9a6a1ec3
@ -96,9 +96,9 @@ def resolve_percentages(box, containing_block, main_flex_direction=None):
|
||||
# Used value == computed value
|
||||
for side in ('top', 'right', 'bottom', 'left'):
|
||||
prop = f'border_{side}_width'
|
||||
if collapse and f'collapse_{prop}' in box.style:
|
||||
setattr(box, prop, box.style[f'collapse_{prop}'])
|
||||
else:
|
||||
# border-{side}-width would have been resolved
|
||||
# during border conflict resolution for collapsed-borders
|
||||
if not (collapse and hasattr(box, prop)):
|
||||
setattr(box, prop, box.style[prop])
|
||||
|
||||
# Shrink *content* widths and heights according to box-sizing
|
||||
|
@ -149,13 +149,13 @@ def margin_width(box, width, left=True, right=True):
|
||||
|
||||
collapse = box.style['border_collapse'] == 'collapse'
|
||||
if left:
|
||||
if collapse and 'collapse_border_left_width' in box.style:
|
||||
width += box.style['collapse_border_left_width']
|
||||
if collapse and hasattr(box, 'border_left_width'):
|
||||
width += box.border_left_width
|
||||
else:
|
||||
width += box.style['border_left_width']
|
||||
if right:
|
||||
if collapse and 'collapse_border_right_width' in box.style:
|
||||
width += box.style['collapse_border_right_width']
|
||||
if collapse and hasattr(box, 'border_right_width'):
|
||||
width += box.border_right_width
|
||||
else:
|
||||
width += box.style['border_right_width']
|
||||
|
||||
|
@ -1080,7 +1080,8 @@ def collapse_table_borders(table):
|
||||
# the correct widths on each box. The actual border grid will be
|
||||
# painted separately.
|
||||
def set_transparent_border(box, side, twice_width):
|
||||
box.style[f'collapse_border_{side}_width'] = twice_width / 2
|
||||
prop = f'border_{side}_width'
|
||||
setattr(box, prop, twice_width / 2)
|
||||
|
||||
def remove_borders(box):
|
||||
set_transparent_border(box, 'top', 0)
|
||||
|
Loading…
Reference in New Issue
Block a user