diff options
author | James Bursa <james@netsurf-browser.org> | 2005-05-21 23:30:19 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-05-21 23:30:19 +0000 |
commit | ff74a126f7a0b37ca81e5bd78d691aea1436884a (patch) | |
tree | 394d6d916102b24aee58a2af72ba776dc4bcaea4 /css/css.h | |
parent | 9edb2fb92ca5d02406142edc8443b6d3e54e8ac5 (diff) | |
download | netsurf-ff74a126f7a0b37ca81e5bd78d691aea1436884a.tar.gz netsurf-ff74a126f7a0b37ca81e5bd78d691aea1436884a.tar.bz2 |
[project @ 2005-05-21 23:30:19 by bursa]
Improve selector specificity support by adding "working stylesheets" with pre-sorted lists of rules. This also simplifies css_get_style(). The stylesheet origin is now encoded in the specificity. Improve output of css_dump_style().
svn path=/import/netsurf/; revision=1729
Diffstat (limited to 'css/css.h')
-rw-r--r-- | css/css.h | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -38,6 +38,17 @@ typedef unsigned long colour; /* 0xbbggrr */ #define RIGHT 1 #define BOTTOM 2 #define LEFT 3 +#define CSS_SPECIFICITY_UA 0x0000000 +#define CSS_SPECIFICITY_USER 0x1000000 +#define CSS_SPECIFICITY_AUTHOR 0x2000000 +#define CSS_SPECIFICITY_ID 0x10000 +#define CSS_SPECIFICITY_CLASS 0x100 +#define CSS_SPECIFICITY_ATTR 0x100 +#define CSS_SPECIFICITY_ELEMENT 0x1 + + +struct css_working_stylesheet; + /** Representation of a CSS 2 length. */ struct css_length { @@ -461,12 +472,19 @@ struct css_style { struct css_stylesheet; +typedef enum { + CSS_ORIGIN_AUTHOR, + CSS_ORIGIN_USER, + CSS_ORIGIN_UA +} css_origin; + /** Data specific to CONTENT_CSS. */ struct content_css_data { struct css_stylesheet *css; /**< Opaque stylesheet data. */ unsigned int import_count; /**< Number of entries in import_url. */ char **import_url; /**< Imported stylesheet urls. */ struct content **import_content; /**< Imported stylesheet contents. */ + css_origin origin; /**< Origin of stylesheet. */ }; @@ -615,7 +633,12 @@ const char *css_parser_TokenName(int tokenType); #endif -void css_get_style(struct content *c, xmlNode *n, struct css_style * style); +void css_set_origin(struct content *c, css_origin origin); +struct css_working_stylesheet *css_make_working_stylesheet( + struct content **stylesheet_content, + unsigned int stylesheet_count); +void css_get_style(struct css_working_stylesheet *working_stylesheet, + xmlNode *element, struct css_style *style); struct css_style *css_duplicate_style(const struct css_style * const style); void css_free_style(struct css_style *style); void css_deep_free_content(struct css_content *content); |