mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 04:02:34 +03:00
improve desktop text search header usage
remove unecessary inclusion of desktop search header in content header which has knock on effect of not having ctype or string system headers dragged in unecessarily. Futher this highlighted use of ctype API where internal ascii processing ought to be used.
This commit is contained in:
parent
2352bea153
commit
ebe1b05114
@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <nsutils/time.h>
|
||||
|
||||
#include "netsurf/inttypes.h"
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include "desktop/search.h" /* search flags enum */
|
||||
#include "netsurf/content_type.h"
|
||||
#include "netsurf/mouse.h" /* mouse state enums */
|
||||
#include "netsurf/console.h" /* console state and flags enums */
|
||||
@ -421,24 +420,6 @@ bool content_scroll_at_point(struct hlcache_handle *h,
|
||||
bool content_drop_file_at_point(struct hlcache_handle *h,
|
||||
int x, int y, char *file);
|
||||
|
||||
/**
|
||||
* Free text search a content
|
||||
*
|
||||
* \param[in] h Handle to content to search.
|
||||
* \param[in] context The context passed to gui table search handlers
|
||||
* \param[in] flags The flags that control the search
|
||||
* \param[in] The string being searched for.
|
||||
* \retun NSERROR_OK on success else error code on faliure
|
||||
*/
|
||||
nserror content_textsearch(struct hlcache_handle *h, void *context, search_flags_t flags, const char *string);
|
||||
|
||||
/**
|
||||
* Clear a search
|
||||
*
|
||||
* \param[in] h Handle to content to clear search from.
|
||||
*/
|
||||
nserror content_textsearch_clear(struct hlcache_handle *h);
|
||||
|
||||
|
||||
/**
|
||||
* Control debug con a content.
|
||||
|
@ -16,6 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
#include <dom/dom.h>
|
||||
|
@ -26,6 +26,7 @@
|
||||
* Implementation of special element handling conversion.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <dom/dom.h>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
* Box tree treeview box replacement (implementation).
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <dom/dom.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
|
@ -22,6 +22,8 @@
|
||||
* Implementation of HTML content DOM event handling.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "utils/corestrings.h"
|
||||
#include "utils/nsoption.h"
|
||||
|
@ -21,6 +21,8 @@
|
||||
* HTML form handling implementation
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "utils/corestrings.h"
|
||||
#include "utils/log.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dom/dom.h>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <png.h>
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
* plain text content handling implementation.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <parserutils/input/inputstream.h>
|
||||
|
||||
#include "utils/errors.h"
|
||||
|
@ -25,9 +25,11 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/errors.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/ascii.h"
|
||||
#include "netsurf/types.h"
|
||||
#include "desktop/selection.h"
|
||||
|
||||
@ -507,11 +509,11 @@ content_textsearch_find_pattern(const char *string,
|
||||
if (ch != '#') {
|
||||
/* scan forwards until we find a match for
|
||||
this char */
|
||||
if (!case_sens) ch = toupper(ch);
|
||||
if (!case_sens) ch = ascii_to_upper(ch);
|
||||
while (s < es) {
|
||||
if (case_sens) {
|
||||
if (*s == ch) break;
|
||||
} else if (toupper(*s) == ch)
|
||||
} else if (ascii_to_upper(*s) == ch)
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
@ -548,7 +550,7 @@ content_textsearch_find_pattern(const char *string,
|
||||
if (case_sens)
|
||||
matches = (*s == ch);
|
||||
else
|
||||
matches = (toupper(*s) == toupper(ch));
|
||||
matches = (ascii_to_upper(*s) == ascii_to_upper(ch));
|
||||
}
|
||||
if (matches && first) {
|
||||
ss = s; /* remember first non-'*' char */
|
||||
|
@ -28,8 +28,27 @@
|
||||
|
||||
struct textsearch_context;
|
||||
struct content;
|
||||
struct hlcache_handle;
|
||||
struct box;
|
||||
|
||||
/**
|
||||
* Free text search a content
|
||||
*
|
||||
* \param[in] h Handle to content to search.
|
||||
* \param[in] context The context passed to gui table search handlers
|
||||
* \param[in] flags The flags that control the search
|
||||
* \param[in] The string being searched for.
|
||||
* \retun NSERROR_OK on success else error code on faliure
|
||||
*/
|
||||
nserror content_textsearch(struct hlcache_handle *h, void *context, search_flags_t flags, const char *string);
|
||||
|
||||
/**
|
||||
* Clear a search
|
||||
*
|
||||
* \param[in] h Handle to content to clear search from.
|
||||
*/
|
||||
nserror content_textsearch_clear(struct hlcache_handle *h);
|
||||
|
||||
/**
|
||||
* Ends the search process, invalidating all state freeing the list of
|
||||
* found boxes.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "utils/config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <nsutils/time.h>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "utils/errors.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "utils/errors.h"
|
||||
#include "content/content.h"
|
||||
#include "content/textsearch.h"
|
||||
#include "netsurf/types.h"
|
||||
#include "netsurf/browser_window.h"
|
||||
|
||||
|
@ -16,11 +16,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _NETSURF_DESKTOP_SEARCH_H_
|
||||
#define _NETSURF_DESKTOP_SEARCH_H_
|
||||
/**
|
||||
* \file
|
||||
* Browseing window text search interface
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifndef NETSURF_DESKTOP_SEARCH_H_
|
||||
#define NETSURF_DESKTOP_SEARCH_H_
|
||||
|
||||
struct browser_window;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "netsurf/clipboard.h"
|
||||
#include "netsurf/browser_window.h"
|
||||
|
Loading…
Reference in New Issue
Block a user