diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2010-04-27 12:02:12 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2010-04-27 12:02:12 +0000 |
commit | 4d67ca25a7a9cd24fe338a6a3b44114c5302d846 (patch) | |
tree | d08d7f4d681e0b2cb88e4994553a1648af07b9a2 | |
parent | 0de2013f253923a413ed80e1935a149eeea1a8c1 (diff) | |
download | netsurf-4d67ca25a7a9cd24fe338a6a3b44114c5302d846.tar.gz netsurf-4d67ca25a7a9cd24fe338a6a3b44114c5302d846.tar.bz2 |
Fix vertical placement of absolute positioned inlines using staic position. Simplify placement of inlines on a line.
svn path=/trunk/netsurf/; revision=10495
-rw-r--r-- | render/layout.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/render/layout.c b/render/layout.c index 37af1c2f7..45bcaa295 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2488,27 +2488,38 @@ bool layout_line(struct box *first, int *width, int *y, for (d = first; d != b; d = d->next) { d->inline_new_line = false; - if (d->type == BOX_INLINE || d->type == BOX_BR || + + if (d->type == BOX_INLINE_BLOCK && + (css_computed_position(d->style) == + CSS_POSITION_ABSOLUTE || + css_computed_position(d->style) == + CSS_POSITION_FIXED)) { + /* positioned inline-blocks: + * set static position (x,y) only, rest of positioning + * is handled later */ + d->x += x0; + d->y = *y; + continue; + } + else if ((d->type == BOX_INLINE && + ((d->object || d->gadget) == false)) || + d->type == BOX_BR || d->type == BOX_TEXT || d->type == BOX_INLINE_END) { + /* regular inlines */ d->x += x0; d->y = *y - d->padding[TOP]; + + if (d->type == BOX_TEXT && d->height > used_height) { + /* text */ + used_height = d->height; + } } - if ((d->type == BOX_INLINE && (d->object || d->gadget)) || + else if ((d->type == BOX_INLINE && (d->object || d->gadget)) || d->type == BOX_INLINE_BLOCK) { - d->y = *y + d->border[TOP].width + d->margin[TOP]; - } - if (d->type == BOX_INLINE_BLOCK) { + /* replaced inlines and inline-blocks */ d->x += x0; - } - if (d->type == BOX_INLINE_BLOCK && - (css_computed_position(d->style) == - CSS_POSITION_ABSOLUTE || - css_computed_position(d->style) == - CSS_POSITION_FIXED)) - continue; - if ((d->type == BOX_INLINE && (d->object || d->gadget)) || - d->type == BOX_INLINE_BLOCK) { + d->y = *y + d->border[TOP].width + d->margin[TOP]; h = d->margin[TOP] + d->border[TOP].width + d->padding[TOP] + d->height + d->padding[BOTTOM] + @@ -2517,9 +2528,6 @@ bool layout_line(struct box *first, int *width, int *y, if (used_height < h) used_height = h; } - if (d->type == BOX_TEXT && d->height > used_height) - used_height = d->height; - } first->inline_new_line = true; |