[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 12:14:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 59eb69d1f285c057cb5e6cabf59cca2c9b232f33
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 17 19:00:10 2010 +0000

    2010-08-17  Martin Robinson  <mrobinson at igalia.com>
    
            [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp
            https://bugs.webkit.org/show_bug.cgi?id=44069
    
            No new tests as functionality has not changed.
    
            * GNUmakefile.am: Add WEBKITGTK_API_VERSION_STRING definition, which
            allows WebCore to use this as well.
            * platform/graphics/gtk/ImageGtk.cpp:
            (getWebKitDataDirectory): Added this helper.
            (WebCore::Image::loadPlatformResource): Use GOwnPtr for gchar pointers and
            use the new getWebKitDataDirectory helper.
            * platform/gtk/GOwnPtrGtk.cpp: Move the GtkIconInfo template specialization to this file.
            (WTF::GtkIconInfo): Added this forward declaration.
            * platform/gtk/GOwnPtrGtk.h: Declaration for new template specialization.
    2010-08-17  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp
            https://bugs.webkit.org/show_bug.cgi?id=44069
    
            * WebCoreSupport/InspectorClientGtk.cpp:
            (WebKit::InspectorClient::openInspectorFrontend): Switched to using the new WEBKITGTK_API_VERSION_STRING define.
            * webkit/webkitprivate.cpp:
            (inspectorGSettings): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65529 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bc4ec6d..de84981 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-17  Martin Robinson  <mrobinson at igalia.com>
+
+        [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=44069
+
+        No new tests as functionality has not changed.
+
+        * GNUmakefile.am: Add WEBKITGTK_API_VERSION_STRING definition, which
+        allows WebCore to use this as well.
+        * platform/graphics/gtk/ImageGtk.cpp:
+        (getWebKitDataDirectory): Added this helper.
+        (WebCore::Image::loadPlatformResource): Use GOwnPtr for gchar pointers and
+        use the new getWebKitDataDirectory helper.
+        * platform/gtk/GOwnPtrGtk.cpp: Move the GtkIconInfo template specialization to this file.
+        (WTF::GtkIconInfo): Added this forward declaration.
+        * platform/gtk/GOwnPtrGtk.h: Declaration for new template specialization.
+
 2010-08-17  Stephen White  <senorblanco at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 700560c..729bee4 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -69,6 +69,7 @@ webcore_cppflags += \
 	-DDATA_DIR=\"${datadir}\"
 
 webcoregtk_cppflags += \
+	-DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \
 	-DWTF_USE_SOUP=1 \
 	-DWTF_USE_GSTREAMER=1 \
 	-I$(srcdir)/WebCore/accessibility/gtk \
@@ -4622,7 +4623,7 @@ dist_webinspectorimages_DATA = \
 	$(shell ls $(WebCore)/inspector/front-end/Images/*.gif) \
 	$(shell ls $(WebCore)/inspector/front-end/Images/*.png)
 
-webresourcesdir = ${datadir}/webkit- at WEBKITGTK_API_VERSION@/images
+webresourcesdir = ${datadir}/webkitgtk- at WEBKITGTK_API_VERSION@/images
 dist_webresources_DATA = \
 	$(WebCore)/Resources/textAreaResizeCorner.png \
 	$(WebCore)/Resources/nullPlugin.png \
diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp
index 30db6d7..5272243 100644
--- a/WebCore/platform/graphics/gtk/ImageGtk.cpp
+++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp
@@ -27,81 +27,60 @@
 
 #include "BitmapImage.h"
 #include "CairoUtilities.h"
-#include "GOwnPtr.h"
+#include "GOwnPtrGtk.h"
 #include "SharedBuffer.h"
 #include <wtf/text/CString.h>
 #include <cairo.h>
 #include <gtk/gtk.h>
 
-#ifdef _WIN32
-#  include <mbstring.h>
-#  include <shlobj.h>
-/* search for data relative to where we are installed */
+#if PLATFORM(WIN)
+#include <mbstring.h>
+#include <shlobj.h>
 
 static HMODULE hmodule;
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL,
-    DWORD     fdwReason,
-    LPVOID    lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
-    switch (fdwReason) {
-    case DLL_PROCESS_ATTACH:
+    if (fdwReason == DLL_PROCESS_ATTACH)
         hmodule = hinstDLL;
-        break;
-    }
-
     return TRUE;
 }
-#ifdef __cplusplus
 }
-#endif
 
-static char *
-get_webkit_datadir(void)
+static const char* getWebKitDataDirectory()
 {
-    static char retval[1000];
-    static int beenhere = 0;
-
-    unsigned char *p;
-
-    if (beenhere)
-        return retval;
+    static char* dataDirectory = 0;
+    if (dataDirectory)
+        return dataDirectory;
 
-    if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10))
+    dataDirectory = new char[PATH_MAX];
+    if (!GetModuleFileName(hmodule, static_cast<CHAR*>(dataDirectory), sizeof(dataDirectory) - 10))
         return DATA_DIR;
 
-    p = _mbsrchr((const unsigned char *) retval, '\\');
+    // 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((const unsigned char *) retval, '\\');
+    p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\');
     if (p) {
         if (!stricmp((const char *) (p+1), "bin"))
             *p = '\0';
     }
-    strcat(retval, "\\share");
-
-    beenhere = 1;
+    strcat(dataDirectory, "\\share");
 
-    return retval;
+    return dataDirectory;
 }
 
