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 --- !NetSurf/Resources/CSS,f79 | 4 +++- render/layout.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/!NetSurf/Resources/CSS,f79 b/!NetSurf/Resources/CSS,f79 index 81b3f211b..c269ebde9 100644 --- a/!NetSurf/Resources/CSS,f79 +++ b/!NetSurf/Resources/CSS,f79 @@ -35,6 +35,8 @@ a:link { color: #00f; text-decoration: underline; } th { font-weight: bold; } td { text-align: left; } +p { margin-top: 1em; margin-bottom: 1em; } + /* kludge until this gets implemented */ dl, ul, ol { padding-left: 0.5em; } li, dd { padding-left: 1em; margin-bottom: 0.3em; } @@ -44,7 +46,7 @@ hr { background-color: #000; height: 1px; } center { text-align: center; } small { font-size: smaller; } big { font-size: larger; } -select, input { background-color: #eeb; color: #000; width: 10em; height: 2em; +select, input { background-color: #eeb; color: #000; width: 10em; height: 2em; text-align: left;} textarea { background-color: #eeb; color: #000; text-align: left; } input[type=button], input[type=image], input[type=reset], input[type=submit], 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