From bae61d9224f7856ea8563efa96c41743120b2233 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 29 Feb 2008 23:03:26 +0000 Subject: Periodically reflow the page while fetching a page's objects. Make buffer all rendering default. svn path=/trunk/netsurf/; revision=3874 --- render/html.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index b51510d3d..589344b16 100644 --- a/render/html.c +++ b/render/html.c @@ -492,6 +492,7 @@ bool html_convert(struct content *c, int width, int height) content_broadcast(c, CONTENT_MSG_STATUS, msg_data); LOG(("Layout document")); html_reformat(c, width, height); + c->reformat_time = wallclock(); /*box_dump(c->data.html.layout->children, 0);*/ if (c->active == 0) @@ -526,7 +527,7 @@ bool html_head(struct content *c, xmlNode *head) continue; LOG(("Node: %s", node->name)); - if (!c->title && strcmp((const char *) node->name, + if (!c->title && strcmp((const char *) node->name, "title") == 0) { xmlChar *title = xmlNodeGetContent(node); if (!title) @@ -557,16 +558,16 @@ bool html_head(struct content *c, xmlNode *head) /* don't use the central values to ease freeing later on */ if ((s = xmlGetProp(node, (const xmlChar *) "target"))) { if ((!strcasecmp((const char *) s, "_blank")) || - (!strcasecmp((const char *) s, + (!strcasecmp((const char *) s, "_top")) || - (!strcasecmp((const char *) s, + (!strcasecmp((const char *) s, "_parent")) || - (!strcasecmp((const char *) s, + (!strcasecmp((const char *) s, "_self")) || ('a' <= s[0] && s[0] <= 'z') || ('A' <= s[0] && s[0] <= 'Z')) { /* [6.16] */ - c->data.html.base_target = - talloc_strdup(c, + c->data.html.base_target = + talloc_strdup(c, (const char *) s); if (!c->data.html.base_target) { xmlFree(s); @@ -1406,6 +1407,21 @@ void html_object_callback(content_msg msg, struct content *object, html_set_status(c, ""); content_set_done(c); } + /* If 1) the configuration option to reflow pages while objects are + * fetched is set + * 2) an object is newly fetched & converted, + * 3) the object's parent HTML is ready for reformat, + * 4) the time since the previous reformat is more than the + * configured minimum time between reformats + * then reformat the page to display newly fetched objects */ + else if (option_incremental_reflow && msg == CONTENT_MSG_DONE && + (c->status == CONTENT_STATUS_READY || + c->status == CONTENT_STATUS_DONE) && + (option_min_reflow_period < + (wallclock() - c->reformat_time))) { + content_reformat(c, c->available_width, c->height); + c->reformat_time = wallclock(); + } if (c->status == CONTENT_STATUS_READY) html_set_status(c, ""); } -- cgit v1.2.3