1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

Move code from format_table() to new distribute_table_widths().

This commit is contained in:
Laurent MONIN 2005-12-01 11:37:08 +01:00 committed by Laurent MONIN
parent ac01cbba30
commit 978eff94ad

View File

@ -1195,7 +1195,7 @@ draw_table_caption(struct html_context *html_context, struct table *table,
NULL, table->link_num);
if (!part) return;
table->part->cy += part->box.height;
table->part->cx = -1;
table->part->link_num = part->link_num;
@ -1226,6 +1226,18 @@ draw_table_bad_html(struct html_context *html_context, struct table *table)
}
}
static void
distribute_table_widths(struct table *table)
{
/* DBG("%d %d %d", t->min_width, t->max_width, table->width); */
if (table->min_width >= table->width)
distribute_widths(table, table->min_width);
else if (table->max_width < table->width && table->full_width)
distribute_widths(table, table->max_width);
else
distribute_widths(table, table->width);
}
void
format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
unsigned char **end, struct html_context *html_context)
@ -1256,13 +1268,7 @@ format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
margins = par_format.leftmargin + par_format.rightmargin;
if (get_table_cellpadding(html_context, table)) goto ret2;
/* DBG("%d %d %d", t->min_width, t->max_width, table->width); */
if (table->min_width >= table->width)
distribute_widths(table, table->min_width);
else if (table->max_width < table->width && table->full_width)
distribute_widths(table, table->max_width);
else
distribute_widths(table, table->width);
distribute_table_widths(table);
if (!part->document && part->box.x == 1) {
int total_width = table->real_width + margins;