Remove assumption of gui window from search.
svn path=/trunk/netsurf/; revision=12603
This commit is contained in:
parent
8faa353087
commit
430b63e242
|
@ -378,15 +378,32 @@ struct selection *browser_window_get_selection(struct browser_window *bw)
|
|||
return bw->cur_sel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scroll offsets for a browser window.
|
||||
*
|
||||
* \param bw The browser window
|
||||
* \param x The x scroll offset to set
|
||||
* \param y The y scroll offset to set
|
||||
*/
|
||||
/* exported interface, documented in browser.h */
|
||||
void browser_window_scroll_visible(struct browser_window *bw,
|
||||
const struct rect *rect)
|
||||
{
|
||||
assert(bw != NULL);
|
||||
|
||||
static void browser_window_set_scroll(struct browser_window *bw, int x, int y)
|
||||
switch (bw->browser_window_type) {
|
||||
default:
|
||||
/* fall through to NORMAL until frame(set)s are handled
|
||||
* in the core */
|
||||
case BROWSER_WINDOW_NORMAL:
|
||||
gui_window_scroll_visible(bw->window,
|
||||
rect->x0, rect->y0, rect->x1, rect->y1);
|
||||
break;
|
||||
|
||||
case BROWSER_WINDOW_IFRAME:
|
||||
if (bw->scroll_x != NULL)
|
||||
scrollbar_set(bw->scroll_x, rect->x0, false);
|
||||
if (bw->scroll_y != NULL)
|
||||
scrollbar_set(bw->scroll_y, rect->y0, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* exported interface, documented in browser.h */
|
||||
void browser_window_set_scroll(struct browser_window *bw, int x, int y)
|
||||
{
|
||||
if (bw->window != NULL) {
|
||||
gui_window_set_scroll(bw->window, x, y);
|
||||
|
|
|
@ -339,6 +339,27 @@ void browser_window_get_position(struct browser_window *bw, bool root,
|
|||
*/
|
||||
void browser_window_set_position(struct browser_window *bw, int x, int y);
|
||||
|
||||
/*
|
||||
* Scroll the browser window to display the passed area
|
||||
*
|
||||
* \param bw browser window to scroll
|
||||
* \param rect area to display
|
||||
*/
|
||||
void browser_window_scroll_visible(struct browser_window *bw,
|
||||
const struct rect *rect);
|
||||
|
||||
/**
|
||||
* Set scroll offsets for a browser window.
|
||||
*
|
||||
* \param bw The browser window
|
||||
* \param x The x scroll offset to set
|
||||
* \param y The y scroll offset to set
|
||||
*
|
||||
* TODO -- Do we really need this and browser_window_scroll_visible?
|
||||
* Ditto for gui_window_* variants.
|
||||
*/
|
||||
void browser_window_set_scroll(struct browser_window *bw, int x, int y);
|
||||
|
||||
/*
|
||||
* Set the position of the current browser window with respect to the parent
|
||||
* browser window
|
||||
|
|
|
@ -193,7 +193,7 @@ void search_step(struct search_context *context, search_flags_t flags,
|
|||
context->callbacks->back_state(false, context->p);
|
||||
if (context->callbacks->forward_state != NULL)
|
||||
context->callbacks->forward_state(false, context->p);
|
||||
gui_window_set_scroll(context->bw->window, 0, 0);
|
||||
browser_window_set_scroll(context->bw, 0, 0);
|
||||
return;
|
||||
}
|
||||
search_text(string, string_len, context, flags);
|
||||
|
@ -367,8 +367,7 @@ void search_text(const char *string, int string_len,
|
|||
break;
|
||||
}
|
||||
|
||||
gui_window_scroll_visible(context->bw->window,
|
||||
bounds.x0, bounds.y0, bounds.x1, bounds.y1);
|
||||
browser_window_scroll_visible(context->bw, &bounds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue