Diff
Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog 2012-02-20 08:40:40 UTC (rev 108219)
@@ -1,3 +1,22 @@
+2012-02-20 Paweł Forysiuk <[email protected]>
+
+ [GTK] Can't find webinspector and error page redirection on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=51616
+
+ Create and use an abstraction for finding shared resources on Windows.
+
+ Reviewed by Martin Robinson.
+
+ * platform/FileSystem.h:
+ (WebCore):
+ * platform/audio/gtk/AudioBusGtk.cpp:
+ (WebCore::AudioBus::loadPlatformResource):
+ * platform/graphics/gtk/ImageGtk.cpp:
+ (WebCore::getPathToImageResource):
+ * platform/gtk/FileSystemGtk.cpp:
+ (WebCore::sharedResourcesPath):
+ (WebCore):
+
2012-02-19 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix make distcheck issues.
Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/FileSystem.h (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/FileSystem.h 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/FileSystem.h 2012-02-20 08:40:40 UTC (rev 108219)
@@ -198,6 +198,7 @@
String filenameToString(const char*);
String filenameForDisplay(const String&);
CString applicationDirectoryPath();
+CString sharedResourcesPath();
uint64_t getVolumeFreeSizeForPath(const char*);
#endif
Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp 2012-02-20 08:40:40 UTC (rev 108219)
@@ -23,6 +23,7 @@
#include "AudioBus.h"
#include "AudioFileReader.h"
+#include "FileSystem.h"
#include "GOwnPtr.h"
#include <gio/gio.h>
@@ -33,7 +34,7 @@
PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate)
{
GOwnPtr<gchar> filename(g_strdup_printf("%s.wav", name));
- GOwnPtr<gchar> absoluteFilename(g_build_filename(DATA_DIR, "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "resources", "audio", filename.get(), NULL));
+ GOwnPtr<gchar> absoluteFilename(g_build_filename(sharedResourcesPath().data(), "resources", "audio", filename.get(), NULL));
GFile* file = g_file_new_for_path(filename.get());
if (!g_file_query_exists(file, 0)) {
Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp 2012-02-20 08:40:40 UTC (rev 108219)
@@ -26,6 +26,7 @@
#include "config.h"
#include "BitmapImage.h"
+#include "FileSystem.h"
#include "GdkCairoUtilities.h"
#include "GOwnPtrGtk.h"
#include "SharedBuffer.h"
@@ -33,63 +34,16 @@
#include <cairo.h>
#include <gtk/gtk.h>
-#if PLATFORM(WIN)
-#include <mbstring.h>
-#include <shlobj.h>
+namespace WebCore {
-static HMODULE hmodule;
-
-extern "C" {
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- if (fdwReason == DLL_PROCESS_ATTACH)
- hmodule = hinstDLL;
- return TRUE;
-}
-}
-
static char* getPathToImageResource(char* resource)
{
- static char* dataDirectory = 0;
- if (!dataDirectory) {
- dataDirectory = new char[PATH_MAX];
- if (!GetModuleFileName(hmodule, static_cast<CHAR*>(dataDirectory), sizeof(dataDirectory) - 10))
- dataDirectory = DATA_DIR;
-
- // FIXME: This is pretty ugly. Ideally we should be using Windows API
- // functions or GLib methods to calculate paths.
- unsigned char *p;
- p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\');
- *p = '\0';
- p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\');
- if (p) {
- if (!stricmp((const char *) (p+1), "bin"))
- *p = '\0';
- }
- strcat(dataDirectory, "\\share\\webkitgtk-"WEBKITGTK_API_VERSION_STRING"\\images\\");
- }
-
- char* imageResourcePath = new char[PATH_MAX];
- strcat(imageResourcePath, dataDirectory);
- strcat(imageResourcePath, resource);
-
- return imageResourcePath;
-}
-
-#else
-
-static char* getPathToImageResource(char* resource)
-{
if (g_getenv("WEBKIT_TOP_LEVEL"))
return g_build_filename(g_getenv("WEBKIT_TOP_LEVEL"), "Source", "WebCore", "Resources", resource, NULL);
- return g_build_filename(DATA_DIR, "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "images", resource, NULL);
+ return g_build_filename(sharedResourcesPath().data(), "images", resource, NULL);
}
-#endif
-
-namespace WebCore {
-
static CString getThemeIconFileName(const char* name, int size)
{
GtkIconInfo* iconInfo = gtk_icon_theme_lookup_icon(gtk_icon_theme_get_default(),
Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/gtk/FileSystemGtk.cpp (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/gtk/FileSystemGtk.cpp 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/platform/gtk/FileSystemGtk.cpp 2012-02-20 08:40:40 UTC (rev 108219)
@@ -190,6 +190,26 @@
return dirname.get();
}
+CString sharedResourcesPath()
+{
+ static CString cachedPath;
+ if (!cachedPath.isNull())
+ return cachedPath;
+
+#if OS(WINDOWS)
+ HMODULE hmodule = 0;
+ GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<char*>(sharedResourcesPath), &hmodule);
+
+ GOwnPtr<gchar> runtimeDir(g_win32_get_package_installation_directory_of_module(hmodule));
+ GOwnPtr<gchar> dataPath(g_build_filename(runtimeDir.get(), "share", "webkitgtk-"WEBKITGTK_API_VERSION_STRING, NULL));
+#else
+ GOwnPtr<gchar> dataPath(g_build_filename(DATA_DIR, "webkitgtk-"WEBKITGTK_API_VERSION_STRING, NULL));
+#endif
+
+ cachedPath = dataPath.get();
+ return cachedPath;
+}
+
uint64_t getVolumeFreeSizeForPath(const char* path)
{
GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(path));
Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/ChangeLog (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/ChangeLog 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/ChangeLog 2012-02-20 08:40:40 UTC (rev 108219)
@@ -1,3 +1,16 @@
+2012-02-20 Paweł Forysiuk <[email protected]>
+ [GTK] Can't find webinspector and error page redirection on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=51616
+
+ Use an abstraction for finding shared resources on Windows.
+
+ Reviewed by Martin Robinson.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::dispatchDidFailLoad):
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::inspectorFilesPath):
+
2012-02-19 Gustavo Noronha Silva <[email protected]>
[GTK] Remove unused GSettings stuff
Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2012-02-20 08:40:40 UTC (rev 108219)
@@ -33,6 +33,7 @@
#include "DocumentLoader.h"
#include "DocumentLoaderGtk.h"
#include "ErrorsGtk.h"
+#include "FileSystem.h"
#include "FormState.h"
#include "FrameLoader.h"
#include "FrameNetworkingContextGtk.h"
@@ -1105,7 +1106,9 @@
String content;
gchar* fileContent = 0;
- gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL);
+ GOwnPtr<gchar> errorPath(g_build_filename(sharedResourcesPath().data(), "resources", "error.html", NULL));
+ gchar* errorURI = g_filename_to_uri(errorPath.get(), 0, 0);
+
GFile* errorFile = g_file_new_for_uri(errorURI);
g_free(errorURI);
Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp (108218 => 108219)
--- releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp 2012-02-20 08:40:15 UTC (rev 108218)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp 2012-02-20 08:40:40 UTC (rev 108219)
@@ -20,6 +20,7 @@
#include "config.h"
#include "InspectorClientGtk.h"
+#include "FileSystem.h"
#include "Frame.h"
#include "InspectorController.h"
#include "NotImplemented.h"
@@ -163,7 +164,7 @@
if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
m_inspectorFilesPath.set(g_strdup(environmentPath));
else
- m_inspectorFilesPath.set(g_build_filename(DATA_DIR, "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "webinspector", NULL));
+ m_inspectorFilesPath.set(g_build_filename(sharedResourcesPath().data(), "webinspector", NULL));
return m_inspectorFilesPath.get();
}