From 3c7538a9f906e38e78be0300049f9e49839d7fd7 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 12 May 2020 21:09:41 +0100 Subject: hoist common text search out of content handlers --- content/handlers/html/redraw.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'content/handlers/html/redraw.c') diff --git a/content/handlers/html/redraw.c b/content/handlers/html/redraw.c index f9fb6b4fd..aa99782c7 100644 --- a/content/handlers/html/redraw.c +++ b/content/handlers/html/redraw.c @@ -167,7 +167,6 @@ text_redraw(const char *utf8_text, bool excluded, struct content *c, const struct selection *sel, - struct textsearch_context *search, const struct redraw_context *ctx) { bool highlighted = false; @@ -195,8 +194,8 @@ text_redraw(const char *utf8_text, /* what about the current search operation, if any? */ if (!highlighted && - (search != NULL) && - content_textsearch_ishighlighted(search, + (c->textsearch.context != NULL) && + content_textsearch_ishighlighted(c->textsearch.context, offset, offset + len, &start_idx, @@ -1138,11 +1137,19 @@ static bool html_redraw_text_box(const html_content *html, struct box *box, font_plot_style_from_css(&html->len_ctx, box->style, &fstyle); fstyle.background = current_background_color; - if (!text_redraw(box->text, box->length, box->byte_offset, - box->space, &fstyle, x, y, - clip, box->height, scale, excluded, - (struct content *)html, &html->sel, - html->search, ctx)) + if (!text_redraw(box->text, + box->length, + box->byte_offset, + box->space, + &fstyle, + x, y, + clip, + box->height, + scale, + excluded, + (struct content *)html, + &html->sel, + ctx)) return false; return true; -- cgit v1.2.3