diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-01-07 16:23:05 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-01-07 16:23:05 +0100 |
commit | a153bb89aaa85933d9619b4ffbff98a90baa7324 (patch) | |
tree | 640ba92a8f6fc722d305f9c7fb47545164074a88 /src/styleengine.hh | |
parent | c931cda3a9797da8ffd3ad24562a88837f5f4773 (diff) |
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.
Diffstat (limited to 'src/styleengine.hh')
-rw-r--r-- | src/styleengine.hh | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/styleengine.hh b/src/styleengine.hh index 8b5dd1fd..66f28cee 100644 --- a/src/styleengine.hh +++ b/src/styleengine.hh @@ -17,9 +17,9 @@ class StyleEngine; * 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 @@ class StyleEngine : public Doctree { 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 @@ class StyleEngine : public Doctree { 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); |