diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-04 17:54:43 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2014-01-04 17:54:43 +0000 |
commit | 0aa488288caa69738032a7f68d3b75ab1e776c61 (patch) | |
tree | f04926db301c93946e5a29fe77afad91dbf178a3 /render | |
parent | 7853fbbc4e3ed8e6a77d7f01fa6565c37b5fde4e (diff) | |
download | netsurf-0aa488288caa69738032a7f68d3b75ab1e776c61.tar.gz netsurf-0aa488288caa69738032a7f68d3b75ab1e776c61.tar.bz2 |
Fix longstanding bug where floating root element caused assertion. Bug #394.
Diffstat (limited to 'render')
-rw-r--r-- | render/box_construct.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/render/box_construct.c b/render/box_construct.c index a72f918f8..b259e6a1f 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1013,12 +1013,13 @@ bool box_construct_element(struct box_construct_ctx *ctx, box->type == BOX_BR || box->type == BOX_INLINE_BLOCK || css_computed_float(box->style) == CSS_FLOAT_LEFT || - css_computed_float(box->style) == CSS_FLOAT_RIGHT)) { + css_computed_float(box->style) == CSS_FLOAT_RIGHT) && + props.node_is_root == false) { /* Found an inline child of a block without a current container * (i.e. this box is the first child of its parent, or was * preceded by block-level siblings) */ assert(props.containing_block != NULL && - "Root box must not be inline or floated"); + "Box must have containing block."); props.inline_container = box_create(NULL, NULL, false, NULL, NULL, NULL, NULL, ctx->bctx); @@ -1073,9 +1074,11 @@ bool box_construct_element(struct box_construct_ctx *ctx, return false; } - if (css_computed_float(box->style) == CSS_FLOAT_LEFT || + if (props.node_is_root == false && + (css_computed_float(box->style) == + CSS_FLOAT_LEFT || css_computed_float(box->style) == - CSS_FLOAT_RIGHT) { + CSS_FLOAT_RIGHT)) { /* Float: insert a float between the parent and box. */ struct box *flt = box_create(NULL, NULL, false, props.href, props.target, props.title, |