diff options
author | James Bursa <james@netsurf-browser.org> | 2005-01-01 22:05:21 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-01-01 22:05:21 +0000 |
commit | 7a71363d767f88f54e80e4bbe07eaef54e6fbbee (patch) | |
tree | c4a04c6cef960ad4a7cf1d510bb040c622074c18 /render/html.h | |
parent | ff8dc1f9d60c67f60c118175e385153fbdb06fa3 (diff) | |
download | netsurf-7a71363d767f88f54e80e4bbe07eaef54e6fbbee.tar.gz netsurf-7a71363d767f88f54e80e4bbe07eaef54e6fbbee.tar.bz2 |
[project @ 2005-01-01 22:05:20 by bursa]
xcalloc/xrealloc/xstrdup-purge week, part 5. Improve and simplify encoding detection.
svn path=/import/netsurf/; revision=1416
Diffstat (limited to 'render/html.h')
-rw-r--r-- | render/html.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/render/html.h b/render/html.h index c91f89f1f..a5b9a0fe6 100644 --- a/render/html.h +++ b/render/html.h @@ -36,11 +36,27 @@ struct plotters; extern char *default_stylesheet_url; extern char *adblock_stylesheet_url; +/** An object (<img>, <object>, etc.) in a CONTENT_HTML document. */ +struct content_html_object { + char *url; /**< URL of this object. */ + struct content *content; /**< Content, or 0. */ + struct box *box; /**< Node in box tree containing it. */ + /** Pointer to array of permitted content_type, terminated by + * CONTENT_UNKNOWN, or 0 if any type is acceptable. */ + const content_type *permitted_types; + bool background; /** Is this object a background image? */ +}; + /** Data specific to CONTENT_HTML. */ struct content_html_data { htmlParserCtxt *parser; /**< HTML parser context. */ + /** HTML parser encoding handler. */ + xmlCharEncodingHandler *encoding_handler; - const char *encoding; /**< Encoding of source. */ + char *encoding; /**< Encoding of source, 0 if unknown. */ + enum { ENCODING_SOURCE_HEADER, ENCODING_SOURCE_DETECTED, + ENCODING_SOURCE_META } encoding_source; + /**< Source of encoding information. */ bool getenc; /**< Need to get the encoding from the document, as it * wasn't specified in the Content-Type header. */ @@ -60,15 +76,7 @@ struct content_html_data { /** Number of entries in object. */ unsigned int object_count; /** Objects. Each may be 0. */ - struct { - char *url; /**< URL of this object. */ - struct content *content; /**< Content, or 0. */ - struct box *box; /**< Node in box tree containing it. */ - /** Pointer to array of permitted content_type, terminated by - * CONTENT_UNKNOWN, or 0 if any type is acceptable. */ - const content_type *permitted_types; - bool background; /** Is this object a background image? */ - } *object; + struct content_html_object *object; struct imagemap **imagemaps; /**< Hashtable of imagemaps */ @@ -88,7 +96,7 @@ bool html_process_data(struct content *c, char *data, unsigned int size); bool html_convert(struct content *c, int width, int height); void html_reformat(struct content *c, int width, int height); void html_destroy(struct content *c); -void html_fetch_object(struct content *c, char *url, struct box *box, +bool html_fetch_object(struct content *c, char *url, struct box *box, const content_type *permitted_types, int available_width, int available_height, bool background); |