[project @ 2004-02-20 00:42:36 by bursa]

Partial implementation of collapsing margins.

svn path=/import/netsurf/; revision=561
This commit is contained in:
James Bursa 2004-02-20 00:42:36 +00:00
parent 13925ef8d5
commit 919805da51
2 changed files with 11 additions and 3 deletions

View File

@ -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],

View File

@ -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;
}