summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-10-13 10:50:46 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-10-13 10:50:46 +0000
commita5ac56655c3526ba9b6ba0bf92c38d9e206383ac (patch)
tree4ba1aebf9f985dfd38cf9196c242305bb3a31edf /render/layout.c
parent79978eafcdd04001554350390b3bdbcb83063d3e (diff)
downloadnetsurf-a5ac56655c3526ba9b6ba0bf92c38d9e206383ac.tar.gz
netsurf-a5ac56655c3526ba9b6ba0bf92c38d9e206383ac.tar.bz2
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
Diffstat (limited to 'render/layout.c')
-rw-r--r--render/layout.c17
1 files changed, 16 insertions, 1 deletions
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;
}