diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-10-26 20:34:47 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-10-26 20:34:47 +0100 |
commit | 54215bccc9abe648593e29b11878552be69fd835 (patch) | |
tree | 468211d6e69b8e5423935748f18652c178e40a95 /src | |
parent | 1b864d4d57d1c193bff13485fc8647fe8af8807e (diff) |
add klass parameter
Diffstat (limited to 'src')
-rw-r--r-- | src/css.hh | 36 | ||||
-rw-r--r-- | src/html.cc | 14 | ||||
-rw-r--r-- | src/styleengine.cc | 4 | ||||
-rw-r--r-- | src/styleengine.hh | 2 |
4 files changed, 51 insertions, 5 deletions
@@ -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 (); diff --git a/src/html.cc b/src/html.cc index 7fd53227..391abfdb 100644 --- a/src/html.cc +++ b/src/html.cc @@ -3445,7 +3445,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) { 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 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) 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 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize) 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); diff --git a/src/styleengine.cc b/src/styleengine.cc index f1eb5330..a2ad556e 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -19,8 +19,8 @@ StyleEngine::~StyleEngine () { } 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 diff --git a/src/styleengine.hh b/src/styleengine.hh index 1e69ff49..3d6ef382 100644 --- a/src/styleengine.hh +++ b/src/styleengine.hh @@ -11,7 +11,7 @@ class StyleEngine { 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; }; }; |