summaryrefslogtreecommitdiff
path: root/render/html_object.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-04-20 19:18:15 +0100
committerVincent Sanders <vince@kyllikki.org>2016-04-20 19:18:15 +0100
commita6dd92c57137eeabf3e5dc92edeb472ac2c60c96 (patch)
tree867c69769d2c093ec5baffd9862b1479f0e39099 /render/html_object.c
parent31de1c251b5c6f6a39f6f7500e28c6086b807953 (diff)
downloadnetsurf-a6dd92c57137eeabf3e5dc92edeb472ac2c60c96.tar.gz
netsurf-a6dd92c57137eeabf3e5dc92edeb472ac2c60c96.tar.bz2
use monotonic clock call for html reflow timing
Diffstat (limited to 'render/html_object.c')
-rw-r--r--render/html_object.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/render/html_object.c b/render/html_object.c
index 9be3339a6..22c9b712a 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -26,8 +26,8 @@
#include <string.h>
#include <strings.h>
#include <stdlib.h>
+#include <nsutils/time.h>
-#include "utils/utils.h"
#include "utils/corestrings.h"
#include "utils/config.h"
#include "utils/log.h"
@@ -434,32 +434,40 @@ html_object_callback(hlcache_handle *object,
break;
}
- if (c->base.status == CONTENT_STATUS_READY && c->base.active == 0 &&
- (event->type == CONTENT_MSG_LOADING ||
- event->type == CONTENT_MSG_DONE ||
- event->type == CONTENT_MSG_ERROR)) {
+ if (c->base.status == CONTENT_STATUS_READY &&
+ c->base.active == 0 &&
+ (event->type == CONTENT_MSG_LOADING ||
+ event->type == CONTENT_MSG_DONE ||
+ event->type == CONTENT_MSG_ERROR)) {
/* all objects have arrived */
content__reformat(&c->base, false, c->base.available_width,
c->base.height);
content_set_done(&c->base);
- }
-
- /* If 1) the configuration option to reflow pages while objects are
- * fetched is set
- * 2) an object is newly fetched & converted,
- * 3) the box's dimensions need to change due to being replaced
- * 4) the object's parent HTML is ready for reformat,
- * 5) 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 (nsoption_bool(incremental_reflow) &&
- event->type == CONTENT_MSG_DONE &&
- box != NULL && !(box->flags & REPLACE_DIM) &&
- (c->base.status == CONTENT_STATUS_READY ||
- c->base.status == CONTENT_STATUS_DONE) &&
- (wallclock() > c->base.reformat_time)) {
- content__reformat(&c->base, false, c->base.available_width,
- c->base.height);
+ } else if (nsoption_bool(incremental_reflow) &&
+ event->type == CONTENT_MSG_DONE &&
+ box != NULL &&
+ !(box->flags & REPLACE_DIM) &&
+ (c->base.status == CONTENT_STATUS_READY ||
+ c->base.status == CONTENT_STATUS_DONE)) {
+ /* 1) the configuration option to reflow pages while
+ * objects are fetched is set
+ * 2) an object is newly fetched & converted,
+ * 3) the box's dimensions need to change due to being replaced
+ * 4) the object's parent HTML is ready for reformat,
+ */
+ uint64_t ms_now;
+ nsu_getmonotonic_ms(&ms_now);
+ if (ms_now > c->base.reformat_time) {
+ /* The time since the previous reformat is
+ * more than the configured minimum time
+ * between reformats so reformat the page to
+ * display newly fetched objects
+ */
+ content__reformat(&c->base,
+ false,
+ c->base.available_width,
+ c->base.height);
+ }
}
return NSERROR_OK;