From 09b1ede5a3fe5c37e34fe1c13780536f30297806 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 15 Apr 2003 17:53:00 +0000 Subject: [project @ 2003-04-15 17:53:00 by bursa] Inline images and related. svn path=/import/netsurf/; revision=125 --- content/cache.c | 4 ++-- content/content.c | 13 +++++++++---- content/content.h | 18 ++++++++++++++++-- content/fetch.c | 6 ++++-- 4 files changed, 31 insertions(+), 10 deletions(-) (limited to 'content') diff --git a/content/cache.c b/content/cache.c index f9dd4e4f5..bf0f46511 100644 --- a/content/cache.c +++ b/content/cache.c @@ -1,5 +1,5 @@ /** - * $Id: cache.c,v 1.2 2003/03/04 11:59:35 bursa Exp $ + * $Id: cache.c,v 1.3 2003/04/15 17:53:00 bursa Exp $ */ #include @@ -108,7 +108,7 @@ struct content * cache_get(const char * const url) void cache_put(struct content * content) { struct cache_entry * e; - LOG(("content %p, url '%s'", content, content->url)); + LOG(("content %p, url '%s', size %lu", content, content->url, content->size)); current_size += content->size; /* clear old data from the usused_list until the size drops below max_size */ diff --git a/content/content.c b/content/content.c index 439c0fba2..5a9e2956b 100644 --- a/content/content.c +++ b/content/content.c @@ -1,5 +1,5 @@ /** - * $Id: content.c,v 1.6 2003/04/06 18:09:34 bursa Exp $ + * $Id: content.c,v 1.7 2003/04/15 17:53:00 bursa Exp $ */ #include @@ -75,6 +75,7 @@ struct content * content_create(content_type type, char *url) c->status = CONTENT_LOADING; c->size = sizeof(struct content); c->status_callback = 0; + strcpy(c->status_message, "Loading"); handler_map[type].create(c); return c; } @@ -102,9 +103,11 @@ int content_convert(struct content *c, unsigned long width, unsigned long height assert(c != 0); assert(c->type < CONTENT_OTHER); assert(c->status == CONTENT_LOADING); + c->available_width = width; if (handler_map[c->type].convert(c, width, height)) return 1; - c->status = CONTENT_READY; + if (c->status == CONTENT_LOADING) + c->status = CONTENT_DONE; return 0; } @@ -118,7 +121,8 @@ void content_revive(struct content *c, unsigned long width, unsigned long height { assert(c != 0); assert(c->type < CONTENT_OTHER); - assert(c->status == CONTENT_READY); + assert(c->status == CONTENT_DONE); + c->available_width = width; handler_map[c->type].revive(c, width, height); } @@ -131,7 +135,8 @@ void content_reformat(struct content *c, unsigned long width, unsigned long heig { assert(c != 0); assert(c->type < CONTENT_OTHER); - assert(c->status == CONTENT_READY); + assert(c->status != CONTENT_LOADING); + c->available_width = width; handler_map[c->type].reformat(c, width, height); } diff --git a/content/content.h b/content/content.h index ce7f05248..462d58b69 100644 --- a/content/content.h +++ b/content/content.h @@ -1,5 +1,5 @@ /** - * $Id: content.h,v 1.8 2003/04/13 12:50:10 bursa Exp $ + * $Id: content.h,v 1.9 2003/04/15 17:53:00 bursa Exp $ */ #ifndef _NETSURF_DESKTOP_CONTENT_H_ @@ -49,8 +49,15 @@ struct content { char *url; content_type type; - enum {CONTENT_LOADING, CONTENT_READY} status; + enum { + CONTENT_LOADING, /* content is being fetched or converted + and is not safe to display */ + CONTENT_PENDING, /* some parts of content still being + loaded, but can be displayed */ + CONTENT_DONE /* all finished */ + } status; unsigned long width, height; + unsigned long available_width; union { @@ -69,6 +76,12 @@ struct content } text_selection; struct font_set* fonts; struct page_elements elements; + unsigned int object_count; /* images etc. */ + struct { + char *url; + struct content *content; + struct box *box; + } *object; } html; struct @@ -94,6 +107,7 @@ struct content int error; void (*status_callback)(void *p, const char *status); void *status_p; + char status_message[80]; }; diff --git a/content/fetch.c b/content/fetch.c index d1c3f0e07..642010fb3 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -1,5 +1,5 @@ /** - * $Id: fetch.c,v 1.4 2003/04/09 21:57:09 bursa Exp $ + * $Id: fetch.c,v 1.5 2003/04/15 17:53:00 bursa Exp $ */ #include @@ -191,8 +191,10 @@ void fetch_poll(void) LOG(("CURLMSG_DONE, result %i", curl_msg->data.result)); /* inform the caller that the fetch is done */ - if (curl_msg->data.result == CURLE_OK) + if (curl_msg->data.result == CURLE_OK && f->had_headers) f->callback(FETCH_FINISHED, f->p, 0, 0); + else if (curl_msg->data.result == CURLE_OK) + f->callback(FETCH_ERROR, f->p, "No data received", 0); else if (curl_msg->data.result != CURLE_WRITE_ERROR) f->callback(FETCH_ERROR, f->p, f->error_buffer, 0); -- cgit v1.2.3