From c0c441dc39e215f94c1cc04b2a20eabb141bbce4 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 14 Dec 2008 22:21:18 +0100 Subject: inherit pseudo classes "link" and "visited" --- src/styleengine.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/styleengine.cc') 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"; } /** -- cgit v1.2.3