diff options
author | corvid <corvid@lavabit.com> | 2011-06-12 15:49:32 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2011-06-12 15:49:32 +0000 |
commit | aa1785ccf469b84eec7ab9961c04d9e0a54d2ad2 (patch) | |
tree | 161a6e56555026b731fec926d1e6844954f44f1e /src/styleengine.cc | |
parent | c5be2477a8078aa2c34c5b121320a062efe9a250 (diff) | |
parent | 988480437fbc89955ef4f08c283ce1f193972420 (diff) |
merge in recent changes from main repo
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r-- | src/styleengine.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc index d763146e..9a8a1738 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) @@ -706,7 +714,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; @@ -723,11 +732,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); |