From ca6424595b5bfea78d7d6107b705c0e9a9ffe77b Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Wed, 10 Oct 2007 14:37:10 +0200 Subject: [PATCH] format.(clink|vlink|...) -> format.color.(clink|vlink|...) It makes more obvious these fields are colors. --- src/document/html/parser.c | 8 ++++---- src/document/html/parser.h | 11 +++++++---- src/document/html/parser/general.c | 4 ++-- src/document/html/parser/link.c | 10 +++++----- src/document/html/parser/parse.c | 2 +- src/document/html/renderer.c | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/document/html/parser.c b/src/document/html/parser.c index 8a3dded5..30b858ae 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -899,12 +899,12 @@ init_html_parser(struct uri *uri, struct document_options *options, format.title = NULL; format.style = options->default_style; - format.clink = options->default_link; - format.vlink = options->default_vlink; + format.color.clink = options->default_link; + format.color.vlink = options->default_vlink; #ifdef CONFIG_BOOKMARKS - format.bookmark_link = options->default_bookmark_link; + format.color.bookmark_link = options->default_bookmark_link; #endif - format.image_link = options->default_image_link; + format.color.image_link = options->default_image_link; par_format.align = ALIGN_LEFT; par_format.leftmargin = options->margin; diff --git a/src/document/html/parser.h b/src/document/html/parser.h index 44d255f9..3e8fd3d4 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -32,12 +32,15 @@ struct text_attrib { unsigned char *image; unsigned char *title; struct form_control *form; - color_T clink; - color_T vlink; + + struct { + color_T clink; + color_T vlink; #ifdef CONFIG_BOOKMARKS - color_T bookmark_link; + color_T bookmark_link; #endif - color_T image_link; + color_T image_link; + } color; #ifdef CONFIG_CSS /* Bug 766: CSS speedup. 56% of CPU time was going to diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c index 277905c6..59db0a30 100644 --- a/src/document/html/parser/general.c +++ b/src/document/html/parser/general.c @@ -166,8 +166,8 @@ 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.fg); - get_color(html_context, a, "link", &format.clink); - get_color(html_context, a, "vlink", &format.vlink); + 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.bg) != -1) html_context->was_body_background = 1; diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index 8ac09a63..1987b037 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.fg = format.vlink; + format.style.fg = 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.fg = format.bookmark_link; + format.style.fg = 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.fg = format.clink; + format.style.fg = format.color.clink; html_top->pseudo_class &= ~ELEMENT_VISITED; html_top->pseudo_class |= ELEMENT_LINK; } @@ -199,7 +199,7 @@ put_image_label(unsigned char *a, unsigned char *label, html_focusable(html_context, a); fg = format.style.fg; - format.style.fg = format.image_link; + format.style.fg = format.color.image_link; put_chrs(html_context, label, strlen(label)); format.style.fg = fg; } @@ -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.fg = format.clink; + format.style.fg = 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 95d61bd3..00d0007e 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.fg = format.clink; + format.style.fg = 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 486607c6..d30a43ed 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -1306,7 +1306,7 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen) link->color.background = format.style.bg; link->color.foreground = link_is_textinput(link) - ? format.style.fg : format.clink; + ? format.style.fg : format.color.clink; init_link_event_hooks(html_context, link); @@ -1896,7 +1896,7 @@ color_link_lines(struct html_context *html_context) /* XXX: Entering hack zone! Change to clink color after * link text has been recolored. */ if (schar->data == ':' && colors.foreground == 0x0) - colors.foreground = format.clink; + colors.foreground = format.color.clink; } colors.foreground = 0x0;