Bug 138311

Summary: [GTK] Add context menu API to Web Process Extensions
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: chavarria1991, commit-queue, gustavo, pnormand
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Updated patch gustavo: review+

Description Carlos Garcia Campos 2014-11-03 08:31:06 PST
Useful when the information in the UI process is not enough to build or customize the context menu, for example, when you need to access the Node of the hit test result.
Comment 1 Carlos Garcia Campos 2014-11-03 11:10:42 PST
Created attachment 240864 [details]
Patch
Comment 2 WebKit Commit Bot 2014-11-03 11:13:53 PST
Attachment 240864 [details] did not pass style-queue:


WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h"
ERROR: Source/WebKit2/PlatformGTK.cmake:376:  Alphabetical sorting problem. ""        <file alias=\"images/missingImage@2x\">missingImage@2x.png</file>\n"" should be before ""        <file alias=\"images/missingImage\">missingImage.png</file>\n"".  [list/order] [5]
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebHitTestResult.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h"
Total errors found: 1 in 22 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Gustavo Noronha (kov) 2014-11-04 05:53:21 PST
Comment on attachment 240864 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=240864&action=review

I like the idea and the API, the code looks correct to me as well.

> Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:257
> +    } else {
> +        WKRetain(wkDefaultMenu);
> +        *wkNewMenu = wkDefaultMenu;
> +    }

How about making this an early return?
Comment 4 Carlos Garcia Campos 2014-11-04 06:17:14 PST
(In reply to comment #3)
> Comment on attachment 240864 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=240864&action=review
> 
> I like the idea and the API, the code looks correct to me as well.

This is needed by Yelp, I'll try to use this in yelp asap to make sure the API is good.

> > Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:257
> > +    } else {
> > +        WKRetain(wkDefaultMenu);
> > +        *wkNewMenu = wkDefaultMenu;
> > +    }
> 
> How about making this an early return?

Sure.
Comment 5 Marcos Chavarría Teijeiro (irc: chavaone) 2014-11-05 01:10:46 PST
Yelp (the GNOME help viewer) needs to access the DOM tree when we generate the context menu to check if we are clicking a piece of code or to get the link title.

I have use this patch to implement this feature and it works really well!! Great work!!
Comment 6 Carlos Garcia Campos 2014-11-06 02:34:04 PST
Created attachment 241099 [details]
Updated patch
Comment 7 WebKit Commit Bot 2014-11-06 02:36:34 PST
Attachment 241099 [details] did not pass style-queue:


WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h"
ERROR: Source/WebKit2/PlatformGTK.cmake:376:  There should be exactly one empty line instead of 0 between ""        <file alias=\"images/panIcon\">panIcon.png</file>\n"" and ""        <file alias=\"images/textAreaResizeCorner\">textAreaResizeCorner.png</file>\n"".  [list/emptyline] [5]
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebHitTestResult.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h"
WARNING: File exempt from style guide. Skipping: "Source/WebKit2/UIProcess/API/gtk/WebKitHitTestResult.h"
Total errors found: 1 in 22 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Carlos Garcia Campos 2014-11-06 07:08:08 PST
Committed r175694: <http://trac.webkit.org/changeset/175694>