diff options
author | James Bursa <james@netsurf-browser.org> | 2002-12-27 18:58:03 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2002-12-27 18:58:03 +0000 |
commit | ffe6ce5f5e159076755f2e8245767bf4bae0d635 (patch) | |
tree | 45e7f5929506182e9b864f965a70e0ff169416fd /render/layout.c | |
parent | 0e4fbaf4391e073ca1208d4935ee9d9a11e27d5d (diff) | |
download | netsurf-ffe6ce5f5e159076755f2e8245767bf4bae0d635.tar.gz netsurf-ffe6ce5f5e159076755f2e8245767bf4bae0d635.tar.bz2 |
[project @ 2002-12-27 18:58:03 by bursa]
Consider colspan when calculating column widths.
svn path=/import/netsurf/; revision=62
Diffstat (limited to 'render/layout.c')
-rw-r--r-- | render/layout.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/render/layout.c b/render/layout.c index 3b915084b..142eede0e 100644 --- a/render/layout.c +++ b/render/layout.c @@ -1,5 +1,5 @@ /** - * $Id: layout.c,v 1.25 2002/12/27 17:38:47 bursa Exp $ + * $Id: layout.c,v 1.26 2002/12/27 18:58:03 bursa Exp $ */ #include <assert.h> @@ -729,11 +729,29 @@ void calculate_table_widths(struct box *table) col[i].type = COLUMN_WIDTH_FIXED; col[i].min = col[i].max = col[i].width = width; } else { + unsigned int j; + unsigned long min = 0, max = 0, extra; + calculate_widths(cell); - if (col[i].min < cell->min_width) - col[i].min = cell->min_width; - if (col[i].max < cell->max_width) - col[i].max = cell->max_width; + + /* distribute extra width to spanned columns */ + for (j = 0; j != cell->columns; j++) { + min += col[i].min; + max += col[i].max; + } + if (min < cell->min_width) { + extra = 1 + (cell->min_width - min) + / cell->columns; + for (j = 0; j != cell->columns; j++) + col[i].min += extra; + } + if (max < cell->max_width) { + extra = 1 + (cell->max_width - max) + / cell->columns; + for (j = 0; j != cell->columns; j++) + col[i].max += extra; + } + if (col[i].type != COLUMN_WIDTH_UNKNOWN) continue; if (cell->style->width.width == CSS_WIDTH_PERCENT) { |