From 230cb5f01fbb9948ce5dd067e87535f9c012779c Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 9 Apr 2003 21:57:09 +0000 Subject: [project @ 2003-04-09 21:57:09 by bursa] Table layout fixes, allowed type list. svn path=/import/netsurf/; revision=119 --- render/html.c | 7 ++++--- render/layout.c | 58 ++++++++++++++++++++++++++++++--------------------------- 2 files changed, 35 insertions(+), 30 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index 05af7af70..5105089be 100644 --- a/render/html.c +++ b/render/html.c @@ -1,5 +1,5 @@ /** - * $Id: html.c,v 1.10 2003/04/06 20:56:40 bursa Exp $ + * $Id: html.c,v 1.11 2003/04/09 21:57:09 bursa Exp $ */ #include @@ -96,8 +96,9 @@ int html_convert(struct content *c, unsigned int width, unsigned int height) fetch_data->c = c; fetch_data->i = i; c->active++; - fetchcache(c->data.html.stylesheet_url[i], c->url, html_convert_css_callback, - fetch_data, width, height); + fetchcache(c->data.html.stylesheet_url[i], c->url, + html_convert_css_callback, + fetch_data, width, height, 1 << CONTENT_CSS); } while (c->active != 0) { diff --git a/render/layout.c b/render/layout.c index 8db380344..891d54f1f 100644 --- a/render/layout.c +++ b/render/layout.c @@ -1,5 +1,5 @@ /** - * $Id: layout.c,v 1.37 2003/04/04 15:19:31 bursa Exp $ + * $Id: layout.c,v 1.38 2003/04/09 21:57:09 bursa Exp $ */ #include @@ -845,9 +845,37 @@ void calculate_table_widths(struct box *table) for (j = 0; j != cell->columns; j++) { min += col[i + j].min; max += col[i + j].max; + } + + /* use specified width if colspan == 1 */ + if (col[i].type != COLUMN_WIDTH_FIXED && + cell->style->width.width == CSS_WIDTH_LENGTH && + cell->columns == 1) { + width = len(&cell->style->width.value.length, + cell->style); + col[i].type = COLUMN_WIDTH_FIXED; + if (min < width) + /* specified width greater than min => use it */ + col[i].width = col[i].max = max = col[i].min = min = width; + else + /* specified width not big enough => use min */ + col[i].width = col[i].max = max = min; + } + + else if (col[i].type == COLUMN_WIDTH_UNKNOWN) { + if (cell->style->width.width == CSS_WIDTH_PERCENT) { + col[i].type = COLUMN_WIDTH_PERCENT; + col[i].width = cell->style->width.value.percent; + } else if (cell->style->width.width == CSS_WIDTH_AUTO) { + col[i].type = COLUMN_WIDTH_AUTO; + } + } + + for (j = 0; j != cell->columns; j++) { if (col[i + j].type != COLUMN_WIDTH_FIXED) flexible_columns++; } + /* distribute extra width to spanned columns */ if (min < cell->min_width) { if (flexible_columns == 0) { @@ -888,40 +916,16 @@ void calculate_table_widths(struct box *table) col[i + j].max += extra; } } - - /* use specified width if colspan == 1 */ - if (col[i].type != COLUMN_WIDTH_FIXED && - cell->style->width.width == CSS_WIDTH_LENGTH && - cell->columns == 1) { - width = len(&cell->style->width.value.length, - cell->style); - col[i].type = COLUMN_WIDTH_FIXED; - if (min < width) - /* specified width greater than min => use it */ - col[i].width = col[i].max = col[i].min = width; - else - /* specified width not big enough => use min */ - col[i].width = col[i].max = min; - } - - else if (col[i].type == COLUMN_WIDTH_UNKNOWN) { - if (cell->style->width.width == CSS_WIDTH_PERCENT) { - col[i].type = COLUMN_WIDTH_PERCENT; - col[i].width = cell->style->width.value.percent; - } else if (cell->style->width.width == CSS_WIDTH_AUTO) { - col[i].type = COLUMN_WIDTH_AUTO; - } - } } } } for (i = 0; i < table->columns; i++) { + LOG(("col %u, type %i, min %lu, max %lu, width %lu", + i, col[i].type, col[i].min, col[i].max, col[i].width)); assert(col[i].min <= col[i].max); min_width += col[i].min; max_width += col[i].max; - LOG(("col %u, type %i, min %lu, max %lu, width %lu", - i, col[i].type, col[i].min, col[i].max, col[i].width)); } table->min_width = min_width; table->max_width = max_width; -- cgit v1.2.3