void search(gpointer data, gint direction) { struct Client *c = (struct Client *)data; WebKitWebView *web_view = WEBKIT_WEB_VIEW(c->web_view); WebKitFindController *fc = webkit_web_view_get_find_controller(web_view); if (search_text == NULL) return; switch (direction) { case 0: webkit_find_controller_search(fc, search_text, WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | WEBKIT_FIND_OPTIONS_WRAP_AROUND, G_MAXUINT); break; case 1: webkit_find_controller_search_next(fc); break; case -1: webkit_find_controller_search_previous(fc); break; } }
void inSiteSearchNext(RuskWindow *rusk) { if(gtk_widget_is_visible(GTK_WIDGET(rusk->insiteSearch))) { webkit_find_controller_search_next(webkit_web_view_get_find_controller(rusk->webview)); } }
void ephy_find_toolbar_find_next (EphyFindToolbar *toolbar) { #ifdef HAVE_WEBKIT2 webkit_find_controller_search_next (toolbar->priv->controller); #else find_again (toolbar, EPHY_FIND_DIRECTION_NEXT); #endif }
long wxWebViewWebKit::Find(const wxString& text, int flags) { WebKitFindController* findctrl = webkit_web_view_get_find_controller(m_web_view); bool newSearch = false; if(text != m_findText || (flags & wxWEBVIEW_FIND_MATCH_CASE) != (m_findFlags & wxWEBVIEW_FIND_MATCH_CASE)) { newSearch = true; //If it is a new search we need to clear existing highlights webkit_find_controller_search_finish(findctrl); } m_findFlags = flags; m_findText = text; //If the search string is empty then we clear any selection and highlight if(text.empty()) { webkit_find_controller_search_finish(findctrl); ClearSelection(); return wxNOT_FOUND; } bool wrap = false, forward = true; guint32 options = WEBKIT_FIND_OPTIONS_NONE; if(flags & wxWEBVIEW_FIND_WRAP) { wrap = true; options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND; } if(!(flags & wxWEBVIEW_FIND_MATCH_CASE)) { options |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE; } if(flags & wxWEBVIEW_FIND_BACKWARDS) { forward = false; options |= WEBKIT_FIND_OPTIONS_BACKWARDS; } if(newSearch) { //Initially we count the matches to know how many we have m_findCount = -1; webkit_find_controller_count_matches(findctrl, wxGTK_CONV(text), options, G_MAXUINT); GMainContext *main_context = g_main_context_get_thread_default(); while (m_findCount == -1) { g_main_context_iteration(main_context, TRUE); } //Highlight them if needed if(flags & wxWEBVIEW_FIND_HIGHLIGHT_RESULT) { webkit_find_controller_search(findctrl, wxGTK_CONV(text), options, G_MAXUINT); } //In this case we return early to match IE behaviour m_findPosition = -1; return m_findCount; } else { if(forward) m_findPosition++; else m_findPosition--; if(m_findPosition < 0) m_findPosition += m_findCount; if(m_findPosition > m_findCount) m_findPosition -= m_findCount; } if(forward) { webkit_find_controller_search_next(findctrl); if(m_findPosition == m_findCount && !wrap) { return wxNOT_FOUND; } } else { webkit_find_controller_search_previous(findctrl); if(m_findPosition == -1 && !wrap) { return wxNOT_FOUND; } } return newSearch ? m_findCount : m_findPosition; }
void ephy_find_toolbar_find_next (EphyFindToolbar *toolbar) { webkit_find_controller_search_next (toolbar->controller); }