diff src/styleengine.hh @ 1494:9225a90ad7dd

make Doctree a non-virtual class Doctree now is a proper class with it's own implementation. StyleEngine no longer needs to provide the Doctree interface itself. This hopefully make the code easier to understand and should also be a bit faster as no virtual methods are involved.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Thu, 07 Jan 2010 16:23:05 +0100
parents 6ed936726b50
children b27cf7eb15b6
line wrap: on
line diff
--- a/src/styleengine.hh	Thu Jan 07 14:49:43 2010 +0000
+++ b/src/styleengine.hh	Thu Jan 07 16:23:05 2010 +0100
@@ -17,9 +17,9 @@
  * HTML elements and their attributes via the startElement() / endElement()
  * methods.
  */
-class StyleEngine : public Doctree {
+class StyleEngine {
    private:
-      class Node : public DoctreeNode {
+      class Node {
          public:
             dw::core::style::Style *style;
             dw::core::style::Style *wordStyle;
@@ -30,7 +30,7 @@
       dw::core::Layout *layout;
       lout::misc::SimpleVector <Node> *stack;
       CssContext *cssContext;
-      int num;
+      Doctree *doctree;
       int importDepth;
 
       dw::core::style::Style *style0 (CssPropertyList *nonCssHints = NULL);
@@ -49,24 +49,12 @@
       StyleEngine (dw::core::Layout *layout);
       ~StyleEngine ();
 
-      /* Doctree interface */
-      inline const DoctreeNode *top () {
-         return stack->getRef (stack->size () - 1);
-      };
-
-      inline const DoctreeNode *parent (const DoctreeNode *n) {
-         if (n->depth > 1)
-            return stack->getRef (n->depth - 1);
-         else
-            return NULL;
-      };
-
       void parse (DilloHtml *html, DilloUrl *url, const char *buf, int buflen,
                   CssOrigin origin);
       void startElement (int tag);
       void startElement (const char *tagname);
       void setId (const char *id);
-      const char * getId () { return top ()->id; };
+      const char * getId () { return doctree->top ()->id; };
       void setClass (const char *klass);
       void setStyle (const char *style);
       void endElement (int tag);