From 3405803280c9cafab0a4ef229faa4bc447e4c953 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 7 Nov 2014 12:33:34 +0000 Subject: Improve content encoding information API Extend the content_get_encoding() API to retrieve the source of the encoding as well as the actual encoding. --- render/html.c | 22 +++++++--------------- render/html.h | 1 - 2 files changed, 7 insertions(+), 16 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index 4e9347aa5..a3474c7ad 100644 --- a/render/html.c +++ b/render/html.c @@ -2128,29 +2128,21 @@ struct box *html_get_box_tree(hlcache_handle *h) * \param c Content to retrieve charset from * \return Pointer to charset, or NULL */ -static const char *html_encoding(const struct content *c) +static const char *html_encoding(const struct content *c, enum content_encoding_type op) { html_content *html = (html_content *) c; assert(html != NULL); + if (op == CONTENT_ENCODING_SOURCE) { + char enc_token[10] = "Encoding0"; + enc_token[8] = '0' + html->encoding_source; + return messages_get(enc_token); + } + return html->encoding; } -/** - * Retrieve the charset of an HTML document - * - * \param h Content to retrieve charset from - * \return Pointer to charset, or NULL - */ -dom_hubbub_encoding_source html_get_encoding_source(hlcache_handle *h) -{ - html_content *c = (html_content *) hlcache_handle_get_content(h); - - assert(c != NULL); - - return c->encoding_source; -} /** * Retrieve framesets used in an HTML document diff --git a/render/html.h b/render/html.h index 6503c91fe..ee204d3d6 100644 --- a/render/html.h +++ b/render/html.h @@ -171,7 +171,6 @@ bool text_redraw(const char *utf8_text, size_t utf8_len, dom_document *html_get_document(struct hlcache_handle *h); struct box *html_get_box_tree(struct hlcache_handle *h); -dom_hubbub_encoding_source html_get_encoding_source(struct hlcache_handle *h); struct content_html_frames *html_get_frameset(struct hlcache_handle *h); struct content_html_iframe *html_get_iframe(struct hlcache_handle *h); struct nsurl *html_get_base_url(struct hlcache_handle *h); -- cgit v1.2.3