summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 17:20:19 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 17:20:19 +0000
commit1d8b0aad719898be0f1b8a862be41c2b51075c80 (patch)
tree1efac87b00dba4be396a3aa9ef1c45e023272ff0 /src/parse
parent03c0b36fdb90960b4a4c1e6f86084c850463195b (diff)
downloadlibcss-1d8b0aad719898be0f1b8a862be41c2b51075c80.tar.gz
libcss-1d8b0aad719898be0f1b8a862be41c2b51075c80.tar.bz2
Rework handling of imported stylesheets.
No longer is the client called back mid-parse. Instead, they must acquire details of and process imported stylesheets after css_stylesheet_data_done() has been called on the parent sheet. The return code of css_stylesheet_data_done() informs the client of the need to process imported sheets. svn path=/trunk/libcss/; revision=6504
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/language.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/parse/language.c b/src/parse/language.c
index a187379..11fe972 100644
--- a/src/parse/language.c
+++ b/src/parse/language.c
@@ -408,7 +408,6 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
} else if (atkeyword->ilower == c->strings[IMPORT]) {
if (c->state != HAD_RULE) {
css_rule *rule;
- css_stylesheet *import;
css_media_type media = 0;
css_error error;
@@ -477,49 +476,15 @@ css_error handleStartAtRule(css_language *c, const parserutils_vector *vector)
if (error != CSS_OK)
return error;
- /** \todo resolve URI */
- char url[uri->idata->len + 1];
- memcpy(url, uri->idata->data, uri->idata->len);
- url[uri->idata->len] = '\0';
-
- /* Create imported sheet */
- error = css_stylesheet_create(c->sheet->level, NULL,
- url, NULL, c->sheet->origin, media,
- c->sheet->import, c->sheet->import_pw,
- c->alloc, c->pw, &import);
+ error = css_stylesheet_rule_set_nascent_import(c->sheet,
+ rule, uri->idata, media);
if (error != CSS_OK) {
css_stylesheet_rule_destroy(c->sheet, rule);
return error;
}
- /* Trigger fetch of imported sheet */
- if (c->sheet->import != NULL) {
- error = c->sheet->import(c->sheet->import_pw,
- url, import);
- if (error != CSS_OK) {
- css_stylesheet_destroy(import);
- css_stylesheet_rule_destroy(c->sheet,
- rule);
- return error;
- }
- }
-
- error = css_stylesheet_rule_set_import(c->sheet, rule,
- import);
- if (error != CSS_OK) {
- /** \todo we need to tell the client to stop
- * doing stuff with the imported sheet */
- css_stylesheet_destroy(import);
- css_stylesheet_rule_destroy(c->sheet, rule);
- return error;
- }
-
- /* Imported sheet is now owned by the rule */
-
error = css_stylesheet_add_rule(c->sheet, rule);
if (error != CSS_OK) {
- /** \todo we need to tell the client to stop
- * doing stuff with the imported sheet */
css_stylesheet_rule_destroy(c->sheet, rule);
return error;
}