Changeset 121093 in webkit
- Timestamp:
- Jun 23, 2012 3:55:05 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 10 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r121083 r121093 1 2012-06-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add ContextMenu API to WebKit2 GTK+ API 4 https://bugs.webkit.org/show_bug.cgi?id=81011 5 6 Reviewed by Martin Robinson. 7 8 Add WebKitWebView::context-menu signal and WebKitContextMenu and 9 WebKitContextMenuItem objects to customize the default menu or 10 buils new menus. 11 12 * GNUmakefile.list.am: Add new files to destination. 13 * UIProcess/API/gtk/WebKitContextMenu.cpp: Added. 14 (webkitContextMenuFinalize): 15 (webkit_context_menu_init): 16 (webkit_context_menu_class_init): 17 (webkitContextMenuPopulate): Populate the given vector of 18 ContextMenuItems with the WebKitContextMenu items releasing the 19 items added to the vector. 20 (webkitContextMenuCreate): Create a new WebKitContextMenu for the 21 given WKArrayRef of WKContextMenuItemRef. 22 (webkitContextMenuSetParentItem): Set the parent menu item of the 23 menu. Used when a menu is added as a submenu of a menu item. 24 (webkitContextMenuGetParentItem): Return the parent menu item of 25 the menu. 26 (webkit_context_menu_new): Create a new WebKitContextMenu. 27 (webkit_context_menu_new_with_items): Create a new 28 WebKitContextMenu using the given list of WebKitContextMenuItem. 29 (webkit_context_menu_prepend): Add item at the beginning. 30 (webkit_context_menu_append): Add item at the end. 31 (webkit_context_menu_insert): Insert item at a random position. 32 (webkit_context_menu_move_item): Move an existing item to a new 33 position. 34 (webkit_context_menu_get_items): Get the list of items. 35 (webkit_context_menu_get_n_items): Get the number of items. 36 (webkit_context_menu_first): Get the first item. 37 (webkit_context_menu_last): Get the last item. 38 (webkit_context_menu_get_item_at_position): Get the item at the 39 given position. 40 (webkit_context_menu_remove): Remove the given item. 41 (webkit_context_menu_remove_all): Remove all items. 42 * UIProcess/API/gtk/WebKitContextMenu.h: Added. 43 * UIProcess/API/gtk/WebKitContextMenuActions.cpp: Added. 44 (webkitContextMenuActionIsCheckable): Check if the given stock 45 action is a toggle action. 46 (webkitContextMenuActionGetActionTag): Get the WebCore 47 ContextMenuAction corresponding to the given stock action. 48 (webkitContextMenuActionGetForContextMenuItem): Get the stock 49 action corresponding to the given WebCore ContextMenuAction. 50 (webkitContextMenuActionGetLabel): Get the label string of the 51 given stock action. 52 * UIProcess/API/gtk/WebKitContextMenuActions.h: Added. 53 * UIProcess/API/gtk/WebKitContextMenuActionsPrivate.h: Added. 54 * UIProcess/API/gtk/WebKitContextMenuItem.cpp: Added. 55 (webkitContextMenuItemFinalize): 56 (webkit_context_menu_item_init): 57 (webkit_context_menu_item_class_init): 58 (checkAndWarnIfMenuHasParentItem): Check whether the given menu 59 is already inside another menu showing a warning in such case. 60 (webkitContextMenuItemSetSubMenu): Set the submenu of a menu item, 61 checking that the menu is not part of another menu and setting the 62 item as the parent of the submenu. 63 (webkitContextMenuItemCreate): Create a new WebKitContextMenuItem 64 for the given WKContextMenuItemRef. 65 (webkitContextMenuItemCreateForGtkItem): Create a new 66 WebKitContextMenuItem using the given GtkMenuItem. 67 (webkitContextMenuItemSetSubMenuFromGtkMenu): Set the given 68 GtkMenu as submenu of the item. This is used only to add Input 69 Methods submenu that is created by GTK. 70 (webkitContextMenuItemRelease): Release the WebCore 71 ContextMenuItem associated to the item. 72 (webkit_context_menu_item_new): Create a new WebKitContextMenuItem 73 for the given GtkAction. 74 (webkit_context_menu_item_new_from_stock_action): Create a new 75 WebKitContextMenuItem for a stock action. 76 (webkit_context_menu_item_new_from_stock_action_with_label): 77 Create a new WebKitContextMenuItem for a stock action using a 78 custom label. 79 (webkit_context_menu_item_new_with_submenu): Create a new 80 WebKitContextMenuItem with a submenu. 81 (webkit_context_menu_item_new_separator): Create a new separator 82 menu item. 83 (webkit_context_menu_item_get_action): Get the GtkAction of the item. 84 (webkit_context_menu_item_get_stock_action): Get the stock action 85 of the item. 86 (webkit_context_menu_item_is_separator): Whether item is a separator. 87 (webkit_context_menu_item_set_submenu): Set or replace the 88 submenu of the item. 89 (webkit_context_menu_item_get_submenu): Get the submenu of the item. 90 * UIProcess/API/gtk/WebKitContextMenuItem.h: Added. 91 * UIProcess/API/gtk/WebKitContextMenuItemPrivate.h: Added. 92 * UIProcess/API/gtk/WebKitContextMenuPrivate.h: Added. 93 * UIProcess/API/gtk/WebKitDefines.h: 94 * UIProcess/API/gtk/WebKitWebView.cpp: 95 (webkit_web_view_class_init): Add WebKitWebView::context-menu signal. 96 (getUnicodeMenuItemPosition): Helper function that returns the 97 position of the unicode menu item in the proposed context menu. 98 (webkitWebViewCreateAndAppendInputMethodsMenuItem): Use 99 WebKitContextMenu API to add the input methods submenu to the 100 default context menu. 101 (webkitWebViewPopulateContextMenu): Create a WebKitContextMenu for 102 the default context menu and emit WebKitWebView::context-menu 103 signal. Then populate the context menu proxy with the resulting 104 WebKitContextMenu. 105 * UIProcess/API/gtk/WebKitWebView.h: 106 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 107 (webkitWebViewBaseButtonPressEvent): In case of right click save 108 the event to be used by context menu signal. 109 (webkitWebViewBaseTakeContextMenuEvent): Return and release the 110 saved button event. 111 * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: 112 * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add sections for 113 WebKitContextMenu and WebKitContextMenuItem. 114 * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. 115 * UIProcess/API/gtk/docs/webkit2gtk.types: Add 116 webkit_context_menu_get_type and webkit_context_menu_item_get_type. 117 * UIProcess/API/gtk/tests/GNUmakefile.am: Add new test for context menu. 118 * UIProcess/API/gtk/tests/TestContextMenu.cpp: Added. 119 (testContextMenuDefaultMenu): 120 (testContextMenuPopulateMenu): 121 (testContextMenuCustomMenu): 122 (testContextMenuDisableMenu): 123 (testContextMenuSubMenu): 124 (beforeAll): 125 (afterAll): 126 * UIProcess/API/gtk/tests/TestMain.h: 127 (Test::addLogFatalFlag): Add a log level flag to the mask of flags 128 causing the program to abort. 129 (Test::removeLogFatalFlag): Remove a log level flag to the mask of 130 flags causing the program to abort. 131 * UIProcess/API/gtk/tests/WebViewTest.cpp: 132 (WebViewTest::quitMainLoop): Finish the main loop. 133 (WebViewTest::quitMainLoopAfterProcessingPendingEvents): Finish 134 the main loop when all pending events have been processed. 135 (quitMainLoopIdleCallback): 136 (WebViewTest::wait): 137 * UIProcess/API/gtk/tests/WebViewTest.h: 138 * UIProcess/API/gtk/webkit2.h: Include WebKitContextMenu.h, 139 WebKitContextMenuItem.h and WebKitContextMenuActions.h. 140 * UIProcess/API/gtk/webkit2marshal.list: 141 * UIProcess/gtk/WebContextMenuProxyGtk.cpp: 142 (WebKit::WebContextMenuProxyGtk::showContextMenu): Attach the 143 popup menu to the view widget before showing it. 144 1 145 2012-06-22 Alexandru Chiculita <achicu@adobe.com> 2 146 -
trunk/Source/WebKit2/GNUmakefile.list.am
r120963 r121093 90 90 $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardList.h \ 91 91 $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardListItem.h \ 92 $(WebKit2)/UIProcess/API/gtk/WebKitContextMenu.h \ 93 $(WebKit2)/UIProcess/API/gtk/WebKitContextMenuActions.h \ 94 $(WebKit2)/UIProcess/API/gtk/WebKitContextMenuItem.h \ 92 95 $(WebKit2)/UIProcess/API/gtk/WebKitCookieManager.h \ 93 96 $(WebKit2)/UIProcess/API/gtk/WebKitDefines.h \ … … 579 582 Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListItem.cpp \ 580 583 Source/WebKit2/UIProcess/API/gtk/WebKitBackForwardListPrivate.h \ 584 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.cpp \ 585 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenu.h \ 586 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuPrivate.h \ 587 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp \ 588 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h \ 589 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActionsPrivate.h \ 581 590 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp \ 582 591 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.h \ 592 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.cpp \ 593 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItem.h \ 594 Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuItemPrivate.h \ 583 595 Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.h \ 584 596 Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp \ -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitDefines.h
r109329 r121093 33 33 #include <glib.h> 34 34 35 typedef struct _WebKitPrintOperation WebKitPrintOperation; 36 typedef struct _WebKitFindController WebKitFindController; 37 typedef struct _WebKitWebView WebKitWebView; 35 typedef struct _WebKitPrintOperation WebKitPrintOperation; 36 typedef struct _WebKitFindController WebKitFindController; 37 typedef struct _WebKitWebView WebKitWebView; 38 typedef struct _WebKitContextMenu WebKitContextMenu; 39 typedef struct _WebKitContextMenuItem WebKitContextMenuItem; 38 40 39 41 #ifdef G_OS_WIN32 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r120908 r121093 26 26 #include "WebKitBackForwardListPrivate.h" 27 27 #include "WebKitContextMenuClient.h" 28 #include "WebKitContextMenuItemPrivate.h" 29 #include "WebKitContextMenuPrivate.h" 28 30 #include "WebKitEnumTypes.h" 29 31 #include "WebKitError.h" … … 51 53 #include <JavaScriptCore/APICast.h> 52 54 #include <WebCore/DragIcon.h> 55 #include <WebCore/GOwnPtrGtk.h> 53 56 #include <WebCore/GtkUtilities.h> 54 57 #include <glib/gi18n-lib.h> … … 84 87 85 88 RUN_FILE_CHOOSER, 89 90 CONTEXT_MENU, 86 91 87 92 LAST_SIGNAL … … 983 988 G_TYPE_BOOLEAN, 1, /* number of parameters */ 984 989 WEBKIT_TYPE_FILE_CHOOSER_REQUEST); 990 991 /** 992 * WebKitWebView::context-menu: 993 * @web_view: the #WebKitWebView on which the signal is emitted 994 * @context_menu: the proposed #WebKitContextMenu 995 * @event: the #GdkEvent that triggered the context menu 996 * @hit_test_result: a #WebKitHitTestResult 997 * 998 * Emmited when a context menu is about to be displayed to give the application 999 * a chance to customize the proposed menu, prevent the menu from being displayed 1000 * or build its own context menu. 1001 * <itemizedlist> 1002 * <listitem><para> 1003 * To customize the proposed menu you can use webkit_context_menu_prepend(), 1004 * webkit_context_menu_append() or webkit_context_menu_insert() to add new 1005 * #WebKitContextMenuItem<!-- -->s to @context_menu, webkit_context_menu_move_item() 1006 * to reorder existing items, or webkit_context_menu_remove() to remove an 1007 * existing item. The signal handler should return %FALSE, and the menu represented 1008 * by @context_menu will be shown. 1009 * </para></listitem> 1010 * <listitem><para> 1011 * To prevent the menu from being displayed you can just connect to this signal 1012 * and return %TRUE so that the proposed menu will not be shown. 1013 * </para></listitem> 1014 * <listitem><para> 1015 * To build your own menu, you can remove all items from the proposed menu with 1016 * webkit_context_menu_remove_all(), add your own items and return %FALSE so 1017 * that the menu will be shown. You can also ignore the proposed #WebKitContextMenu, 1018 * build your own #GtkMenu and return %TRUE to prevent the proposed menu from being shown. 1019 * </para></listitem> 1020 * <listitem><para> 1021 * If you just want the default menu to be shown always, simply don't connect to this 1022 * signal because showing the proposed context menu is the default behaviour. 1023 * </para></listitem> 1024 * </itemizedlist> 1025 * 1026 * If the signal handler returns %FALSE the context menu represented by @context_menu 1027 * will be shown, if it return %TRUE the context menu will not be shown. 1028 * 1029 * The proposed #WebKitContextMenu passed in @context_menu argument is only valid 1030 * during the signal emission. 1031 * 1032 * Returns: %TRUE to stop other handlers from being invoked for the event. 1033 * %FALSE to propagate the event further. 1034 */ 1035 signals[CONTEXT_MENU] = 1036 g_signal_new("context-menu", 1037 G_TYPE_FROM_CLASS(webViewClass), 1038 G_SIGNAL_RUN_LAST, 1039 G_STRUCT_OFFSET(WebKitWebViewClass, context_menu), 1040 g_signal_accumulator_true_handled, 0, 1041 webkit_marshal_BOOLEAN__OBJECT_BOXED_OBJECT, 1042 G_TYPE_BOOLEAN, 3, 1043 WEBKIT_TYPE_CONTEXT_MENU, 1044 GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE, 1045 WEBKIT_TYPE_HIT_TEST_RESULT); 985 1046 } 986 1047 … … 1232 1293 } 1233 1294 1234 static void webkitWebViewCreateAndAppendDefaultMenuItems(WebKitWebView* webView, WKArrayRef wkProposedMenu, Vector<ContextMenuItem>& contextMenuItems)1235 {1236 for (size_t i = 0; i < WKArrayGetSize(wkProposedMenu); ++i) {1237 WKContextMenuItemRef wkItem = static_cast<WKContextMenuItemRef>(WKArrayGetItemAtIndex(wkProposedMenu, i));1238 contextMenuItems.append(toImpl(wkItem)->data()->core());1239 }1240 }1241 1242 1295 static bool webkitWebViewShouldShowInputMethodsMenu(WebKitWebView* webView) 1243 1296 { … … 1251 1304 } 1252 1305 1253 static void webkitWebViewCreateAndAppendInputMethodsMenuItem(WebKitWebView* webView, Vector<ContextMenuItem>& contextMenuItems) 1306 static int getUnicodeMenuItemPosition(WebKitContextMenu* contextMenu) 1307 { 1308 GList* items = webkit_context_menu_get_items(contextMenu); 1309 GList* iter; 1310 int i = 0; 1311 for (iter = items, i = 0; iter; iter = g_list_next(iter), ++i) { 1312 WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(iter->data); 1313 1314 if (webkit_context_menu_item_is_separator(item)) 1315 continue; 1316 if (webkit_context_menu_item_get_stock_action(item) == WEBKIT_CONTEXT_MENU_ACTION_UNICODE) 1317 return i; 1318 } 1319 return -1; 1320 } 1321 1322 static void webkitWebViewCreateAndAppendInputMethodsMenuItem(WebKitWebView* webView, WebKitContextMenu* contextMenu) 1254 1323 { 1255 1324 if (!webkitWebViewShouldShowInputMethodsMenu(webView)) 1256 1325 return; 1326 1327 // Place the im context menu item right before the unicode menu item 1328 // if it's present. 1329 int unicodeMenuItemPosition = getUnicodeMenuItemPosition(contextMenu); 1330 if (unicodeMenuItemPosition == -1) 1331 webkit_context_menu_append(contextMenu, webkit_context_menu_item_new_separator()); 1257 1332 1258 1333 GtkIMContext* imContext = webkitWebViewBaseGetIMContext(WEBKIT_WEB_VIEW_BASE(webView)); 1259 1334 GtkMenu* imContextMenu = GTK_MENU(gtk_menu_new()); 1260 1335 gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(imContext), GTK_MENU_SHELL(imContextMenu)); 1261 ContextMenu subMenu(imContextMenu); 1262 1263 ContextMenuItem separator(SeparatorType, ContextMenuItemTagNoAction, String()); 1264 contextMenuItems.append(separator); 1265 ContextMenuItem menuItem(SubmenuType, ContextMenuItemTagNoAction, _("Input _Methods"), &subMenu); 1266 contextMenuItems.append(menuItem); 1336 WebKitContextMenuItem* menuItem = webkit_context_menu_item_new_from_stock_action(WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS); 1337 webkitContextMenuItemSetSubMenuFromGtkMenu(menuItem, imContextMenu); 1338 webkit_context_menu_insert(contextMenu, menuItem, unicodeMenuItemPosition); 1267 1339 } 1268 1340 1269 1341 void webkitWebViewPopulateContextMenu(WebKitWebView* webView, WKArrayRef wkProposedMenu, WKHitTestResultRef wkHitTestResult) 1270 1342 { 1271 WebContextMenuProxyGtk* contextMenu = webkitWebViewBaseGetActiveContextMenuProxy(WEBKIT_WEB_VIEW_BASE(webView)); 1343 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView); 1344 WebContextMenuProxyGtk* contextMenuProxy = webkitWebViewBaseGetActiveContextMenuProxy(webViewBase); 1272 1345 ASSERT(contextMenu); 1273 1346 1347 GRefPtr<WebKitContextMenu> contextMenu = adoptGRef(webkitContextMenuCreate(wkProposedMenu)); 1348 if (WKHitTestResultIsContentEditable(wkHitTestResult)) 1349 webkitWebViewCreateAndAppendInputMethodsMenuItem(webView, contextMenu.get()); 1350 1351 GRefPtr<WebKitHitTestResult> hitTestResult = adoptGRef(webkitHitTestResultCreate(wkHitTestResult)); 1352 GOwnPtr<GdkEvent> contextMenuEvent(webkitWebViewBaseTakeContextMenuEvent(webViewBase)); 1353 1354 gboolean returnValue; 1355 g_signal_emit(webView, signals[CONTEXT_MENU], 0, contextMenu.get(), contextMenuEvent.get(), hitTestResult.get(), &returnValue); 1356 if (returnValue) 1357 return; 1358 1274 1359 Vector<ContextMenuItem> contextMenuItems; 1275 webkit WebViewCreateAndAppendDefaultMenuItems(webView, wkProposedMenu, contextMenuItems);1276 if (WKHitTestResultIsContentEditable(wkHitTestResult))1277 webkitWebViewCreateAndAppendInputMethodsMenuItem(webView, contextMenuItems); 1278 1279 contextMenu->populate(contextMenuItems);1360 webkitContextMenuPopulate(contextMenu.get(), contextMenuItems); 1361 contextMenuProxy->populate(contextMenuItems); 1362 1363 // Clear the menu to make sure it's useless after signal emission. 1364 webkit_context_menu_remove_all(contextMenu.get()); 1280 1365 } 1281 1366 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
r120908 r121093 160 160 gboolean (* run_file_chooser) (WebKitWebView *web_view, 161 161 WebKitFileChooserRequest *request); 162 gboolean (* context_menu) (WebKitWebView *web_view, 163 WebKitContextMenu *context_menu, 164 GdkEvent *event, 165 WebKitHitTestResult *hit_test_result); 162 166 163 167 /* Padding for future expansion */ -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r120305 r121093 47 47 #include <WebCore/DragData.h> 48 48 #include <WebCore/DragIcon.h> 49 #include <WebCore/GOwnPtrGtk.h> 49 50 #include <WebCore/GtkClickCounter.h> 50 51 #include <WebCore/GtkDragAndDropHelper.h> … … 95 96 GtkWidget* inspectorView; 96 97 unsigned inspectorViewHeight; 98 GOwnPtr<GdkEvent> contextMenuEvent; 97 99 WebContextMenuProxyGtk* activeContextMenuProxy; 98 100 }; … … 449 451 if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent)) 450 452 return TRUE; 453 454 // If it's a right click event save it as a possible context menu event. 455 if (buttonEvent->button == 3) 456 priv->contextMenuEvent.set(gdk_event_copy(reinterpret_cast<GdkEvent*>(buttonEvent))); 451 457 priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(buttonEvent), 452 458 priv->clickCounter.clickCountForGdkButtonEvent(widget, buttonEvent))); … … 785 791 return webkitWebViewBase->priv->activeContextMenuProxy; 786 792 } 793 794 GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase* webkitWebViewBase) 795 { 796 return webkitWebViewBase->priv->contextMenuEvent.release(); 797 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBasePrivate.h
r120305 r121093 50 50 void webkitWebViewBaseSetActiveContextMenuProxy(WebKitWebViewBase*, WebContextMenuProxyGtk*); 51 51 WebContextMenuProxyGtk* webkitWebViewBaseGetActiveContextMenuProxy(WebKitWebViewBase*); 52 GdkEvent* webkitWebViewBaseTakeContextMenuEvent(WebKitWebViewBase*); 52 53 53 54 #endif // WebKitWebViewBasePrivate_h -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml
r119837 r121093 38 38 <xi:include href="xml/WebKitURISchemeRequest.xml"/> 39 39 <xi:include href="xml/WebKitVersion.xml"/> 40 <xi:include href="xml/WebKitContextMenu.xml"/> 41 <xi:include href="xml/WebKitContextMenuItem.xml"/> 40 42 </chapter> 41 43 -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
r120908 r121093 747 747 WEBKIT_CHECK_VERSION 748 748 </SECTION> 749 750 <SECTION> 751 <FILE>WebKitContextMenu</FILE> 752 WebKitContextMenu 753 webkit_context_menu_new 754 webkit_context_menu_new_with_items 755 webkit_context_menu_prepend 756 webkit_context_menu_append 757 webkit_context_menu_insert 758 webkit_context_menu_move_item 759 webkit_context_menu_get_items 760 webkit_context_menu_get_n_items 761 webkit_context_menu_first 762 webkit_context_menu_last 763 webkit_context_menu_get_item_at_position 764 webkit_context_menu_remove 765 webkit_context_menu_remove_all 766 767 <SUBSECTION Standard> 768 WebKitContextMenuClass 769 WEBKIT_TYPE_CONTEXT_MENU 770 WEBKIT_CONTEXT_MENU 771 WEBKIT_IS_CONTEXT_MENU 772 WEBKIT_CONTEXT_MENU_CLASS 773 WEBKIT_IS_CONTEXT_MENU_CLASS 774 WEBKIT_CONTEXT_MENU_GET_CLASS 775 776 <SUBSECTION Private> 777 WebKitContextMenuPrivate 778 webkit_context_menu_get_type 779 </SECTION> 780 781 <SECTION> 782 <FILE>WebKitContextMenuItem</FILE> 783 WebKitContextMenuItem 784 WebKitContextMenuAction 785 webkit_context_menu_item_new 786 webkit_context_menu_item_new_from_stock_action 787 webkit_context_menu_item_new_from_stock_action_with_label 788 webkit_context_menu_item_new_with_submenu 789 webkit_context_menu_item_new_separator 790 webkit_context_menu_item_get_action 791 webkit_context_menu_item_get_stock_action 792 webkit_context_menu_item_is_separator 793 webkit_context_menu_item_set_submenu 794 webkit_context_menu_item_get_submenu 795 796 <SUBSECTION Standard> 797 WebKitContextMenuItemClass 798 WEBKIT_TYPE_CONTEXT_MENU_ITEM 799 WEBKIT_CONTEXT_MENU_ITEM 800 WEBKIT_IS_CONTEXT_MENU_ITEM 801 WEBKIT_CONTEXT_MENU_ITEM_CLASS 802 WEBKIT_IS_CONTEXT_MENU_ITEM_CLASS 803 WEBKIT_CONTEXT_MENU_ITEM_GET_CLASS 804 805 <SUBSECTION Private> 806 WebKitContextMenuItemPrivate 807 webkit_context_menu_item_get_type 808 </SECTION> -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk.types
r119700 r121093 20 20 webkit_web_inspector_get_type 21 21 webkit_uri_scheme_request_get_type 22 webkit_context_menu_get_type 23 webkit_context_menu_item_get_type -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
r119837 r121093 3 3 TEST_PROGS += \ 4 4 Programs/WebKit2APITests/TestBackForwardList \ 5 Programs/WebKit2APITests/TestContextMenu \ 5 6 Programs/WebKit2APITests/TestCookieManager \ 6 7 Programs/WebKit2APITests/TestDownloads \ … … 168 169 Programs_WebKit2APITests_TestWebKitVersion_LDFLAGS = $(webkit2_tests_ldflags) 169 170 171 Programs_WebKit2APITests_TestContextMenu_SOURCES = \ 172 Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp 173 Programs_WebKit2APITests_TestContextMenu_CPPFLAGS = $(webkit2_tests_cppflags) 174 Programs_WebKit2APITests_TestContextMenu_LDADD = $(webkit2_tests_ldadd) 175 Programs_WebKit2APITests_TestContextMenu_LDFLAGS = $(webkit2_tests_ldflags) 176 170 177 endif # ENABLE_WEBKIT2 -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h
r112221 r121093 76 76 } 77 77 78 void addLogFatalFlag(unsigned flag) 79 { 80 unsigned fatalMask = g_log_set_always_fatal(static_cast<GLogLevelFlags>(G_LOG_FATAL_MASK)); 81 fatalMask |= flag; 82 g_log_set_always_fatal(static_cast<GLogLevelFlags>(fatalMask)); 83 } 84 85 void removeLogFatalFlag(unsigned flag) 86 { 87 unsigned fatalMask = g_log_set_always_fatal(static_cast<GLogLevelFlags>(G_LOG_FATAL_MASK)); 88 fatalMask &= ~flag; 89 g_log_set_always_fatal(static_cast<GLogLevelFlags>(fatalMask)); 90 } 91 78 92 HashSet<GObject*> m_watchedObjects; 79 93 }; -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp
r118146 r121093 44 44 } 45 45 46 static gboolean testLoadTimeoutFinishLoop(GMainLoop* loop)47 {48 g_main_loop_quit(loop);49 return FALSE;50 }51 52 46 void WebViewTest::loadURI(const char* uri) 53 47 { … … 113 107 } 114 108 109 void WebViewTest::quitMainLoop() 110 { 111 g_main_loop_quit(m_mainLoop); 112 } 113 114 void WebViewTest::quitMainLoopAfterProcessingPendingEvents() 115 { 116 while (gtk_events_pending()) 117 gtk_main_iteration(); 118 quitMainLoop(); 119 } 120 121 static gboolean quitMainLoopIdleCallback(WebViewTest* test) 122 { 123 test->quitMainLoop(); 124 return FALSE; 125 } 126 115 127 void WebViewTest::wait(double seconds) 116 128 { 117 g_timeout_add_seconds(seconds, reinterpret_cast<GSourceFunc>( testLoadTimeoutFinishLoop), m_mainLoop);129 g_timeout_add_seconds(seconds, reinterpret_cast<GSourceFunc>(quitMainLoopIdleCallback), m_mainLoop); 118 130 g_main_loop_run(m_mainLoop); 119 131 } -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h
r118146 r121093 41 41 void goToBackForwardListItem(WebKitBackForwardListItem*); 42 42 43 void quitMainLoop(); 44 void quitMainLoopAfterProcessingPendingEvents(); 43 45 void wait(double seconds); 44 46 void waitUntilLoadFinished(); -
trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h
r119837 r121093 26 26 #include <webkit2/WebKitBackForwardList.h> 27 27 #include <webkit2/WebKitBackForwardListItem.h> 28 #include <webkit2/WebKitContextMenu.h> 29 #include <webkit2/WebKitContextMenuActions.h> 30 #include <webkit2/WebKitContextMenuItem.h> 28 31 #include <webkit2/WebKitCookieManager.h> 29 32 #include <webkit2/WebKitDefines.h> -
trunk/Source/WebKit2/UIProcess/API/gtk/webkit2marshal.list
r113697 r121093 2 2 BOOLEAN:ENUM,STRING,POINTER 3 3 BOOLEAN:OBJECT 4 BOOLEAN:OBJECT,BOXED,OBJECT 4 5 BOOLEAN:OBJECT,ENUM 5 6 BOOLEAN:STRING -
trunk/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.cpp
r120305 r121093 93 93 NativeWebMouseEvent* mouseEvent = m_page->currentlyProcessedMouseDownEvent(); 94 94 const GdkEvent* event = mouseEvent ? mouseEvent->nativeEvent() : 0; 95 gtk_menu_attach_to_widget(m_menu.platformDescription(), GTK_WIDGET(m_webView), 0); 95 96 gtk_menu_popup(m_menu.platformDescription(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 96 97 event ? event->button.button : 3, event ? event->button.time : GDK_CURRENT_TIME);
Note: See TracChangeset
for help on using the changeset viewer.