From 3f62ae40d44812d08ef531d04c51937e9273b193 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 27 Jul 2009 13:56:05 +0000 Subject: Retrieve charset specified on the HTTP layer. svn path=/trunk/netsurf/; revision=8821 --- css/css.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'css/css.c') diff --git a/css/css.c b/css/css.c index b527e1667..6bebac0ef 100644 --- a/css/css.c +++ b/css/css.c @@ -56,6 +56,7 @@ static void *myrealloc(void *ptr, size_t size, void *pw) bool nscss_create(struct content *c, struct content *parent, const char *params[]) { + const char *charset = NULL; css_origin origin = CSS_ORIGIN_AUTHOR; uint64_t media = CSS_MEDIA_ALL; lwc_context *dict = NULL; @@ -64,10 +65,16 @@ bool nscss_create(struct content *c, struct content *parent, union content_msg_data msg_data; css_error error; - /** \todo extract charset from params */ /** \todo what happens about the allocator? */ /** \todo proper error reporting */ + /* Find charset specified on HTTP layer, if any */ + /** \todo What happens if there isn't one and parent content exists? */ + for (i = 0; params[i] != NULL; i += 2) { + if (strcasecmp(params[i], "charset") == 0) + charset = params[i + 1]; + } + if (parent != NULL) { assert(parent->type == CONTENT_HTML || parent->type == CONTENT_CSS); @@ -140,7 +147,7 @@ bool nscss_create(struct content *c, struct content *parent, c->data.css.import_count = 0; c->data.css.imports = NULL; - error = css_stylesheet_create(CSS_LEVEL_21, NULL, + error = css_stylesheet_create(CSS_LEVEL_21, charset, c->url, NULL, origin, media, quirks, false, c->data.css.dict, myrealloc, NULL, -- cgit v1.2.3