Conversion pipeline: Handle elements with percentage sizes that are children of zero size parents correctly. Fixes #6155 (error converting epub to mobi)

This commit is contained in:
Kovid Goyal 2010-07-17 17:56:14 -06:00
parent ed5b45164b
commit 9825a47254

View File

@ -475,7 +475,8 @@ class Style(object):
value = float(m.group(1)) value = float(m.group(1))
unit = m.group(2) unit = m.group(2)
if unit == '%': if unit == '%':
base = base or self.width if base is None:
base = self.width
result = (value / 100.0) * base result = (value / 100.0) * base
elif unit == 'px': elif unit == 'px':
result = value * 72.0 / self._profile.dpi result = value * 72.0 / self._profile.dpi