summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2009-01-22 15:39:06 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2009-01-22 15:39:06 +0000
commit3594651a6bdd43626e3b6490adc19327697ff411 (patch)
tree9ff4417ea73cd95693b87366c35eedcad0176b42
parent61489da9405ea5f3a2ea7fc8fe828f5296c1e0ea (diff)
downloadnetsurf-3594651a6bdd43626e3b6490adc19327697ff411.tar.gz
netsurf-3594651a6bdd43626e3b6490adc19327697ff411.tar.bz2
Handle clear before working out available width for tables and blocks that cause a new block formatting context.
svn path=/trunk/netsurf/; revision=6174
-rw-r--r--render/layout.c22
1 files changed, 12 insertions, 10 deletions
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;