diff options
-rw-r--r-- | src/css.hh | 4 | ||||
-rw-r--r-- | src/html.cc | 39 |
2 files changed, 15 insertions, 28 deletions
@@ -8,7 +8,7 @@ class CssProperty { public: typedef union { int intVal; - char *strVal; + const char *strVal; } Value; typedef enum { @@ -123,7 +123,7 @@ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> { static CssPropertyList *parse (const char *buf); void set (CssProperty::Name name, CssProperty::Value value); - void set (CssProperty::Name name, char *value) { + void set (CssProperty::Name name, const char *value) { CssProperty::Value v; v.strVal = value; set (name, v); diff --git a/src/html.cc b/src/html.cc index fcc769d0..711abe01 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1915,39 +1915,26 @@ static void Html_tag_open_br(DilloHtml *html, const char *tag, int tagsize) */ static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize) { - StyleAttrs style_attrs; - Style *old_style; /*Font font;*/ const char *attrbuf; int32_t color; + CssPropertyList props; - if (!prefs.force_my_colors) { - old_style = html->styleEngine->style (); - style_attrs = *old_style; - - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "color"))) { - if (prefs.contrast_visited_color && html->InVisitedLink) { - color = html->visited_color; - } else { - /* use the tag-specified color */ - color = a_Html_color_parse(html, attrbuf, - style_attrs.color->getColor()); - style_attrs.color = Color::createSimple (HT2LT(html), color); - } + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "color"))) { + if (prefs.contrast_visited_color && html->InVisitedLink) { + color = html->visited_color; + } else { + /* use the tag-specified color */ + color = a_Html_color_parse(html, attrbuf, -1); } + if (color != -1) + props.set (CssProperty::CSS_PROPERTY_COLOR, color); + } -#if 0 - //if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "face"))) { - // font = *( style_attrs.font ); - // font.name = attrbuf; - // style_attrs.font = a_Dw_style_font_new_from_list (&font); - //} -#endif + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "face"))) + props.set (CssProperty::CSS_PROPERTY_FONT_FAMILY, attrbuf); -// html->styleEngine->style () = -// Style::create (HT2LT(html), &style_attrs); -// old_style->unref (); - } + html->styleEngine->setNonCssProperties (&props); } /* |