Periodically reflow the page while fetching a page's objects. Make buffer all rendering default.

svn path=/trunk/netsurf/; revision=3874
This commit is contained in:
Michael Drake 2008-02-29 23:03:26 +00:00
parent f752aca0d4
commit bae61d9224
5 changed files with 45 additions and 13 deletions

View File

@ -97,7 +97,7 @@ typedef enum {
/** 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 {
@ -205,6 +205,10 @@ struct content {
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
alloced as talloc children of this. */

View File

@ -128,6 +128,14 @@ int option_toolbar_status_width = 6667;
#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 @@ struct {
{ "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 @@ bool options_save_tree(struct tree *tree, const char *filename, const char *page
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 @@ bool options_save_tree_directory(struct node *directory, xmlNode *node) {
} 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 @@ bool options_save_tree_entry(struct node *entry, xmlNode *node) {
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 @@ bool options_save_tree_entry(struct node *entry, xmlNode *node) {
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;

View File

@ -80,6 +80,8 @@ extern int option_window_screen_width;
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;

View File

@ -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, "");
}

View File

@ -83,7 +83,7 @@ bool option_window_stagger = true; \
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; \