diff options
author | James Bursa <james@netsurf-browser.org> | 2003-08-30 19:20:19 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2003-08-30 19:20:19 +0000 |
commit | a842b765fa72584629d98e40fa47645810bc1f20 (patch) | |
tree | 3ecd43af2a9be2704b6906b54310dc12636b65da | |
parent | 9a6d854181a0b951322875096de57df6b4cc4be0 (diff) | |
download | netsurf-a842b765fa72584629d98e40fa47645810bc1f20.tar.gz netsurf-a842b765fa72584629d98e40fa47645810bc1f20.tar.bz2 |
[project @ 2003-08-30 19:20:19 by bursa]
Table layout fix / optimisation.
svn path=/import/netsurf/; revision=262
-rw-r--r-- | render/layout.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/render/layout.c b/render/layout.c index 7a586c0aa..4e6427b9a 100644 --- a/render/layout.c +++ b/render/layout.c @@ -911,10 +911,19 @@ void calculate_table_widths(struct box *table) unsigned int i, pass; struct box *row_group, *row, *cell; unsigned long width, min_width = 0, max_width = 0; - struct column *col = xcalloc(table->columns, sizeof(*col)); + struct column *col; LOG(("table %p, columns %u", table, table->columns)); + /* check if the widths have already been calculated */ + if (table->max_width != UNKNOWN_MAX_WIDTH) + return; + + if (table->col) + col = table->col; + else + col = xcalloc(table->columns, sizeof(*col)); + assert(table->children != 0 && table->children->children != 0); for (pass = 0; pass != 2; pass++) { for (row_group = table->children; row_group != 0; row_group = row_group->next) { @@ -949,6 +958,8 @@ void calculate_table_widths(struct box *table) cell->columns == 1) { width = len(&cell->style->width.value.length, cell->style); + if (width < cell->min_width) + width = cell->min_width; col[i].type = COLUMN_WIDTH_FIXED; if (min < width) /* specified width greater than min => use it */ @@ -981,6 +992,8 @@ void calculate_table_widths(struct box *table) max = 0; for (j = 0; j != cell->columns; j++) { col[i + j].min += extra; + if (col[i + j].width < col[i + j].min) + col[i + j].width = col[i + j].min; if (col[i + j].max < col[i + j].min) col[i + j].max = col[i + j].min; max += col[i + j].max; |