summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-08-07 08:11:51 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-08-07 08:11:51 +0000
commitdc761c227e004f3dcbd8fa3bd8d58201762ac602 (patch)
tree2fbfa73a3de3e365b9709b2f13f188ff4e9ffee4 /docs
parent826eb5873c5908c658013f7e61aec30911614d55 (diff)
downloadlibcss-dc761c227e004f3dcbd8fa3bd8d58201762ac602.tar.gz
libcss-dc761c227e004f3dcbd8fa3bd8d58201762ac602.tar.bz2
Sketch out the internal representation of a stylesheet
svn path=/trunk/libcss/; revision=4942
Diffstat (limited to 'docs')
-rw-r--r--docs/Representation96
1 files changed, 96 insertions, 0 deletions
diff --git a/docs/Representation b/docs/Representation
new file mode 100644
index 0000000..b4e4a89
--- /dev/null
+++ b/docs/Representation
@@ -0,0 +1,96 @@
+LibCSS internal stylesheet representation
+=========================================
+
+Selector:
+
+struct selector {
+ selector_type type; /**< Type of selector */
+
+ struct {
+ const uint8_t *name;
+ size_t name_len;
+
+ const uint8_t *value;
+ size_t value_len;
+ } data; /**< Selector data */
+
+ combinator combinator_type; /**< Type of combinator */
+ struct selector *combinator; /**< Combining selector */
+
+ struct rule *rule; /**< Owning rule */
+
+ struct style *style; /**< Applicable style */
+
+ struct selector *chain_next; /**< Next in hash chain */
+ struct selector *chain_prev; /**< Previous in hash chain */
+};
+
+Rule:
+
+struct rule {
+ rule_type type; /**< Type of rule */
+
+ union {
+ struct {
+ uint32_t selector_count;
+ struct selector **selectors;
+ } selector;
+ struct {
+ uint32_t media;
+ uint32_t rule_count;
+ struct rule **rules;
+ } media;
+ struct {
+ struct style *style;
+ } font_face;
+ struct {
+ uint32_t selector_count;
+ struct selector **selectors;
+ struct style *style;
+ } page;
+ struct {
+ struct stylesheet *sheet;
+ } import;
+ struct {
+ char *encoding;
+ } charset;
+ } data; /**< Rule data */
+
+ uint32_t index; /**< Index of rule in sheet */
+
+ struct stylesheet *owner; /**< Owning sheet */
+
+ struct rule *parent; /**< Parent rule */
+ struct rule *first_child; /**< First in child list */
+ struct rule *last_child; /**< Last in child list */
+ struct rule *next; /**< Next rule */
+ struct rule *prev; /**< Previous rule */
+};
+
+Stylesheet:
+
+struct stylesheet {
+#define HASH_SIZE (37)
+ struct selector *selectors[HASH_SIZE]; /**< Hashtable of selectors */
+
+ uint32_t rule_count; /**< Number of rules in sheet */
+ struct rule *rule_list; /**< List of rules in sheet */
+
+ bool disabled; /**< Whether this sheet is
+ * disabled */
+
+ char *url; /**< URL of this sheet */
+ char *title; /**< Title of this sheet */
+
+ uint32_t media; /**< Bitfield of media types */
+
+ void *ownerNode; /**< Owning node in document */
+ struct rule *ownerRule; /**< Owning rule in parent */
+
+ struct stylesheet *parent; /**< Parent sheet */
+ struct stylesheet *first_child; /**< First in child list */
+ struct stylesheet *last_child; /**< Last in child list */
+ struct stylesheet *next; /**< Next in sibling list */
+ struct stylesheet *prev; /**< Previous in sibling list */
+};
+