summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-02-20 00:42:36 +0000
committerJames Bursa <james@netsurf-browser.org>2004-02-20 00:42:36 +0000
commit919805da51f243482475d06cce998c2c6390e9e2 (patch)
tree08bc085983ff43878bf78e1fd23ba3d051e6764b /render/layout.c
parent13925ef8d507d9206856a49975ab3eb26dbba9b8 (diff)
downloadnetsurf-919805da51f243482475d06cce998c2c6390e9e2.tar.gz
netsurf-919805da51f243482475d06cce998c2c6390e9e2.tar.bz2
[project @ 2004-02-20 00:42:36 by bursa]
Partial implementation of collapsing margins. svn path=/import/netsurf/; revision=561
Diffstat (limited to 'render/layout.c')
-rw-r--r--render/layout.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/render/layout.c b/render/layout.c
index ee908e0d9..98e30fee9 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -353,6 +353,7 @@ void layout_block_children(struct box *box, struct box *cont,
int width = box->width;
int y = box->padding[TOP];
int y1;
+ int vert_margin = 0;
assert(box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT ||
@@ -375,16 +376,20 @@ void layout_block_children(struct box *box, struct box *cont,
if (c->style) {
layout_block_find_dimensions(width, c->style, c);
c->x += c->margin[LEFT] + c->border[LEFT];
- c->y += c->margin[TOP] + c->border[TOP];
+ if (vert_margin < c->margin[TOP])
+ vert_margin = c->margin[TOP];
+ c->y += vert_margin + c->border[TOP];
} else {
c->width = box->width;
}
layout_node(c, width, cont, cx + c->x, cy + c->y);
y = c->y + c->height + c->padding[TOP] + c->padding[BOTTOM] +
- c->border[BOTTOM] + c->margin[BOTTOM];
+ c->border[BOTTOM];
if (box->width < c->width)
box->width = c->width;
+
+ vert_margin = c->margin[BOTTOM];
}
box->height = y - box->padding[TOP];
}
@@ -685,6 +690,7 @@ struct box * layout_line(struct box *first, int width, int *y,
place_float_below(b, width, cy + height + 1, cont);
/* fprintf(stderr, "layout_line: float doesn't fit %li %li\n", b->x, b->y); */
}
+ assert(cont->float_children != b);
b->next_float = cont->float_children;
cont->float_children = b;
}