From a5ac56655c3526ba9b6ba0bf92c38d9e206383ac Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 13 Oct 2008 10:50:46 +0000 Subject: Fix float percentage heights to match other browsers: for floated elements the containing block is the nearest ancestor box at block level, rather than the block formatting context block that the float is in. svn path=/trunk/netsurf/; revision=5553 --- render/layout.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index ee5dde5c3..9065e7d89 100644 --- a/render/layout.c +++ b/render/layout.c @@ -1023,13 +1023,28 @@ void layout_find_dimensions(int available_width, style); break; case CSS_HEIGHT_PERCENT: - if (box->float_container) { + if (box->style->position == CSS_POSITION_ABSOLUTE && + box->float_container) { + /* Box is absolutely positioned */ containing_block = box->float_container; + } else if (box->float_container && + box->style->position != + CSS_POSITION_ABSOLUTE && + (box->style->float_ == + CSS_FLOAT_LEFT || + box->style->float_ == + CSS_FLOAT_RIGHT)) { + /* Box is a float */ + assert(box->parent && box->parent->parent && + box->parent->parent->parent); + containing_block = box->parent->parent->parent; } else if (box->parent && box->parent->type != BOX_INLINE_CONTAINER) { + /* Box is a block level element */ containing_block = box->parent; } else if (box->parent && box->parent->type == BOX_INLINE_CONTAINER) { + /* Box is an inline block */ assert(box->parent->parent); containing_block = box->parent->parent; } -- cgit v1.2.3