Skip to content

Commit

Permalink
Store harmonized border-{...}-width in computed value collapse_border…
Browse files Browse the repository at this point in the history
…_{...}_width
  • Loading branch information
kygoh committed May 25, 2023
1 parent 4427d9f commit 9e59b20
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions weasyprint/formatting_structure/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,18 +1025,9 @@ def collapse_table_borders(table, grid_width, grid_height):
horizontal_borders = [[weak_null_border for x in range(grid_width)]
for y in range(grid_height + 1)]

def backup_border_width(box_style, side):
box_style[f'__border_{side}_width'] = box_style[f'border_{side}_width']

def restore_border_width(box_style, side):
if f'__border_{side}_width' in box_style:
box_style[f'border_{side}_width'] = \
box_style[f'__border_{side}_width']

def set_one_border(border_grid, box_style, side, grid_x, grid_y):
from ..draw import get_color

restore_border_width(box_style, side)
style = box_style[f'border_{side}_style']
width = box_style[f'border_{side}_width']
color = get_color(box_style, f'border_{side}_color')
Expand Down Expand Up @@ -1107,8 +1098,7 @@ def set_borders(box, x, y, w, h):
# the correct widths on each box. The actual border grid will be
# painted separately.
def set_transparent_border(box, side, twice_width):
backup_border_width(box.style, side)
box.style[f'border_{side}_width'] = twice_width / 2
box.style[f'collapse_border_{side}_width'] = twice_width / 2

def remove_borders(box):
set_transparent_border(box, 'top', 0)
Expand Down

0 comments on commit 9e59b20

Please sign in to comment.