From 38e6fd1b74f2bc6677398d5167aff68bf163a286 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 20 Jan 2016 18:38:04 +0000 Subject: Split adding float to a container out into separate function. --- render/layout.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index 008be2426..4381f296c 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2087,6 +2087,19 @@ void find_sides(struct box *fl, int y0, int y1, } +/** + * Insert a float into a container. + * + * \param cont block formatting context block, used to contain float + * \param b box to add to float + */ +static void add_float_to_container(struct box *cont, struct box *b) +{ + b->next_float = cont->float_children; + cont->float_children = b; +} + + /** * Layout lines of text or inline boxes with floats. * @@ -2787,16 +2800,7 @@ bool layout_line(struct box *first, int *width, int *y, else right = b; } - if (cont->float_children == b) { -#ifdef LAYOUT_DEBUG - LOG("float %p already placed", b); -#endif - - box_dump(stderr, cont, 0, true); - assert(0); - } - b->next_float = cont->float_children; - cont->float_children = b; + add_float_to_container(cont, b); split_box = 0; } -- cgit v1.2.3