Title: [260425] trunk/Source
Revision
260425
Author
csaave...@igalia.com
Date
2020-04-21 05:31:22 -0700 (Tue, 21 Apr 2020)

Log Message

[GTK4] Adapt to GtkIconTheme API changes
https://bugs.webkit.org/show_bug.cgi?id=210745

Reviewed by Adrian Perez de Castro.

Source/WebCore:

No new tests needed.

GtkIconTheme changes in GTK and since we're no longer following
the theme we can drop the missing image from the icon theme, so remove
now unnecessary code.

* platform/graphics/gtk/ImageGtk.cpp:
(WebCore::Image::loadPlatformResource): Directly load image from compiled
GResource.
(WebCore::loadResourceSharedBuffer): Deleted.
(WebCore::loadMissingImageIconFromTheme): Deleted.

Source/WTF:

* wtf/glib/GTypedefs.h: Remove unneeded GtkIconInfo definition.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (260424 => 260425)


--- trunk/Source/WTF/ChangeLog	2020-04-21 10:33:58 UTC (rev 260424)
+++ trunk/Source/WTF/ChangeLog	2020-04-21 12:31:22 UTC (rev 260425)
@@ -1,3 +1,12 @@
+2020-04-21  Claudio Saavedra  <csaave...@igalia.com>
+
+        [GTK4] Adapt to GtkIconTheme API changes
+        https://bugs.webkit.org/show_bug.cgi?id=210745
+
+        Reviewed by Adrian Perez de Castro.
+
+        * wtf/glib/GTypedefs.h: Remove unneeded GtkIconInfo definition.
+
 2020-04-20  Timothy Horton  <timothy_hor...@apple.com>
 
         Try to fix the build after r260407

Modified: trunk/Source/WTF/wtf/glib/GTypedefs.h (260424 => 260425)


--- trunk/Source/WTF/wtf/glib/GTypedefs.h	2020-04-21 10:33:58 UTC (rev 260424)
+++ trunk/Source/WTF/wtf/glib/GTypedefs.h	2020-04-21 12:31:22 UTC (rev 260425)
@@ -82,7 +82,6 @@
 typedef struct _GtkBorder GtkBorder;
 typedef struct _GtkClipboard GtkClipboard;
 typedef struct _GtkContainer GtkContainer;
-typedef struct _GtkIconInfo GtkIconInfo;
 typedef struct _GtkMenu GtkMenu;
 typedef struct _GtkMenuItem GtkMenuItem;
 typedef struct _GtkObject GtkObject;

Modified: trunk/Source/WebCore/ChangeLog (260424 => 260425)


--- trunk/Source/WebCore/ChangeLog	2020-04-21 10:33:58 UTC (rev 260424)
+++ trunk/Source/WebCore/ChangeLog	2020-04-21 12:31:22 UTC (rev 260425)
@@ -1,3 +1,22 @@
+2020-04-21  Claudio Saavedra  <csaave...@igalia.com>
+
+        [GTK4] Adapt to GtkIconTheme API changes
+        https://bugs.webkit.org/show_bug.cgi?id=210745
+
+        Reviewed by Adrian Perez de Castro.
+
+        No new tests needed.
+
+        GtkIconTheme changes in GTK and since we're no longer following
+        the theme we can drop the missing image from the icon theme, so remove
+        now unnecessary code.
+
+        * platform/graphics/gtk/ImageGtk.cpp:
+        (WebCore::Image::loadPlatformResource): Directly load image from compiled
+        GResource.
+        (WebCore::loadResourceSharedBuffer): Deleted.
+        (WebCore::loadMissingImageIconFromTheme): Deleted.
+
 2020-04-21  Rob Buis  <rb...@igalia.com>
 
         Exit early in FrameLoader::loadURL when redirecting to another frame

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


--- trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp	2020-04-21 10:33:58 UTC (rev 260424)
+++ trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp	2020-04-21 12:31:22 UTC (rev 260425)
@@ -26,11 +26,9 @@
 #include "config.h"
 
 #include "BitmapImage.h"
-#include "GUniquePtrGtk.h"
 #include "GdkCairoUtilities.h"
 #include "SharedBuffer.h"
 #include <cairo.h>
-#include <gtk/gtk.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/GUniquePtr.h>
 
@@ -46,39 +44,15 @@
     return icon;
 }
 
-static Ref<SharedBuffer> loadResourceSharedBuffer(const char* filename)
-{
-    GUniqueOutPtr<gchar> content;
-    gsize length;
-    if (!g_file_get_contents(filename, &content.outPtr(), &length, nullptr))
-        return SharedBuffer::create();
-
-    return SharedBuffer::create(content.get(), length);
-}
-
 void BitmapImage::invalidatePlatformData()
 {
 }
 
-static Ref<Image> loadMissingImageIconFromTheme(const char* name)
+Ref<Image> Image::loadPlatformResource(const char* name)
 {
-    int iconSize = g_str_has_suffix(name, "@2x") ? 32 : 16;
-    auto icon = BitmapImage::create();
-    GRefPtr<GtkIconInfo> iconInfo = adoptGRef(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);
-        return icon;
-    }
-
     return loadImageFromGResource(name);
 }
 
-Ref<Image> Image::loadPlatformResource(const char* name)
-{
-    return g_str_has_prefix(name, "missingImage") ? loadMissingImageIconFromTheme(name) : loadImageFromGResource(name);
-}
-
 GdkPixbuf* BitmapImage::getGdkPixbuf()
 {
     RefPtr<cairo_surface_t> surface = nativeImageForCurrentFrame();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to