diff --git a/src/document/html/parser.c b/src/document/html/parser.c index 1caf29468..5ca2d7565 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -915,7 +915,7 @@ init_html_parser(struct uri *uri, struct document_options *options, par_format.dd_margin = options->margin; par_format.flags = P_NONE; - par_format.bgcolor = options->default_style.color.background; + par_format.color.background = options->default_style.color.background; html_top->invisible = 0; html_top->name = NULL; diff --git a/src/document/html/parser.h b/src/document/html/parser.h index 279c02ad4..717779fca 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -96,7 +96,9 @@ struct par_attrib { unsigned list_number; int dd_margin; enum format_list_flag flags; - color_T bgcolor; + struct { + color_T background; + } color; }; /* HTML parser stack mortality info */ diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index c10239ee1..d5dfdeb58 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -187,17 +187,17 @@ html_apply_canvas_bgcolor(struct html_context *html_context) &html_context->stack); #endif - if (par_format.bgcolor != format.style.color.background) { + if (par_format.color.background != format.style.color.background) { /* Modify the root HTML element - format_html_part() will take * this from there. */ struct html_element *e = html_bottom; html_context->was_body_background = 1; - e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background; + e->parattr.color.background = e->attr.style.color.background = par_format.color.background = format.style.color.background; } if (html_context->has_link_lines - && par_format.bgcolor != html_context->options->default_style.color.background + && par_format.color.background != html_context->options->default_style.color.background && !search_html_stack(html_context, "BODY")) { html_context->special_f(html_context, SP_COLOR_LINK_LINES); } @@ -416,8 +416,8 @@ html_html(struct html_context *html_context, unsigned char *a, * this from there. */ struct html_element *e = html_bottom; - if (par_format.bgcolor != format.style.color.background) - e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background; + if (par_format.color.background != format.style.color.background) + e->parattr.color.background = e->attr.style.color.background = par_format.color.background = format.style.color.background; } void diff --git a/src/document/html/parser/table.c b/src/document/html/parser/table.c index deddd12fe..09e357a8c 100644 --- a/src/document/html/parser/table.c +++ b/src/document/html/parser/table.c @@ -245,7 +245,7 @@ parse_table_attributes(struct table *table, unsigned char *attr, int real, table->align = par_format.align; get_align(html_context, attr, &table->align); - table->bgcolor = par_format.bgcolor; + table->bgcolor = par_format.color.background; get_bgcolor(html_context, attr, &table->bgcolor); } diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index acf8305b0..34d886cbb 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -163,7 +163,7 @@ realloc_line(struct html_context *html_context, struct document *document, end = &line->chars[length]; end->data = ' '; end->attr = 0; - set_screen_char_color(end, par_format.bgcolor, 0x0, + set_screen_char_color(end, par_format.color.background, 0x0, COLOR_ENSURE_CONTRAST, /* for bug 461 */ document->options.color_mode); @@ -188,7 +188,7 @@ expand_lines(struct html_context *html_context, struct part *part, if (!use_document_bg_colors(&part->document->options)) return; - par_format.bgcolor = bgcolor; + par_format.color.background = bgcolor; for (line = 0; line < lines; line++) realloc_line(html_context, part->document, Y(y + line), X(x)); @@ -246,7 +246,7 @@ clear_hchars(struct html_context *html_context, int x, int y, int width) end = pos + width - 1; end->data = ' '; end->attr = 0; - set_screen_char_color(end, par_format.bgcolor, 0x0, + set_screen_char_color(end, par_format.color.background, 0x0, COLOR_ENSURE_CONTRAST, /* for bug 461 */ part->document->options.color_mode); @@ -1881,7 +1881,7 @@ static inline void color_link_lines(struct html_context *html_context) { struct document *document = html_context->part->document; - struct color_pair colors = INIT_COLOR_PAIR(par_format.bgcolor, 0x0); + struct color_pair colors = INIT_COLOR_PAIR(par_format.color.background, 0x0); enum color_mode color_mode = document->options.color_mode; enum color_flags color_flags = document->options.color_flags; int y; @@ -2278,7 +2278,7 @@ render_html_document(struct cache_entry *cached, struct document *document, >= document->options.width)); #endif - document->color.background = par_format.bgcolor; + document->color.background = par_format.color.background; done_html_parser(html_context); diff --git a/src/document/html/tables.c b/src/document/html/tables.c index 135dcf9bd..26ac0a4bb 100644 --- a/src/document/html/tables.c +++ b/src/document/html/tables.c @@ -873,7 +873,7 @@ draw_table_cell(struct table *table, int col, int row, int x, int y, if (cell->is_header) format.style.attr |= AT_BOLD; format.style.color.background = cell->bgcolor; - par_format.bgcolor = cell->bgcolor; + par_format.color.background = cell->bgcolor; if (cell->valign == VALIGN_MIDDLE) tmpy += (height - cell->height) / 2; @@ -908,7 +908,7 @@ draw_table_cells(struct table *table, int x, int y, { int col, row; int xp; - color_T bgcolor = par_format.bgcolor; + color_T bgcolor = par_format.color.background; struct table_frames table_frames; get_table_frames(table, &table_frames); @@ -1033,7 +1033,8 @@ draw_frame_point(struct table *table, signed char *frame[2], int x, int y, + 27 * int_max(bottom, 0); draw_frame_hchars(table->part, x, y, 1, border_chars[pos], - par_format.bgcolor, table->bordercolor, html_context); + par_format.color.background, table->bordercolor, + html_context); } static inline void @@ -1049,7 +1050,7 @@ draw_frame_hline(struct table *table, signed char *frame[2], int x, int y, if (pos < 0 || table->cols_widths[col] <= 0) return; draw_frame_hchars(table->part, x, y, table->cols_widths[col], hltable[pos], - par_format.bgcolor, table->bordercolor, html_context); + par_format.color.background, table->bordercolor, html_context); } static inline void @@ -1065,7 +1066,7 @@ draw_frame_vline(struct table *table, signed char *frame[2], int x, int y, if (pos < 0 || table->rows_heights[row] <= 0) return; draw_frame_vchars(table->part, x, y, table->rows_heights[row], vltable[pos], - par_format.bgcolor, table->bordercolor, html_context); + par_format.color.background, table->bordercolor, html_context); } static inline int