From 4d67ca25a7a9cd24fe338a6a3b44114c5302d846 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 27 Apr 2010 12:02:12 +0000 Subject: [PATCH] Fix vertical placement of absolute positioned inlines using staic position. Simplify placement of inlines on a line. svn path=/trunk/netsurf/; revision=10495 --- render/layout.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 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 || - d->type == BOX_TEXT || - d->type == BOX_INLINE_END) { - d->x += x0; - d->y = *y - d->padding[TOP]; - } - 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) { - 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)) + 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; - if ((d->type == BOX_INLINE && (d->object || d->gadget)) || + } + 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; + } + } + else if ((d->type == BOX_INLINE && (d->object || d->gadget)) || d->type == BOX_INLINE_BLOCK) { + /* replaced inlines and inline-blocks */ + d->x += x0; + 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;