From cfe57002febe0f58dfc87f0173ad42126f1362f4 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 23 May 2020 21:17:42 +0100 Subject: remove unused css length usage in selection --- content/handlers/html/html.c | 2 +- content/handlers/html/private.h | 1 + content/handlers/html/textselection.c | 2 +- content/handlers/text/textplain.c | 5 +++-- content/textsearch.c | 2 ++ desktop/selection.c | 11 +---------- desktop/selection.h | 4 +--- 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c index a8ae9e452..136c4eef2 100644 --- a/content/handlers/html/html.c +++ b/content/handlers/html/html.c @@ -1304,7 +1304,7 @@ html_open(struct content *c, html->drag_owner.no_owner = true; /* text selection */ - selection_init(&html->sel, html->layout, &html->len_ctx); + selection_init(&html->sel, html->layout); html->selection_type = HTML_SELECTION_NONE; html->selection_owner.none = true; diff --git a/content/handlers/html/private.h b/content/handlers/html/private.h index ff20be837..43b0e84f2 100644 --- a/content/handlers/html/private.h +++ b/content/handlers/html/private.h @@ -29,6 +29,7 @@ #include "netsurf/types.h" #include "content/content_protected.h" #include "desktop/selection.h" +#include "content/handlers/css/utils.h" struct gui_layout_table; diff --git a/content/handlers/html/textselection.c b/content/handlers/html/textselection.c index 11e9deeb4..67fd25be3 100644 --- a/content/handlers/html/textselection.c +++ b/content/handlers/html/textselection.c @@ -271,7 +271,7 @@ html_create_selection(struct content *c, struct selection **sel_out) return NSERROR_NOMEM; } - selection_init(sel, html->layout, &html->len_ctx); + selection_init(sel, html->layout); *sel_out = sel; return NSERROR_OK; diff --git a/content/handlers/text/textplain.c b/content/handlers/text/textplain.c index 275efda83..5142291bb 100644 --- a/content/handlers/text/textplain.c +++ b/content/handlers/text/textplain.c @@ -42,6 +42,7 @@ #include "content/content_factory.h" #include "content/hlcache.h" #include "content/textsearch.h" +#include "content/handlers/css/utils.h" #include "desktop/selection.h" #include "desktop/gui_internal.h" @@ -1227,7 +1228,7 @@ textplain_open(struct content *c, text->bw = bw; /* text selection */ - selection_init(&text->sel, NULL, NULL); + selection_init(&text->sel, NULL); return NSERROR_OK; } @@ -1579,7 +1580,7 @@ textplain_create_selection(struct content *c, struct selection **sel_out) return NSERROR_NOMEM; } - selection_init(sel, NULL, NULL); + selection_init(sel, NULL); *sel_out = sel; return NSERROR_OK; diff --git a/content/textsearch.c b/content/textsearch.c index ae3c8a2b1..4ad23cf20 100644 --- a/content/textsearch.c +++ b/content/textsearch.c @@ -23,6 +23,8 @@ */ #include +#include +#include #include "utils/errors.h" #include "utils/utils.h" diff --git a/desktop/selection.c b/desktop/selection.c index d4fa7ca7d..6839724f8 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -355,9 +355,7 @@ void selection_reinit(struct selection *s, struct box *root) /* exported interface documented in desktop/selection.h */ void -selection_init(struct selection *s, - struct box *root, - const nscss_len_ctx *len_ctx) +selection_init(struct selection *s, struct box *root) { if (s->defined) { selection_clear(s, true); @@ -367,13 +365,6 @@ selection_init(struct selection *s, s->start_idx = 0; s->end_idx = 0; s->drag_state = DRAG_NONE; - if (len_ctx != NULL) { - s->len_ctx = *len_ctx; - } else { - s->len_ctx.vw = 0; - s->len_ctx.vh = 0; - s->len_ctx.root_style = NULL; - } selection_reinit(s, root); } diff --git a/desktop/selection.h b/desktop/selection.h index cc8d8da4e..cb9289ac7 100644 --- a/desktop/selection.h +++ b/desktop/selection.h @@ -25,7 +25,6 @@ #include #include "netsurf/mouse.h" -#include "content/handlers/css/utils.h" struct box; struct browser_window; @@ -47,7 +46,6 @@ struct selection { struct content *c; struct box *root; - nscss_len_ctx len_ctx; unsigned max_idx; /* total bytes in text representation */ @@ -112,7 +110,7 @@ void selection_destroy(struct selection *s); * \param s selection object * \param root the root box for html document or NULL for text/plain */ -void selection_init(struct selection *s, struct box *root, const nscss_len_ctx *len_ctx); +void selection_init(struct selection *s, struct box *root); /** * Initialise the selection object to use the given box subtree as its root, -- cgit v1.2.3