From 3594651a6bdd43626e3b6490adc19327697ff411 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 22 Jan 2009 15:39:06 +0000 Subject: Handle clear before working out available width for tables and blocks that cause a new block formatting context. svn path=/trunk/netsurf/; revision=6174 --- render/layout.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index 54e1b17d2..afb841c99 100644 --- a/render/layout.c +++ b/render/layout.c @@ -319,6 +319,12 @@ bool layout_block_context(struct box *block, struct content *content) goto advance_to_next_box; } + /* Clearance. */ + y = 0; + if (box->style && box->style->clear != CSS_CLEAR_NONE) + y = layout_clear(block->float_children, + box->style->clear); + inset = 0; available_width = box->parent->width; if (box->type == BOX_BLOCK || box->object) { @@ -328,11 +334,12 @@ bool layout_block_context(struct box *block, struct content *content) /* box establishes new block formatting context * so available width may be diminished due to * floats. */ - int x0, x1; + int x0, x1, top; struct box *left, *right; + top = cy > y ? cy : y; x0 = cx; x1 = cx + box->parent->width; - find_sides(block->float_children, cy, cy, + find_sides(block->float_children, top, top, &x0, &x1, &left, &right); inset = x0 - cx; if (box->style->width.width == CSS_WIDTH_AUTO) { @@ -345,11 +352,12 @@ bool layout_block_context(struct box *block, struct content *content) layout_block_add_scrollbar(box, BOTTOM); } else if (box->type == BOX_TABLE) { if (box->style->width.width == CSS_WIDTH_AUTO) { - int x0, x1; + int x0, x1, top; struct box *left, *right; + top = cy > y ? cy : y; x0 = cx; x1 = cx + box->parent->width; - find_sides(block->float_children, cy, cy, + find_sides(block->float_children, top, top, &x0, &x1, &left, &right); available_width = x1 - x0 > 0 ? x1 - x0 : 0; } @@ -372,12 +380,6 @@ bool layout_block_context(struct box *block, struct content *content) else if (max_neg_margin < -box->margin[TOP]) max_neg_margin = -box->margin[TOP]; - /* Clearance. */ - y = 0; - if (box->style && box->style->clear != CSS_CLEAR_NONE) - y = layout_clear(block->float_children, - box->style->clear); - if (box->type != BOX_BLOCK || y || box->border[TOP] || box->padding[TOP]) { margin_box->y += max_pos_margin - max_neg_margin; -- cgit v1.2.3