changeset 495:7224de9c34b7

add StyleEngine
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Thu, 23 Oct 2008 20:03:33 +0200
parents db216e0183a1
children 8f420eb7c20d
files src/css.cc src/css.hh src/html.cc src/html_common.hh
diffstat 4 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Thu Oct 23 19:09:42 2008 +0200
+++ b/src/css.cc	Thu Oct 23 20:03:33 2008 +0200
@@ -11,8 +11,7 @@
 
 #include "css.hh"
 
-StyleEngine::StyleEngine (DilloHtml *html) {
-   this->html = html;
+StyleEngine::StyleEngine () {
 }
 
 StyleEngine::~StyleEngine () {
--- a/src/css.hh	Thu Oct 23 19:09:42 2008 +0200
+++ b/src/css.hh	Thu Oct 23 20:03:33 2008 +0200
@@ -2,19 +2,17 @@
 #define __CSS_HH__
 
 #include "dw/core.hh"
-#include "html_common.hh"
 
 class StyleEngine {
    private:
-      DilloHtml *html;
       dw::core::style::Style *currentStyle;
 
    public:
-      StyleEngine (DilloHtml *html);
+      StyleEngine ();
       ~StyleEngine ();
 
-      void startElement (const char *name);
-      void endElement (const char *name);
+      void startElement (int tag, const char *id, const char *style);
+      void endElement (int tag);
       inline dw::core::style::Style *style () { return currentStyle; };
 };
 
--- a/src/html.cc	Thu Oct 23 19:09:42 2008 +0200
+++ b/src/html.cc	Thu Oct 23 20:03:33 2008 +0200
@@ -481,6 +481,8 @@
    stack->getRef(0)->current_bg_color = prefs.bg_color;
    stack->getRef(0)->hand_over_break = false;
 
+   styleEngine = new StyleEngine ();
+
    InFlags = IN_NONE;
 
    Stash = dStr_new("");
--- a/src/html_common.hh	Thu Oct 23 19:09:42 2008 +0200
+++ b/src/html_common.hh	Thu Oct 23 20:03:33 2008 +0200
@@ -13,6 +13,8 @@
 
 #include "form.hh"
 
+#include "css.hh"
+
 /*
  * Macros 
  */
@@ -174,6 +176,7 @@
    float DocTypeVersion;          /* HTML or XHTML version number */
 
    lout::misc::SimpleVector<DilloHtmlState> *stack;
+   StyleEngine *styleEngine;
 
    int InFlags; /* tracks which elements we are in */