Fix replaced_max_content_width

Related to #576.
This commit is contained in:
Guillaume Ayoub 2018-02-22 18:28:38 +01:00
parent 19342fb93f
commit e20616575d
1 changed files with 3 additions and 0 deletions

View File

@ -640,6 +640,9 @@ def replaced_max_content_width(box, outer=True):
width, _ = default_image_sizing(
iwidth, iheight, image.intrinsic_ratio, 'auto', height,
default_width=300, default_height=150)
elif box.style['width'].unit == '%':
# See https://drafts.csswg.org/css-sizing/#intrinsic-contribution
width = 0
else:
assert width.unit == 'px'
width = width.value