Author: tlsa
Date: Fri Feb 29 23:03:26 2008
New Revision: 3874
URL:
http://source.netsurf-browser.org?rev=3874&view=rev
Log:
Periodically reflow the page while fetching a page's objects. Make buffer all
rendering default.
Modified:
trunk/netsurf/content/content.h
trunk/netsurf/desktop/options.c
trunk/netsurf/desktop/options.h
trunk/netsurf/render/html.c
trunk/netsurf/riscos/options.h
Modified: trunk/netsurf/content/content.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=387...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Fri Feb 29 23:03:26 2008
@@ -97,7 +97,7 @@
/** Extra data for some content_msg messages. */
union content_msg_data {
const char *error; /**< Error message, for CONTENT_MSG_ERROR. */
- const char *new_url; /**< Replacement URL (or NULL if the same
+ const char *new_url; /**< Replacement URL (or NULL if the same
* as previous), for CONTENT_MSG_NEWPTR. */
/** Area of content which needs redrawing, for CONTENT_MSG_REDRAW. */
struct {
@@ -204,6 +204,10 @@
unsigned int time; /**< Creation time, if TYPE_UNKNOWN,
LOADING or READY,
otherwise total time. */
+
+ unsigned int reformat_time; /**< Time the HTML content was last
+ reformatted. Used while fetching
+ a page's objects. */
unsigned int size; /**< Estimated size of all data
associated with this content, except
Modified: trunk/netsurf/desktop/options.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/desktop/options.c?rev=387...
==============================================================================
--- trunk/netsurf/desktop/options.c (original)
+++ trunk/netsurf/desktop/options.c Fri Feb 29 23:03:26 2008
@@ -128,6 +128,14 @@
#endif
/** default window scale */
int option_scale = 100;
+/* Whether to reflow web pages while objects are fetching */
+bool option_incremental_reflow = true;
+/* Minimum time between HTML reflows while objects are fetching */
+#ifdef riscos
+int option_min_reflow_period = 100; /* time in cs */
+#else
+int option_min_reflow_period = 25; /* time in cs */
+#endif
/* Fetcher configuration */
/** Maximum simultaneous active fetchers */
@@ -192,6 +200,8 @@
{ "window_screen_height",OPTION_INTEGER, &option_window_screen_height },
{ "toolbar_status_size", OPTION_INTEGER, &option_toolbar_status_width },
{ "scale", OPTION_INTEGER, &option_scale },
+ { "incremental_reflow", OPTION_BOOL, &option_incremental_reflow },
+ { "min_reflow_period", OPTION_INTEGER, &option_min_reflow_period },
/* Fetcher options */
{ "max_fetchers", OPTION_INTEGER, &option_max_fetchers },
{ "max_fetchers_per_host",
@@ -568,7 +578,7 @@
return false;
}
- title = xmlNewTextChild(head, NULL, (const xmlChar *) "title",
+ title = xmlNewTextChild(head, NULL, (const xmlChar *) "title",
(const xmlChar *) page_title);
if (!title) {
warn_user("NoMemory", 0);
@@ -625,8 +635,8 @@
} else {
/* directory */
/* invalid HTML */
- h4 = xmlNewTextChild(ul, NULL,
- (const xmlChar *) "h4",
+ h4 = xmlNewTextChild(ul, NULL,
+ (const xmlChar *) "h4",
(const xmlChar *) child->data.text);
if (!h4)
return false;
@@ -657,7 +667,7 @@
if (!li)
return false;
- a = xmlNewTextChild(li, NULL, (const xmlChar *) "a",
+ a = xmlNewTextChild(li, NULL, (const xmlChar *) "a",
(const xmlChar *) entry->data.text);
if (!a)
return false;
@@ -665,7 +675,7 @@
element = tree_find_element(entry, TREE_ELEMENT_URL);
if (!element)
return false;
- href = xmlNewProp(a, (const xmlChar *) "href",
+ href = xmlNewProp(a, (const xmlChar *) "href",
(const xmlChar *) element->text);
if (!href)
return false;
Modified: trunk/netsurf/desktop/options.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/desktop/options.h?rev=387...
==============================================================================
--- trunk/netsurf/desktop/options.h (original)
+++ trunk/netsurf/desktop/options.h Fri Feb 29 23:03:26 2008
@@ -80,6 +80,8 @@
extern int option_window_screen_height;
extern int option_toolbar_status_width;
extern int option_scale;
+extern bool option_incremental_reflow;
+extern int option_min_reflow_period;
/* Fetcher configuration. */
extern int option_max_fetchers;
Modified: trunk/netsurf/render/html.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/render/html.c?rev=3874&am...
==============================================================================
--- trunk/netsurf/render/html.c (original)
+++ trunk/netsurf/render/html.c Fri Feb 29 23:03:26 2008
@@ -492,6 +492,7 @@
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 @@
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 @@
/* 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);
@@ -1405,6 +1406,21 @@
content_reformat(c, c->available_width, c->height);
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, "");
Modified: trunk/netsurf/riscos/options.h
URL:
http://source.netsurf-browser.org/trunk/netsurf/riscos/options.h?rev=3874...
==============================================================================
--- trunk/netsurf/riscos/options.h (original)
+++ trunk/netsurf/riscos/options.h Fri Feb 29 23:03:26 2008
@@ -83,7 +83,7 @@
bool option_window_size_clone = true; \
bool option_background_images = true; \
bool option_buffer_animations = true; \
-bool option_buffer_everything = false; \
+bool option_buffer_everything = true; \
bool option_open_browser_at_startup = false; \
bool option_no_plugins = false; \
bool option_block_popups = false; \