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.
Created attachment 240864 [details] Patch
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 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?
(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.
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!!
Created attachment 241099 [details] Updated patch
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.
Committed r175694: <http://trac.webkit.org/changeset/175694>