Bug 16624 - [GTK] Improvements to search API
Summary: [GTK] Improvements to search API
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks: 14141
  Show dependency treegraph
 
Reported: 2007-12-27 07:33 PST by Cosimo Cecchi
Modified: 2014-04-08 17:54 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cosimo Cecchi 2007-12-27 07:33:18 PST
Hi, currently we have the following search API in WebKit/GTK

gboolean webkit_web_view_search_text (WebKitWebView* web_view, const gchar* string, gboolean case_sensitive, gboolean forward, gboolean wrap);

guint webkit_web_view_mark_text_matches (WebKitWebView* web_view, const gchar* string, gboolean case_sensitive, guint limit);

void webkit_web_view_set_highlight_text_matches (WebKitWebView* web_view, gboolean highlight);

void webkit_web_view_unmark_text_matches (WebKitWebView* web_view);

which IMHO is not optimal.
webkit_web_view_search_text directly looks for a provided string, returning a bool value is found/not found, and one match at a time is selected in the web view, with the possibility to go forward/backwards and wrap. This API misses the possibility to highlight all the occurrencies of the string, and also to un-highlight.
webkit_web_view_mark_text_matches and the other functions, look for a provided string and highlight a maximum provided number of occurrences (|limit|). This API also provides a function to highlight/unhighlight the found occurrencies, but lacks a way to go forward/backwards in highliting the occurrencies, to wrap the search and returns an int.

I think all this is confusing, and we should merge the two APIs together like this:
webkit_web_view_mark_text_matches should not have "limit" as an argument.
Then we would have:
enum
{
  NOT_FOUND,
  FOUND,
  FOUND_WRAPPED
} Result
- Result webkit_web_view_highlight_single_match (WebKitWebView *, direction)
- guint webkit_web_view_highlight_matches (WebKitWebView *, limit)
- void webkit_web_view_unhighlight_matches (WebKitWebView *)
- void webkit_web_view_unmark_matches (WebKitWebView *)

This would also cover bug #16584.
Comment 1 Sergio Villar Senin 2012-01-17 09:11:04 PST
Cosimo maybe you'd like to take a look at the new find API for WebKit2, see https://bugs.webkit.org/show_bug.cgi?id=76070
Comment 2 Martin Robinson 2014-04-08 17:54:10 PDT
WebKit1GTK+ has been removed.