diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-01-25 15:10:14 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-01-25 15:10:14 +0000 |
commit | 3849ebdadb6c3c9fe87f7555eeb058562bfb4271 (patch) | |
tree | 08743f15edda91823db6a05ff1c0b61c40e8c63d | |
parent | [w3m-dev 02908] document code of frame (diff) | |
download | w3m-3849ebdadb6c3c9fe87f7555eeb058562bfb4271.tar.gz w3m-3849ebdadb6c3c9fe87f7555eeb058562bfb4271.zip |
[w3m-dev 02909] wrong table width calculation (sf.net Bug#506949)
* table.c (correct_table_matrix4): added
* table.c (set_table_matrix0): use correct_table_matrix4()
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | table.c | 54 |
2 files changed, 48 insertions, 14 deletions
@@ -1,3 +1,9 @@ +2002-01-26 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 02909] wrong table width calculation (sf.net Bug#506949) + * table.c (correct_table_matrix4): added + * table.c (set_table_matrix0): use correct_table_matrix4() + 2002-01-25 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 02908] document code of frame @@ -2291,4 +2297,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.261 2002/01/25 14:59:14 ukai Exp $ +$Id: ChangeLog,v 1.262 2002/01/25 15:10:14 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: table.c,v 1.14 2002/01/23 17:57:10 ukai Exp $ */ +/* $Id: table.c,v 1.15 2002/01/25 15:10:14 ukai Exp $ */ /* * HTML table */ @@ -3180,11 +3180,38 @@ correct_table_matrix3(struct table *t, int col, char *flags, double s, } static void +correct_table_matrix4(struct table *t, int col, int cspan, char *flags, + double s, double b) +{ + int i, j; + double ss; + int ecol = col + cspan; + int size = t->maxcol + 1; + double w = 1. / (b * b); + + for (i = 0; i < size; i++) { + if (flags[i] && !(i >= col && i < ecol)) + continue; + for (j = i; j < size; j++) { + if (flags[j] && !(j >= col && j < ecol)) + continue; + if (i >= col && i < ecol && j >= col && j < ecol) + ss = (1. - s) * (1. - s); + else if ((i >= col && i < ecol) || (j >= col && j < ecol)) + ss = -(1. - s) * s; + else + ss = s * s; + m_add_val(t->matrix, i, j, w * ss); + } + } +} + +static void set_table_matrix0(struct table *t, int maxwidth) { int size = t->maxcol + 1; int i, j, k, bcol, ecol; - int swidth, width, a; + int width, a; double w0, w1, w, s, b; #ifdef __GNUC__ double we[size]; @@ -3218,26 +3245,27 @@ set_table_matrix0(struct table *t, int maxwidth) j = cell->eindex[k]; bcol = cell->col[j]; ecol = bcol + cell->colspan[j]; - swidth = 0; for (i = bcol; i < ecol; i++) { - swidth += t->tabwidth[i]; expand[i]++; } - width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing; - w = weight(width); - w1 = 0.; - for (i = bcol; i < ecol; i++) - w1 += we[i]; - s = w / (w0 + w - w1); - a = (int)(s * maxwidth); - b = sigma_td_nw(a); - correct_table_matrix2(t, bcol, cell->colspan[j], s, b); } w1 = 0.; for (i = 0; i < size; i++) if (expand[i] == 0) w1 += we[i]; + + for (k = 0; k < cell->necell; k++) { + j = cell->eindex[k]; + bcol = cell->col[j]; + width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing; + w = weight(width); + s = w / (w1 + w); + a = (int)(s * maxwidth); + b = sigma_td_nw(a); + correct_table_matrix4(t, bcol, cell->colspan[j], expand, s, b); + } + for (i = 0; i < size; i++) { if (expand[i] == 0) { s = we[i] / max(w1, 1.); |