Bug 16286
Summary: | [GTK] API: Can WebView implement GtkEditable? | ||
---|---|---|---|
Product: | WebKit | Reporter: | Alp Toker <alp> |
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | christian, lethalman88 |
Priority: | P2 | Keywords: | Gtk |
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All |
Alp Toker
From the docs:
<snip>
The GtkEditable interface is an interface which should be implemented by text editing widgets, such as GtkEntry and GtkText. It contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.
As an example of the latter usage, by connecting the following handler to "insert_text", an application can convert all entry into a widget into uppercase.
</snip>
We can implement some of the functions in this interface easily (eg. get/set editable). Others, taking integer indexes, may be difficult or impossible to map elegantly to the browser DOM, eg.:
void gtk_editable_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos);
The question is:
(1) Can we elegantly implement this interface properly?
(2) If not, is it worth partially implementing this interface, or would it be better to just skip it and do our own thing?
Someone needs to do this research before we can move forward on this bug.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Luca Bruno
The implementation of getting chars, the selection bounds, selecting and deleting the selection become simple enough using Range and the SelectionController.
Inserting and deleting text won't be enabled at the moment, since we force the widget to be not editable as it should be.
Christian Dywan
While implementing GtkEditable is clearly desirable if we want to make the life of developers as agreeable as possible, I am not sure how much sense the integer values make in this context. This is especially difficult because selection can be related to the view or different kinds of contained elements and there is currently no way to find out what a "I can copy something right now" actually means.
See also bug 16144.
Luca Bruno
GtkTextBuffer is the same of our WebView. They're a policy for getting text. We just return the text, not the html. If textbuffer can work with integers, we can too and it makes sense.
Alp Toker
I've discussed this with Owen Taylor, who worked on GtkTextView. He confirms that implementing GtkEditable wouldn't make much sense, especially in a browser widget:
[01:36] <owen> alp: well, as the author of GtkEditable, I consider GtkEditable a mistake, and see no evidence that anybody has ever benifited from it.
Luca Bruno
Ok then, going straight without implementing it then is the best choice as i see.