From 4c40bbc0962d8ac5800a374ed19fbb261dd329c6 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 21 Jan 2009 23:01:59 +0000 Subject: Fix placement of tables in normal flow next to floats. This stops big blank gaps appearing e.g. at the top of wikipedia articles, on some google search results and on amazon product pages. svn path=/trunk/netsurf/; revision=6162 --- render/layout.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index 1c8220385..54e1b17d2 100644 --- a/render/layout.c +++ b/render/layout.c @@ -344,7 +344,16 @@ bool layout_block_context(struct box *block, struct content *content) layout_block_add_scrollbar(box, RIGHT); layout_block_add_scrollbar(box, BOTTOM); } else if (box->type == BOX_TABLE) { - if (!layout_table(box, box->parent->width, content)) + if (box->style->width.width == CSS_WIDTH_AUTO) { + int x0, x1; + struct box *left, *right; + x0 = cx; + x1 = cx + box->parent->width; + find_sides(block->float_children, cy, cy, + &x0, &x1, &left, &right); + available_width = x1 - x0 > 0 ? x1 - x0 : 0; + } + if (!layout_table(box, available_width, content)) return false; layout_solve_width(box->parent->width, box->width, -1, -1, box->margin, box->padding, @@ -438,6 +447,8 @@ bool layout_block_context(struct box *block, struct content *content) find_sides(block->float_children, y, y + box->height, &x0, &x1, &left, &right); + if (box->style->width.width == CSS_WIDTH_AUTO) + break; if (box->width <= x1 - x0) break; if (!left && !right) -- cgit v1.2.3