From 04566797cd304ec084867f69bf792fa09e3ea46f Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 6 Nov 2005 11:00:33 +0000 Subject: [project @ 2005-11-06 11:00:33 by bursa] Fix crash when a frame contains floats. svn path=/import/netsurf/; revision=1877 --- render/layout.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index fd2eed207..a607261fd 100644 --- a/render/layout.c +++ b/render/layout.c @@ -93,8 +93,6 @@ bool layout_document(struct content *content, int width, int height) assert(content->type == CONTENT_HTML); - doc->float_children = 0; - layout_minmax_block(doc); layout_block_find_dimensions(width, doc); @@ -161,6 +159,8 @@ bool layout_block_context(struct box *block, struct content *content) gui_multitask(); + block->float_children = 0; + if (block->object) { if (block->object->type == CONTENT_HTML) { box = block->object->data.html.layout; @@ -1285,6 +1285,7 @@ bool layout_line(struct box *first, int width, int *y, } else { /* float */ + LOG(("float %p", b)); d = b->children; d->float_children = 0; /* css_dump_style(b->style); */ @@ -1320,7 +1321,11 @@ bool layout_line(struct box *first, int width, int *y, place_float_below(b, width, cx, cy + height + 1, cont); /* fprintf(stderr, "layout_line: float doesn't fit %li %li\n", b->x, b->y); */ } - assert(cont->float_children != b); + if (cont->float_children == b) { + LOG(("float %p already placed", b)); + box_dump(cont, 0); + assert(0); + } b->next_float = cont->float_children; cont->float_children = b; split_box = 0; @@ -1370,7 +1375,6 @@ bool layout_line(struct box *first, int width, int *y, b = split_box->next; } else { /* cut off first word for this line */ - /* \todo allocate from content */ c2 = talloc_memdup(content, split_box, sizeof *c2); if (!c2) -- cgit v1.2.3