1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 07:57:52 +03:00

Fix crash with borders whose widths are in em

Fix #1378.
This commit is contained in:
Guillaume Ayoub 2021-06-13 08:07:18 +02:00
parent c0c9879bc5
commit 23dbd70c1f
2 changed files with 9 additions and 2 deletions

View File

@ -92,6 +92,13 @@ def test_small_borders_2():
HTML(string=html % style).write_pdf()
@assert_no_logs
def test_em_borders():
# Regression test for https://github.com/Kozea/WeasyPrint/issues/1378
html = '<body style="border: 1em solid">'
HTML(string=html).write_pdf()
@assert_no_logs
def test_margin_boxes():
assert_pixels('margin_boxes', 15, 15, '''

View File

@ -386,8 +386,8 @@ def background_size(style, name, values):
@register_computer('outline-width')
def border_width(style, name, value):
"""Compute the ``border-*-width`` properties."""
style = style[name.replace('width', 'style')]
if style in ('none', 'hidden'):
border_style = style[name.replace('width', 'style')]
if border_style in ('none', 'hidden'):
return 0
if value in BORDER_WIDTH_KEYWORDS: