diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-08-07 13:00:28 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-08-07 13:00:28 +0000 |
commit | b0cc93800ab0a94369d3519d7347983117b48ba7 (patch) | |
tree | 6b5901a4b110075036882087fae0e447953cd5f1 /render | |
parent | 2261b616f61e6701b381d6e363e14431f321f843 (diff) | |
download | netsurf-b0cc93800ab0a94369d3519d7347983117b48ba7.tar.gz netsurf-b0cc93800ab0a94369d3519d7347983117b48ba7.tar.bz2 |
Slightly more useful vertical alignment.
svn path=/trunk/netsurf/; revision=9100
Diffstat (limited to 'render')
-rw-r--r-- | render/layout.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/render/layout.c b/render/layout.c index 1189c0668..58c970745 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2458,14 +2458,32 @@ bool layout_line(struct box *first, int *width, int *y, assert(b != first || (move_y && 0 < used_height && (left || right))); - /* align baselines of all text boxes by moving their y so that their - * 0.75 point is aligned */ + /* handle vertical-align by adjusting box y values */ + /** \todo proper vertical alignment handling */ for (d = first; d != b; d = d->next) { if ((d->type == BOX_INLINE && d->inline_end) || d->type == BOX_BR || d->type == BOX_TEXT || d->type == BOX_INLINE_END) { - d->y += 0.75 * (used_height - d->height); + css_fixed value = 0; + css_unit unit = CSS_UNIT_PX; + switch (css_computed_vertical_align(d->style, &value, + &unit)) { + case CSS_VERTICAL_ALIGN_SUPER: + case CSS_VERTICAL_ALIGN_TOP: + case CSS_VERTICAL_ALIGN_TEXT_TOP: + /* already at top */ + break; + case CSS_VERTICAL_ALIGN_SUB: + case CSS_VERTICAL_ALIGN_BOTTOM: + case CSS_VERTICAL_ALIGN_TEXT_BOTTOM: + d->y += used_height - d->height; + break; + default: + case CSS_VERTICAL_ALIGN_BASELINE: + d->y += 0.75 * (used_height - d->height); + break; + } } } |