summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-06-29 23:30:06 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-06-29 23:30:06 +0000
commit928f9494137ec0d193798302973310757c11a9bf (patch)
tree7a1a413490c31a2bdeff5cae682698962eda7ef3 /render
parentf8469d2051315e790aa6b60ac1c0510982ff2f2a (diff)
downloadnetsurf-928f9494137ec0d193798302973310757c11a9bf.tar.gz
netsurf-928f9494137ec0d193798302973310757c11a9bf.tar.bz2
Ensure containing block has valid height for positioning absolute children
svn path=/trunk/netsurf/; revision=2680
Diffstat (limited to 'render')
-rw-r--r--render/layout.c14
1 files changed, 14 insertions, 0 deletions
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 *