kolibrios/programs/network/netsurf/libcss/docs/Representation
Dmitry Pereverzev (SoUrcerer) 370da47fa0 Netsurf initial port (still needs native ui and cURL)
git-svn-id: svn://kolibrios.org@3584 a494cfbc-eb01-0410-851d-a64ba20cac60
2013-06-01 17:14:14 +00:00

99 lines
2.3 KiB
Plaintext

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 */
struct selector *specifics; /**< Selector specifics */
combinator combinator_type; /**< Type of combinator */
struct selector *combinator; /**< Combining selector */
struct rule *rule; /**< Owning rule */
struct style *style; /**< Applicable style */
struct selector *next; /**< Next selector in list */
struct selector *prev; /**< Previous selector */
};
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 */
};