changeset 499:ae0a18aa6f2a

add klass parameter
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sun, 26 Oct 2008 20:34:47 +0100
parents 80382646fb75
children c049012b8b74
files src/css.hh src/html.cc src/styleengine.cc src/styleengine.hh
diffstat 4 files changed, 51 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.hh	Thu Oct 23 20:38:47 2008 +0200
+++ b/src/css.hh	Sun Oct 26 20:34:47 2008 +0100
@@ -3,8 +3,44 @@
 
 #include "dw/core.hh"
 
+class CssProperties {
+   private:
+      dw::core::style::StyleAttrs attrs;
+      bool fontValid;
+      bool textDecorationValid;
+      bool colorValid;
+      bool backgroundColorValid;
+      bool textAlignValid;
+      bool valignValid;
+      bool textAlignCharValid;
+      bool hBorderSpacingValid;
+      bool vBorderSpacingValid;
+      bool widthValid;
+      bool heightValid;
+      bool marginValid;
+      bool borderWidthValid;
+      bool paddingValid;
+      bool borderColorValid;   
+      bool borderStyleValid;
+      bool displayValid;
+      bool whiteSpaceValid;
+      bool listStyleTypeValid;
+      bool cursorValid;
+
+   public:
+      CssProperties ();
+      ~CssProperties ();
+
+     void apply (const CssProperties *p); 
+
+};
+
+class CssSelector {
+};
+
 class CssRule {
    private:
+      CssProperties props;
 
    public:
       CssRule ();
--- a/src/html.cc	Thu Oct 23 20:38:47 2008 +0200
+++ b/src/html.cc	Sun Oct 26 20:34:47 2008 +0100
@@ -3445,7 +3445,7 @@
 {
    int ci, ni;           /* current and new tag indexes */
    const char *attrbuf;
-   char *id = NULL, *style = NULL;
+   char *id = NULL, *klass = NULL, *style = NULL;
    char *start = tag + 1; /* discard the '<' */
    int IsCloseTag = (*start == '/');
 
@@ -3515,6 +3515,13 @@
          html->NameVal = NULL;
       }
 
+      if (tagsize >= 10) {       /* length of "<t class=i>" */
+          attrbuf = Html_get_attr2(html, tag, tagsize, "class",
+                                   HTML_LeftTrim | HTML_RightTrim);
+          if (attrbuf)
+            klass = strdup (attrbuf);
+      }
+
       if (tagsize >= 11) {       /* length of "<t style=i>" */
           attrbuf = Html_get_attr2(html, tag, tagsize, "style",
                                    HTML_LeftTrim | HTML_RightTrim);
@@ -3522,10 +3529,13 @@
             style = strdup (attrbuf);
       }
 
-      html->styleEngine->startElement (ni, id, style);
+
+      html->styleEngine->startElement (ni, id, klass, style);
 
       if (id)
          free (id);
+      if (klass)
+         free (klass);
       if (style)
          free (style);
 
--- a/src/styleengine.cc	Thu Oct 23 20:38:47 2008 +0200
+++ b/src/styleengine.cc	Sun Oct 26 20:34:47 2008 +0100
@@ -19,8 +19,8 @@
 }
 
 void
-StyleEngine::startElement (int tag, const char *id, const char *style) {
-   fprintf(stderr, "===> START %d %s %s\n", tag, id, style);
+StyleEngine::startElement (int tag, const char *id, const char *klass, const char *style) {
+   fprintf(stderr, "===> START %d %s %s %s\n", tag, id, klass, style);
 }
 
 void
--- a/src/styleengine.hh	Thu Oct 23 20:38:47 2008 +0200
+++ b/src/styleengine.hh	Sun Oct 26 20:34:47 2008 +0100
@@ -11,7 +11,7 @@
       StyleEngine ();
       ~StyleEngine ();
 
-      void startElement (int tag, const char *id, const char *style);
+      void startElement (int tag, const char *id, const char *klass, const char *style);
       void endElement (int tag);
       inline dw::core::style::Style *style () { return currentStyle; };
 };