From be460d4477d8955063bf834377d8e934cc507a3d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 14 Jan 2009 11:34:45 +0000 Subject: 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 --- src/stylesheet.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/stylesheet.c') diff --git a/src/stylesheet.c b/src/stylesheet.c index ce971bc..6d01e18 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -699,6 +699,32 @@ css_error css_stylesheet_rule_set_charset(css_stylesheet *sheet, return CSS_OK; } +/** + * 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 * -- cgit v1.2.3