From c3d6099250475d40a8b5c9c548ac8858e9d7b5ac Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 27 Sep 2014 09:57:26 +0100 Subject: Redraws during layout are prohibited, and redundant. --- render/box_textarea.c | 7 +++++++ render/html.c | 5 +++++ render/html_interaction.c | 7 +++++++ render/html_internal.h | 3 +++ 4 files changed, 22 insertions(+) (limited to 'render') diff --git a/render/box_textarea.c b/render/box_textarea.c index fe5a7bab1..a1bbb539e 100644 --- a/render/box_textarea.c +++ b/render/box_textarea.c @@ -155,6 +155,13 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg) { /* Request redraw of the required textarea rectangle */ int x, y; + + if (html->reflowing == true) { + /* Can't redraw during layout, and it will + * be redrawn after layout anyway. */ + break; + } + box_coords(box, &x, &y); content__request_redraw((struct content *)html, diff --git a/render/html.c b/render/html.c index 12c173f0d..36f6e807d 100644 --- a/render/html.c +++ b/render/html.c @@ -738,6 +738,7 @@ html_create_html_data(html_content *c, const http_parameter *params) c->base_target = NULL; c->aborted = false; c->refresh = false; + c->reflowing = false; c->title = NULL; c->bctx = NULL; c->layout = NULL; @@ -1263,6 +1264,8 @@ static void html_reformat(struct content *c, int width, int height) time_before = wallclock(); + htmlc->reflowing = true; + layout_document(htmlc, width, height); layout = htmlc->layout; @@ -1282,6 +1285,8 @@ static void html_reformat(struct content *c, int width, int height) selection_reinit(&htmlc->sel, htmlc->layout); + htmlc->reflowing = false; + time_taken = wallclock() - time_before; c->reformat_time = wallclock() + ((time_taken * 3 < nsoption_uint(min_reflow_period) ? diff --git a/render/html_interaction.c b/render/html_interaction.c index e030e570d..279eb4058 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -1154,6 +1154,13 @@ void html_overflow_scroll_callback(void *client_data, switch(scrollbar_data->msg) { case SCROLLBAR_MSG_MOVED: + + if (html->reflowing == true) { + /* Can't redraw during layout, and it will + * be redrawn after layout anyway. */ + break; + } + html__redraw_a_box(html, box); break; case SCROLLBAR_MSG_SCROLL_START: diff --git a/render/html_internal.h b/render/html_internal.h index 05a085e22..28522dc93 100644 --- a/render/html_internal.h +++ b/render/html_internal.h @@ -94,6 +94,9 @@ typedef struct html_content { /** Whether a meta refresh has been handled */ bool refresh; + /** Whether a layout (reflow) is in progress */ + bool reflowing; + /* Title element node */ dom_node *title; -- cgit v1.2.3