diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-01-21 23:01:59 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-01-21 23:01:59 +0000 |
commit | 4c40bbc0962d8ac5800a374ed19fbb261dd329c6 (patch) | |
tree | 5d3e0ea90e063f9a266bc5f22f19c4b61b5ad7e7 /render | |
parent | 9134956efe86b99abed3740fdd8c2caf7874dbf8 (diff) | |
download | netsurf-4c40bbc0962d8ac5800a374ed19fbb261dd329c6.tar.gz netsurf-4c40bbc0962d8ac5800a374ed19fbb261dd329c6.tar.bz2 |
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
Diffstat (limited to 'render')
-rw-r--r-- | render/layout.c | 13 |
1 files changed, 12 insertions, 1 deletions
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) |