[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 18:16:44 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c32d1dda79f70ca0399797c5175f6d248ed9d55d
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Mar 4 18:00:12 2010 +0000
2010-03-04 Fridrich Strba <fridrich.strba at bluewin.ch>
Reviewed by Holger Freyther.
Make paths relocatable on runtime on Windows
https://bugs.webkit.org/show_bug.cgi?id=32711
* platform/graphics/gtk/ImageGtk.cpp:
(get_webkit_datadir):
(WebCore::Image::loadPlatformResource):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f40cc35..688be38 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-03-04 Fridrich Strba <fridrich.strba at bluewin.ch>
+
+ Reviewed by Holger Freyther.
+
+ Make paths relocatable on runtime on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=32711
+
+ * platform/graphics/gtk/ImageGtk.cpp:
+ (get_webkit_datadir):
+ (WebCore::Image::loadPlatformResource):
+
2010-03-04 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp
index 9c41369..a5bf64d 100644
--- a/WebCore/platform/graphics/gtk/ImageGtk.cpp
+++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp
@@ -32,6 +32,66 @@
#include <cairo.h>
#include <gtk/gtk.h>
+#ifdef _WIN32
+# include <mbstring.h>
+# include <shlobj.h>
+/* search for data relative to where we are installed */
+
+static HMODULE hmodule;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ hmodule = hinstDLL;
+ break;
+ }
+
+ return TRUE;
+}
+#ifdef __cplusplus
+}
+#endif
+
+static char *
+get_webkit_datadir(void)
+{
+ static char retval[1000];
+ static int beenhere = 0;
+
+ unsigned char *p;
+
+ if (beenhere)
+ return retval;
+
+ if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10))
+ return DATA_DIR;
+
+ p = _mbsrchr((const unsigned char *) retval, '\\');
+ *p = '\0';
+ p = _mbsrchr((const unsigned char *) retval, '\\');
+ if (p) {
+ if (!stricmp((const char *) (p+1), "bin"))
+ *p = '\0';
+ }
+ strcat(retval, "\\share");
+
+ beenhere = 1;
+
+ return retval;
+}
+
+#undef DATA_DIR
+#define DATA_DIR get_webkit_datadir ()
+#endif
+
+
namespace WTF {
template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info)
@@ -96,8 +156,13 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
CString fileName;
if (!strcmp("missingImage", name))
fileName = getThemeIconFileName(GTK_STOCK_MISSING_IMAGE, 16);
- if (fileName.isNull())
- fileName = String::format("%s/webkit-1.0/images/%s.png", DATA_DIR, name).utf8();
+ if (fileName.isNull()) {
+ gchar* imagename = g_strdup_printf("%s.png", name);
+ gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, 0);
+ fileName = glib_file_name;
+ g_free(imagename);
+ g_free(glibFileName);
+ }
return loadImageFromFile(fileName);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list