From ddeadd1c02880367ad786b113d352a519f45ec73 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 23 Jul 2009 23:05:34 +0000 Subject: Merge LibCSS port to trunk. svn path=/trunk/netsurf/; revision=8752 --- content/content.c | 11 +++++++---- content/content.h | 3 ++- content/fetchcache.c | 7 +++++-- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'content') diff --git a/content/content.c b/content/content.c index bda652fad..2b4499a29 100644 --- a/content/content.c +++ b/content/content.c @@ -247,7 +247,8 @@ const char * const content_status_name[] = { /** An entry in handler_map. */ struct handler_entry { - bool (*create)(struct content *c, const char *params[]); + bool (*create)(struct content *c, struct content *parent, + const char *params[]); bool (*process_data)(struct content *c, char *data, unsigned int size); bool (*convert)(struct content *c, int width, int height); void (*reformat)(struct content *c, int width, int height); @@ -280,7 +281,8 @@ static const struct handler_entry handler_map[] = { {textplain_create, textplain_process_data, textplain_convert, textplain_reformat, textplain_destroy, 0, textplain_redraw, 0, 0, 0, true}, - {0, 0, css_convert, 0, css_destroy, 0, 0, 0, 0, 0, false}, + {nscss_create, nscss_process_data, nscss_convert, 0, nscss_destroy, + 0, 0, 0, 0, 0, true}, #ifdef WITH_JPEG {0, 0, nsjpeg_convert, 0, nsjpeg_destroy, 0, nsjpeg_redraw, nsjpeg_redraw_tiled, 0, 0, false}, @@ -565,7 +567,8 @@ bool content_can_reformat(struct content *c) */ bool content_set_type(struct content *c, content_type type, - const char *mime_type, const char *params[]) + const char *mime_type, const char *params[], + struct content *parent) { union content_msg_data msg_data; struct content *clone; @@ -637,7 +640,7 @@ bool content_set_type(struct content *c, content_type type, } if (handler_map[type].create) { - if (!handler_map[type].create(c, params)) { + if (!handler_map[type].create(c, parent, params)) { c->type = CONTENT_UNKNOWN; c->status = CONTENT_STATUS_ERROR; return false; diff --git a/content/content.h b/content/content.h index 298e669ca..1db6122ee 100644 --- a/content/content.h +++ b/content/content.h @@ -283,7 +283,8 @@ struct content * content_get(const char *url); struct content * content_get_ready(const char *url); bool content_can_reformat(struct content *c); bool content_set_type(struct content *c, content_type type, - const char *mime_type, const char *params[]); + const char *mime_type, const char *params[], + struct content *parent); void content_set_status(struct content *c, const char *status_message, ...); bool content_process_data(struct content *c, const char *data, unsigned int size); diff --git a/content/fetchcache.c b/content/fetchcache.c index cb5cc9132..71e39e4fa 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -409,6 +409,7 @@ void fetchcache_callback(fetch_msg msg, void *p, const void *data, content_type type; char *mime_type; char **params; + struct content *parent; unsigned int i; union content_msg_data msg_data; @@ -426,9 +427,11 @@ void fetchcache_callback(fetch_msg msg, void *p, const void *data, return; } type = content_lookup(mime_type); + parent = fetch_get_parent(c->fetch); res = content_set_type(c, c->download ? CONTENT_OTHER : type, - mime_type, (const char **) params); + mime_type, (const char **) params, + parent); free(mime_type); for (i = 0; params[i]; i++) free(params[i]); @@ -734,7 +737,7 @@ void fetchcache_error_page(struct content *c, const char *error) if ((length = snprintf(error_page, sizeof(error_page), messages_get("ErrorPage"), error)) < 0) length = 0; - if (!content_set_type(c, CONTENT_HTML, "text/html", params)) + if (!content_set_type(c, CONTENT_HTML, "text/html", params, NULL)) return; if (!content_process_data(c, error_page, length)) return; -- cgit v1.2.3