Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. LibCSS internal stylesheet representation
  2. =========================================
  3.  
  4. Selector:
  5.  
  6. struct selector {
  7.         selector_type type;                     /**< Type of selector */
  8.  
  9.         struct {
  10.                 const uint8_t *name;
  11.                 size_t name_len;
  12.  
  13.                 const uint8_t *value;
  14.                 size_t value_len;
  15.         } data;                                 /**< Selector data */
  16.  
  17.         struct selector *specifics;             /**< Selector specifics */
  18.  
  19.         combinator combinator_type;             /**< Type of combinator */
  20.         struct selector *combinator;            /**< Combining selector */
  21.  
  22.         struct rule *rule;                      /**< Owning rule */
  23.  
  24.         struct style *style;                    /**< Applicable style */
  25.  
  26.         struct selector *next;                  /**< Next selector in list */
  27.         struct selector *prev;                  /**< Previous selector */
  28. };
  29.  
  30. Rule:
  31.  
  32. struct rule {
  33.         rule_type type;                         /**< Type of rule */
  34.  
  35.         union {
  36.                 struct {
  37.                         uint32_t selector_count;
  38.                         struct selector **selectors;
  39.                 } selector;
  40.                 struct {
  41.                         uint32_t media;
  42.                         uint32_t rule_count;
  43.                         struct rule **rules;
  44.                 } media;
  45.                 struct {
  46.                         struct style *style;
  47.                 } font_face;
  48.                 struct {
  49.                         uint32_t selector_count;
  50.                         struct selector **selectors;
  51.                         struct style *style;
  52.                 } page;
  53.                 struct {
  54.                         struct stylesheet *sheet;
  55.                 } import;
  56.                 struct {
  57.                         char *encoding;
  58.                 } charset;
  59.         } data;                                 /**< Rule data */
  60.  
  61.         uint32_t index;                         /**< Index of rule in sheet */
  62.  
  63.         struct stylesheet *owner;               /**< Owning sheet */
  64.  
  65.         struct rule *parent;                    /**< Parent rule */
  66.         struct rule *first_child;               /**< First in child list */
  67.         struct rule *last_child;                /**< Last in child list */
  68.         struct rule *next;                      /**< Next rule */
  69.         struct rule *prev;                      /**< Previous rule */
  70. };
  71.  
  72. Stylesheet:
  73.  
  74. struct stylesheet {
  75. #define HASH_SIZE (37)
  76.         struct selector *selectors[HASH_SIZE];  /**< Hashtable of selectors */
  77.  
  78.         uint32_t rule_count;                    /**< Number of rules in sheet */
  79.         struct rule *rule_list;                 /**< List of rules in sheet */
  80.  
  81.         bool disabled;                          /**< Whether this sheet is
  82.                                                  * disabled */
  83.  
  84.         char *url;                              /**< URL of this sheet */
  85.         char *title;                            /**< Title of this sheet */
  86.  
  87.         uint32_t media;                         /**< Bitfield of media types */
  88.  
  89.         void *ownerNode;                        /**< Owning node in document */
  90.         struct rule *ownerRule;                 /**< Owning rule in parent */
  91.  
  92.         struct stylesheet *parent;              /**< Parent sheet */
  93.         struct stylesheet *first_child;         /**< First in child list */
  94.         struct stylesheet *last_child;          /**< Last in child list */
  95.         struct stylesheet *next;                /**< Next in sibling list */
  96.         struct stylesheet *prev;                /**< Previous in sibling list */
  97. };
  98.  
  99.