From 832ecb9ce34fbb44ab72c8bc2408e436ba541d20 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Thu, 8 Apr 2010 15:40:17 +0000 Subject: Allow nscss to retain charset and nscss_clone to use it svn path=/trunk/netsurf/; revision=10318 --- css/css.c | 7 +++++-- css/css.h | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/css/css.c b/css/css.c index d666b891f..99d31f857 100644 --- a/css/css.c +++ b/css/css.c @@ -96,6 +96,8 @@ nserror nscss_create_css_data(struct content_css_data *c, c->import_count = 0; c->imports = NULL; + if (charset != NULL) + c->charset = strdup(charset); error = css_stylesheet_create(CSS_LEVEL_21, charset, url, NULL, quirks, false, @@ -328,6 +330,8 @@ void nscss_destroy_css_data(struct content_css_data *c) css_stylesheet_destroy(c->sheet); c->sheet = NULL; } + + free(c->charset); } bool nscss_clone(const struct content *old, struct content *new_content) @@ -336,10 +340,9 @@ bool nscss_clone(const struct content *old, struct content *new_content) unsigned long size; /* Simply replay create/process/convert */ - /** \todo We need the charset of the old sheet */ if (nscss_create_css_data(&new_content->data.css, content__get_url(new_content), - NULL, new_content->quirks) != NSERROR_OK) + old->data.css.charset, new_content->quirks) != NSERROR_OK) return false; data = content__get_source_data(new_content, &size); diff --git a/css/css.h b/css/css.h index c95f87053..e192b969c 100644 --- a/css/css.h +++ b/css/css.h @@ -36,8 +36,8 @@ struct nscss_import; struct content_css_data { css_stylesheet *sheet; /**< Stylesheet object */ - - uint32_t import_count; /**< Number of sheets imported */ + char *charset; /**< Character set of stylesheet */ + uint32_t import_count; /**< Number of sheets imported */ struct nscss_import *imports; /**< Array of imported sheets */ }; -- cgit v1.2.3