summaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-14 00:29:45 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-14 00:29:45 +0000
commit5134709a436559f89871d0dc5cac57c17aa7d3ab (patch)
tree19d2354687c67f97067b5b6b1c2317caec8caef6 /src/stylesheet.c
parent3ba0934ed0722b1021acc8bda47b4c66e1914ab9 (diff)
downloadlibcss-5134709a436559f89871d0dc5cac57c17aa7d3ab.tar.gz
libcss-5134709a436559f89871d0dc5cac57c17aa7d3ab.tar.bz2
Create charset rule objects.
svn path=/trunk/libcss/; revision=6059
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 72c5f02..ce971bc 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -674,6 +674,32 @@ css_error css_stylesheet_rule_append_style(css_stylesheet *sheet,
}
/**
+ * Set the charset of a CSS rule
+ *
+ * \param sheet The stylesheet context
+ * \param rule The rule to add to (must be of type CSS_RULE_CHARSET)
+ * \param charset The charset
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_rule_set_charset(css_stylesheet *sheet,
+ css_rule *rule, const parserutils_hash_entry *charset)
+{
+ css_rule_charset *r = (css_rule_charset *) rule;
+
+ if (sheet == NULL || rule == NULL || charset == NULL)
+ return CSS_BADPARM;
+
+ /* Ensure rule is a CSS_RULE_CHARSET */
+ if (rule->type != CSS_RULE_CHARSET)
+ return CSS_INVALID;
+
+ /* Set rule's encoding field */
+ r->encoding = charset;
+
+ return CSS_OK;
+}
+
+/**
* Add a rule to a stylesheet
*
* \param sheet The stylesheet to add to