diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-08-04 23:46:11 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-08-04 23:46:11 +0000 |
commit | 1560847dc040a0bfc90da892cb327001b1a39765 (patch) | |
tree | f8bc2fe65803f8dc17b1f41d874e883aaa8cf5d4 | |
parent | ec7f168e2d432f3ef184c86f65e0def1f369f671 (diff) | |
download | libcss-1560847dc040a0bfc90da892cb327001b1a39765.tar.gz libcss-1560847dc040a0bfc90da892cb327001b1a39765.tar.bz2 |
Something approximating @import
svn path=/trunk/libcss/; revision=4904
-rw-r--r-- | src/parse/css21.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/parse/css21.c b/src/parse/css21.c index 7a8d6b4..2dafe89 100644 --- a/src/parse/css21.c +++ b/src/parse/css21.c @@ -45,7 +45,7 @@ struct css_css21 { enum { BEFORE_CHARSET, - AFTER_CHARSET, + BEFORE_RULES, HAD_RULE, } state; /**< State flag, for at-rule handling */ @@ -327,13 +327,38 @@ css_error handleStartAtRule(css_css21 *c, const parserutils_vector *vector) if (token != NULL) return CSS_INVALID; - c->state = AFTER_CHARSET; + c->state = BEFORE_RULES; } else { return CSS_INVALID; } } else if (atkeyword->data.ptr == c->strings[IMPORT]) { - /** \todo any0 = (STRING | URI) ws - * (IDENT ws (',' ws IDENT ws)* )? */ + if (c->state != HAD_RULE) { + /* any0 = (STRING | URI) ws + * (IDENT ws (',' ws IDENT ws)* )? */ + const css_token *uri = + parserutils_vector_iterate(vector, &any); + if (uri == NULL || (token->type != CSS_TOKEN_STRING && + token->type != CSS_TOKEN_URI)) + return CSS_INVALID; + + /* Whitespace */ + do { + token = parserutils_vector_iterate(vector, + &any); + if (token == NULL || token->type != CSS_TOKEN_S) + break; + } while (token != NULL); + + /** \todo Media list */ + if (token != NULL) { + } + + /** \todo trigger fetch of imported sheet */ + + c->state = BEFORE_RULES; + } else { + return CSS_INVALID; + } } else if (atkeyword->data.ptr == c->strings[MEDIA]) { /** \todo any0 = IDENT ws (',' ws IDENT ws)* */ } else if (atkeyword->data.ptr == c->strings[PAGE]) { |