From 04f0525fbf8e6a35654d31dff0fa5fc98e5f5102 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 24 Jan 2005 23:02:37 +0000 Subject: [project @ 2005-01-24 23:02:37 by bursa] Reformat pages loaded from memory cache to window width. svn path=/import/netsurf/; revision=1467 --- content/content.c | 4 +++- content/fetchcache.c | 5 +++++ content/fetchcache.h | 1 + css/css.c | 2 ++ desktop/browser.c | 1 + render/html.c | 14 +++++++++----- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/content/content.c b/content/content.c index c9ad560a5..2edec37b0 100644 --- a/content/content.c +++ b/content/content.c @@ -414,7 +414,9 @@ bool content_set_type(struct content *c, content_type type, } content_remove_user(c, callback, p1, p2); content_broadcast(clone, CONTENT_MSG_NEWPTR, msg_data); - fetchcache_go(clone, 0, callback, p1, p2, 0, 0, false); + fetchcache_go(clone, 0, callback, p1, p2, + clone->width, clone->height, + 0, 0, false); } } diff --git a/content/fetchcache.c b/content/fetchcache.c index bd20d12a3..327a32613 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -123,6 +123,8 @@ struct content * fetchcache(const char *url, * the new content * \param p1 user parameter for callback * \param p2 user parameter for callback + * \param width available space + * \param height available space * \param post_urlenc url encoded post data, or 0 if none * \param post_multipart multipart post data, or 0 if none * \param cookies send and accept cookies @@ -134,6 +136,7 @@ void fetchcache_go(struct content *content, char *referer, void (*callback)(content_msg msg, struct content *c, void *p1, void *p2, union content_msg_data data), void *p1, void *p2, + int width, int height, char *post_urlenc, struct form_successful_control *post_multipart, bool cookies) @@ -182,6 +185,8 @@ void fetchcache_go(struct content *content, char *referer, } else if (content->status == CONTENT_STATUS_DONE) { callback(CONTENT_MSG_LOADING, content, p1, p2, msg_data); + if (content->available_width != width) + content_reformat(content, width, height); if (content_find_user(content, callback, p1, p2)) callback(CONTENT_MSG_READY, content, p1, p2, msg_data); if (content_find_user(content, callback, p1, p2)) diff --git a/content/fetchcache.h b/content/fetchcache.h index 68fe3fd7f..5a1794901 100644 --- a/content/fetchcache.h +++ b/content/fetchcache.h @@ -35,6 +35,7 @@ void fetchcache_go(struct content *content, char *referer, void (*callback)(content_msg msg, struct content *c, void *p1, void *p2, union content_msg_data data), void *p1, void *p2, + int width, int height, char *post_urlenc, struct form_successful_control *post_multipart, bool cookies); diff --git a/css/css.c b/css/css.c index d54f03229..65bbbe474 100644 --- a/css/css.c +++ b/css/css.c @@ -807,6 +807,7 @@ void css_atimport(struct content *c, struct css_node *node) c->active++; fetchcache_go(c->data.css.import_content[i], c->url, css_atimport_callback, c, (void *) i, + c->width, c->height, 0, 0, false); } @@ -870,6 +871,7 @@ void css_atimport_callback(content_msg msg, struct content *css, fetchcache_go(c->data.css.import_content[i], c->url, css_atimport_callback, c, (void *) i, + css->width, css->height, 0, 0, false); } break; diff --git a/desktop/browser.c b/desktop/browser.c index 3d9f3c33f..e4cfb2273 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -220,6 +220,7 @@ void browser_window_go_post(struct browser_window *bw, const char *url, fetchcache_go(c, option_send_referer ? referer : 0, browser_window_callback, bw, 0, + gui_window_get_width(bw->window), 0, post_urlenc, post_multipart, true); } diff --git a/render/html.c b/render/html.c index 3f5ff507e..35b2c5c87 100644 --- a/render/html.c +++ b/render/html.c @@ -445,7 +445,8 @@ bool html_find_stylesheets(struct content *c, xmlNode *head) c->active++; fetchcache_go(c->data.html.stylesheet_content[STYLESHEET_BASE], 0, html_convert_css_callback, c, - (void *) STYLESHEET_BASE, 0, 0, false); + (void *) STYLESHEET_BASE, c->width, c->height, + 0, 0, false); if (option_block_ads) { c->data.html.stylesheet_content[STYLESHEET_ADBLOCK] = @@ -459,7 +460,8 @@ bool html_find_stylesheets(struct content *c, xmlNode *head) fetchcache_go(c->data.html. stylesheet_content[STYLESHEET_ADBLOCK], 0, html_convert_css_callback, c, - (void *) STYLESHEET_ADBLOCK, 0, 0, false); + (void *) STYLESHEET_ADBLOCK, c->width, + c->height, 0, 0, false); } for (node = head == 0 ? 0 : head->children; node; node = node->next) { @@ -527,7 +529,7 @@ bool html_find_stylesheets(struct content *c, xmlNode *head) fetchcache_go(c->data.html.stylesheet_content[i], c->url, html_convert_css_callback, - c, (void *) i, + c, (void *) i, c->width, c->height, 0, 0, false); free(url); i++; @@ -681,8 +683,8 @@ void html_convert_css_callback(content_msg msg, struct content *css, fetchcache_go(c->data.html.stylesheet_content[i], c->url, html_convert_css_callback, - c, (void *) i, - 0, 0, false); + c, (void *) i, css->width, + css->height, 0, 0, false); } break; @@ -747,6 +749,7 @@ bool html_fetch_object(struct content *c, char *url, struct box *box, c->active++; fetchcache_go(c->data.html.object[i].content, c->url, html_object_callback, c, (void *) i, + available_width, available_height, 0, 0, false); return true; @@ -840,6 +843,7 @@ void html_object_callback(content_msg msg, struct content *object, c->url, html_object_callback, c, (void * ) i, + 0, 0, 0, 0, false); } } -- cgit v1.2.3