Changeset 259799 in webkit
- Timestamp:
- Apr 9, 2020, 7:48:31 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/API/glib/WebKitContextMenuItem.cpp (modified) (1 diff)
-
Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp (modified) (5 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259789 r259799 1 2020-04-09 Claudio Saavedra <csaavedra@igalia.com> 2 3 [GTK] Clean-up use of deprecated GtkAction 4 https://bugs.webkit.org/show_bug.cgi?id=210273 5 6 Reviewed by Carlos Garcia Campos. 7 8 GtkAction is deprecated, however we use it because it's exposed 9 in the public API. Guard deprecated API usage to remove warnings and 10 update docs to not suggest using the deprecated API. 11 12 * Shared/API/glib/WebKitContextMenuItem.cpp: 13 * Shared/glib/WebContextMenuItemGlib.cpp: 14 (WebKit::WebContextMenuItemGlib::buildActionName const): 15 (WebKit::WebContextMenuItemGlib::createActionIfNeeded): 16 1 17 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 18 -
trunk/Source/WebKit/Shared/API/glib/WebKitContextMenuItem.cpp
r248846 r259799 181 181 * when a menu item created with a %WEBKIT_CONTEXT_MENU_ACTION_STOP is 182 182 * activated the action associated will be handled by WebKit and the current 183 * load operation will be stopped. You can get the #G tkAction of a183 * load operation will be stopped. You can get the #GAction of a 184 184 * #WebKitContextMenuItem created with a #WebKitContextMenuAction with 185 * webkit_context_menu_item_get_ action() and connect to #GtkAction::activate signal186 * to be notified when the item is activated . But you can't prevent the associated185 * webkit_context_menu_item_get_gaction() and connect to the #GSimpleAction::activate signal 186 * to be notified when the item is activated, but you can't prevent the associated 187 187 * action from being performed. 188 188 * -
trunk/Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp
r246374 r259799 79 79 80 80 #if PLATFORM(GTK) 81 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 81 82 WebContextMenuItemGlib::WebContextMenuItemGlib(GtkAction* action) 82 83 : WebContextMenuItemData(GTK_IS_TOGGLE_ACTION(action) ? CheckableActionType : ActionType, ContextMenuItemBaseApplicationTag, String::fromUTF8(gtk_action_get_label(action)), gtk_action_get_sensitive(action), GTK_IS_TOGGLE_ACTION(action) ? gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)) : false) … … 86 87 g_object_set_data_full(G_OBJECT(m_gAction.get()), "webkit-gtk-action", g_object_ref(m_gtkAction), g_object_unref); 87 88 } 89 ALLOW_DEPRECATED_DECLARATIONS_END 88 90 #endif 89 91 … … 95 97 { 96 98 #if PLATFORM(GTK) 99 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 97 100 if (m_gtkAction) 98 101 return GUniquePtr<char>(g_strdup(gtk_action_get_name(m_gtkAction))); 102 ALLOW_DEPRECATED_DECLARATIONS_END 99 103 #endif 100 104 … … 118 122 119 123 #if PLATFORM(GTK) 124 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 120 125 // Create the GtkAction for backwards compatibility only. 121 126 if (!m_gtkAction) { … … 130 135 131 136 g_signal_connect_object(m_gAction.get(), "activate", G_CALLBACK(gtk_action_activate), m_gtkAction, G_CONNECT_SWAPPED); 137 ALLOW_DEPRECATED_DECLARATIONS_END 132 138 #endif 133 139 } -
trunk/Tools/ChangeLog
r259787 r259799 1 2020-04-09 Claudio Saavedra <csaavedra@igalia.com> 2 3 [GTK] Clean-up use of deprecated GtkAction 4 https://bugs.webkit.org/show_bug.cgi?id=210273 5 6 Reviewed by Carlos Garcia Campos. 7 8 GtkAction is deprecated so remove usage of it in the 9 context menu API tests and guard its API usage when 10 we still need to use it to test the deprecated WebKitGTK+ API 11 exposing GtkAction. 12 13 * TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp: 14 (testContextMenuPopulateMenu): 15 1 16 2020-04-09 Aakash Jain <aakash_jain@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp
r247901 r259799 113 113 } 114 114 115 void checkActionState(G tkAction* action, unsigned state)116 { 117 if (state & Visible)118 g_assert_true(g tk_action_get_visible(action));115 void checkActionState(GAction* action, unsigned state) 116 { 117 if (state & Enabled) 118 g_assert_true(g_action_get_enabled(action)); 119 119 else 120 g_assert_false(gtk_action_get_visible(action)); 121 122 if (state & Enabled) 123 g_assert_true(gtk_action_get_sensitive(action)); 124 else 125 g_assert_false(gtk_action_get_sensitive(action)); 126 127 if (GTK_IS_TOGGLE_ACTION(action)) { 120 g_assert_false(g_action_get_enabled(action)); 121 122 const GVariantType* type = g_action_get_state_type(action); 123 if (type && g_variant_type_equal(type, G_VARIANT_TYPE_BOOLEAN)) { 124 GRefPtr<GVariant> actionState = adoptGRef(g_action_get_state(action)); 128 125 if (state & Checked) 129 g_assert_true(g tk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)));126 g_assert_true(g_variant_get_boolean(actionState.get())); 130 127 else 131 g_assert_false(g tk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)));128 g_assert_false(g_variant_get_boolean(actionState.get())); 132 129 } 133 130 } … … 151 148 g_assert_cmpint(webkit_context_menu_item_get_stock_action(item), ==, stockAction); 152 149 153 checkActionState( action, state);150 checkActionState(gAction, state); 154 151 155 152 return g_list_next(items); … … 167 164 GtkAction* action = webkit_context_menu_item_get_action(item); 168 165 g_assert_true(GTK_IS_ACTION(action)); 169 G_GNUC_END_IGNORE_DEPRECATIONS;170 166 171 167 GAction* gAction = webkit_context_menu_item_get_gaction(item); … … 182 178 g_assert_cmpint(webkit_context_menu_item_get_stock_action(item), ==, WEBKIT_CONTEXT_MENU_ACTION_CUSTOM); 183 179 g_assert_cmpstr(gtk_action_get_label(action), ==, label); 184 185 checkActionState(action, state); 180 G_GNUC_END_IGNORE_DEPRECATIONS; 181 182 checkActionState(gAction, state); 186 183 187 184 return g_list_next(items); … … 205 202 g_assert_true(G_IS_ACTION(gAction)); 206 203 207 checkActionState( action, state);204 checkActionState(gAction, state); 208 205 209 206 WebKitContextMenu* subMenu = webkit_context_menu_item_get_submenu(item); … … 656 653 test->waitUntilLoadFinished(); 657 654 655 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 658 656 // Create a custom menu item. 659 657 GRefPtr<GtkAction> action = adoptGRef(gtk_action_new("WebKitGTKCustomAction", "Custom _Action", nullptr, nullptr)); … … 671 669 g_assert_false(test->m_activated); 672 670 g_assert_true(test->m_toggled); 671 G_GNUC_END_IGNORE_DEPRECATIONS; 673 672 674 673 // Create a custom menu item using GAction.
Note:
See TracChangeset
for help on using the changeset viewer.