summaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index 5c6f0972..d9ec3ff2 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -465,6 +465,21 @@ bool StyleEngine::computeLength (dw::core::style::Length *dest,
}
/**
+ * \brief Similar to StyleEngine::style(), but with backgroundColor set.
+ * A normal style might have backgroundColor == NULL to indicate a transparent
+ * background. This method ensures that backgroundColor is set.
+ */
+Style * StyleEngine::backgroundStyle () {
+ StyleAttrs attrs = *style ();
+
+ for (int i = stack->size () - 1; i >= 0 && ! attrs.backgroundColor; i--)
+ attrs.backgroundColor = stack->getRef (i)->style->backgroundColor;
+
+ assert (attrs.backgroundColor);
+ return Style::create (layout, &attrs);
+}
+
+/**
* \brief Create a new style object based on the previously opened / closed
* HTML elements and the nonCssProperties that have been set.
* This method is private. Call style() to get a current style object.