From 919805da51f243482475d06cce998c2c6390e9e2 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Fri, 20 Feb 2004 00:42:36 +0000 Subject: [project @ 2004-02-20 00:42:36 by bursa] Partial implementation of collapsing margins. svn path=/import/netsurf/; revision=561 --- render/layout.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'render/layout.c') 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; } -- cgit v1.2.3