blob: 3c9a7951c5193d2dca8f0280e2031cb5792d8de9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef __STYLEENGINE_HH__
#define __STYLEENGINE_HH__
#include "dw/core.hh"
#include "doctree.hh"
#include "css.hh"
class StyleEngine : public Doctree {
private:
class Node : public DoctreeNode {
public:
dw::core::style::Style *style;
const char *styleAttribute;
};
dw::core::Layout *layout;
lout::misc::SimpleVector <Node> *stack;
CssContext *cssContext;
dw::core::style::Style *style0 (CssPropertyList *nonCssProperties = NULL);
void apply (dw::core::style::StyleAttrs *attrs, CssPropertyList *props);
int computeValue (int value, dw::core::style::Font *font);
void computeValues (dw::core::style::Box *box, dw::core::style::Font *font);
public:
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 > 0)
return stack->getRef (n->depth - 1);
else
return NULL;
};
void startElement (int tag, const char *id, const char *klass,
const char *style);
void endElement (int tag);
void setNonCssProperties (CssPropertyList *props);
void setPseudoClass (const char *pseudoClass);
inline dw::core::style::Style *style () {
dw::core::style::Style *s = stack->getRef (stack->size () - 1)->style;
if (s)
return s;
else
return style0 ();
};
};
#endif
|