From 63b6455f7365507ce502369b738ecc09e54e25ed Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 13 Apr 2003 12:50:10 +0000 Subject: [project @ 2003-04-13 12:50:10 by bursa] style element, CSS fixes, id selectors. svn path=/import/netsurf/; revision=124 --- render/layout.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index 891d54f1f..7b1e40ba4 100644 --- a/render/layout.c +++ b/render/layout.c @@ -1,5 +1,5 @@ /** - * $Id: layout.c,v 1.38 2003/04/09 21:57:09 bursa Exp $ + * $Id: layout.c,v 1.39 2003/04/13 12:50:10 bursa Exp $ */ #include @@ -408,10 +408,22 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long move_y = 1; /* fprintf(stderr, "layout_line: '%.*s' %li %li\n", b->length, b->text, xp, x); */ } else { + /* float */ + unsigned long w = width; d = b->children; d->float_children = 0; /* css_dump_style(b->style); */ - layout_node(d, width, d, 0, 0); + if (d->style->width.width == CSS_WIDTH_AUTO) { + /* either a float with no width specified (contravenes standard) + * or we don't know the width for some reason, eg. image not loaded */ + calculate_widths(b); + w = width / 2; + if (d->max_width < w) + w = d->max_width; + else if (w < d->min_width) + w = d->min_width; + } + layout_node(d, w, d, 0, 0); d->x = d->y = 0; b->width = d->width; b->height = d->height; -- cgit v1.2.3