RESOLVED FIXED 80597
[WK2] Add WKHitTestResultIsContentEditable()
https://bugs.webkit.org/show_bug.cgi?id=80597
Summary [WK2] Add WKHitTestResultIsContentEditable()
Carlos Garcia Campos
Reported 2012-03-08 07:59:34 PST
It will be used by the Gtk port to add input methods and unicode menu items to the default context menu for editable elements.
Attachments
Patch (13.08 KB, patch)
2012-03-08 08:06 PST, Carlos Garcia Campos
mrobinson: review+
mrobinson: commit-queue-
Carlos Garcia Campos
Comment 1 2012-03-08 08:06:13 PST
Created attachment 130824 [details] Patch Patch includes also additions to the GTK API and new test case in GTK+ unit tests.
WebKit Review Bot
Comment 2 2012-03-08 08:08:45 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alexey Proskuryakov
Comment 3 2012-03-08 12:25:06 PST
Looks good to me. Just one question - how does Mac port achieve the same, and is it inappropriate for Gtk?
Carlos Garcia Campos
Comment 4 2012-03-09 00:39:27 PST
(In reply to comment #3) > Looks good to me. Just one question - how does Mac port achieve the same, and is it inappropriate for Gtk? I don't know if mac has an input methods menu item, ContextMenuItemTagInputMethods enum is specific to GTK+. In any case, the GTK+ API allows the users to ignore the given default context menu and build their own menu using the given hit test result. I think knowing whether hit test is editable content could be useful for other things too.
Alexey Proskuryakov
Comment 5 2012-03-09 09:16:16 PST
Mac provides a number of menu items in editable context only, and client can configure the menu. So, the next step is to figure out how it's done, so that we don't add multiple APIs for the same thing.
Carlos Garcia Campos
Comment 6 2012-03-12 00:41:39 PDT
So, Anders and Sam should know about how mac does it. In any case the patch simply adds a bool flag to HitTestResult to know whether it's editable content, this is not only used by context menu, but also in didMouseMoveOverElement(), so as I said it could be used for other things too.
Carlos Garcia Campos
Comment 7 2012-03-12 03:14:26 PDT
Actually, all menu items are added to the default context menu by WebCore in the WebProcess, in ContextMenuController, using the hit test result. I guess that's where all editable menu items are added for mac (and other ports). But input methods context menu items are special case, because they are created by GTK+ API (gtk_im_multicontext_append_menuitems), so that needs to be called in the UI process.
Martin Robinson
Comment 8 2012-06-08 16:08:54 PDT
Comment on attachment 130824 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=130824&action=review Normally I would not review patches that affect the C WebKit API, but this patch has been sitting for a very long time with no input. The API makes a lot of sense to me, but given that the WebKit2 team hasn't really chimed in, I think it's better to make this API private when landing. You can just move the new API to Source/WebKit2/UIProcess/API/C/WKHitTestResultPrivate.h. > Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp:360 > + * Returns: %TRUE if there's an editable element in the coordinates of the Hit Test, Maybe @hit_test_result would be better than " the Hit Test" Should probably say "at the coordinates" instead of "in the coordinates"
Carlos Garcia Campos
Comment 9 2012-06-13 05:32:19 PDT
(In reply to comment #8) > (From update of attachment 130824 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=130824&action=review > > Normally I would not review patches that affect the C WebKit API, but this patch has been sitting for a very long time with no input. The API makes a lot of sense to me, but given that the WebKit2 team hasn't really chimed in, I think it's better to make this API private when landing. You can just move the new API to Source/WebKit2/UIProcess/API/C/WKHitTestResultPrivate.h. That would require adding a new file, so I would have the same problem that in bug #79482, I don't have a mac, and I have no idea how to deal with xcode files :-( > > Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.cpp:360 > > + * Returns: %TRUE if there's an editable element in the coordinates of the Hit Test, > > Maybe @hit_test_result would be better than " the Hit Test" Ok > Should probably say "at the coordinates" instead of "in the coordinates" Sure. Thanks for reviewing!
Carlos Garcia Campos
Comment 10 2012-06-14 01:41:00 PDT
Note You need to log in before you can comment on or make changes to this bug.