changeset 1737:31d490fe7e0a

allow to apply CssContext to an arbitrary node in the docTree
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Mon, 11 Oct 2010 23:35:49 +0200
parents 6b1ecbfe96b5
children 7974b38cc036
files src/css.cc src/css.hh
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Mon Oct 11 21:57:32 2010 +0200
+++ b/src/css.cc	Mon Oct 11 23:35:49 2010 +0200
@@ -428,7 +428,7 @@
       }
    }
 
-   ruleList[numLists] = elementTable[docTree->top ()->element];
+   ruleList[numLists] = elementTable[node->element];
    if (ruleList[numLists])
       numLists++;
 
@@ -512,9 +512,8 @@
  * This allows e.g. user styles to overwrite author styles.
  */
 void CssContext::apply (CssPropertyList *props, Doctree *docTree,
+         DoctreeNode *node,
          CssPropertyList *tagStyle, CssPropertyList *nonCssHints) {
-   const DoctreeNode *node = docTree->top ();
-
    if (sheet[CSS_PRIMARY_USER_AGENT])
       sheet[CSS_PRIMARY_USER_AGENT]->apply (props, docTree, node);
 
--- a/src/css.hh	Mon Oct 11 21:57:32 2010 +0200
+++ b/src/css.hh	Mon Oct 11 23:35:49 2010 +0200
@@ -478,7 +478,7 @@
       void addRule (CssSelector *sel, CssPropertyList *props,
                     CssPrimaryOrder order);
       void apply (CssPropertyList *props,
-         Doctree *docTree,
+         Doctree *docTree, DoctreeNode *node,
          CssPropertyList *tagStyle, CssPropertyList *nonCssHints);
 };