diff --git a/src/document/dom/rss.c b/src/document/dom/rss.c index d9dff1793..c75fccb9b 100644 --- a/src/document/dom/rss.c +++ b/src/document/dom/rss.c @@ -214,8 +214,6 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx) for (type = 0; type < RSS_STYLES; type++) { struct screen_char *template = &data->styles[type]; - color_T background = document->options.default_style.bg; - color_T foreground = document->options.default_style.fg; static int i_want_struct_module_for_dom; static unsigned char *names[RSS_STYLES] = { "title", "aux" }; @@ -237,7 +235,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx) selector = find_css_selector(&css->selectors, CST_ELEMENT, CSR_ROOT, names[type], strlen(names[type])); - init_template_by_style(template, &document->options, 0, foreground, background, + init_template_by_style(template, &document->options, selector ? &selector->properties : NULL); } diff --git a/src/document/dom/source.c b/src/document/dom/source.c index 4be7b225c..c54fc4d95 100644 --- a/src/document/dom/source.c +++ b/src/document/dom/source.c @@ -342,10 +342,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void * for (type = 0; type < DOM_NODES; type++) { struct screen_char *template = &data->styles[type]; - color_T background = document->options.default_style.bg; - color_T foreground = document->options.default_style.fg; static int i_want_struct_module_for_dom; - struct dom_string *name = get_dom_node_type_name(type); struct css_selector *selector = NULL; @@ -372,7 +369,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void * selector = find_css_selector(&css->selectors, CST_ELEMENT, CSR_ROOT, name->string, name->length); - init_template_by_style(template, &document->options, 0, foreground, background, + init_template_by_style(template, &document->options, selector ? &selector->properties : NULL); } diff --git a/src/document/dom/util.c b/src/document/dom/util.c index c78a95da5..8134c3928 100644 --- a/src/document/dom/util.c +++ b/src/document/dom/util.c @@ -38,9 +38,9 @@ init_template(struct screen_char *template, struct document_options *options, void init_template_by_style(struct screen_char *template, struct document_options *options, - color_T background, color_T foreground, enum screen_char_attr attr, - LIST_OF(struct css_property) *properties) + LIST_OF(struct css_property) *properties) { + struct text_style style = options->default_style; struct css_property *property; if (properties) { @@ -50,19 +50,19 @@ 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) - background = property->value.color; + style.bg = property->value.color; break; case CSS_PT_COLOR: - foreground = property->value.color; + style.fg = property->value.color; break; case CSS_PT_FONT_WEIGHT: - attr |= property->value.font_attribute.add; + style.attr |= property->value.font_attribute.add; break; case CSS_PT_FONT_STYLE: - attr |= property->value.font_attribute.add; + style.attr |= property->value.font_attribute.add; break; case CSS_PT_TEXT_DECORATION: - attr |= property->value.font_attribute.add; + style.attr |= property->value.font_attribute.add; break; case CSS_PT_DISPLAY: case CSS_PT_NONE: @@ -74,7 +74,7 @@ init_template_by_style(struct screen_char *template, struct document_options *op } } - init_template(template, options, attr, foreground, background); + get_screen_char_template(template, options, style); } diff --git a/src/document/dom/util.h b/src/document/dom/util.h index 890c839a6..fe6424d3e 100644 --- a/src/document/dom/util.h +++ b/src/document/dom/util.h @@ -44,8 +44,6 @@ struct dom_renderer { void init_template_by_style(struct screen_char *template, struct document_options *options, - color_T background, color_T foreground, - enum screen_char_attr attr, LIST_OF(struct css_property) *properties); void render_dom_text(struct dom_renderer *renderer, struct screen_char *template,