-#undef DATA_DIR
-#define DATA_DIR get_webkit_datadir ()
-#endif
-
+#else
 
-namespace WTF {
-
-template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info)
+static const char* getWebKitDataDirectory()
 {
-    if (info)
-        gtk_icon_info_free(info);
+    return DATA_DIR;
 }
 
-}
+#endif
 
 namespace WebCore {
 
@@ -158,11 +137,9 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
     if (!strcmp("missingImage", name))
         fileName = getThemeIconFileName(GTK_STOCK_MISSING_IMAGE, 16);
     if (fileName.isNull()) {
-        gchar* imagename = g_strdup_printf("%s.png", name);
-        gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, NULL);
-        fileName = glibFileName;
-        g_free(imagename);
-        g_free(glibFileName);
+        GOwnPtr<gchar> imageName(g_strdup_printf("%s.png", name));
+        GOwnPtr<gchar> glibFileName(g_build_filename(getWebKitDataDirectory(), "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "images", imageName.get(), NULL));
+        fileName = glibFileName.get();
     }
 
     return loadImageFromFile(fileName);
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
index 0558f33..9b693f4 100644
--- a/WebCore/platform/gtk/GOwnPtrGtk.cpp
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -19,8 +19,7 @@
 #include "config.h"
 #include "GOwnPtrGtk.h"
 
-#include <gdk/gdk.h>
-#include <glib.h>
+#include <gtk/gtk.h>
 
 namespace WTF {
 
@@ -30,4 +29,10 @@ template <> void freeOwnedGPtr<GdkEvent>(GdkEvent* ptr)
         gdk_event_free(ptr);
 }
 
+template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info)
+{
+    if (info)
+        gtk_icon_info_free(info);
+}
+
 }
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h
index 674ea58..8341661 100644
--- a/WebCore/platform/gtk/GOwnPtrGtk.h
+++ b/WebCore/platform/gtk/GOwnPtrGtk.h
@@ -23,10 +23,12 @@
 #include "GOwnPtr.h"
 
 typedef union _GdkEvent GdkEvent;
+typedef struct _GtkIconInfo GtkIconInfo;
 
 namespace WTF {
 
-template<> void freeOwnedGPtr<GdkEvent>(GdkEvent*);
+template <> void freeOwnedGPtr<GdkEvent>(GdkEvent*);
+template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo*);
 
 }
 
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index b600da5..316d95f 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-17  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=44069
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorClient::openInspectorFrontend): Switched to using the new WEBKITGTK_API_VERSION_STRING define.
+        * webkit/webkitprivate.cpp:
+        (inspectorGSettings): Ditto.
+
 2010-08-17  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r65500.
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index 691a915..67dc158 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -87,8 +87,7 @@ void InspectorClient::openInspectorFrontend(InspectorController* controller)
         GOwnPtr<gchar> fullPath(g_strdup_printf("%s/WebCore/inspector/front-end/inspector.html", currentDirectory.get()));
         inspectorURI.set(g_filename_to_uri(fullPath.get(), NULL, NULL));
     } else {
-        GOwnPtr<gchar> dataPath(g_strdup_printf(DATA_DIR"/webkitgtk-%.1f/webinspector/inspector.html", WEBKITGTK_API_VERSION));
-        inspectorURI.set(g_filename_to_uri(dataPath.get(), NULL, NULL));
+        inspectorURI.set(g_filename_to_uri(DATA_DIR"/webkitgtk-"WEBKITGTK_API_VERSION_STRING"/webinspector/inspector.html", NULL, NULL));
     }
 
     webkit_web_view_load_uri(inspectorWebView, inspectorURI.get());
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index 856a259..027c4ce 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -237,18 +237,18 @@ GSettings* inspectorGSettings()
     if (settings)
         return settings;
 
-    GOwnPtr<gchar> schemaID(g_strdup_printf("org.webkitgtk-%.1f.inspector", WEBKITGTK_API_VERSION));
+    const gchar* schemaID = "org.webkitgtk-"WEBKITGTK_API_VERSION_STRING".inspector"
 
     // Unfortunately GSettings will abort the process execution if the
     // schema is not installed, which is the case for when running
     // tests, or even the introspection dump at build time, so check
     // if we have the schema before trying to initialize it.
-    if (!isSchemaAvailable(schemaID.get())) {
+    if (!isSchemaAvailable(schemaID)) {
         g_warning("GSettings schema not found - settings will not be used or saved.");
         return 0;
     }
 
-    settings = g_settings_new(schemaID.get());
+    settings = g_settings_new(schemaID);
 
     return settings;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list