comparison src/styleengine.hh @ 506:03de2284bfa6

switch to original enum names from dillo-0.8.0-css-3
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Wed, 29 Oct 2008 18:19:19 +0100
parents 00b31843839b
children fd2454cd0120
comparison
equal deleted inserted replaced
505:a3b15690d2f4 506:03de2284bfa6
1 #ifndef __STYLEENGINE_HH__ 1 #ifndef __STYLEENGINE_HH__
2 #define __STYLEENGINE_HH__ 2 #define __STYLEENGINE_HH__
3 3
4 #include "dw/core.hh" 4 #include "dw/core.hh"
5 #include "doctree.hh" 5 #include "doctree.hh"
6 #include "css.hh"
6 7
7 class StyleEngine : public Doctree { 8 class StyleEngine : public Doctree {
8 private: 9 private:
9 class Node : public DoctreeNode { 10 class Node : public DoctreeNode {
10 public: 11 public:
11 dw::core::style::Style *style; 12 dw::core::style::Style *style;
12
13
14 }; 13 };
15 14
16 lout::misc::SimpleVector <Node> *stack; 15 lout::misc::SimpleVector <Node> *stack;
16
17 dw::core::style::Style *style0 ();
17 18
18 public: 19 public:
19 StyleEngine (); 20 StyleEngine ();
20 ~StyleEngine (); 21 ~StyleEngine ();
21 22
22 /* Doctree interface */ 23 /* Doctree interface */
23 const DoctreeNode *top () { 24 inline const DoctreeNode *top () {
24 return stack->getRef (stack->size () - 1); 25 return stack->getRef (stack->size () - 1);
25 }; 26 };
26 const DoctreeNode *parent (const DoctreeNode *n) { 27
28 inline const DoctreeNode *parent (const DoctreeNode *n) {
27 if (n->depth > 0) 29 if (n->depth > 0)
28 return stack->getRef (n->depth - 1); 30 return stack->getRef (n->depth - 1);
29 else 31 else
30 return NULL; 32 return NULL;
31 }; 33 };
32 34
33 void startElement (int tag, const char *id, const char *klass, const char *style); 35 void startElement (int tag, const char *id, const char *klass,
36 const char *style);
34 void endElement (int tag); 37 void endElement (int tag);
38 void setNonCssProperties (CssPropertyList *props);
35 39
36 inline dw::core::style::Style *style () { 40 inline dw::core::style::Style *style () {
37 return stack->getRef (stack->size () - 1)->style; 41 dw::core::style::Style *s = stack->getRef (stack->size () - 1)->style;
42 if (s)
43 return s;
44 else
45 return style0 ();
38 }; 46 };
39 }; 47 };
40 48
41 #endif 49 #endif