summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-07-08 20:54:19 +0000
committerJames Bursa <james@netsurf-browser.org>2003-07-08 20:54:19 +0000
commit80013c7a7194c47b11f6f8dddc416367df3f134d (patch)
treee7abb77fb2a04de04df7dac0c47794d5426ea655
parentfc493927d40a5ad3205e2f08829ffe3f8bb60f7e (diff)
downloadnetsurf-80013c7a7194c47b11f6f8dddc416367df3f134d.tar.gz
netsurf-80013c7a7194c47b11f6f8dddc416367df3f134d.tar.bz2
[project @ 2003-07-08 20:54:19 by bursa]
Table column width improvements. svn path=/import/netsurf/; revision=212
-rw-r--r--render/layout.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/render/layout.c b/render/layout.c
index db26dadbf..14e9258f2 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -646,9 +646,19 @@ void layout_table(struct box * table, unsigned long width, struct box * cont,
table_width = max_width;
} else {
/* for fixed-width tables, distribute the extra space too */
- unsigned long extra = (table_width - max_width) / table->columns;
- for (i = 0; i < table->columns; i++) {
- table->col[i].width = table->col[i].max + extra;
+ unsigned int flexible_columns = 0;
+ for (i = 0; i != table->columns; i++)
+ if (table->col[i].type != COLUMN_WIDTH_FIXED)
+ flexible_columns++;
+ if (flexible_columns == 0) {
+ unsigned long extra = (table_width - max_width) / table->columns;
+ for (i = 0; i != table->columns; i++)
+ table->col[i].width = table->col[i].max + extra;
+ } else {
+ unsigned long extra = (table_width - max_width) / flexible_columns;
+ for (i = 0; i != table->columns; i++)
+ if (table->col[i].type != COLUMN_WIDTH_FIXED)
+ table->col[i].width = table->col[i].max + extra;
}
}
} else {
@@ -914,7 +924,7 @@ void calculate_table_widths(struct box *table)
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 &&
@@ -928,6 +938,7 @@ void calculate_table_widths(struct box *table)
else
/* specified width not big enough => use min */
col[i].width = col[i].max = max = min;
+ continue;
}
else if (col[i].type == COLUMN_WIDTH_UNKNOWN) {