diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parse/language.c | 12 | ||||
-rw-r--r-- | src/stylesheet.c | 6 | ||||
-rw-r--r-- | src/stylesheet.h | 3 |
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 */ |