summaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-14 11:34:45 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-14 11:34:45 +0000
commitbe460d4477d8955063bf834377d8e934cc507a3d (patch)
treef3bf0f79d709950b515266e4bfdb9556de9973af /src/stylesheet.c
parent48ec2d9eab392794845b666f7b261e4db38fd1e9 (diff)
downloadlibcss-be460d4477d8955063bf834377d8e934cc507a3d.tar.gz
libcss-be460d4477d8955063bf834377d8e934cc507a3d.tar.bz2
Make @import actually create a rule and attempt some kind of fetch logic.
There's still a bunch of outstanding functionality here (like URL resolution and media list parsing). Also, there's currently no way of telling the client to stop fetching data for a stylesheet (and, more importantly, not to attempt to access the stylesheet again as it's about to be destroyed) svn path=/trunk/libcss/; revision=6062
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index ce971bc..6d01e18 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -700,6 +700,32 @@ css_error css_stylesheet_rule_set_charset(css_stylesheet *sheet,
}
/**
+ * Set the imported stylesheet associated with a rule
+ *
+ * \param sheet The stylesheet context
+ * \param rule The rule to add to (must be of type CSS_RULE_IMPORT)
+ * \param import The imported sheet
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_rule_set_import(css_stylesheet *sheet,
+ css_rule *rule, css_stylesheet *import)
+{
+ css_rule_import *r = (css_rule_import *) rule;
+
+ if (sheet == NULL || rule == NULL || import == NULL)
+ return CSS_BADPARM;
+
+ /* Ensure rule is a CSS_RULE_IMPORT */
+ if (rule->type != CSS_RULE_IMPORT)
+ return CSS_INVALID;
+
+ /* Set the rule's sheet field */
+ r->sheet = import;
+
+ return CSS_OK;
+}
+
+/**
* Add a rule to a stylesheet
*
* \param sheet The stylesheet to add to