From 243e0abbcd5a6895c518054b15437521d6ef73b5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 6 Jun 2008 14:54:19 +0000 Subject: Establish a new block formatting context for blocks with non-visisble overflow style. (9.4.1) svn path=/trunk/netsurf/; revision=4270 --- render/layout.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index 7a8dbd53a..00f1a9629 100644 --- a/render/layout.c +++ b/render/layout.c @@ -290,6 +290,9 @@ bool layout_block_context(struct box *block, struct content *content) (box->style->position == CSS_POSITION_ABSOLUTE|| box->style->position == CSS_POSITION_FIXED)) { box->x = box->parent->padding[LEFT]; + /* absolute positioned; this element will establish + * its own block context when it gets laid out later, + * so no need to look at its children now. */ goto advance_to_next_box; } @@ -335,6 +338,36 @@ bool layout_block_context(struct box *block, struct content *content) } } + /* Unless the box has an overflow style of visible, the box + * establishes a new block context. */ + if (box->type != BOX_INLINE_CONTAINER && box->style && + box->style->overflow != CSS_OVERFLOW_VISIBLE) { + layout_block_context(box, content); + + if (box->type == BOX_BLOCK || box->object) + cy += box->padding[TOP]; + + if (box->type == BOX_BLOCK && box->height == AUTO) { + box->height = 0; + layout_block_add_scrollbar(box, BOTTOM); + } + + cy += box->height + box->padding[BOTTOM] + + box->border[BOTTOM]; + max_pos_margin = max_neg_margin = 0; + if (max_pos_margin < box->margin[BOTTOM]) + max_pos_margin = box->margin[BOTTOM]; + else if (max_neg_margin < -box->margin[BOTTOM]) + max_neg_margin = -box->margin[BOTTOM]; + cx -= box->x; + y = box->y + box->padding[TOP] + box->height + + box->padding[BOTTOM] + + box->border[BOTTOM]; + /* Skip children, because they are done in the new + * block context */ + goto advance_to_next_box; + } + LOG(("box %p, cx %i, cy %i", box, cx, cy)); /* Layout (except tables). */ -- cgit v1.2.1