mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-28 06:49:41 +03:00
Change meaning of c->redraw_time to be the earliest time to reflow during page asset fetch. Have the time selected vary depending on how long the last reflow took.
svn path=/trunk/netsurf/; revision=3925
This commit is contained in:
parent
b91ad2b1ff
commit
4ec38922ac
@ -205,9 +205,9 @@ 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 reformat_time; /**< Earliest time to attempt a
|
||||
period reflow while fetching a
|
||||
page's objects. */
|
||||
|
||||
unsigned int size; /**< Estimated size of all data
|
||||
associated with this content, except
|
||||
|
@ -132,9 +132,9 @@ int option_scale = 100;
|
||||
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 */
|
||||
unsigned int option_min_reflow_period = 100; /* time in cs */
|
||||
#else
|
||||
int option_min_reflow_period = 25; /* time in cs */
|
||||
unsigned int option_min_reflow_period = 25; /* time in cs */
|
||||
#endif
|
||||
|
||||
/* Fetcher configuration */
|
||||
|
@ -81,7 +81,7 @@ 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;
|
||||
extern unsigned int option_min_reflow_period;
|
||||
|
||||
/* Fetcher configuration. */
|
||||
extern int option_max_fetchers;
|
||||
|
@ -407,6 +407,7 @@ bool html_convert(struct content *c, int width, int height)
|
||||
xmlDoc *document;
|
||||
xmlNode *html, *head;
|
||||
union content_msg_data msg_data;
|
||||
unsigned int time_before, time_taken;
|
||||
|
||||
/* finish parsing */
|
||||
if (c->source_size == 0)
|
||||
@ -491,8 +492,15 @@ bool html_convert(struct content *c, int width, int height)
|
||||
html_set_status(c, messages_get("Formatting"));
|
||||
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
|
||||
LOG(("Layout document"));
|
||||
time_before = wallclock();
|
||||
html_reformat(c, width, height);
|
||||
c->reformat_time = wallclock();
|
||||
time_taken = wallclock() - time_before;
|
||||
LOG(("Layout took %dcs", time_taken));
|
||||
c->reformat_time = wallclock() +
|
||||
((time_taken < option_min_reflow_period ?
|
||||
option_min_reflow_period : time_taken * 1.25));
|
||||
LOG(("Scheduling relayout no sooner than %dcs",
|
||||
c->reformat_time - wallclock()));
|
||||
/*box_dump(c->data.html.layout->children, 0);*/
|
||||
|
||||
if (c->active == 0)
|
||||
@ -1417,10 +1425,13 @@ void html_object_callback(content_msg msg, struct content *object,
|
||||
else if (option_incremental_reflow && msg == CONTENT_MSG_DONE &&
|
||||
(c->status == CONTENT_STATUS_READY ||
|
||||
c->status == CONTENT_STATUS_DONE) &&
|
||||
(option_min_reflow_period <
|
||||
(int)(wallclock() - c->reformat_time))) {
|
||||
(wallclock() > c->reformat_time)) {
|
||||
unsigned int time_before = wallclock(), time_taken;
|
||||
content_reformat(c, c->available_width, c->height);
|
||||
c->reformat_time = wallclock();
|
||||
time_taken = wallclock() - time_before;
|
||||
c->reformat_time = wallclock() +
|
||||
((time_taken < option_min_reflow_period ?
|
||||
option_min_reflow_period : time_taken * 1.25));
|
||||
}
|
||||
if (c->status == CONTENT_STATUS_READY)
|
||||
html_set_status(c, "");
|
||||
|
Loading…
Reference in New Issue
Block a user