--- WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp Fri Sep 10 20:20:33 2010 +++ WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp Tue Jan 11 12:47:14 2011 @@ -71,6 +71,30 @@ #include #include +#ifdef _WIN32 +/* search for data relative to where we are installed */ +#include +#include + +static HMODULE GetThisDllHandle() +{ + MEMORY_BASIC_INFORMATION info; + size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)GetThisDllHandle, &info, sizeof(info)); + assert(len == sizeof(info)); + return len ? (HMODULE)info.AllocationBase : NULL; +} + +const gchar * +get_webkit_datadir(void) +{ + gchar *retval; + retval = g_build_filename (g_win32_get_package_installation_directory_of_module (GetThisDllHandle()), "/share", NULL); + return retval; +} +#undef DATA_DIR +#define DATA_DIR get_webkit_datadir () +#endif + using namespace WebCore; namespace WebKit { @@ -989,7 +1013,13 @@ String content; gchar* fileContent = 0; +#ifdef _WIN32 + gchar* errorPath = g_build_filename (DATA_DIR, "/webkit-1.0/resources/error.html", NULL); + gchar* errorURI = g_filename_to_uri(errorPath, NULL, NULL); + g_free(errorPath); +#else gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL); +#endif GFile* errorFile = g_file_new_for_uri(errorURI); g_free(errorURI); --- WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp Fri Sep 10 20:20:33 2010 +++ WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp Mon Jan 17 07:42:35 2011 @@ -27,6 +27,31 @@ #include "NotImplemented.h" #include "PlatformString.h" +#ifdef _WIN32 +/* search for data relative to where we are installed */ +# include +# include + +static HMODULE GetThisDllHandle() +{ + MEMORY_BASIC_INFORMATION info; + size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)GetThisDllHandle, &info, sizeof(info)); + assert(len == sizeof(info)); + return len ? (HMODULE)info.AllocationBase : NULL; +} + +const gchar * +get_webkit_path(void) +{ + gchar *retval; + retval = g_build_filename (g_win32_get_package_installation_directory_of_module (GetThisDllHandle()), "/share", NULL); + return retval; +} +#undef DATA_DIR +#define DATA_DIR get_webkit_path () +#endif + + using namespace WebCore; namespace WebKit { @@ -67,21 +92,30 @@ webkit_web_inspector_set_web_view(webInspector, inspectorWebView); GOwnPtr inspectorURI; - +#ifdef _WIN32 + gchar* inspectorPath = g_build_filename (DATA_DIR, "/webkit-1.0/webinspector/inspector.html", NULL); +#endif // Make the Web Inspector work when running tests if (g_file_test("WebCore/inspector/front-end/inspector.html", G_FILE_TEST_EXISTS)) { GOwnPtr currentDirectory(g_get_current_dir()); GOwnPtr fullPath(g_strdup_printf("%s/WebCore/inspector/front-end/inspector.html", currentDirectory.get())); inspectorURI.set(g_filename_to_uri(fullPath.get(), NULL, NULL)); } else +#ifdef _WIN32 + inspectorURI.set(g_filename_to_uri(inspectorPath, NULL, NULL)); +#else inspectorURI.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/inspector.html", NULL, NULL)); - +#endif webkit_web_view_load_uri(inspectorWebView, inspectorURI.get()); gtk_widget_show(GTK_WIDGET(inspectorWebView)); Page* inspectorPage = core(inspectorWebView); inspectorPage->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, inspectorPage)); + +#ifdef _WIN32 + g_free(inspectorPath); +#endif } void InspectorClient::highlight(Node* node) @@ -145,6 +179,10 @@ String InspectorFrontendClient::localizedStringsURL() { GOwnPtr URL; + +#ifdef _WIN32 + gchar* localizedPath = g_build_filename (DATA_DIR, "/webkit-1.0/webinspector/localizedStrings.js", NULL); +#endif // Make the Web Inspector work when running tests if (g_file_test("WebCore/English.lproj/localizedStrings.js", G_FILE_TEST_EXISTS)) { @@ -152,10 +190,16 @@ GOwnPtr fullPath(g_strdup_printf("%s/WebCore/English.lproj/localizedStrings.js", currentDirectory.get())); URL.set(g_filename_to_uri(fullPath.get(), NULL, NULL)); } else +#ifdef _WIN32 + URL.set(g_filename_to_uri(localizedPath, NULL, NULL)); +#else URL.set(g_filename_to_uri(DATA_DIR"/webkit-1.0/webinspector/localizedStrings.js", NULL, NULL)); - +#endif // FIXME: support l10n of localizedStrings.js return String::fromUTF8(URL.get()); +#ifdef _WIN32 + g_free(localizedPath); +#endif } String InspectorFrontendClient::hiddenPanels()