From 928f9494137ec0d193798302973310757c11a9bf Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 29 Jun 2006 23:30:06 +0000 Subject: Ensure containing block has valid height for positioning absolute children svn path=/trunk/netsurf/; revision=2680 --- render/layout.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index 0af725bc0..ed33481cc 100644 --- a/render/layout.c +++ b/render/layout.c @@ -158,6 +158,7 @@ bool layout_block_context(struct box *block, struct content *content) int max_pos_margin = 0; int max_neg_margin = 0; int y; + int old_height; struct box *margin_box; assert(block->type == BOX_BLOCK || @@ -296,10 +297,19 @@ bool layout_block_context(struct box *block, struct content *content) cy = y; } + /* Before positioning absolute children, ensure box has a + * valid height. */ + old_height = box->height; + if (box->height == AUTO) + box->height = 0; + /* Absolutely positioned children. */ if (!layout_absolute_children(box, content)) return false; + /* And restore height for normal layout */ + box->height = old_height; + /* Advance to next box. */ if (box->type == BOX_BLOCK && !box->object && box->children) { y = box->padding[TOP]; @@ -2783,6 +2793,10 @@ void layout_compute_offsets(struct box *box, struct box *containing_block, int *top, int *right, int *bottom, int *left) { + assert(containing_block->width != UNKNOWN_WIDTH && + containing_block->width != AUTO && + containing_block->height != AUTO); + /* left */ if (box->style->pos[LEFT].pos == CSS_POS_PERCENT) *left = ((box->style->pos[LEFT].value.percent * -- cgit v1.2.3