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
This commit is contained in:
Michael Drake 2008-10-13 10:50:46 +00:00
parent 79978eafcd
commit a5ac56655c

View File

@ -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;
}