Make search_term_highlighted a core function.
svn path=/trunk/netsurf/; revision=12524
This commit is contained in:
parent
ee5dfee544
commit
25e7c86fb7
|
@ -135,11 +135,6 @@ void gui_create_form_select_menu(struct browser_window *bw,
|
|||
|
||||
void gui_launch_url(const char *url);
|
||||
|
||||
bool gui_search_term_highlighted(struct gui_window *g,
|
||||
unsigned start_offset, unsigned end_offset,
|
||||
unsigned *start_idx, unsigned *end_idx,
|
||||
struct search_context *context);
|
||||
|
||||
struct ssl_cert_info;
|
||||
|
||||
void gui_cert_verify(const char *url, const struct ssl_cert_info *certs,
|
||||
|
|
|
@ -598,7 +598,7 @@ bool find_occurrences_text(const char *pattern, int p_len,
|
|||
* Determines whether any portion of the given text box should be
|
||||
* selected because it matches the current search string.
|
||||
*
|
||||
* \param g gui window
|
||||
* \param bw browser window
|
||||
* \param start_offset byte offset within text of string to be checked
|
||||
* \param end_offset byte offset within text
|
||||
* \param start_idx byte offset within string of highlight start
|
||||
|
@ -606,12 +606,12 @@ bool find_occurrences_text(const char *pattern, int p_len,
|
|||
* \return true iff part of the box should be highlighted
|
||||
*/
|
||||
|
||||
bool gui_search_term_highlighted(struct gui_window *g,
|
||||
bool search_term_highlighted(struct browser_window *bw,
|
||||
unsigned start_offset, unsigned end_offset,
|
||||
unsigned *start_idx, unsigned *end_idx,
|
||||
struct search_context *context)
|
||||
{
|
||||
if (g == context->bw->window) {
|
||||
if (bw == context->bw) {
|
||||
struct list_entry *a;
|
||||
for(a = context->found->next; a; a = a->next)
|
||||
if (a->sel && selection_defined(a->sel) &&
|
||||
|
|
|
@ -88,4 +88,9 @@ bool search_create_context(struct browser_window *bw,
|
|||
struct search_callbacks *callbacks, void *p);
|
||||
void search_show_all(bool all, struct search_context *context);
|
||||
|
||||
bool search_term_highlighted(struct browser_window *bw,
|
||||
unsigned start_offset, unsigned end_offset,
|
||||
unsigned *start_idx, unsigned *end_idx,
|
||||
struct search_context *context);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "content/content_protected.h"
|
||||
#include "css/css.h"
|
||||
#include "css/utils.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/plotters.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/textinput.h"
|
||||
|
@ -877,8 +876,8 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
|
|||
/* what about the current search operation, if any? */
|
||||
if (!highlighted && (current_redraw_browser->search_context
|
||||
!= NULL) &&
|
||||
gui_search_term_highlighted(
|
||||
current_redraw_browser->window,
|
||||
search_term_highlighted(
|
||||
current_redraw_browser,
|
||||
offset, offset + len,
|
||||
&start_idx, &end_idx,
|
||||
current_redraw_browser->
|
||||
|
|
|
@ -785,8 +785,7 @@ bool textplain_redraw(struct content *c, int x, int y,
|
|||
if (!highlighted && (bw->search_context
|
||||
!= NULL)) {
|
||||
unsigned start_idx, end_idx;
|
||||
if (gui_search_term_highlighted(
|
||||
bw->window,
|
||||
if (search_term_highlighted(bw,
|
||||
tab_ofst, tab_ofst + 1,
|
||||
&start_idx, &end_idx,
|
||||
bw->search_context))
|
||||
|
|
Loading…
Reference in New Issue