1 /*
2  * Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
3  * Copyright 2005 Adrian Lees <adrianl@users.sourceforge.net>
4  * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
5  *
6  * This file is part of NetSurf, http://www.netsurf-browser.org/
7  *
8  * NetSurf is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * NetSurf is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /**
22  * \file
23  * Free text search (core)
24  */
25 
26 #include <stdbool.h>
27 
28 #include "utils/errors.h"
29 #include "content/content.h"
30 #include "netsurf/types.h"
31 #include "netsurf/browser_window.h"
32 
33 #include "desktop/browser_private.h"
34 #include "desktop/search.h"
35 
36 /* exported function documented in desktop/search.h */
browser_window_search(struct browser_window * bw,void * context,search_flags_t flags,const char * string)37 void browser_window_search(struct browser_window *bw, void *context,
38 		search_flags_t flags, const char *string)
39 {
40 	if ((bw != NULL) &&
41 	    (bw->current_content != NULL)) {
42 		content_textsearch(bw->current_content, context, flags, string);
43 	}
44 }
45 
46 /* exported function documented in desktop/search.h */
browser_window_search_clear(struct browser_window * bw)47 void browser_window_search_clear(struct browser_window *bw)
48 {
49 	if ((bw != NULL) &&
50 	    (bw->current_content != NULL)) {
51 		content_textsearch_clear(bw->current_content);
52 	}
53 }
54