Title: [246374] trunk/Source
Revision
246374
Author
[email protected]
Date
2019-06-12 13:43:36 -0700 (Wed, 12 Jun 2019)

Log Message

[GTK] GTK_STOCK_* types have been deprecated since GTK 3.10
https://bugs.webkit.org/show_bug.cgi?id=198787

Patch by Ludovico de Nittis <[email protected]> on 2019-06-12
Reviewed by Michael Catanzaro.

Source/WebCore:

No behaviour changes.

* platform/graphics/gtk/IconGtk.cpp:
(WebCore::lookupIconName):
* platform/graphics/gtk/ImageGtk.cpp:
(WebCore::loadMissingImageIconFromTheme):

Source/WebKit:

We completely remove the gtkStockIDFromContextMenuAction function in order to get rid of the stock items.
This function was used only in "createActionIfNeeded" where now we pass a nullptr as a stock_id variable.

* Shared/glib/WebContextMenuItemGlib.cpp:
(WebKit::gtkStockIDFromContextMenuAction):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246373 => 246374)


--- trunk/Source/WebCore/ChangeLog	2019-06-12 20:38:18 UTC (rev 246373)
+++ trunk/Source/WebCore/ChangeLog	2019-06-12 20:43:36 UTC (rev 246374)
@@ -1,3 +1,17 @@
+2019-06-12  Ludovico de Nittis  <[email protected]>
+
+        [GTK] GTK_STOCK_* types have been deprecated since GTK 3.10
+        https://bugs.webkit.org/show_bug.cgi?id=198787
+
+        Reviewed by Michael Catanzaro.
+
+        No behaviour changes.
+
+        * platform/graphics/gtk/IconGtk.cpp:
+        (WebCore::lookupIconName):
+        * platform/graphics/gtk/ImageGtk.cpp:
+        (WebCore::loadMissingImageIconFromTheme):
+
 2019-06-12  Antti Koivisto  <[email protected]>
 
         (Async scrolling) Handle 'position:fixed' inside 'position:sticky' correctly.

Modified: trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp (246373 => 246374)


--- trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp	2019-06-12 20:38:18 UTC (rev 246373)
+++ trunk/Source/WebCore/platform/graphics/gtk/IconGtk.cpp	2019-06-12 20:43:36 UTC (rev 246374)
@@ -86,7 +86,7 @@
         if(gtk_icon_theme_has_icon(iconTheme, iconName.utf8().data()))
             return iconName;
     }
-    return GTK_STOCK_FILE;
+    return "text-x-generic";
 }
 
 // FIXME: Move the code to ChromeClient::iconForFiles().

Modified: trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp (246373 => 246374)


--- trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp	2019-06-12 20:38:18 UTC (rev 246373)
+++ trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp	2019-06-12 20:43:36 UTC (rev 246374)
@@ -64,7 +64,7 @@
 {
     int iconSize = g_str_has_suffix(name, "@2x") ? 32 : 16;
     auto icon = BitmapImage::create();
-    GUniquePtr<GtkIconInfo> iconInfo(gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(), GTK_STOCK_MISSING_IMAGE, iconSize, GTK_ICON_LOOKUP_NO_SVG));
+    GUniquePtr<GtkIconInfo> iconInfo(gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(), "image-missing", iconSize, GTK_ICON_LOOKUP_NO_SVG));
     if (iconInfo) {
         auto buffer = loadResourceSharedBuffer(gtk_icon_info_get_filename(iconInfo.get()));
         icon->setData(WTFMove(buffer), true);

Modified: trunk/Source/WebKit/ChangeLog (246373 => 246374)


--- trunk/Source/WebKit/ChangeLog	2019-06-12 20:38:18 UTC (rev 246373)
+++ trunk/Source/WebKit/ChangeLog	2019-06-12 20:43:36 UTC (rev 246374)
@@ -1,3 +1,16 @@
+2019-06-12  Ludovico de Nittis  <[email protected]>
+
+        [GTK] GTK_STOCK_* types have been deprecated since GTK 3.10
+        https://bugs.webkit.org/show_bug.cgi?id=198787
+
+        Reviewed by Michael Catanzaro.
+
+        We completely remove the gtkStockIDFromContextMenuAction function in order to get rid of the stock items.
+        This function was used only in "createActionIfNeeded" where now we pass a nullptr as a stock_id variable.
+
+        * Shared/glib/WebContextMenuItemGlib.cpp:
+        (WebKit::gtkStockIDFromContextMenuAction):
+
 2019-06-12  Brent Fulgham  <[email protected]>
 
         Unreviewed fix after rr246360.

Modified: trunk/Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp (246373 => 246374)


--- trunk/Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp	2019-06-12 20:38:18 UTC (rev 246373)
+++ trunk/Source/WebKit/Shared/glib/WebContextMenuItemGlib.cpp	2019-06-12 20:43:36 UTC (rev 246374)
@@ -36,93 +36,6 @@
 namespace WebKit {
 using namespace WebCore;
 
-#if PLATFORM(GTK)
-static const char* gtkStockIDFromContextMenuAction(ContextMenuAction action)
-{
-    switch (action) {
-    case ContextMenuItemTagCopyLinkToClipboard:
-    case ContextMenuItemTagCopyImageToClipboard:
-    case ContextMenuItemTagCopyMediaLinkToClipboard:
-    case ContextMenuItemTagCopy:
-        return GTK_STOCK_COPY;
-    case ContextMenuItemTagOpenLinkInNewWindow:
-    case ContextMenuItemTagOpenImageInNewWindow:
-    case ContextMenuItemTagOpenFrameInNewWindow:
-    case ContextMenuItemTagOpenMediaInNewWindow:
-        return GTK_STOCK_OPEN;
-    case ContextMenuItemTagDownloadLinkToDisk:
-    case ContextMenuItemTagDownloadImageToDisk:
-        return GTK_STOCK_SAVE;
-    case ContextMenuItemTagGoBack:
-        return GTK_STOCK_GO_BACK;
-    case ContextMenuItemTagGoForward:
-        return GTK_STOCK_GO_FORWARD;
-    case ContextMenuItemTagStop:
-        return GTK_STOCK_STOP;
-    case ContextMenuItemTagReload:
-        return GTK_STOCK_REFRESH;
-    case ContextMenuItemTagCut:
-        return GTK_STOCK_CUT;
-    case ContextMenuItemTagPaste:
-        return GTK_STOCK_PASTE;
-    case ContextMenuItemTagDelete:
-        return GTK_STOCK_DELETE;
-    case ContextMenuItemTagSelectAll:
-        return GTK_STOCK_SELECT_ALL;
-    case ContextMenuItemTagSpellingGuess:
-        return nullptr;
-    case ContextMenuItemTagIgnoreSpelling:
-        return GTK_STOCK_NO;
-    case ContextMenuItemTagLearnSpelling:
-        return GTK_STOCK_OK;
-    case ContextMenuItemTagOther:
-        return GTK_STOCK_MISSING_IMAGE;
-    case ContextMenuItemTagSearchInSpotlight:
-        return GTK_STOCK_FIND;
-    case ContextMenuItemTagSearchWeb:
-        return GTK_STOCK_FIND;
-    case ContextMenuItemTagOpenWithDefaultApplication:
-        return GTK_STOCK_OPEN;
-    case ContextMenuItemPDFZoomIn:
-        return GTK_STOCK_ZOOM_IN;
-    case ContextMenuItemPDFZoomOut:
-        return GTK_STOCK_ZOOM_OUT;
-    case ContextMenuItemPDFAutoSize:
-        return GTK_STOCK_ZOOM_FIT;
-    case ContextMenuItemPDFNextPage:
-        return GTK_STOCK_GO_FORWARD;
-    case ContextMenuItemPDFPreviousPage:
-        return GTK_STOCK_GO_BACK;
-    // New tags, not part of API
-    case ContextMenuItemTagOpenLink:
-        return GTK_STOCK_OPEN;
-    case ContextMenuItemTagCheckSpelling:
-        return GTK_STOCK_SPELL_CHECK;
-    case ContextMenuItemTagFontMenu:
-        return GTK_STOCK_SELECT_FONT;
-    case ContextMenuItemTagShowFonts:
-        return GTK_STOCK_SELECT_FONT;
-    case ContextMenuItemTagBold:
-        return GTK_STOCK_BOLD;
-    case ContextMenuItemTagItalic:
-        return GTK_STOCK_ITALIC;
-    case ContextMenuItemTagUnderline:
-        return GTK_STOCK_UNDERLINE;
-    case ContextMenuItemTagShowColors:
-        return GTK_STOCK_SELECT_COLOR;
-    case ContextMenuItemTagToggleMediaControls:
-    case ContextMenuItemTagToggleMediaLoop:
-    case ContextMenuItemTagCopyImageUrlToClipboard:
-        // No icon for this.
-        return nullptr;
-    case ContextMenuItemTagEnterVideoFullscreen:
-        return GTK_STOCK_FULLSCREEN;
-    default:
-        return nullptr;
-    }
-}
-#endif // PLATFORM(GTK)
-
 WebContextMenuItemGlib::WebContextMenuItemGlib(ContextMenuItemType type, ContextMenuAction action, const String& title, bool enabled, bool checked)
     : WebContextMenuItemData(type, action, title, enabled, checked)
 {
@@ -207,10 +120,10 @@
     // Create the GtkAction for backwards compatibility only.
     if (!m_gtkAction) {
         if (type() == CheckableActionType) {
-            m_gtkAction = GTK_ACTION(gtk_toggle_action_new(g_action_get_name(m_gAction.get()), title().utf8().data(), nullptr, gtkStockIDFromContextMenuAction(action())));
+            m_gtkAction = GTK_ACTION(gtk_toggle_action_new(g_action_get_name(m_gAction.get()), title().utf8().data(), nullptr, nullptr));
             gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(m_gtkAction), checked());
         } else
-            m_gtkAction = gtk_action_new(g_action_get_name(m_gAction.get()), title().utf8().data(), 0, gtkStockIDFromContextMenuAction(action()));
+            m_gtkAction = gtk_action_new(g_action_get_name(m_gAction.get()), title().utf8().data(), 0, nullptr);
         gtk_action_set_sensitive(m_gtkAction, enabled());
         g_object_set_data_full(G_OBJECT(m_gAction.get()), "webkit-gtk-action", m_gtkAction, g_object_unref);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to