Changeset 65529 in webkit
- Timestamp:
- Aug 17, 2010 12:00:10 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65528 r65529 1 2010-08-17 Martin Robinson <mrobinson@igalia.com> 2 3 [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=44069 5 6 No new tests as functionality has not changed. 7 8 * GNUmakefile.am: Add WEBKITGTK_API_VERSION_STRING definition, which 9 allows WebCore to use this as well. 10 * platform/graphics/gtk/ImageGtk.cpp: 11 (getWebKitDataDirectory): Added this helper. 12 (WebCore::Image::loadPlatformResource): Use GOwnPtr for gchar pointers and 13 use the new getWebKitDataDirectory helper. 14 * platform/gtk/GOwnPtrGtk.cpp: Move the GtkIconInfo template specialization to this file. 15 (WTF::GtkIconInfo): Added this forward declaration. 16 * platform/gtk/GOwnPtrGtk.h: Declaration for new template specialization. 17 1 18 2010-08-17 Stephen White <senorblanco@chromium.org> 2 19 -
trunk/WebCore/GNUmakefile.am
r65526 r65529 70 70 71 71 webcoregtk_cppflags += \ 72 -DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \ 72 73 -DWTF_USE_SOUP=1 \ 73 74 -DWTF_USE_GSTREAMER=1 \ … … 4623 4624 $(shell ls $(WebCore)/inspector/front-end/Images/*.png) 4624 4625 4625 webresourcesdir = ${datadir}/webkit -@WEBKITGTK_API_VERSION@/images4626 webresourcesdir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/images 4626 4627 dist_webresources_DATA = \ 4627 4628 $(WebCore)/Resources/textAreaResizeCorner.png \ -
trunk/WebCore/platform/graphics/gtk/ImageGtk.cpp
r64506 r65529 28 28 #include "BitmapImage.h" 29 29 #include "CairoUtilities.h" 30 #include "GOwnPtr .h"30 #include "GOwnPtrGtk.h" 31 31 #include "SharedBuffer.h" 32 32 #include <wtf/text/CString.h> … … 34 34 #include <gtk/gtk.h> 35 35 36 #ifdef _WIN32 37 # include <mbstring.h> 38 # include <shlobj.h> 39 /* search for data relative to where we are installed */ 36 #if PLATFORM(WIN) 37 #include <mbstring.h> 38 #include <shlobj.h> 40 39 41 40 static HMODULE hmodule; 42 41 43 #ifdef __cplusplus44 42 extern "C" { 45 #endif 46 BOOL WINAPI 47 DllMain(HINSTANCE hinstDLL, 48 DWORD fdwReason, 49 LPVOID lpvReserved) 43 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 50 44 { 51 switch (fdwReason) { 52 case DLL_PROCESS_ATTACH: 45 if (fdwReason == DLL_PROCESS_ATTACH) 53 46 hmodule = hinstDLL; 54 break;55 }56 57 47 return TRUE; 58 48 } 59 #ifdef __cplusplus60 49 } 61 #endif62 50 63 static char * 64 get_webkit_datadir(void) 51 static const char* getWebKitDataDirectory() 65 52 { 66 static char retval[1000]; 67 static int beenhere = 0; 53 static char* dataDirectory = 0; 54 if (dataDirectory) 55 return dataDirectory; 68 56 69 unsigned char *p; 70 71 if (beenhere) 72 return retval; 73 74 if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10)) 57 dataDirectory = new char[PATH_MAX]; 58 if (!GetModuleFileName(hmodule, static_cast<CHAR*>(dataDirectory), sizeof(dataDirectory) - 10)) 75 59 return DATA_DIR; 76 60 77 p = _mbsrchr((const unsigned char *) retval, '\\'); 61 // FIXME: This is pretty ugly. Ideally we should be using Windows API 62 // functions or GLib methods to calculate paths. 63 unsigned char *p; 64 p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\'); 78 65 *p = '\0'; 79 p = _mbsrchr( (const unsigned char *) retval, '\\');66 p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\'); 80 67 if (p) { 81 68 if (!stricmp((const char *) (p+1), "bin")) 82 69 *p = '\0'; 83 70 } 84 strcat( retval, "\\share");71 strcat(dataDirectory, "\\share"); 85 72 86 beenhere = 1; 87 88 return retval; 73 return dataDirectory; 89 74 } 90 75 91 #undef DATA_DIR 92 #define DATA_DIR get_webkit_datadir () 93 #endif 76 #else 94 77 95 96 namespace WTF { 97 98 template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info) 78 static const char* getWebKitDataDirectory() 99 79 { 100 if (info) 101 gtk_icon_info_free(info); 80 return DATA_DIR; 102 81 } 103 82 104 } 83 #endif 105 84 106 85 namespace WebCore { … … 159 138 fileName = getThemeIconFileName(GTK_STOCK_MISSING_IMAGE, 16); 160 139 if (fileName.isNull()) { 161 gchar* imagename = g_strdup_printf("%s.png", name); 162 gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, NULL); 163 fileName = glibFileName; 164 g_free(imagename); 165 g_free(glibFileName); 140 GOwnPtr<gchar> imageName(g_strdup_printf("%s.png", name)); 141 GOwnPtr<gchar> glibFileName(g_build_filename(getWebKitDataDirectory(), "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "images", imageName.get(), NULL)); 142 fileName = glibFileName.get(); 166 143 } 167 144 -
trunk/WebCore/platform/gtk/GOwnPtrGtk.cpp
r60482 r65529 20 20 #include "GOwnPtrGtk.h" 21 21 22 #include <gdk/gdk.h> 23 #include <glib.h> 22 #include <gtk/gtk.h> 24 23 25 24 namespace WTF { … … 31 30 } 32 31 32 template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info) 33 { 34 if (info) 35 gtk_icon_info_free(info); 33 36 } 37 38 } -
trunk/WebCore/platform/gtk/GOwnPtrGtk.h
r60482 r65529 24 24 25 25 typedef union _GdkEvent GdkEvent; 26 typedef struct _GtkIconInfo GtkIconInfo; 26 27 27 28 namespace WTF { 28 29 29 template<> void freeOwnedGPtr<GdkEvent>(GdkEvent*); 30 template <> void freeOwnedGPtr<GdkEvent>(GdkEvent*); 31 template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo*); 30 32 31 33 } -
trunk/WebKit/gtk/ChangeLog
r65501 r65529 1 2010-08-17 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Gustavo Noronha Silva. 4 5 [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp 6 https://bugs.webkit.org/show_bug.cgi?id=44069 7 8 * WebCoreSupport/InspectorClientGtk.cpp: 9 (WebKit::InspectorClient::openInspectorFrontend): Switched to using the new WEBKITGTK_API_VERSION_STRING define. 10 * webkit/webkitprivate.cpp: 11 (inspectorGSettings): Ditto. 12 1 13 2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
r65501 r65529 88 88 inspectorURI.set(g_filename_to_uri(fullPath.get(), NULL, NULL)); 89 89 } else { 90 GOwnPtr<gchar> dataPath(g_strdup_printf(DATA_DIR"/webkitgtk-%.1f/webinspector/inspector.html", WEBKITGTK_API_VERSION)); 91 inspectorURI.set(g_filename_to_uri(dataPath.get(), NULL, NULL)); 90 inspectorURI.set(g_filename_to_uri(DATA_DIR"/webkitgtk-"WEBKITGTK_API_VERSION_STRING"/webinspector/inspector.html", NULL, NULL)); 92 91 } 93 92 -
trunk/WebKit/gtk/webkit/webkitprivate.cpp
r65498 r65529 238 238 return settings; 239 239 240 GOwnPtr<gchar> schemaID(g_strdup_printf("org.webkitgtk-%.1f.inspector", WEBKITGTK_API_VERSION));240 const gchar* schemaID = "org.webkitgtk-"WEBKITGTK_API_VERSION_STRING".inspector" 241 241 242 242 // Unfortunately GSettings will abort the process execution if the … … 244 244 // tests, or even the introspection dump at build time, so check 245 245 // if we have the schema before trying to initialize it. 246 if (!isSchemaAvailable(schemaID .get())) {246 if (!isSchemaAvailable(schemaID)) { 247 247 g_warning("GSettings schema not found - settings will not be used or saved."); 248 248 return 0; 249 249 } 250 250 251 settings = g_settings_new(schemaID .get());251 settings = g_settings_new(schemaID); 252 252 253 253 return settings;
Note: See TracChangeset
for help on using the changeset viewer.