summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/html.cc4
-rw-r--r--src/styleengine.cc18
-rw-r--r--src/styleengine.hh3
3 files changed, 17 insertions, 8 deletions
diff --git a/src/html.cc b/src/html.cc
index a9c5a324..00ab0ab3 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2414,11 +2414,11 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
if (a_Capi_get_flags(url) & CAPI_IsCached) {
html->InVisitedLink = true;
- html->styleEngine->setPseudo ("visited");
+ html->styleEngine->setPseudoVisited ();
if (html->visited_color != -1)
props.set (CssProperty::CSS_PROPERTY_COLOR, html->visited_color);
} else {
- html->styleEngine->setPseudo ("link");
+ html->styleEngine->setPseudoLink ();
if (html->link_color != -1)
props.set (CssProperty::CSS_PROPERTY_COLOR, html->link_color);
}
diff --git a/src/styleengine.cc b/src/styleengine.cc
index 3f1df608..a4a59173 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -39,6 +39,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) {
style_attrs.backgroundColor = Color::create (layout, 0xffffff);
n->style = Style::create (layout, &style_attrs);
+ n->pseudo = NULL;
}
StyleEngine::~StyleEngine () {
@@ -64,7 +65,7 @@ void StyleEngine::startElement (int element) {
n->element = element;
n->id = NULL;
n->klass = NULL;
- n->pseudo = NULL;
+ n->pseudo = stack->getRef (stack->size () - 2)->pseudo; // inherit pseudo
n->styleAttribute = NULL;
n->inheritBackgroundColor = false;
}
@@ -108,12 +109,19 @@ void StyleEngine::inheritBackgroundColor () {
}
/**
- * \brief set the CSS pseudo class (e.g. "link", "visited").
+ * \brief set the CSS pseudo class :link.
+ */
+void StyleEngine::setPseudoLink () {
+ Node *n = stack->getRef (stack->size () - 1);
+ n->pseudo = "link";
+}
+
+/**
+ * \brief set the CSS pseudo class :visited.
*/
-void StyleEngine::setPseudo (const char *pseudo) {
+void StyleEngine::setPseudoVisited () {
Node *n = stack->getRef (stack->size () - 1);
- assert (n->pseudo == NULL);
- n->pseudo = dStrdup (pseudo);
+ n->pseudo = "visited";
}
/**
diff --git a/src/styleengine.hh b/src/styleengine.hh
index 1b17cb52..c22631e7 100644
--- a/src/styleengine.hh
+++ b/src/styleengine.hh
@@ -50,7 +50,8 @@ class StyleEngine : public Doctree {
void setClass (const char *klass);
void setStyle (const char *style);
void endElement (int tag);
- void setPseudo (const char *pseudo);
+ void setPseudoLink ();
+ void setPseudoVisited ();
void setNonCssHints (CssPropertyList *nonCssHints);
void inheritBackgroundColor (); /* \todo get rid of this somehow */