summaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2011-09-19 21:33:52 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2011-09-19 21:33:52 +0200
commitabd446c2eebe1f96764b6d95f1c6c61ae9bc40b2 (patch)
treeb313bbeebf50fd53369d303824edab57aa69d016 /src/styleengine.cc
parentb0b0cddaff10b4cff371b8bb7aa21e045f8e3915 (diff)
parent0caf22a3f7c33578a073cee42c6cfa61f971bc42 (diff)
merge
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index 776c1694..a4c31ccb 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -52,6 +52,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) {
n->wordStyle = NULL;
n->backgroundStyle = NULL;
n->styleAttrProperties = NULL;
+ n->styleAttrPropertiesImportant = NULL;
n->nonCssProperties = NULL;
n->inheritBackgroundColor = false;
}
@@ -82,6 +83,7 @@ void StyleEngine::startElement (int element) {
stack->increase ();
Node *n = stack->getRef (stack->size () - 1);
n->styleAttrProperties = NULL;
+ n->styleAttrPropertiesImportant = NULL;
n->nonCssProperties = NULL;
n->style = NULL;
n->wordStyle = NULL;
@@ -138,10 +140,14 @@ void StyleEngine::setStyle (const char *styleAttr) {
Node *n = stack->getRef (stack->size () - 1);
assert (n->styleAttrProperties == NULL);
// parse style information from style="" attribute, if it exists
- if (styleAttr && prefs.parse_embedded_css)
- n->styleAttrProperties =
- CssParser::parseDeclarationBlock (styleAttr,
- strlen (styleAttr));
+ if (styleAttr && prefs.parse_embedded_css) {
+ n->styleAttrProperties = new CssPropertyList (true);
+ n->styleAttrPropertiesImportant = new CssPropertyList (true);
+
+ CssParser::parseDeclarationBlock (styleAttr, strlen (styleAttr),
+ n->styleAttrProperties,
+ n->styleAttrPropertiesImportant);
+ }
};
/**
@@ -213,6 +219,8 @@ void StyleEngine::endElement (int element) {
if (n->styleAttrProperties)
delete n->styleAttrProperties;
+ if (n->styleAttrPropertiesImportant)
+ delete n->styleAttrPropertiesImportant;
if (n->nonCssProperties)
delete n->nonCssProperties;
if (n->style)
@@ -709,7 +717,8 @@ Style * StyleEngine::backgroundStyle () {
* This method is private. Call style() to get a current style object.
*/
Style * StyleEngine::style0 (int i) {
- CssPropertyList props, *styleAttrProperties, *nonCssProperties;
+ CssPropertyList props, *styleAttrProperties, *styleAttrPropertiesImportant;
+ CssPropertyList *nonCssProperties;
// get previous style from the stack
StyleAttrs attrs = *stack->getRef (i - 1)->style;
@@ -726,11 +735,13 @@ Style * StyleEngine::style0 (int i) {
preprocessAttrs (&attrs);
styleAttrProperties = stack->getRef (i)->styleAttrProperties;
+ styleAttrPropertiesImportant = stack->getRef(i)->styleAttrPropertiesImportant;
nonCssProperties = stack->getRef (i)->nonCssProperties;
// merge style information
cssContext->apply (&props, doctree, stack->getRef(i)->doctreeNode,
- styleAttrProperties, nonCssProperties);
+ styleAttrProperties, styleAttrPropertiesImportant,
+ nonCssProperties);
// apply style
apply (i, &attrs, &props);