Skip to content

Commit

Permalink
Calculate margin width using collapse_border_{left,right}_width for c…
Browse files Browse the repository at this point in the history
…ollapsed-borders mode
  • Loading branch information
kygoh committed May 25, 2023
1 parent 800a683 commit d87034f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions weasyprint/layout/preferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,15 @@ def margin_width(box, width, left=True, right=True):
percentages += style_value.value

if left:
width += box.style['border_left_width']
if box.style['border_collapse'] and 'collapse_border_left_width' in box.style:
width += box.style['collapse_border_left_width']
else:
width += box.style['border_left_width']
if right:
width += box.style['border_right_width']
if box.style['border_collapse'] and 'collapse_border_right_width' in box.style:
width += box.style['collapse_border_right_width']
else:
width += box.style['border_right_width']

if percentages < 100:
return width / (1 - percentages / 100)
Expand Down

0 comments on commit d87034f

Please sign in to comment.