mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 00:21:15 +03:00
Accept vertical-align: top and bottom but interpret them as text-top/bottom.
This commit is contained in:
parent
ef711d45fe
commit
7d70ff44de
@ -449,10 +449,8 @@ def vertical_align(value):
|
||||
if is_dimension_or_percentage(value, negative=True):
|
||||
return value
|
||||
keyword = get_keyword(value)
|
||||
if keyword in ('top', 'bottom'):
|
||||
raise InvalidValues('value not supported yet')
|
||||
if keyword in ('baseline', 'middle', 'sub', 'super',
|
||||
'text-top', 'text-bottom'):
|
||||
'text-top', 'text-bottom', 'top', 'bottom'):
|
||||
return keyword
|
||||
|
||||
|
||||
|
@ -489,12 +489,13 @@ def inline_box_verticality(box, baseline_y):
|
||||
one_ex = box.style.font_size * 0.5
|
||||
top = baseline_y - (one_ex + child.margin_height()) / 2.
|
||||
child_baseline_y = top + child.baseline
|
||||
elif vertical_align == 'text-top':
|
||||
# TODO: actually implement vertical-align: top and bottom
|
||||
elif vertical_align in ('text-top', 'top'):
|
||||
# align top with the top of the parent’s content area
|
||||
top = (baseline_y - box.baseline + box.margin_top +
|
||||
box.border_top_width + box.padding_top)
|
||||
child_baseline_y = top + child.baseline
|
||||
elif vertical_align == 'text-bottom':
|
||||
elif vertical_align in ('text-bottom', 'bottom'):
|
||||
# align bottom with the bottom of the parent’s content area
|
||||
bottom = (baseline_y - box.baseline + box.margin_top +
|
||||
box.border_top_width + box.padding_top + box.height)
|
||||
|
Loading…
Reference in New Issue
Block a user