diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c index bcbd4382a..ed48af20e 100644 --- a/content/handlers/html/html.c +++ b/content/handlers/html/html.c @@ -1592,6 +1592,7 @@ static void html_reformat(struct content *c, int width, int height) selection_reinit(&htmlc->sel, htmlc->layout); htmlc->reflowing = false; + htmlc->had_initial_layout = true; /* calculate next reflow time at three times what it took to reflow */ nsu_getmonotonic_ms(&ms_after); diff --git a/content/handlers/html/html_internal.h b/content/handlers/html/html_internal.h index 2ba96f0f8..7a8d95612 100644 --- a/content/handlers/html/html_internal.h +++ b/content/handlers/html/html_internal.h @@ -127,6 +127,9 @@ typedef struct html_content { /** Whether a layout (reflow) is in progress */ bool reflowing; + /** Whether an initial layout has been done */ + bool had_initial_layout; + /** Whether scripts are enabled for this content */ bool enable_scripting; diff --git a/content/handlers/html/html_object.c b/content/handlers/html/html_object.c index acd32565b..37bf29faf 100644 --- a/content/handlers/html/html_object.c +++ b/content/handlers/html/html_object.c @@ -178,6 +178,10 @@ html_object_callback(hlcache_handle *object, box->flags & REPLACE_DIM) { union content_msg_data data; + if (c->had_initial_layout == false) { + break; + } + if (!box_visible(box)) break; @@ -212,6 +216,10 @@ html_object_callback(hlcache_handle *object, if (c->base.status != CONTENT_STATUS_LOADING) { union content_msg_data data = event->data; + if (c->had_initial_layout == false) { + break; + } + if (!box_visible(box)) break;