summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-06-06 14:54:19 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-06-06 14:54:19 +0000
commit243e0abbcd5a6895c518054b15437521d6ef73b5 (patch)
treeb33354cc7eb493af2bf1a5db20f286cf9fc75b42
parentb2cbb513faebda77d6933671b95ece508b47f09e (diff)
downloadnetsurf-243e0abbcd5a6895c518054b15437521d6ef73b5.tar.gz
netsurf-243e0abbcd5a6895c518054b15437521d6ef73b5.tar.bz2
Establish a new block formatting context for blocks with non-visisble overflow style. (9.4.1)
svn path=/trunk/netsurf/; revision=4270
-rw-r--r--render/layout.c33
1 files changed, 33 insertions, 0 deletions
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). */