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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/**
* $Id: css.h,v 1.1.1.1 2002/04/22 09:24:34 bursa Exp $
*/
#include "css_enum.h"
/**
* structures and typedefs
*/
typedef unsigned long colour; /* 0xrrggbb */
#define TRANSPARENT 0x1000000
struct css_length {
float value;
css_unit unit;
};
struct css_style {
css_display display;
css_float float_;
struct {
enum { CSS_FONT_SIZE_INHERIT,
CSS_FONT_SIZE_ABSOLUTE,
CSS_FONT_SIZE_LENGTH,
CSS_FONT_SIZE_PERCENT } size;
union {
float absolute;
struct css_length length;
float percent;
} value;
} font_size;
struct {
enum { CSS_HEIGHT_AUTO,
CSS_HEIGHT_LENGTH } height;
struct css_length length;
} height;
struct {
enum { CSS_WIDTH_AUTO,
CSS_WIDTH_LENGTH,
CSS_WIDTH_PERCENT } width;
union {
struct css_length length;
float percent;
} value;
} width;
enum { BACKGROUND_SCROLL = 1, BACKGROUND_FIXED } background_attachment;
colour background_color;
/* char background_image[100]; */
/* background-position */
enum { BACKGROUND_REPEAT = 1, BACKGROUND_REPEAT_X,
BACKGROUND_REPEAT_Y, BACKGROUND_NO_REPEAT } background_repeat;
/* borders */
enum { CLEAR_NONE = 1, CLEAR_BOTH, CLEAR_LEFT, CLEAR_RIGHT } clear;
colour color;
/* font-family */
enum { FONT_STRAIGHT, FONT_OBLIQUE, FONT_ITALIC } font_style;
enum { FONT_NORMAL, FONT_SMALLCAPS } font_variant;
struct {
enum { WEIGHT_ABSOLUTE, WEIGHT_BOLDER, WEIGHT_LIGHTER } weight;
unsigned int value;
} font_weight;
};
struct css_stylesheet;
struct css_selector {
char * element;
char * class;
char * id;
};
/**
* interface
*/
struct css_stylesheet * css_new_stylesheet(void);
void css_get_style(struct css_stylesheet * stylesheet, struct css_selector * selector,
unsigned int selectors, struct css_style * style);
void css_parse_stylesheet(struct css_stylesheet * stylesheet, char * str);
void css_dump_style(const struct css_style * const style);
void css_cascade(struct css_style * const style, const struct css_style * const apply);
|