From 67484bc1c6f9f304eba89d3b531eabdf8eb70732 Mon Sep 17 00:00:00 2001 From: "carlosgc@webkit.org" Date: Wed, 28 Sep 2011 16:20:57 +0000 Subject: [PATCH] [GTK] Add WebKitError to GTK+ WebKit2 API https://bugs.webkit.org/show_bug.cgi?id=68508 Reviewed by Martin Robinson. Source/WebKit2: Add WebKitNetworkError enum to define network errors. * GNUmakefile.am: Add new files to compilation. * UIProcess/API/gtk/WebKitError.cpp: Added. (webkit_network_error_quark): * UIProcess/API/gtk/WebKitError.h: * UIProcess/API/gtk/WebKitPrivate.h: Add COMPILE_ASSERT_MATCHING_ENUM macro. * UIProcess/API/gtk/webkit2.h: Add WebKitError.h and WebKitEnumTypes.h Tools: * GNUmakefile.am: Add path to webkitgtk derived sources to the include path. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96225 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 18 ++++++ Source/WebKit2/GNUmakefile.am | 71 ++++++++++++++++++++++-- Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp | 36 ++++++++++++ Source/WebKit2/UIProcess/API/gtk/WebKitError.h | 44 +++++++++++++++ Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h | 4 ++ Source/WebKit2/UIProcess/API/gtk/webkit2.h | 2 + Tools/ChangeLog | 10 ++++ Tools/GNUmakefile.am | 3 +- 8 files changed, 181 insertions(+), 7 deletions(-) create mode 100644 Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp create mode 100644 Source/WebKit2/UIProcess/API/gtk/WebKitError.h diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index e5a5e33..ffb8984 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,5 +1,23 @@ 2011-09-28 Carlos Garcia Campos + [GTK] Add WebKitError to GTK+ WebKit2 API + https://bugs.webkit.org/show_bug.cgi?id=68508 + + Reviewed by Martin Robinson. + + Add WebKitNetworkError enum to define network errors. + + * GNUmakefile.am: Add new files to compilation. + * UIProcess/API/gtk/WebKitError.cpp: Added. + (webkit_network_error_quark): + * UIProcess/API/gtk/WebKitError.h: + * UIProcess/API/gtk/WebKitPrivate.h: Add + COMPILE_ASSERT_MATCHING_ENUM macro. + * UIProcess/API/gtk/webkit2.h: Add WebKitError.h and + WebKitEnumTypes.h + +2011-09-28 Carlos Garcia Campos + [GTK] Fix Programs/unittests/webkit2/testwebview https://bugs.webkit.org/show_bug.cgi?id=68993 diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index 8ab2277..8cc7f60 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -68,7 +68,8 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_HEA $(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h libwebkit2gtkincludedir = $(libwebkitgtkincludedir)/webkit2 -libwebkit2gtkinclude_HEADERS = \ +webkit2gtk_headers = \ + $(WebKit2)/UIProcess/API/gtk/WebKitError.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \ $(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \ @@ -453,6 +454,8 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \ Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h \ Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitError.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \ Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h \ Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp \ @@ -857,7 +860,8 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_CPP -I$(srcdir)/Source/WebKit2/WebProcess/WebPage/gtk \ -I$(top_builddir)/DerivedSources/WebKit2 \ -I$(top_builddir)/DerivedSources/WebKit2/include \ - -I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \ -I$(top_builddir)/DerivedSources/WebKit2/include/JavaScriptCore \ -I$(top_builddir)/DerivedSources/WebKit2/include/WebCore \ -I$(top_builddir)/DerivedSources/WebKit2/include/WebKit2 \ @@ -936,11 +940,11 @@ generate-webkit2-forwarding-headers: $(WebKit2)/Scripts/generate-forwarding-head BUILT_SOURCES += generate-webkit2-forwarding-headers -$(GENSOURCES_WEBKIT2)/include/webkit2gtk/webkit2: $(libwebkit2gtkinclude_HEADERS) - $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/include/webkit2gtk \ +$(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2: $(webkit2gtk_headers) + $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/include \ && ln -s -f ${shell pwd}/$(WebKit2)/UIProcess/API/gtk $@ -BUILT_SOURCES += $(GENSOURCES_WEBKIT2)/include/webkit2gtk/webkit2 +BUILT_SOURCES += $(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2 vpath %.messages.in = \ $(WebKit2)/PluginProcess \ @@ -980,8 +984,62 @@ DerivedSources/WebKit2/%MessageReceiver.cpp: %.messages.in $(message_gen_scripts DerivedSources/WebKit2/%Messages.h: %.messages.in $(message_gen_scripts) $(AM_V_GEN)$(PYTHON) $(WebKit2)/Scripts/generate-messages-header.py $< > $@ +webkit2gtk_built_headers_dir := $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 +$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h: stamp-webkit2enumtypes + @true + +stamp-webkit2enumtypes: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am + $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \ + && glib-mkenums \ + --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \ + --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \ + --fhead "#include \n\n" \ + --fhead "#include \n\n" \ + --fhead "G_BEGIN_DECLS\n\n" \ + --ftail "G_END_DECLS\n\n" \ + --ftail "#endif\n" \ + --fprod "#include \n\n" \ + --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \ + --eprod "WK_EXPORT GType\n@enum_name@_get_type(void);\n\n" \ + $(webkit2gtk_headers) | \ + sed 's,web_kit,webkit,' | \ + sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \ + > xgen-gth \ + && (cmp -s xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h || cp xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h) \ + && rm -f xgen-gth \ + && echo timestamp > $(@F) + +$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am + $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \ + && glib-mkenums \ + --fhead "#include \n" \ + --fhead "#include \n" \ + --fhead "#include \"$(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h\"\n\n" \ + --fhead "extern \"C\" {\n\n" \ + --fprod "\n/* Enumerations from \"@filename@\". */" \ + --vhead "static const G@Type@Value _@enum_name@_values[] = {" \ + --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ + --vtail " { 0, NULL, NULL }\n};\n\n" \ + --vtail "GType @enum_name@_get_type(void)\n{\n" \ + --vtail " static GType type = 0;\n\n" \ + --vtail " if (!type)\n" \ + --vtail " type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \ + --vtail " return type;\n}\n\n" \ + --ftail "}\n" \ + $(webkit2gtk_headers) | \ + sed 's,web_kit,webkit,' \ + > xgen-gtc \ + && cp xgen-gtc $@ \ + && rm -f xgen-gtc + + +BUILT_SOURCES += \ + $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp \ + $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h + CLEANFILES += \ $(BUILT_SOURCES) \ + $(top_builddir)/stamp-webkit2enumtypes \ $(top_builddir)/Programs/WebKitWebProcess DISTCLEANFILES += \ @@ -998,7 +1056,8 @@ webkit2_tests_cflags = \ -I$(srcdir)/Source \ -I$(srcdir)/Source/WebKit2 \ -I$(top_builddir)/DerivedSources/WebKit2/include \ - -I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \ -I$(srcdir)/Source/WebKit2/UIProcess/API/gtk \ $(global_cflags) \ $(global_cppflags) \ diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp new file mode 100644 index 0000000..9bd938d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2011 Igalia S.L. + * Copyright (C) 2008 Luca Bruno + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebKitError.h" + +#include "WebKitPrivate.h" +#include + +GQuark webkit_network_error_quark(void) +{ + return g_quark_from_static_string(WebCore::errorDomainNetwork); +} + +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FAILED, NetworkErrorFailed); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_TRANSPORT, NetworkErrorTransport); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL, NetworkErrorUnknownProtocol); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_CANCELLED, NetworkErrorCancelled); +COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST, NetworkErrorFileDoesNotExist); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitError.h b/Source/WebKit2/UIProcess/API/gtk/WebKitError.h new file mode 100644 index 0000000..d7815d1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitError.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011 Igalia S.L. + * Copyright (C) 2008 Luca Bruno + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitError_h +#define WebKitError_h + +#include +#include + +G_BEGIN_DECLS + +#define WEBKIT_NETWORK_ERROR webkit_network_error_quark () + +typedef enum { + WEBKIT_NETWORK_ERROR_FAILED = 399, + WEBKIT_NETWORK_ERROR_TRANSPORT = 300, + WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL = 301, + WEBKIT_NETWORK_ERROR_CANCELLED = 302, + WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST = 303 +} WebKitNetworkError; + +WK_EXPORT GQuark +webkit_network_error_quark (void); + +G_END_DECLS + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h index a102e61..423c464 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h @@ -27,6 +27,7 @@ #define WebKitPrivate_h #include +#include G_BEGIN_DECLS @@ -34,6 +35,9 @@ G_BEGIN_DECLS #define WEBKIT_PARAM_WRITABLE (static_cast(G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) #define WEBKIT_PARAM_READWRITE (static_cast(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) +#define COMPILE_ASSERT_MATCHING_ENUM(webkitName, webcoreName) \ + COMPILE_ASSERT(int(webkitName) == int(WebCore::webcoreName), mismatchingEnums) + G_END_DECLS #endif // WebKitPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index 7e1c48c..ef93adc 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -20,6 +20,8 @@ #ifndef __WEBKIT2_H__ #define __WEBKIT2_H__ +#include +#include #include #include #include diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 845ac4e..b6ea07f 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,13 @@ +2011-09-28 Carlos Garcia Campos + + [GTK] Add WebKitError to GTK+ WebKit2 API + https://bugs.webkit.org/show_bug.cgi?id=68508 + + Reviewed by Martin Robinson. + + * GNUmakefile.am: Add path to webkitgtk derived sources to the + include path. + 2011-09-28 Philippe Normand [GTK] missing WebKit2 support in run-gtk-tests diff --git a/Tools/GNUmakefile.am b/Tools/GNUmakefile.am index 56c1853..af1e69d 100644 --- a/Tools/GNUmakefile.am +++ b/Tools/GNUmakefile.am @@ -57,7 +57,8 @@ Programs_GtkLauncher2_CPPFLAGS = \ -I$(srcdir)/Source/WebKit2/UIProcess/API/gtk \ -I$(top_builddir)/Source/WebKit2/UIProcess/API/gtk \ -I$(srcdir)/Source/WebKit/gtk \ - -I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \ + -I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \ -I$(top_builddir)/Source/WebKit/gtk \ -I$(top_builddir)/DerivedSources \ $(global_cppflags) \ -- 2.7.4