remove unused is_html parameter to text selection routines

This commit is contained in:
Vincent Sanders 2020-05-23 22:09:40 +01:00
parent a8c540ea59
commit 2ea577c47e
5 changed files with 14 additions and 29 deletions

View File

@ -493,7 +493,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
selection_prepare(&c->sel, (struct content *)c, true); selection_prepare(&c->sel, (struct content *)c);
nerror = http_parameter_list_find_item(params, corestring_lwc_charset, &charset); nerror = http_parameter_list_find_item(params, corestring_lwc_charset, &charset);
if (nerror == NSERROR_OK) { if (nerror == NSERROR_OK) {

View File

@ -265,13 +265,11 @@ nserror
html_create_selection(struct content *c, struct selection **sel_out) html_create_selection(struct content *c, struct selection **sel_out)
{ {
struct selection *sel; struct selection *sel;
sel = selection_create(c, true); sel = selection_create(c);
if (sel == NULL) { if (sel == NULL) {
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
selection_init(sel);
*sel_out = sel; *sel_out = sel;
return NSERROR_OK; return NSERROR_OK;
} }

View File

@ -169,7 +169,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
c->formatted_width = 0; c->formatted_width = 0;
c->bw = NULL; c->bw = NULL;
selection_prepare(&c->sel, (struct content *)c, false); selection_prepare(&c->sel, (struct content *)c);
return NSERROR_OK; return NSERROR_OK;
@ -1575,13 +1575,11 @@ static nserror
textplain_create_selection(struct content *c, struct selection **sel_out) textplain_create_selection(struct content *c, struct selection **sel_out)
{ {
struct selection *sel; struct selection *sel;
sel = selection_create(c, false); sel = selection_create(c);
if (sel == NULL) { if (sel == NULL) {
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
selection_init(sel);
*sel_out = sel; *sel_out = sel;
return NSERROR_OK; return NSERROR_OK;
} }

View File

@ -49,13 +49,6 @@
#include "netsurf/window.h" #include "netsurf/window.h"
#include "desktop/gui_internal.h" #include "desktop/gui_internal.h"
/**
* Text selection works by labelling each node in the box tree with its
* start index in the textual representation of the tree's content.
*/
#define SPACE_LEN(b) ((b->space == 0) ? 0 : 1)
struct selection_string { struct selection_string {
char *buffer; char *buffer;
@ -67,8 +60,6 @@ struct selection_string {
}; };
/** /**
* Redraws the given range of text. * Redraws the given range of text.
* *
@ -254,24 +245,24 @@ selection_string_append(const char *text,
/* exported interface documented in desktop/selection.h */ /* exported interface documented in desktop/selection.h */
struct selection *selection_create(struct content *c, bool is_html) struct selection *selection_create(struct content *c)
{ {
struct selection *s; struct selection *sel;
s = calloc(1, sizeof(struct selection)); sel = calloc(1, sizeof(struct selection));
if (s) { if (sel) {
selection_prepare(s, c, is_html); selection_prepare(sel, c);
selection_init(sel);
} }
return s; return sel;
} }
/* exported interface documented in desktop/selection.h */ /* exported interface documented in desktop/selection.h */
void selection_prepare(struct selection *s, struct content *c, bool is_html) void selection_prepare(struct selection *s, struct content *c)
{ {
if (s) { if (s) {
s->c = c; s->c = c;
s->is_html = is_html;
s->root = NULL; s->root = NULL;
s->drag_state = DRAG_NONE; s->drag_state = DRAG_NONE;
s->max_idx = 0; s->max_idx = 0;

View File

@ -53,7 +53,6 @@ struct selection
unsigned end_idx; unsigned end_idx;
bool defined; bool defined;
bool is_html;
seln_drag_state drag_state; seln_drag_state drag_state;
}; };
@ -79,7 +78,7 @@ struct selection
* *
* \return new selection context * \return new selection context
*/ */
struct selection *selection_create(struct content *c, bool is_html); struct selection *selection_create(struct content *c);
/** /**
* Prepare a newly created selection object for use. * Prepare a newly created selection object for use.
@ -88,9 +87,8 @@ struct selection *selection_create(struct content *c, bool is_html);
* *
* \param s selection object * \param s selection object
* \param c content * \param c content
* \param is_html true if content is html false if content is textplain
*/ */
void selection_prepare(struct selection *s, struct content *c, bool is_html); void selection_prepare(struct selection *s, struct content *c);
/** /**
* Destroys a selection object clearing it if nesessary * Destroys a selection object clearing it if nesessary