summaryrefslogtreecommitdiff
path: root/css/css.h
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-05-21 23:30:19 +0000
committerJames Bursa <james@netsurf-browser.org>2005-05-21 23:30:19 +0000
commitff74a126f7a0b37ca81e5bd78d691aea1436884a (patch)
tree394d6d916102b24aee58a2af72ba776dc4bcaea4 /css/css.h
parent9edb2fb92ca5d02406142edc8443b6d3e54e8ac5 (diff)
downloadnetsurf-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.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/css/css.h b/css/css.h
index 19b8a8c25..adddbf987 100644
--- a/css/css.h
+++ b/css/css.h
@@ -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);