summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-12-05 14:20:58 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-12-05 14:20:58 +0000
commit01d8e176628db2dc5a2a192ac7b097bd1998c8eb (patch)
treeaaafdf5d24f1bf0299dc171862c1a41e8f2f6914 /src
parent478018da914c247d0d49f64aba9eb3eb9a552199 (diff)
downloadlibcss-01d8e176628db2dc5a2a192ac7b097bd1998c8eb.tar.gz
libcss-01d8e176628db2dc5a2a192ac7b097bd1998c8eb.tar.bz2
Provide notification hook for imported stylesheets, to enable clients to parallelise their processing
svn path=/trunk/libcss/; revision=10999
Diffstat (limited to 'src')
-rw-r--r--src/parse/language.c12
-rw-r--r--src/stylesheet.c6
-rw-r--r--src/stylesheet.h3
3 files changed, 21 insertions, 0 deletions
diff --git a/src/parse/language.c b/src/parse/language.c
index cfe78e8..9605e5f 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -450,6 +450,18 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
return error;
}
+ /* Inform client of need for import */
+ if (c->sheet->import != NULL) {
+ error = c->sheet->import(c->sheet->import_pw,
+ c->sheet, url, media);
+ if (error != CSS_OK) {
+ lwc_string_unref(url);
+ css_stylesheet_rule_destroy(c->sheet,
+ rule);
+ return error;
+ }
+ }
+
/* No longer care about url */
lwc_string_unref(url);
diff --git a/src/stylesheet.c b/src/stylesheet.c
index eed4735..f2bb81a 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -32,6 +32,8 @@ static size_t _rule_size(const css_rule *rule);
* \param alloc_pw Client private data for alloc
* \param resolve URL resolution function
* \param resolve_pw Client private data for resolve
+ * \param import Import notification function
+ * \param import_pw Client private data for import
* \param stylesheet Pointer to location to receive stylesheet
* \return CSS_OK on success,
* CSS_BADPARM on bad parameters,
@@ -42,6 +44,7 @@ css_error css_stylesheet_create(css_language_level level,
bool allow_quirks, bool inline_style,
css_allocator_fn alloc, void *alloc_pw,
css_url_resolution_fn resolve, void *resolve_pw,
+ css_import_notification_fn import, void *import_pw,
css_stylesheet **stylesheet)
{
css_parser_optparams params;
@@ -135,6 +138,9 @@ css_error css_stylesheet_create(css_language_level level,
sheet->resolve = resolve;
sheet->resolve_pw = resolve_pw;
+ sheet->import = import;
+ sheet->import_pw = import_pw;
+
sheet->alloc = alloc;
sheet->pw = alloc_pw;
diff --git a/src/stylesheet.h b/src/stylesheet.h
index 2c6caac..fbd76b0 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -170,6 +170,9 @@ struct css_stylesheet {
css_style *free_styles[4]; /**< Free styles: 16B buckets */
+ css_import_notification_fn import; /**< Import notification function */
+ void *import_pw; /**< Private word */
+
css_url_resolution_fn resolve; /**< URL resolution function */
void *resolve_pw; /**< Private word */