diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/styleengine.cc | 15 | ||||
-rw-r--r-- | src/styleengine.hh | 2 | ||||
-rw-r--r-- | src/table.cc | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc index 7b151469..fa628d84 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -64,6 +64,7 @@ void StyleEngine::startElement (int element) { n->klass = NULL; n->pseudo = NULL; n->styleAttribute = NULL; + n->inheritBackgroundColor = false; } void StyleEngine::setId (const char *id) { @@ -95,6 +96,16 @@ void StyleEngine::setNonCssHints (CssPropertyList *nonCssHints) { } /** + * \brief Use of the background color of the parent style as default. + * This is only used in table code to allow for colors specified for + * table rows as table rows are currently no widgets and therefore + * don't draw any background. + */ +void StyleEngine::inheritBackgroundColor () { + stack->getRef (stack->size () - 1)->inheritBackgroundColor = true; +} + +/** * \brief set the CSS pseudo class (e.g. "link", "visited"). */ void StyleEngine::setPseudo (const char *pseudo) { @@ -337,6 +348,10 @@ Style * StyleEngine::style0 (CssPropertyList *nonCssProperties) { StyleAttrs attrs = *stack->getRef (stack->size () - 2)->style; // reset values that are not inherited according to CSS attrs.resetValues (); + + if (stack->getRef (stack->size () - 2)->inheritBackgroundColor) + attrs.backgroundColor = + stack->getRef (stack->size () - 2)->style->backgroundColor; cssContext->apply (&props, this, tagStyleProps, nonCssProperties); diff --git a/src/styleengine.hh b/src/styleengine.hh index 60b044b8..7631eb55 100644 --- a/src/styleengine.hh +++ b/src/styleengine.hh @@ -11,6 +11,7 @@ class StyleEngine : public Doctree { public: dw::core::style::Style *style; const char *styleAttribute; + bool inheritBackgroundColor; }; dw::core::Layout *layout; @@ -44,6 +45,7 @@ class StyleEngine : public Doctree { void endElement (int tag); void setPseudo (const char *pseudo); void setNonCssHints (CssPropertyList *nonCssHints); + void inheritBackgroundColor (); inline dw::core::style::Style *style () { dw::core::style::Style *s = stack->getRef (stack->size () - 1)->style; diff --git a/src/table.cc b/src/table.cc index 994dcbbd..2b7e2517 100644 --- a/src/table.cc +++ b/src/table.cc @@ -191,6 +191,7 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize) } } + html->styleEngine->inheritBackgroundColor (); html->styleEngine->setNonCssHints (&props); ((dw::Table*)S_TOP(html)->table)->addRow (html->styleEngine->style ()); |