remove unused css length usage in selection

This commit is contained in:
Vincent Sanders 2020-05-23 21:17:42 +01:00
parent e65e41e2d6
commit cfe57002fe
7 changed files with 10 additions and 17 deletions

View File

@ -1304,7 +1304,7 @@ html_open(struct content *c,
html->drag_owner.no_owner = true; html->drag_owner.no_owner = true;
/* text selection */ /* 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_type = HTML_SELECTION_NONE;
html->selection_owner.none = true; html->selection_owner.none = true;

View File

@ -29,6 +29,7 @@
#include "netsurf/types.h" #include "netsurf/types.h"
#include "content/content_protected.h" #include "content/content_protected.h"
#include "desktop/selection.h" #include "desktop/selection.h"
#include "content/handlers/css/utils.h"
struct gui_layout_table; struct gui_layout_table;

View File

@ -271,7 +271,7 @@ html_create_selection(struct content *c, struct selection **sel_out)
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
selection_init(sel, html->layout, &html->len_ctx); selection_init(sel, html->layout);
*sel_out = sel; *sel_out = sel;
return NSERROR_OK; return NSERROR_OK;

View File

@ -42,6 +42,7 @@
#include "content/content_factory.h" #include "content/content_factory.h"
#include "content/hlcache.h" #include "content/hlcache.h"
#include "content/textsearch.h" #include "content/textsearch.h"
#include "content/handlers/css/utils.h"
#include "desktop/selection.h" #include "desktop/selection.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
@ -1227,7 +1228,7 @@ textplain_open(struct content *c,
text->bw = bw; text->bw = bw;
/* text selection */ /* text selection */
selection_init(&text->sel, NULL, NULL); selection_init(&text->sel, NULL);
return NSERROR_OK; return NSERROR_OK;
} }
@ -1579,7 +1580,7 @@ textplain_create_selection(struct content *c, struct selection **sel_out)
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
selection_init(sel, NULL, NULL); selection_init(sel, NULL);
*sel_out = sel; *sel_out = sel;
return NSERROR_OK; return NSERROR_OK;

View File

@ -23,6 +23,8 @@
*/ */
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "utils/errors.h" #include "utils/errors.h"
#include "utils/utils.h" #include "utils/utils.h"

View File

@ -355,9 +355,7 @@ void selection_reinit(struct selection *s, struct box *root)
/* exported interface documented in desktop/selection.h */ /* exported interface documented in desktop/selection.h */
void void
selection_init(struct selection *s, selection_init(struct selection *s, struct box *root)
struct box *root,
const nscss_len_ctx *len_ctx)
{ {
if (s->defined) { if (s->defined) {
selection_clear(s, true); selection_clear(s, true);
@ -367,13 +365,6 @@ selection_init(struct selection *s,
s->start_idx = 0; s->start_idx = 0;
s->end_idx = 0; s->end_idx = 0;
s->drag_state = DRAG_NONE; 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); selection_reinit(s, root);
} }

View File

@ -25,7 +25,6 @@
#include <stdbool.h> #include <stdbool.h>
#include "netsurf/mouse.h" #include "netsurf/mouse.h"
#include "content/handlers/css/utils.h"
struct box; struct box;
struct browser_window; struct browser_window;
@ -47,7 +46,6 @@ struct selection
{ {
struct content *c; struct content *c;
struct box *root; struct box *root;
nscss_len_ctx len_ctx;
unsigned max_idx; /* total bytes in text representation */ unsigned max_idx; /* total bytes in text representation */
@ -112,7 +110,7 @@ void selection_destroy(struct selection *s);
* \param s selection object * \param s selection object
* \param root the root box for html document or NULL for text/plain * \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, * Initialise the selection object to use the given box subtree as its root,