From 0aa488288caa69738032a7f68d3b75ab1e776c61 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 4 Jan 2014 17:54:43 +0000 Subject: Fix longstanding bug where floating root element caused assertion. Bug #394. --- render/box_construct.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'render/box_construct.c') 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, -- cgit v1.2.3