diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-01-18 23:41:48 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-01-18 23:41:48 +0000 |
commit | 20120a8acf810aa371393f28a8755df183055f27 (patch) | |
tree | 0c2a077a83e53f5c0804c4714613ca456b5b1efc /render | |
parent | ddd59deaf22c7b8e834f695b40540c235d0725b9 (diff) | |
download | netsurf-20120a8acf810aa371393f28a8755df183055f27.tar.gz netsurf-20120a8acf810aa371393f28a8755df183055f27.tar.bz2 |
Make blocks which establish a new block formatting context use have the correct width and position to avoid overlapping floats. Fixes the main problem on the amazon.co.uk front page.
svn path=/trunk/netsurf/; revision=6142
Diffstat (limited to 'render')
-rw-r--r-- | render/layout.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/render/layout.c b/render/layout.c index e3b1c3bdd..9fda32dad 100644 --- a/render/layout.c +++ b/render/layout.c @@ -364,9 +364,26 @@ bool layout_block_context(struct box *block, struct content *content) * establishes a new block context. */ if (box->type == BOX_BLOCK && box->style && box->style->overflow != CSS_OVERFLOW_VISIBLE) { + int x0, x1; + struct box *left, *right; + cy += max_pos_margin - max_neg_margin; box->y += max_pos_margin - max_neg_margin; + /* Before calling layout_block_context, find the + * available width */ + x0 = cx; + x1 = cx + box->parent->width; + find_sides(block->float_children, cy, cy, &x0, &x1, + &left, &right); + box->x += x0 - cx; + x1 = box->parent->width - x1 + x0; + if (box->width - x1 > 0) + box->width -= x1; + else + box->width = 0; + cx = x0; + layout_block_context(box, content); if (box->type == BOX_BLOCK || box->object) |