From bc498c00da012c631891b6c19d90c5a6dd8e3d99 Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Fri, 12 Oct 2007 16:41:06 +0200 Subject: [PATCH] struct text_style_color fg,bg -> foreground, background --- src/document/css/apply.c | 4 ++-- src/document/dom/renderer.c | 2 +- src/document/dom/util.c | 6 +++--- src/document/format.c | 2 +- src/document/format.h | 4 ++-- src/document/html/parser.c | 2 +- src/document/html/parser/general.c | 16 ++++++++-------- src/document/html/parser/link.c | 14 +++++++------- src/document/html/parser/parse.c | 2 +- src/document/html/renderer.c | 5 +++-- src/document/html/tables.c | 2 +- src/document/options.c | 4 ++-- src/document/plain/renderer.c | 6 +++--- 13 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/document/css/apply.c b/src/document/css/apply.c index c77513ccc..60c9c327a 100644 --- a/src/document/css/apply.c +++ b/src/document/css/apply.c @@ -46,7 +46,7 @@ css_apply_color(struct html_context *html_context, struct html_element *element, assert(prop->value_type == CSS_VT_COLOR); if (use_document_fg_colors(html_context->options)) - element->attr.style.color.fg = prop->value.color; + element->attr.style.color.foreground = prop->value.color; } static void @@ -57,7 +57,7 @@ css_apply_background_color(struct html_context *html_context, assert(prop->value_type == CSS_VT_COLOR); if (use_document_bg_colors(html_context->options)) - element->attr.style.color.bg = prop->value.color; + element->attr.style.color.background = prop->value.color; } static void diff --git a/src/document/dom/renderer.c b/src/document/dom/renderer.c index bf8860312..656b3eab0 100644 --- a/src/document/dom/renderer.c +++ b/src/document/dom/renderer.c @@ -99,7 +99,7 @@ render_dom_document(struct cache_entry *cached, struct document *document, init_dom_renderer(&renderer, document, buffer, convert_table); - document->bgcolor = document->options.default_style.color.bg; + document->bgcolor = document->options.default_style.color.background; #ifdef CONFIG_UTF8 document->options.utf8 = is_cp_utf8(document->options.cp); #endif /* CONFIG_UTF8 */ diff --git a/src/document/dom/util.c b/src/document/dom/util.c index 09fb4111d..625a89d30 100644 --- a/src/document/dom/util.c +++ b/src/document/dom/util.c @@ -50,10 +50,10 @@ init_template_by_style(struct screen_char *template, struct document_options *op case CSS_PT_BACKGROUND_COLOR: case CSS_PT_BACKGROUND: if (property->value_type == CSS_VT_COLOR) - style.color.bg = property->value.color; + style.color.background = property->value.color; break; case CSS_PT_COLOR: - style.color.fg = property->value.color; + style.color.foreground = property->value.color; break; case CSS_PT_FONT_WEIGHT: case CSS_PT_FONT_STYLE: @@ -288,7 +288,7 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, link->npoints = length; link->type = LINK_HYPERTEXT; link->where = where; - link->color.background = document->options.default_style.color.bg; + link->color.background = document->options.default_style.color.background; link->color.foreground = fgcolor; link->number = document->nlinks; diff --git a/src/document/format.c b/src/document/format.c index f876fb717..67d9b3617 100644 --- a/src/document/format.c +++ b/src/document/format.c @@ -40,7 +40,7 @@ get_screen_char_template(struct screen_char *template, } { - struct color_pair colors = INIT_COLOR_PAIR(style.color.bg, style.color.fg); + struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground); set_term_color(template, &colors, options->color_flags, options->color_mode); } } diff --git a/src/document/format.h b/src/document/format.h index fc912c658..fee79dcf0 100644 --- a/src/document/format.h +++ b/src/document/format.h @@ -17,8 +17,8 @@ enum text_style_format { }; struct text_style_color { - color_T fg; - color_T bg; + color_T foreground; + color_T background; }; struct text_style { diff --git a/src/document/html/parser.c b/src/document/html/parser.c index 9a71b6ced..1caf29468 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.bg; + par_format.bgcolor = options->default_style.color.background; html_top->invisible = 0; html_top->name = NULL; diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index 4675d5b08..c10239ee1 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -158,18 +158,18 @@ html_font(struct html_context *html_context, unsigned char *a, } mem_free(al); } - get_color(html_context, a, "color", &format.style.color.fg); + get_color(html_context, a, "color", &format.style.color.foreground); } void html_body(struct html_context *html_context, unsigned char *a, unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5) { - get_color(html_context, a, "text", &format.style.color.fg); + get_color(html_context, a, "text", &format.style.color.foreground); get_color(html_context, a, "link", &format.color.clink); get_color(html_context, a, "vlink", &format.color.vlink); - if (get_bgcolor(html_context, a, &format.style.color.bg) != -1) + if (get_bgcolor(html_context, a, &format.style.color.background) != -1) html_context->was_body_background = 1; html_context->was_body = 1; /* this will be used by "meta inside body" */ @@ -187,17 +187,17 @@ html_apply_canvas_bgcolor(struct html_context *html_context) &html_context->stack); #endif - if (par_format.bgcolor != format.style.color.bg) { + if (par_format.bgcolor != 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.bg = par_format.bgcolor = format.style.color.bg; + e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background; } if (html_context->has_link_lines - && par_format.bgcolor != html_context->options->default_style.color.bg + && par_format.bgcolor != 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.bg) - e->parattr.bgcolor = e->attr.style.color.bg = par_format.bgcolor = format.style.color.bg; + if (par_format.bgcolor != format.style.color.background) + e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background; } void diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index 0b53046b6..d4b60a1d7 100644 --- a/src/document/html/parser/link.c +++ b/src/document/html/parser/link.c @@ -66,19 +66,19 @@ html_a(struct html_context *html_context, unsigned char *a, ; /* Shut up compiler */ #ifdef CONFIG_GLOBHIST } else if (get_global_history_item(format.link)) { - format.style.color.fg = format.color.vlink; + format.style.color.foreground = format.color.vlink; html_top->pseudo_class &= ~ELEMENT_LINK; html_top->pseudo_class |= ELEMENT_VISITED; #endif #ifdef CONFIG_BOOKMARKS } else if (get_bookmark(format.link)) { - format.style.color.fg = format.color.bookmark_link; + format.style.color.foreground = format.color.bookmark_link; html_top->pseudo_class &= ~ELEMENT_VISITED; /* XXX: Really set ELEMENT_LINK? --pasky */ html_top->pseudo_class |= ELEMENT_LINK; #endif } else { - format.style.color.fg = format.color.clink; + format.style.color.foreground = format.color.clink; html_top->pseudo_class &= ~ELEMENT_VISITED; html_top->pseudo_class |= ELEMENT_LINK; } @@ -198,10 +198,10 @@ put_image_label(unsigned char *a, unsigned char *label, * extension to the standard. After all, it makes sense. */ html_focusable(html_context, a); - fg = format.style.color.fg; - format.style.color.fg = format.color.image_link; + fg = format.style.color.foreground; + format.style.color.foreground = format.color.image_link; put_chrs(html_context, label, strlen(label)); - format.style.color.fg = fg; + format.style.color.foreground = fg; } static void @@ -367,7 +367,7 @@ put_link_line(unsigned char *prefix, unsigned char *linkname, put_chrs(html_context, prefix, strlen(prefix)); format.link = join_urls(html_context->base_href, link); format.target = stracpy(target); - format.style.color.fg = format.color.clink; + format.style.color.foreground = format.color.clink; /* FIXME: linkname typically comes from get_attr_val, which * has already converted it from the document charset to the * terminal charset and expanded character entity references. diff --git a/src/document/html/parser/parse.c b/src/document/html/parser/parse.c index 2de738334..dbeba7da0 100644 --- a/src/document/html/parser/parse.c +++ b/src/document/html/parser/parse.c @@ -887,7 +887,7 @@ start_element(struct element_info *ei, /* XXX: Put something better to format.link. --pasky */ mem_free_set(&format.link, stracpy("javascript:void(0);")); mem_free_set(&format.target, stracpy(html_context->base_target)); - format.style.color.fg = format.color.clink; + format.style.color.foreground = format.color.clink; html_top->pseudo_class = ELEMENT_LINK; mem_free_set(&format.title, stracpy("onClick placeholder")); /* Er. I know. Well, double html_focusable()s shouldn't diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index 77fccc141..3466a82a4 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -1304,9 +1304,10 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen) link->target = null_or_stracpy(form ? form->target : NULL); } - link->color.background = format.style.color.bg; + link->color.background = format.style.color.background; link->color.foreground = link_is_textinput(link) - ? format.style.color.fg : format.color.clink; + ? format.style.color.foreground + : format.color.clink; init_link_event_hooks(html_context, link); diff --git a/src/document/html/tables.c b/src/document/html/tables.c index 064178bb1..135dcf9bd 100644 --- a/src/document/html/tables.c +++ b/src/document/html/tables.c @@ -872,7 +872,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.bg = cell->bgcolor; + format.style.color.background = cell->bgcolor; par_format.bgcolor = cell->bgcolor; if (cell->valign == VALIGN_MIDDLE) diff --git a/src/document/options.c b/src/document/options.c index c97b969a6..5fd9a851f 100644 --- a/src/document/options.c +++ b/src/document/options.c @@ -37,8 +37,8 @@ init_document_options(struct session *ses, struct document_options *doo) doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", ses); /* Color options. */ - doo->default_style.color.fg = get_opt_color("document.colors.text", ses); - doo->default_style.color.bg = get_opt_color("document.colors.background", ses); + doo->default_style.color.foreground = get_opt_color("document.colors.text", ses); + doo->default_style.color.background = get_opt_color("document.colors.background", ses); doo->default_color.link = get_opt_color("document.colors.link", ses); doo->default_color.vlink = get_opt_color("document.colors.vlink", ses); #ifdef CONFIG_BOOKMARKS diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index 3f326d63e..9d2af09b7 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -93,7 +93,7 @@ add_document_link(struct document *document, unsigned char *uri, int length, link->npoints = length; link->type = LINK_HYPERTEXT; link->where = uri; - link->color.background = document->options.default_style.color.bg; + link->color.background = document->options.default_style.color.background; link->color.foreground = document->options.default_color.link; link->number = document->nlinks; @@ -214,7 +214,7 @@ print_document_link(struct plain_renderer *renderer, int lineno, line[link_end] = saved_char; - new_link->color.background = doc_opts->default_style.color.bg; + new_link->color.background = doc_opts->default_style.color.background; set_term_color(&template, &new_link->color, doc_opts->color_flags, doc_opts->color_mode); @@ -637,7 +637,7 @@ render_plain_document(struct cache_entry *cached, struct document *document, renderer.max_width = document->options.wrap ? document->options.box.width : INT_MAX; - document->bgcolor = document->options.default_style.color.bg; + document->bgcolor = document->options.default_style.color.background; document->width = 0; #ifdef CONFIG_UTF8 document->options.utf8 = is_cp_utf8(document->options.cp);