diff options
Diffstat (limited to 'WebKit/gtk/webkit')
37 files changed, 629 insertions, 496 deletions
diff --git a/WebKit/gtk/webkit/webkit.h b/WebKit/gtk/webkit/webkit.h index c0d0e31..d93fae1 100644 --- a/WebKit/gtk/webkit/webkit.h +++ b/WebKit/gtk/webkit/webkit.h @@ -26,6 +26,7 @@ #include <webkit/webkitdom.h> #include <webkit/webkitdownload.h> #include <webkit/webkitgeolocationpolicydecision.h> +#include <webkit/webkitglobals.h> #include <webkit/webkithittestresult.h> #include <webkit/webkitnetworkrequest.h> #include <webkit/webkitnetworkresponse.h> diff --git a/WebKit/gtk/webkit/webkitapplicationcache.cpp b/WebKit/gtk/webkit/webkitapplicationcache.cpp index e967d34..87f3ab5 100644 --- a/WebKit/gtk/webkit/webkitapplicationcache.cpp +++ b/WebKit/gtk/webkit/webkitapplicationcache.cpp @@ -18,15 +18,14 @@ */ #include "config.h" -#include "webkitprivate.h" - -#include <wtf/UnusedParam.h> #include "ApplicationCacheStorage.h" +#include "webkitapplicationcacheprivate.h" +#include <wtf/UnusedParam.h> void webkit_application_cache_set_maximum_size(unsigned long long size) { -#if ENABLE(OFFLINE_WEB_APPLICATIONS) +#if ENABLE(OFFLINE_WEB_APPLICATIONS) WebCore::cacheStorage().empty(); WebCore::cacheStorage().vacuumDatabaseFile(); WebCore::cacheStorage().setMaximumSize(size); diff --git a/WebKit/gtk/webkit/webkitapplicationcacheprivate.h b/WebKit/gtk/webkit/webkitapplicationcacheprivate.h new file mode 100644 index 0000000..cbf3759 --- /dev/null +++ b/WebKit/gtk/webkit/webkitapplicationcacheprivate.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitapplicationcacheprivate_h +#define webkitapplicationcacheprivate_h + +#include "webkitdefines.h" +#include <glib.h> + +extern "C" { + +WEBKIT_API void webkit_application_cache_set_maximum_size(unsigned long long size); + +} + +#endif diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp index 6be591c..60b8e6d 100644 --- a/WebKit/gtk/webkit/webkitdownload.cpp +++ b/WebKit/gtk/webkit/webkitdownload.cpp @@ -19,8 +19,8 @@ */ #include "config.h" +#include "webkitdownload.h" -#include <glib/gi18n-lib.h> #include "GRefPtr.h" #include "Noncopyable.h" #include "NotImplemented.h" @@ -28,17 +28,17 @@ #include "ResourceHandleInternal.h" #include "ResourceRequest.h" #include "ResourceResponse.h" -#include "webkitdownload.h" #include "webkitdownloadprivate.h" #include "webkitenumtypes.h" +#include "webkitglobals.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" #include "webkitnetworkrequestprivate.h" #include "webkitnetworkresponse.h" #include "webkitnetworkresponseprivate.h" -#include "webkitprivate.h" -#include <wtf/text/CString.h> - +#include <glib/gi18n-lib.h> #include <glib/gstdio.h> +#include <wtf/text/CString.h> #ifdef ERROR #undef ERROR @@ -230,7 +230,7 @@ static void webkit_download_class_init(WebKitDownloadClass* downloadClass) objectClass->get_property = webkit_download_get_property; objectClass->set_property = webkit_download_set_property; - webkit_init(); + webkitInit(); /** * WebKitDownload::error: @@ -907,7 +907,7 @@ static void webkit_download_error(WebKitDownload* download, const ResourceError& webkit_download_close_stream(download); WebKitDownloadPrivate* priv = download->priv; - PlatformRefPtr<WebKitDownload> protect(download); + GRefPtr<WebKitDownload> protect(download); g_timer_stop(priv->timer); webkit_download_set_status(download, WEBKIT_DOWNLOAD_STATUS_ERROR); diff --git a/WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp b/WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp index cb023d6..2523c9b 100644 --- a/WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp +++ b/WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp @@ -20,10 +20,9 @@ #include "config.h" #include "webkitgeolocationpolicydecision.h" -#include "webkitprivate.h" #include "Geolocation.h" +#include "webkitgeolocationpolicydecisionprivate.h" -using namespace WebKit; using namespace WebCore; /** diff --git a/WebKit/gtk/webkit/webkitgeolocationpolicydecisionprivate.h b/WebKit/gtk/webkit/webkitgeolocationpolicydecisionprivate.h new file mode 100644 index 0000000..d250044 --- /dev/null +++ b/WebKit/gtk/webkit/webkitgeolocationpolicydecisionprivate.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitgeolocationpolicydecisionprivate_h +#define webkitgeolocationpolicydecisionprivate_h + +#include "webkitgeolocationpolicydecision.h" + +extern "C" { + +WebKitGeolocationPolicyDecision* webkit_geolocation_policy_decision_new(WebKitWebFrame*, WebCore::Geolocation*); + +} + +#endif diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitglobals.cpp index 4652031..6b57533 100644 --- a/WebKit/gtk/webkit/webkitprivate.cpp +++ b/WebKit/gtk/webkit/webkitglobals.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Holger Hans Peter Freyther - * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2008, 2010 Collabora Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -19,63 +19,170 @@ */ #include "config.h" -#include "webkitprivate.h" +#include "webkitglobals.h" #include "ApplicationCacheStorage.h" #include "Chrome.h" -#include "ChromeClientGtk.h" -#include "Element.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameLoaderClientGtk.h" #include "FrameNetworkingContextGtk.h" -#include "GtkVersioning.h" -#include "HTMLMediaElement.h" -#include "HTMLNames.h" -#include "HitTestResult.h" +#include "GOwnPtr.h" #include "IconDatabase.h" #include "Logging.h" +#include "MemoryCache.h" +#include "Page.h" #include "PageCache.h" #include "PageGroup.h" +#include "TextEncodingRegistry.h" #include "Pasteboard.h" #include "PasteboardHelperGtk.h" #include "ResourceHandle.h" #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include "ResourceResponse.h" -#include "TextEncodingRegistry.h" -#include "webkitnetworkresponse.h" +#include "webkitglobalsprivate.h" #include "webkitsoupauthdialog.h" -#include "webkitversion.h" +#include "webkitwebdatabase.h" +#include "webkitwebplugindatabaseprivate.h" #include <libintl.h> #include <runtime/InitializeThreading.h> #include <stdlib.h> #include <wtf/Threading.h> -#if ENABLE(VIDEO) -#include "FullscreenVideoController.h" -#endif - -#if ENABLE(DATABASE) -#include "DatabaseTracker.h" -#endif +static WebKitCacheModel cacheModel = WEBKIT_CACHE_MODEL_DEFAULT; using namespace WebCore; -namespace WebKit { +/** + * SECTION:webkit + * @short_description: Global functions controlling WebKit + * + * WebKit manages many resources which are not related to specific + * views. These functions relate to cross-view limits, such as cache + * sizes, database quotas, and the HTTP session management. + */ -WebCore::EditingBehaviorType core(WebKitEditingBehavior type) +/** + * webkit_get_default_session: + * + * Retrieves the default #SoupSession used by all web views. + * Note that the session features are added by WebKit on demand, + * so if you insert your own #SoupCookieJar before any network + * traffic occurs, WebKit will use it instead of the default. + * + * Return value: (transfer none): the default #SoupSession + * + * Since: 1.1.1 + */ +SoupSession* webkit_get_default_session () { - return (WebCore::EditingBehaviorType)type; + webkitInit(); + return ResourceHandle::defaultSession(); } -PasteboardHelperGtk* pasteboardHelperInstance() +/** + * webkit_set_cache_model: + * @cache_model: a #WebKitCacheModel + * + * Specifies a usage model for WebViews, which WebKit will use to + * determine its caching behavior. All web views follow the cache + * model. This cache model determines the RAM and disk space to use + * for caching previously viewed content . + * + * Research indicates that users tend to browse within clusters of + * documents that hold resources in common, and to revisit previously + * visited documents. WebKit and the frameworks below it include + * built-in caches that take advantage of these patterns, + * substantially improving document load speed in browsing + * situations. The WebKit cache model controls the behaviors of all of + * these caches, including various WebCore caches. + * + * Browsers can improve document load speed substantially by + * specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a + * browsing interface can reduce memory usage substantially by + * specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is + * WEBKIT_CACHE_MODEL_WEB_BROWSER. + * + * Since: 1.1.18 + */ +void webkit_set_cache_model(WebKitCacheModel model) { - static PasteboardHelperGtk* helper = new PasteboardHelperGtk(); - return helper; + webkitInit(); + + if (cacheModel == model) + return; + + // FIXME: Add disk cache handling when soup has the API + guint cacheTotalCapacity; + guint cacheMinDeadCapacity; + guint cacheMaxDeadCapacity; + gdouble deadDecodedDataDeletionInterval; + guint pageCacheCapacity; + + switch (model) { + case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: + pageCacheCapacity = 0; + cacheTotalCapacity = 0; + cacheMinDeadCapacity = 0; + cacheMaxDeadCapacity = 0; + deadDecodedDataDeletionInterval = 0; + break; + case WEBKIT_CACHE_MODEL_WEB_BROWSER: + // Page cache capacity (in pages). Comment from Mac port: + // (Research indicates that value / page drops substantially after 3 pages.) + pageCacheCapacity = 3; + cacheTotalCapacity = 32 * 1024 * 1024; + cacheMinDeadCapacity = cacheTotalCapacity / 4; + cacheMaxDeadCapacity = cacheTotalCapacity / 2; + deadDecodedDataDeletionInterval = 60; + break; + default: + g_return_if_reached(); + } + + cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); + cache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); + pageCache()->setCapacity(pageCacheCapacity); + cacheModel = model; +} + +/** + * webkit_get_cache_model: + * + * Returns the current cache model. For more information about this + * value check the documentation of the function + * webkit_set_cache_model(). + * + * Return value: the current #WebKitCacheModel + * + * Since: 1.1.18 + */ +WebKitCacheModel webkit_get_cache_model() +{ + webkitInit(); + return cacheModel; +} + +/** + * webkit_get_web_plugin_database: + * + * Returns the current #WebKitWebPluginDatabase with information about + * all the plugins WebKit knows about in this instance. + * + * Return value: (transfer none): the current #WebKitWebPluginDatabase + * + * Since: 1.3.8 + */ +WebKitWebPluginDatabase* webkit_get_web_plugin_database() +{ + static WebKitWebPluginDatabase* database = 0; + + webkitInit(); + + if (!database) + database = webkit_web_plugin_database_new(); + + return database; } -} /** end namespace WebKit */ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData) { @@ -110,7 +217,7 @@ static void closeIconDatabaseOnExit() iconDatabase()->close(); } -void webkit_init() +void webkitInit() { static bool isInitialized = false; if (isInitialized) @@ -129,14 +236,14 @@ void webkit_init() // that may only be done by the main thread. atomicCanonicalTextEncodingName("UTF-8"); -#if ENABLE(DATABASE) gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL); webkit_set_web_database_directory_path(databaseDirectory); +#if ENABLE(OFFLINE_WEB_APPLICATIONS) // FIXME: It should be possible for client applications to override the default appcache location WebCore::cacheStorage().setCacheDirectory(databaseDirectory); - g_free(databaseDirectory); #endif + g_free(databaseDirectory); PageGroup::setShouldTrackVisitedLinks(true); @@ -162,3 +269,14 @@ void webkit_init() soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_DECODER); } + +namespace WebKit { + +PasteboardHelperGtk* pasteboardHelperInstance() +{ + static PasteboardHelperGtk* helper = new PasteboardHelperGtk(); + return helper; +} + +} /** end namespace WebKit */ + diff --git a/WebKit/gtk/webkit/webkitglobals.h b/WebKit/gtk/webkit/webkitglobals.h new file mode 100644 index 0000000..6d144fc --- /dev/null +++ b/WebKit/gtk/webkit/webkitglobals.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitglobals_h +#define webkitglobals_h + +#include "webkitdefines.h" +#include <glib.h> +#include <libsoup/soup.h> + +G_BEGIN_DECLS + +/* + * WebKitCacheModel: + * @WEBKIT_CACHE_MODEL_DEFAULT: The default cache model. This is + * WEBKIT_CACHE_MODEL_WEB_BROWSER. + * @WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: Disable the cache completely, which + * substantially reduces memory usage. Useful for applications that only + * access local files. + * @WEBKIT_CACHE_MODEL_WEB_BROWSER: Improve document load speed substantially + * by caching previously viewed content. + * + * Enum values used for determining the webview cache model. + */ +typedef enum { + WEBKIT_CACHE_MODEL_DEFAULT, + WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, + WEBKIT_CACHE_MODEL_WEB_BROWSER +} WebKitCacheModel; + +WEBKIT_API SoupSession* +webkit_get_default_session (void); + +WEBKIT_API WebKitWebPluginDatabase * +webkit_get_web_plugin_database (void); + +WEBKIT_API void +webkit_set_cache_model (WebKitCacheModel cache_model); + +WEBKIT_API WebKitCacheModel +webkit_get_cache_model (void); + +G_END_DECLS + +#endif diff --git a/WebKit/gtk/webkit/webkitglobalsprivate.h b/WebKit/gtk/webkit/webkitglobalsprivate.h new file mode 100644 index 0000000..5923f2e --- /dev/null +++ b/WebKit/gtk/webkit/webkitglobalsprivate.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitglobalsprivate_h +#define webkitglobalsprivate_h + +#include <glib.h> + +#define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) +#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) + +namespace WebKit { + +class PasteboardHelperGtk; +PasteboardHelperGtk* pasteboardHelperInstance(); + +} + +extern "C" { + +void webkitInit(); + +} + +#endif diff --git a/WebKit/gtk/webkit/webkithittestresult.cpp b/WebKit/gtk/webkit/webkithittestresult.cpp index fa0b40b..9632493 100644 --- a/WebKit/gtk/webkit/webkithittestresult.cpp +++ b/WebKit/gtk/webkit/webkithittestresult.cpp @@ -23,13 +23,14 @@ #include "GOwnPtr.h" #include "HitTestResult.h" +#include "KURL.h" #include "WebKitDOMBinding.h" #include "WebKitDOMNode.h" #include "webkitenumtypes.h" -#include "webkitprivate.h" -#include <wtf/text/CString.h> - +#include "webkitglobals.h" +#include "webkitglobalsprivate.h" #include <glib/gi18n-lib.h> +#include <wtf/text/CString.h> /** * SECTION:webkithittestresult @@ -142,7 +143,7 @@ static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* webHitTe objectClass->get_property = webkit_hit_test_result_get_property; objectClass->set_property = webkit_hit_test_result_set_property; - webkit_init(); + webkitInit(); /** * WebKitHitTestResult:context: diff --git a/WebKit/gtk/webkit/webkitnetworkrequest.cpp b/WebKit/gtk/webkit/webkitnetworkrequest.cpp index 23f22a3..7005637 100644 --- a/WebKit/gtk/webkit/webkitnetworkrequest.cpp +++ b/WebKit/gtk/webkit/webkitnetworkrequest.cpp @@ -21,11 +21,11 @@ #include "config.h" #include "webkitnetworkrequest.h" +#include "GRefPtr.h" #include "ResourceRequest.h" -#include "webkitprivate.h" -#include <wtf/text/CString.h> - +#include "webkitglobalsprivate.h" #include <glib/gi18n-lib.h> +#include <wtf/text/CString.h> /** * SECTION:webkitnetworkrequest @@ -120,7 +120,7 @@ static void webkit_network_request_class_init(WebKitNetworkRequestClass* request objectClass->get_property = webkit_network_request_get_property; objectClass->set_property = webkit_network_request_set_property; - webkit_init(); + webkitInit(); /** * WebKitNetworkRequest:uri: @@ -253,7 +253,7 @@ namespace WebKit { WebKitNetworkRequest* kitNew(const WebCore::ResourceRequest& resourceRequest) { - PlatformRefPtr<SoupMessage> soupMessage(adoptPlatformRef(resourceRequest.toSoupMessage())); + GRefPtr<SoupMessage> soupMessage(adoptGRef(resourceRequest.toSoupMessage())); if (soupMessage) return WEBKIT_NETWORK_REQUEST(g_object_new(WEBKIT_TYPE_NETWORK_REQUEST, "message", soupMessage.get(), NULL)); diff --git a/WebKit/gtk/webkit/webkitnetworkresponse.cpp b/WebKit/gtk/webkit/webkitnetworkresponse.cpp index da29212..4b8661b 100644 --- a/WebKit/gtk/webkit/webkitnetworkresponse.cpp +++ b/WebKit/gtk/webkit/webkitnetworkresponse.cpp @@ -24,9 +24,9 @@ #include "GRefPtr.h" #include "ResourceResponse.h" -#include "webkitprivate.h" - +#include "webkitglobalsprivate.h" #include <glib/gi18n-lib.h> +#include <wtf/text/CString.h> /** * SECTION:webkitnetworkresponse @@ -120,7 +120,7 @@ static void webkit_network_response_class_init(WebKitNetworkResponseClass* respo objectClass->get_property = webkit_network_response_get_property; objectClass->set_property = webkit_network_response_set_property; - webkit_init(); + webkitInit(); /** * WebKitNetworkResponse:uri: @@ -263,7 +263,7 @@ WebCore::ResourceResponse core(WebKitNetworkResponse* response) WebKitNetworkResponse* kitNew(const WebCore::ResourceResponse& resourceResponse) { - PlatformRefPtr<SoupMessage> soupMessage(adoptPlatformRef(resourceResponse.toSoupMessage())); + GRefPtr<SoupMessage> soupMessage(adoptGRef(resourceResponse.toSoupMessage())); if (soupMessage) return WEBKIT_NETWORK_RESPONSE(g_object_new(WEBKIT_TYPE_NETWORK_RESPONSE, "message", soupMessage.get(), NULL)); diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h deleted file mode 100644 index cf2e9d6..0000000 --- a/WebKit/gtk/webkit/webkitprivate.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther - * Copyright (C) 2008 Jan Michael C. Alonzo - * Copyright (C) 2008 Collabora Ltd. - * Copyright (C) 2010 Igalia S.L. - * - * 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 webkitprivate_h -#define webkitprivate_h - -/* - * This file knows the shared secret of WebKitWebView, WebKitWebFrame, - * and WebKitNetworkRequest. - * They are using WebCore which musn't be exposed to the outer world. - */ - -#include <webkit/webkitdefines.h> -#include <webkit/webkitnetworkrequest.h> -#include <webkit/webkitwebview.h> -#include <webkit/webkitwebdatasource.h> -#include <webkit/webkitwebframe.h> -#include <webkit/webkitwebsettings.h> -#include <webkit/webkitwebwindowfeatures.h> -#include <webkit/webkitnetworkrequest.h> -#include <webkit/webkitsecurityorigin.h> - -#include "DataObjectGtk.h" -#include "DragActions.h" -#include "Frame.h" -#include "GOwnPtr.h" -#include "Geolocation.h" -#include "IntPoint.h" -#include "IntRect.h" -#include "FrameLoaderClient.h" -#include "Node.h" -#include "Page.h" -#include "PlatformString.h" -#include "ResourceHandle.h" -#include "ResourceRequest.h" -#include "WindowFeatures.h" -#include "Settings.h" -#include <enchant.h> -#include <wtf/OwnPtr.h> -#include <wtf/text/CString.h> - -#include <atk/atk.h> -#include <glib.h> -#include <libsoup/soup.h> - -namespace WebKit { - - class DocumentLoader; - class PasteboardHelperGtk; - - WebCore::EditingBehaviorType core(WebKitEditingBehavior type); - - PasteboardHelperGtk* pasteboardHelperInstance(); -} - -extern "C" { - void webkit_init(); - -#define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) -#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) - - WTF::String - webkitUserAgent(); - - WebKitWebWindowFeatures* - webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features); - - WebKitGeolocationPolicyDecision* - webkit_geolocation_policy_decision_new(WebKitWebFrame*, WebCore::Geolocation*); - - WEBKIT_API void - webkit_application_cache_set_maximum_size(unsigned long long size); - - // WebKitWebDataSource private - WebKitWebDataSource* - webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader>); -} - -#endif diff --git a/WebKit/gtk/webkit/webkitsecurityorigin.cpp b/WebKit/gtk/webkit/webkitsecurityorigin.cpp index 927b76d..5f9afae 100644 --- a/WebKit/gtk/webkit/webkitsecurityorigin.cpp +++ b/WebKit/gtk/webkit/webkitsecurityorigin.cpp @@ -22,7 +22,7 @@ #include "DatabaseTracker.h" #include "PlatformString.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" #include "webkitsecurityoriginprivate.h" #include <glib/gi18n-lib.h> #include <wtf/text/CString.h> diff --git a/WebKit/gtk/webkit/webkitsoupauthdialog.h b/WebKit/gtk/webkit/webkitsoupauthdialog.h index db0ccb8..08b7c9f 100644 --- a/WebKit/gtk/webkit/webkitsoupauthdialog.h +++ b/WebKit/gtk/webkit/webkitsoupauthdialog.h @@ -17,14 +17,12 @@ * Boston, MA 02110-1301, USA. */ -#include <gtk/gtk.h> -#include <libsoup/soup.h> - -#include <webkit/webkitdefines.h> - #ifndef webkitsoupauthdialog_h #define webkitsoupauthdialog_h +#include <gtk/gtk.h> +#include <webkit/webkitdefines.h> + G_BEGIN_DECLS #define WEBKIT_TYPE_SOUP_AUTH_DIALOG (webkit_soup_auth_dialog_get_type ()) diff --git a/WebKit/gtk/webkit/webkitviewportattributes.cpp b/WebKit/gtk/webkit/webkitviewportattributes.cpp index c2de5c1..9a98e44 100644 --- a/WebKit/gtk/webkit/webkitviewportattributes.cpp +++ b/WebKit/gtk/webkit/webkitviewportattributes.cpp @@ -22,7 +22,9 @@ #include "webkitviewportattributes.h" #include "Chrome.h" -#include "webkitprivate.h" +#include "Frame.h" +#include "Page.h" +#include "webkitglobalsprivate.h" #include "webkitviewportattributesprivate.h" #include "webkitwebviewprivate.h" #include <glib/gi18n-lib.h> diff --git a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp index c906ba3..62f7e8c 100644 --- a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp +++ b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp @@ -23,7 +23,8 @@ #include "BackForwardListImpl.h" #include "HistoryItem.h" -#include "webkitprivate.h" +#include "Page.h" +#include "webkitglobalsprivate.h" #include "webkitwebbackforwardlistprivate.h" #include "webkitwebhistoryitem.h" #include "webkitwebhistoryitemprivate.h" @@ -84,7 +85,7 @@ static void webkit_web_back_forward_list_class_init(WebKitWebBackForwardListClas object_class->dispose = webkit_web_back_forward_list_dispose; - webkit_init(); + webkitInit(); g_type_class_add_private(klass, sizeof(WebKitWebBackForwardListPrivate)); } diff --git a/WebKit/gtk/webkit/webkitwebdatabase.cpp b/WebKit/gtk/webkit/webkitwebdatabase.cpp index db72cde..1291986 100644 --- a/WebKit/gtk/webkit/webkitwebdatabase.cpp +++ b/WebKit/gtk/webkit/webkitwebdatabase.cpp @@ -22,7 +22,7 @@ #include "DatabaseDetails.h" #include "DatabaseTracker.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" #include "webkitsecurityoriginprivate.h" #include <glib/gi18n-lib.h> #include <wtf/text/CString.h> diff --git a/WebKit/gtk/webkit/webkitwebdatasource.cpp b/WebKit/gtk/webkit/webkitwebdatasource.cpp index 7d967f7..8538665 100644 --- a/WebKit/gtk/webkit/webkitwebdatasource.cpp +++ b/WebKit/gtk/webkit/webkitwebdatasource.cpp @@ -30,8 +30,9 @@ #include "SharedBuffer.h" #include "SubstituteData.h" #include "runtime/InitializeThreading.h" +#include "webkitglobalsprivate.h" #include "webkitnetworkrequestprivate.h" -#include "webkitprivate.h" +#include "webkitwebdatasourceprivate.h" #include "webkitwebframeprivate.h" #include "webkitwebresource.h" #include "webkitwebviewprivate.h" @@ -126,7 +127,7 @@ static void webkit_web_data_source_class_init(WebKitWebDataSourceClass* klass) gobject_class->dispose = webkit_web_data_source_dispose; gobject_class->finalize = webkit_web_data_source_finalize; - webkit_init(); + webkitInit(); g_type_class_add_private(gobject_class, sizeof(WebKitWebDataSourcePrivate)); } @@ -136,15 +137,6 @@ static void webkit_web_data_source_init(WebKitWebDataSource* webDataSource) webDataSource->priv = G_TYPE_INSTANCE_GET_PRIVATE(webDataSource, WEBKIT_TYPE_WEB_DATA_SOURCE, WebKitWebDataSourcePrivate); } -WebKitWebDataSource* webkit_web_data_source_new_with_loader(PassRefPtr<WebKit::DocumentLoader> loader) -{ - WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(g_object_new(WEBKIT_TYPE_WEB_DATA_SOURCE, NULL)); - WebKitWebDataSourcePrivate* priv = webDataSource->priv; - priv->loader = loader.releaseRef(); - - return webDataSource; -} - /** * webkit_web_data_source_new: * @@ -182,10 +174,8 @@ WebKitWebDataSource* webkit_web_data_source_new_with_request(WebKitNetworkReques const gchar* uri = webkit_network_request_get_uri(request); - WebKitWebDataSource* datasource; - datasource = webkit_web_data_source_new_with_loader( - WebKit::DocumentLoader::create(ResourceRequest(KURL(KURL(), String::fromUTF8(uri))), - SubstituteData())); + ResourceRequest resourceRequest(ResourceRequest(KURL(KURL(), String::fromUTF8(uri)))); + WebKitWebDataSource* datasource = kitNew(WebKit::DocumentLoader::create(resourceRequest, SubstituteData())); WebKitWebDataSourcePrivate* priv = datasource->priv; priv->initialRequest = request; @@ -437,3 +427,16 @@ GList* webkit_web_data_source_get_subresources(WebKitWebDataSource* webDataSourc return webkit_web_view_get_subresources(webView); } + +namespace WebKit { + +WebKitWebDataSource* kitNew(PassRefPtr<WebKit::DocumentLoader> loader) +{ + WebKitWebDataSource* webDataSource = WEBKIT_WEB_DATA_SOURCE(g_object_new(WEBKIT_TYPE_WEB_DATA_SOURCE, NULL)); + WebKitWebDataSourcePrivate* priv = webDataSource->priv; + priv->loader = loader.releaseRef(); + + return webDataSource; +} + +} diff --git a/WebKit/gtk/webkit/webkitwebdatasourceprivate.h b/WebKit/gtk/webkit/webkitwebdatasourceprivate.h new file mode 100644 index 0000000..5c18493 --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebdatasourceprivate.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitwebdatasourceprivate_h +#define webkitwebdatasourceprivate_h + +#include "RefPtr.h" +#include "webkitwebdatasource.h" + +namespace WebKit { + +WebKitWebDataSource* kitNew(PassRefPtr<WebKit::DocumentLoader>); + +} + +#endif diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index ca2b681..d0ea875 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -51,10 +51,10 @@ #include "ScriptController.h" #include "SubstituteData.h" #include "webkitenumtypes.h" +#include "webkitglobalsprivate.h" +#include "webkitmarshal.h" #include "webkitnetworkrequestprivate.h" #include "webkitnetworkresponseprivate.h" -#include "webkitmarshal.h" -#include "webkitprivate.h" #include "webkitsecurityoriginprivate.h" #include "webkitwebframeprivate.h" #include "webkitwebview.h" @@ -115,11 +115,11 @@ static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE(WebKitWebFrame, webkit_web_frame, G_TYPE_OBJECT) -static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +static void webkit_web_frame_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* paramSpec) { WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object); - switch(prop_id) { + switch (propertyId) { case PROP_NAME: g_value_set_string(value, webkit_web_frame_get_name(frame)); break; @@ -139,7 +139,7 @@ static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue g_value_set_enum(value, webkit_web_frame_get_vertical_scrollbar_policy(frame)); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, paramSpec); break; } } @@ -158,7 +158,7 @@ void webkit_web_frame_core_frame_gone(WebKitWebFrame* frame) static WebKitWebDataSource* webkit_web_frame_get_data_source_from_core_loader(WebCore::DocumentLoader* loader) { - return loader ? static_cast<WebKit::DocumentLoader*>(loader)->dataSource() : NULL; + return loader ? static_cast<WebKit::DocumentLoader*>(loader)->dataSource() : 0; } static void webkit_web_frame_finalize(GObject* object) @@ -181,7 +181,7 @@ static void webkit_web_frame_finalize(GObject* object) static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) { - webkit_init(); + webkitInit(); /* * signals @@ -190,8 +190,8 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_FROM_CLASS(frameClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, - NULL, - NULL, + 0, + 0, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -207,8 +207,8 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_FROM_CLASS(frameClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, - NULL, - NULL, + 0, + 0, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -225,8 +225,8 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_FROM_CLASS(frameClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, - NULL, - NULL, + 0, + 0, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); @@ -244,8 +244,8 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_FROM_CLASS(frameClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, - NULL, - NULL, + 0, + 0, webkit_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -254,8 +254,8 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) G_TYPE_FROM_CLASS(frameClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, - NULL, - NULL, + 0, + 0, webkit_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); @@ -290,7 +290,7 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, g_signal_accumulator_true_handled, - NULL, + 0, webkit_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); @@ -308,21 +308,21 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) g_param_spec_string("name", _("Name"), _("The name of the frame"), - NULL, + 0, WEBKIT_PARAM_READABLE)); g_object_class_install_property(objectClass, PROP_TITLE, g_param_spec_string("title", _("Title"), _("The document title of the frame"), - NULL, + 0, WEBKIT_PARAM_READABLE)); g_object_class_install_property(objectClass, PROP_URI, g_param_spec_string("uri", _("URI"), _("The current URI of the contents displayed by the frame"), - NULL, + 0, WEBKIT_PARAM_READABLE)); /** @@ -387,6 +387,7 @@ static void webkit_web_frame_init(WebKitWebFrame* frame) frame->priv = priv; } + /** * webkit_web_frame_new: * @web_view: the controlling #WebKitWebView @@ -400,7 +401,7 @@ static void webkit_web_frame_init(WebKitWebFrame* frame) **/ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); WebKitWebFrame* frame = WEBKIT_WEB_FRAME(g_object_new(WEBKIT_TYPE_WEB_FRAME, NULL)); WebKitWebFramePrivate* priv = frame->priv; @@ -411,7 +412,7 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) priv->coreFrame = Frame::create(viewPriv->corePage, 0, client).get(); priv->coreFrame->init(); - priv->origin = NULL; + priv->origin = 0; return frame; } @@ -426,7 +427,7 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView) */ G_CONST_RETURN gchar* webkit_web_frame_get_title(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); WebKitWebFramePrivate* priv = frame->priv; return priv->title; @@ -442,7 +443,7 @@ G_CONST_RETURN gchar* webkit_web_frame_get_title(WebKitWebFrame* frame) */ G_CONST_RETURN gchar* webkit_web_frame_get_uri(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); WebKitWebFramePrivate* priv = frame->priv; return priv->uri; @@ -461,7 +462,7 @@ G_CONST_RETURN gchar* webkit_web_frame_get_uri(WebKitWebFrame* frame) */ WebKitWebView* webkit_web_frame_get_web_view(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); WebKitWebFramePrivate* priv = frame->priv; return priv->webView; @@ -477,7 +478,7 @@ WebKitWebView* webkit_web_frame_get_web_view(WebKitWebFrame* frame) */ G_CONST_RETURN gchar* webkit_web_frame_get_name(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); WebKitWebFramePrivate* priv = frame->priv; @@ -503,11 +504,11 @@ G_CONST_RETURN gchar* webkit_web_frame_get_name(WebKitWebFrame* frame) */ WebKitWebFrame* webkit_web_frame_get_parent(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); Frame* coreFrame = core(frame); if (!coreFrame) - return NULL; + return 0; return kit(coreFrame->tree()->parent()); } @@ -574,7 +575,7 @@ void webkit_web_frame_load_string(WebKitWebFrame* frame, const gchar* content, c g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame)); g_return_if_fail(content); - webkit_web_frame_load_data(frame, content, contentMimeType, contentEncoding, baseUri, NULL); + webkit_web_frame_load_data(frame, content, contentMimeType, contentEncoding, baseUri, 0); } /** @@ -595,7 +596,7 @@ void webkit_web_frame_load_alternate_string(WebKitWebFrame* frame, const gchar* g_return_if_fail(WEBKIT_IS_WEB_FRAME(frame)); g_return_if_fail(content); - webkit_web_frame_load_data(frame, content, NULL, NULL, baseURL, unreachableURL); + webkit_web_frame_load_data(frame, content, 0, 0, baseURL, unreachableURL); } /** @@ -674,12 +675,12 @@ void webkit_web_frame_reload(WebKitWebFrame* frame) */ WebKitWebFrame* webkit_web_frame_find_frame(WebKitWebFrame* frame, const gchar* name) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); - g_return_val_if_fail(name, NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); + g_return_val_if_fail(name, 0); Frame* coreFrame = core(frame); if (!coreFrame) - return NULL; + return 0; String nameString = String::fromUTF8(name); return kit(coreFrame->tree()->find(AtomicString(nameString))); @@ -696,11 +697,11 @@ WebKitWebFrame* webkit_web_frame_find_frame(WebKitWebFrame* frame, const gchar* */ JSGlobalContextRef webkit_web_frame_get_global_context(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); Frame* coreFrame = core(frame); if (!coreFrame) - return NULL; + return 0; return toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec()); } @@ -717,7 +718,7 @@ JSGlobalContextRef webkit_web_frame_get_global_context(WebKitWebFrame* frame) */ WebKitWebDataSource* webkit_web_frame_get_data_source(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); Frame* coreFrame = core(frame); return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->documentLoader()); @@ -739,7 +740,7 @@ WebKitWebDataSource* webkit_web_frame_get_data_source(WebKitWebFrame* frame) */ WebKitWebDataSource* webkit_web_frame_get_provisional_data_source(WebKitWebFrame* frame) { - g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); Frame* coreFrame = core(frame); return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->provisionalDocumentLoader()); @@ -804,7 +805,7 @@ GtkPrintOperationResult webkit_web_frame_print_full(WebKitWebFrame* frame, GtkPr GtkWidget* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(webkit_web_frame_get_web_view(frame))); if (!gtk_widget_is_toplevel(topLevel)) - topLevel = NULL; + topLevel = 0; Frame* coreFrame = core(frame); if (!coreFrame) @@ -933,7 +934,7 @@ WebKitSecurityOrigin* webkit_web_frame_get_security_origin(WebKitWebFrame* frame { WebKitWebFramePrivate* priv = frame->priv; if (!priv->coreFrame || !priv->coreFrame->document() || !priv->coreFrame->document()->securityOrigin()) - return NULL; + return 0; if (priv->origin && priv->origin->priv->coreOrigin.get() == priv->coreFrame->document()->securityOrigin()) return priv->origin; @@ -962,11 +963,11 @@ WebKitNetworkResponse* webkit_web_frame_get_network_response(WebKitWebFrame* fra { Frame* coreFrame = core(frame); if (!coreFrame) - return NULL; + return 0; WebCore::DocumentLoader* loader = coreFrame->loader()->activeDocumentLoader(); if (!loader) - return NULL; + return 0; return kitNew(loader->response()); } diff --git a/WebKit/gtk/webkit/webkitwebframeprivate.h b/WebKit/gtk/webkit/webkitwebframeprivate.h index 23f1e40..80210d8 100644 --- a/WebKit/gtk/webkit/webkitwebframeprivate.h +++ b/WebKit/gtk/webkit/webkitwebframeprivate.h @@ -23,6 +23,9 @@ #ifndef webkitwebframeprivate_h #define webkitwebframeprivate_h +#include "Frame.h" +#include "webkitwebframe.h" + namespace WebKit { WebKitWebView* getViewFromFrame(WebKitWebFrame*); diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp index ac8e57f..eabdc49 100644 --- a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp +++ b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp @@ -19,12 +19,11 @@ */ #include "config.h" - #include "webkitwebhistoryitem.h" -#include "webkitprivate.h" #include "HistoryItem.h" #include "PlatformString.h" +#include "webkitglobalsprivate.h" #include "webkitwebhistoryitemprivate.h" #include <glib.h> #include <glib/gi18n-lib.h> @@ -128,7 +127,7 @@ static void webkit_web_history_item_class_init(WebKitWebHistoryItemClass* klass) gobject_class->set_property = webkit_web_history_item_set_property; gobject_class->get_property = webkit_web_history_item_get_property; - webkit_init(); + webkitInit(); /** * WebKitWebHistoryItem:title: diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp index ad455bb..1fa2fad 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "webkitwebinspector.h" +#include "DumpRenderTreeSupportGtk.h" #include "FocusController.h" #include "Frame.h" #include "HitTestRequest.h" @@ -32,8 +33,8 @@ #include "RenderLayer.h" #include "RenderView.h" #include "webkit/WebKitDOMNodePrivate.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" #include "webkitwebinspectorprivate.h" #include <glib/gi18n-lib.h> @@ -596,23 +597,23 @@ static bool isSchemaAvailable(const char* schemaID) GSettings* inspectorGSettings() { static GSettings* settings = 0; - if (settings) return settings; + // 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. 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)) { - g_warning("GSettings schema not found - settings will not be used or saved."); + + // This warning is very common on the build bots, which hides valid warnings. + // Skip printing it if we are running inside DumpRenderTree. + if (!DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) + g_warning("GSettings schema not found - settings will not be used or saved."); return 0; } settings = g_settings_new(schemaID); - return settings; } #endif diff --git a/WebKit/gtk/webkit/webkitwebnavigationaction.cpp b/WebKit/gtk/webkit/webkitwebnavigationaction.cpp index b12279e..9f13f28 100644 --- a/WebKit/gtk/webkit/webkitwebnavigationaction.cpp +++ b/WebKit/gtk/webkit/webkitwebnavigationaction.cpp @@ -18,16 +18,14 @@ */ #include "config.h" +#include "webkitwebnavigationaction.h" -#include <wtf/Assertions.h> #include "FrameLoaderTypes.h" - -#include <glib/gi18n-lib.h> -#include "webkitwebnavigationaction.h" -#include "webkitprivate.h" #include "webkitenumtypes.h" - +#include "webkitglobalsprivate.h" +#include <glib/gi18n-lib.h> #include <string.h> +#include <wtf/Assertions.h> static void webkit_web_navigation_action_set_target_frame(WebKitWebNavigationAction* navigationAction, const gchar* targetFrame); diff --git a/WebKit/gtk/webkit/webkitwebplugin.cpp b/WebKit/gtk/webkit/webkitwebplugin.cpp index 0b06416..52d5965 100644 --- a/WebKit/gtk/webkit/webkitwebplugin.cpp +++ b/WebKit/gtk/webkit/webkitwebplugin.cpp @@ -20,7 +20,7 @@ #include "webkitwebplugin.h" #include "PluginPackage.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" #include "webkitwebpluginprivate.h" #include <glib/gi18n-lib.h> @@ -98,7 +98,7 @@ static void webkit_web_plugin_set_property(GObject* object, guint prop_id, const static void webkit_web_plugin_class_init(WebKitWebPluginClass* klass) { - webkit_init(); + webkitInit(); GObjectClass* gobjectClass = reinterpret_cast<GObjectClass*>(klass); diff --git a/WebKit/gtk/webkit/webkitwebplugindatabase.cpp b/WebKit/gtk/webkit/webkitwebplugindatabase.cpp index 08328a0..2d36115 100644 --- a/WebKit/gtk/webkit/webkitwebplugindatabase.cpp +++ b/WebKit/gtk/webkit/webkitwebplugindatabase.cpp @@ -20,7 +20,7 @@ #include "webkitwebplugindatabase.h" #include "PluginDatabase.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" #include "webkitwebplugindatabaseprivate.h" #include "webkitwebpluginprivate.h" @@ -47,7 +47,7 @@ static void webkit_web_plugin_database_dispose(GObject* object) static void webkit_web_plugin_database_class_init(WebKitWebPluginDatabaseClass* klass) { - webkit_init(); + webkitInit(); GObjectClass* gobjectClass = reinterpret_cast<GObjectClass*>(klass); diff --git a/WebKit/gtk/webkit/webkitwebpluginprivate.h b/WebKit/gtk/webkit/webkitwebpluginprivate.h index 885313e..4ae204b 100644 --- a/WebKit/gtk/webkit/webkitwebpluginprivate.h +++ b/WebKit/gtk/webkit/webkitwebpluginprivate.h @@ -21,6 +21,7 @@ #include "webkitwebplugin.h" #include <glib-object.h> +#include <wtf/text/CString.h> namespace WebCore { class PluginPackage; diff --git a/WebKit/gtk/webkit/webkitwebpolicydecision.cpp b/WebKit/gtk/webkit/webkitwebpolicydecision.cpp index 06c1fcb..624ff9a 100644 --- a/WebKit/gtk/webkit/webkitwebpolicydecision.cpp +++ b/WebKit/gtk/webkit/webkitwebpolicydecision.cpp @@ -20,8 +20,8 @@ #include "config.h" #include "webkitwebpolicydecision.h" +#include "FrameLoaderClient.h" #include "FrameLoaderTypes.h" -#include "webkitprivate.h" #include "webkitwebframeprivate.h" #include "webkitwebpolicydecisionprivate.h" diff --git a/WebKit/gtk/webkit/webkitwebresource.cpp b/WebKit/gtk/webkit/webkitwebresource.cpp index c2f3a15..b7f4036 100644 --- a/WebKit/gtk/webkit/webkitwebresource.cpp +++ b/WebKit/gtk/webkit/webkitwebresource.cpp @@ -25,14 +25,13 @@ #include "PlatformString.h" #include "SharedBuffer.h" #include "webkitenumtypes.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" #include "webkitwebresourceprivate.h" -#include <wtf/Assertions.h> -#include <wtf/text/CString.h> - #include <glib.h> #include <glib/gi18n-lib.h> +#include <wtf/Assertions.h> +#include <wtf/text/CString.h> /** * SECTION:webkitwebresource @@ -44,7 +43,6 @@ */ using namespace WebCore; -using namespace WebKit; enum { PROP_0, diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp index 92370d7..3deae30 100644 --- a/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -26,16 +26,19 @@ #include "config.h" #include "webkitwebsettings.h" +#include "EditingBehavior.h" #include "FileSystem.h" #include "Language.h" #include "PluginDatabase.h" #include "webkitenumtypes.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" #include "webkitversion.h" #include "webkitwebsettingsprivate.h" +#include <enchant.h> #include <wtf/text/CString.h> #include <wtf/text/StringConcatenate.h> #include <glib/gi18n-lib.h> + #if OS(UNIX) #include <sys/utsname.h> #endif @@ -241,7 +244,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) gobject_class->set_property = webkit_web_settings_set_property; gobject_class->get_property = webkit_web_settings_get_property; - webkit_init(); + webkitInit(); GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT); @@ -1404,24 +1407,6 @@ void webkit_web_settings_add_extra_plugin_directory(WebKitWebView* webView, cons } /** - * webkit_web_settings_get_enchant_dicts: - * @web_view: a #WebKitWebView - * - * Internal use only. Retrieves a GSList of EnchantDicts from the - * #WebKitWebSettings of @web_view. - * - * Since: 1.1.22 - */ -GSList* webkit_web_settings_get_enchant_dicts(WebKitWebView* webView) -{ - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - - WebKitWebSettings* settings = webkit_web_view_get_settings(webView); - - return settings->priv->enchant_dicts; -} - -/** * webkit_web_settings_get_user_agent: * @web_settings: a #WebKitWebSettings * @@ -1438,3 +1423,21 @@ G_CONST_RETURN gchar* webkit_web_settings_get_user_agent(WebKitWebSettings* webS return priv->user_agent; } + +GSList* webkitWebViewGetEnchantDicts(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + + WebKitWebSettings* settings = webkit_web_view_get_settings(webView); + + return settings->priv->enchant_dicts; +} + +namespace WebKit { + +WebCore::EditingBehaviorType core(WebKitEditingBehavior type) +{ + return (WebCore::EditingBehaviorType)type; +} + +} diff --git a/WebKit/gtk/webkit/webkitwebsettingsprivate.h b/WebKit/gtk/webkit/webkitwebsettingsprivate.h index e848a08..9700ba5 100644 --- a/WebKit/gtk/webkit/webkitwebsettingsprivate.h +++ b/WebKit/gtk/webkit/webkitwebsettingsprivate.h @@ -29,7 +29,9 @@ extern "C" { WEBKIT_API void webkit_web_settings_add_extra_plugin_directory(WebKitWebView*, const gchar* directory); -GSList* webkit_web_settings_get_enchant_dicts(WebKitWebView*); +GSList* webkitWebViewGetEnchantDicts(WebKitWebView*); + +WTF::String webkitUserAgent(); } diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index c814474..bd3538c 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -76,16 +76,17 @@ #include "ResourceHandle.h" #include "ScriptValue.h" #include "Scrollbar.h" +#include "Settings.h" #include "webkit/WebKitDOMDocumentPrivate.h" #include "webkitdownload.h" #include "webkitdownloadprivate.h" #include "webkitenumtypes.h" #include "webkitgeolocationpolicydecision.h" +#include "webkitglobalsprivate.h" #include "webkithittestresultprivate.h" #include "webkitmarshal.h" #include "webkitnetworkrequest.h" #include "webkitnetworkresponse.h" -#include "webkitprivate.h" #include "webkitviewportattributes.h" #include "webkitviewportattributesprivate.h" #include "webkitwebbackforwardlist.h" @@ -96,7 +97,9 @@ #include "webkitwebinspectorprivate.h" #include "webkitwebpolicydecision.h" #include "webkitwebresource.h" +#include "webkitwebsettingsprivate.h" #include "webkitwebplugindatabaseprivate.h" +#include "webkitwebwindowfeatures.h" #include "webkitwebviewprivate.h" #include <gdk/gdkkeysyms.h> #include <glib/gi18n-lib.h> @@ -137,7 +140,6 @@ */ static const double defaultDPI = 96.0; -static WebKitCacheModel cacheModel = WEBKIT_CACHE_MODEL_DEFAULT; static IntPoint globalPointForClientPoint(GdkWindow* window, const IntPoint& clientPoint); using namespace WebKit; @@ -1438,23 +1440,36 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); if (!core(webView)) - return NULL; + return 0; AXObjectCache::enableAccessibility(); Frame* coreFrame = core(webView)->mainFrame(); if (!coreFrame) - return NULL; + return 0; Document* doc = coreFrame->document(); if (!doc) - return NULL; + return 0; + + AccessibilityObject* rootAccessible = doc->axObjectCache()->rootObject(); + if (!rootAccessible) + return 0; + + // We need to return the root accessibility object's first child + // to get to the actual ATK Object associated with the web view. + // See https://bugs.webkit.org/show_bug.cgi?id=51932 + AtkObject* axRoot = rootAccessible->wrapper(); + if (!axRoot || !ATK_IS_OBJECT(axRoot)) + return 0; - AccessibilityObject* coreAccessible = doc->axObjectCache()->getOrCreate(doc->renderer()); - if (!coreAccessible || !coreAccessible->wrapper()) - return NULL; + AtkObject* axWebView = atk_object_ref_accessible_child(ATK_OBJECT(axRoot), 0); + if (!axWebView || !ATK_IS_OBJECT(axWebView)) + return 0; - return coreAccessible->wrapper(); + // We don't want the extra reference returned by ref_accessible_child. + g_object_unref(axWebView); + return axWebView; } static gdouble webViewGetDPI(WebKitWebView* webView) @@ -1757,7 +1772,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) { GtkBindingSet* binding_set; - webkit_init(); + webkitInit(); /* * Signals @@ -3330,7 +3345,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows); settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard); settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache); - settings->setEditingBehaviorType(core(editingBehavior)); + settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(editingBehavior)); settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI); settings->setAllowFileAccessFromFileURLs(enableFileAccessFromFileURI); settings->setDOMPasteAllowed(enableDOMPaste); @@ -3436,7 +3451,7 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar else if (name == g_intern_string("enable-offline-web-application-cache")) settings->setOfflineWebApplicationCacheEnabled(g_value_get_boolean(&value)); else if (name == g_intern_string("editing-behavior")) - settings->setEditingBehaviorType(core(static_cast<WebKitEditingBehavior>(g_value_get_enum(&value)))); + settings->setEditingBehaviorType(static_cast<WebCore::EditingBehaviorType>(g_value_get_enum(&value))); else if (name == g_intern_string("enable-universal-access-from-file-uris")) settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-file-access-from-file-uris")) @@ -3471,7 +3486,7 @@ static void webkit_web_view_init(WebKitWebView* webView) // members, which ensures they are initialized properly. new (priv) WebKitWebViewPrivate(); - priv->imContext = adoptPlatformRef(gtk_im_multicontext_new()); + priv->imContext = adoptGRef(gtk_im_multicontext_new()); Page::PageClients pageClients; pageClients.chromeClient = new WebKit::ChromeClient(webView); @@ -3489,11 +3504,11 @@ static void webkit_web_view_init(WebKitWebView* webView) // We also add a simple wrapper class to provide the public // interface for the Web Inspector. - priv->webInspector = adoptPlatformRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); + priv->webInspector = adoptGRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage); // And our ViewportAttributes friend. - priv->viewportAttributes = adoptPlatformRef(WEBKIT_VIEWPORT_ATTRIBUTES(g_object_new(WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, NULL))); + priv->viewportAttributes = adoptGRef(WEBKIT_VIEWPORT_ATTRIBUTES(g_object_new(WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, NULL))); priv->viewportAttributes->priv->webView = webView; // The smart pointer will call g_object_ref_sink on these adjustments. @@ -3505,17 +3520,17 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->lastPopupXPosition = priv->lastPopupYPosition = -1; priv->editable = false; - priv->backForwardList = adoptPlatformRef(webkit_web_back_forward_list_new_with_web_view(webView)); + priv->backForwardList = adoptGRef(webkit_web_back_forward_list_new_with_web_view(webView)); priv->zoomFullContent = FALSE; - priv->webSettings = adoptPlatformRef(webkit_web_settings_new()); + priv->webSettings = adoptGRef(webkit_web_settings_new()); webkit_web_view_update_settings(webView); g_signal_connect(priv->webSettings.get(), "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); - priv->webWindowFeatures = adoptPlatformRef(webkit_web_window_features_new()); + priv->webWindowFeatures = adoptGRef(webkit_web_window_features_new()); - priv->subResources = adoptPlatformRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref)); + priv->subResources = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref)); priv->currentClickCount = 0; priv->previousClickButton = 0; @@ -4892,7 +4907,7 @@ void webkit_web_view_add_main_resource(WebKitWebView* webView, const char* ident { WebKitWebViewPrivate* priv = webView->priv; - priv->mainResource = adoptPlatformRef(webResource); + priv->mainResource = adoptGRef(webResource); priv->mainResourceIdentifier = identifier; } @@ -5050,138 +5065,6 @@ webkit_web_view_get_dom_document(WebKitWebView* webView) return kit(doc); } -/** - * SECTION:webkit - * @short_description: Global functions controlling WebKit - * - * WebKit manages many resources which are not related to specific - * views. These functions relate to cross-view limits, such as cache - * sizes, database quotas, and the HTTP session management. - */ - -/** - * webkit_get_default_session: - * - * Retrieves the default #SoupSession used by all web views. - * Note that the session features are added by WebKit on demand, - * so if you insert your own #SoupCookieJar before any network - * traffic occurs, WebKit will use it instead of the default. - * - * Return value: (transfer none): the default #SoupSession - * - * Since: 1.1.1 - */ -SoupSession* webkit_get_default_session () -{ - webkit_init(); - return ResourceHandle::defaultSession(); -} - -/** - * webkit_set_cache_model: - * @cache_model: a #WebKitCacheModel - * - * Specifies a usage model for WebViews, which WebKit will use to - * determine its caching behavior. All web views follow the cache - * model. This cache model determines the RAM and disk space to use - * for caching previously viewed content . - * - * Research indicates that users tend to browse within clusters of - * documents that hold resources in common, and to revisit previously - * visited documents. WebKit and the frameworks below it include - * built-in caches that take advantage of these patterns, - * substantially improving document load speed in browsing - * situations. The WebKit cache model controls the behaviors of all of - * these caches, including various WebCore caches. - * - * Browsers can improve document load speed substantially by - * specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a - * browsing interface can reduce memory usage substantially by - * specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is - * WEBKIT_CACHE_MODEL_WEB_BROWSER. - * - * Since: 1.1.18 - */ -void webkit_set_cache_model(WebKitCacheModel model) -{ - webkit_init(); - - if (cacheModel == model) - return; - - // FIXME: Add disk cache handling when soup has the API - guint cacheTotalCapacity; - guint cacheMinDeadCapacity; - guint cacheMaxDeadCapacity; - gdouble deadDecodedDataDeletionInterval; - guint pageCacheCapacity; - - switch (model) { - case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: - pageCacheCapacity = 0; - cacheTotalCapacity = 0; - cacheMinDeadCapacity = 0; - cacheMaxDeadCapacity = 0; - deadDecodedDataDeletionInterval = 0; - break; - case WEBKIT_CACHE_MODEL_WEB_BROWSER: - // Page cache capacity (in pages). Comment from Mac port: - // (Research indicates that value / page drops substantially after 3 pages.) - pageCacheCapacity = 3; - cacheTotalCapacity = 32 * 1024 * 1024; - cacheMinDeadCapacity = cacheTotalCapacity / 4; - cacheMaxDeadCapacity = cacheTotalCapacity / 2; - deadDecodedDataDeletionInterval = 60; - break; - default: - g_return_if_reached(); - } - - cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity); - cache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval); - pageCache()->setCapacity(pageCacheCapacity); - cacheModel = model; -} - -/** - * webkit_get_cache_model: - * - * Returns the current cache model. For more information about this - * value check the documentation of the function - * webkit_set_cache_model(). - * - * Return value: the current #WebKitCacheModel - * - * Since: 1.1.18 - */ -WebKitCacheModel webkit_get_cache_model() -{ - webkit_init(); - return cacheModel; -} - -/** - * webkit_get_web_plugin_database: - * - * Returns the current #WebKitWebPluginDatabase with information about - * all the plugins WebKit knows about in this instance. - * - * Return value: (transfer none): the current #WebKitWebPluginDatabase - * - * Since: 1.3.8 - */ -WebKitWebPluginDatabase* webkit_get_web_plugin_database() -{ - static WebKitWebPluginDatabase* database = 0; - - webkit_init(); - - if (!database) - database = webkit_web_plugin_database_new(); - - return database; -} - GtkMenu* webkit_web_view_get_context_menu(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h index 9abfef6..1838bfe 100644 --- a/WebKit/gtk/webkit/webkitwebview.h +++ b/WebKit/gtk/webkit/webkitwebview.h @@ -50,24 +50,6 @@ typedef enum { WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD } WebKitNavigationResponse; -/* - * WebKitCacheModel: - * @WEBKIT_CACHE_MODEL_DEFAULT: The default cache model. This is - * WEBKIT_CACHE_MODEL_WEB_BROWSER. - * @WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: Disable the cache completely, which - * substantially reduces memory usage. Useful for applications that only - * access local files. - * @WEBKIT_CACHE_MODEL_WEB_BROWSER: Improve document load speed substantially - * by caching previously viewed content. - * - * Enum values used for determining the webview cache model. - */ -typedef enum { - WEBKIT_CACHE_MODEL_DEFAULT, - WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER, - WEBKIT_CACHE_MODEL_WEB_BROWSER -} WebKitCacheModel; - typedef enum { WEBKIT_WEB_VIEW_TARGET_INFO_HTML, @@ -361,12 +343,6 @@ WEBKIT_API void webkit_web_view_set_full_content_zoom (WebKitWebView *webView, gboolean full_content_zoom); -WEBKIT_API SoupSession* -webkit_get_default_session (void); - -WEBKIT_API WebKitWebPluginDatabase * -webkit_get_web_plugin_database (void); - WEBKIT_API const gchar* webkit_web_view_get_encoding (WebKitWebView * webView); @@ -421,12 +397,6 @@ webkit_web_view_get_hit_test_result (WebKitWebView *webView, WEBKIT_API G_CONST_RETURN gchar * webkit_web_view_get_icon_uri (WebKitWebView *webView); -WEBKIT_API void -webkit_set_cache_model (WebKitCacheModel cache_model); - -WEBKIT_API WebKitCacheModel -webkit_get_cache_model (void); - WEBKIT_API WebKitDOMDocument * webkit_web_view_get_dom_document (WebKitWebView *webView); diff --git a/WebKit/gtk/webkit/webkitwebviewprivate.h b/WebKit/gtk/webkit/webkitwebviewprivate.h index dec6dad..29da1fe 100644 --- a/WebKit/gtk/webkit/webkitwebviewprivate.h +++ b/WebKit/gtk/webkit/webkitwebviewprivate.h @@ -52,26 +52,26 @@ extern "C" { typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; struct _WebKitWebViewPrivate { WebCore::Page* corePage; - PlatformRefPtr<WebKitWebSettings> webSettings; - PlatformRefPtr<WebKitWebInspector> webInspector; - PlatformRefPtr<WebKitViewportAttributes> viewportAttributes; - PlatformRefPtr<WebKitWebWindowFeatures> webWindowFeatures; + GRefPtr<WebKitWebSettings> webSettings; + GRefPtr<WebKitWebInspector> webInspector; + GRefPtr<WebKitViewportAttributes> viewportAttributes; + GRefPtr<WebKitWebWindowFeatures> webWindowFeatures; WebKitWebFrame* mainFrame; - PlatformRefPtr<WebKitWebBackForwardList> backForwardList; + GRefPtr<WebKitWebBackForwardList> backForwardList; - PlatformRefPtr<GtkMenu> currentMenu; + GRefPtr<GtkMenu> currentMenu; gint lastPopupXPosition; gint lastPopupYPosition; HashSet<GtkWidget*> children; bool editable; - PlatformRefPtr<GtkIMContext> imContext; + GRefPtr<GtkIMContext> imContext; gboolean transparent; - PlatformRefPtr<GtkAdjustment> horizontalAdjustment; - PlatformRefPtr<GtkAdjustment> verticalAdjustment; + GRefPtr<GtkAdjustment> horizontalAdjustment; + GRefPtr<GtkAdjustment> verticalAdjustment; #ifndef GTK_API_VERSION_2 // GtkScrollablePolicy needs to be checked when @@ -96,9 +96,9 @@ struct _WebKitWebViewPrivate { // These are hosted here because the DataSource object is // created too late in the frame loading process. - PlatformRefPtr<WebKitWebResource> mainResource; + GRefPtr<WebKitWebResource> mainResource; CString mainResourceIdentifier; - PlatformRefPtr<GHashTable> subResources; + GRefPtr<GHashTable> subResources; CString tooltipText; WebCore::IntRect tooltipArea; diff --git a/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp b/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp index ddc657d..93e08ac 100644 --- a/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp +++ b/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp @@ -19,10 +19,11 @@ */ #include "config.h" +#include "webkitwebwindowfeatures.h" #include "WindowFeatures.h" -#include "webkitwebwindowfeatures.h" -#include "webkitprivate.h" +#include "webkitglobalsprivate.h" +#include "webkitwebwindowfeaturesprivate.h" /** * SECTION:webkitwebwindowfeatures @@ -100,7 +101,7 @@ static void webkit_web_window_features_class_init(WebKitWebWindowFeaturesClass* GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT); - webkit_init(); + webkitInit(); /** * WebKitWebWindowFeatures:x: @@ -378,35 +379,6 @@ WebKitWebWindowFeatures* webkit_web_window_features_new() return WEBKIT_WEB_WINDOW_FEATURES(g_object_new(WEBKIT_TYPE_WEB_WINDOW_FEATURES, NULL)); } -// for internal use only -WebKitWebWindowFeatures* webkit_web_window_features_new_from_core_features(const WebCore::WindowFeatures& features) -{ - WebKitWebWindowFeatures *webWindowFeatures = webkit_web_window_features_new(); - - if(features.xSet) - g_object_set(webWindowFeatures, "x", static_cast<int>(features.x), NULL); - - if(features.ySet) - g_object_set(webWindowFeatures, "y", static_cast<int>(features.y), NULL); - - if(features.widthSet) - g_object_set(webWindowFeatures, "width", static_cast<int>(features.width), NULL); - - if(features.heightSet) - g_object_set(webWindowFeatures, "height", static_cast<int>(features.height), NULL); - - g_object_set(webWindowFeatures, - "toolbar-visible", features.toolBarVisible, - "statusbar-visible", features.statusBarVisible, - "scrollbar-visible", features.scrollbarsVisible, - "menubar-visible", features.menuBarVisible, - "locationbar-visible", features.locationBarVisible, - "fullscreen", features.fullscreen, - NULL); - - return webWindowFeatures; -} - /** * webkit_web_window_features_equal: * @features1: a #WebKitWebWindowFeatures instance @@ -443,3 +415,35 @@ gboolean webkit_web_window_features_equal(WebKitWebWindowFeatures* features1, We return TRUE; return FALSE; } + +namespace WebKit { + +WebKitWebWindowFeatures* kitNew(const WebCore::WindowFeatures& features) +{ + WebKitWebWindowFeatures *webWindowFeatures = webkit_web_window_features_new(); + + if(features.xSet) + g_object_set(webWindowFeatures, "x", static_cast<int>(features.x), NULL); + + if(features.ySet) + g_object_set(webWindowFeatures, "y", static_cast<int>(features.y), NULL); + + if(features.widthSet) + g_object_set(webWindowFeatures, "width", static_cast<int>(features.width), NULL); + + if(features.heightSet) + g_object_set(webWindowFeatures, "height", static_cast<int>(features.height), NULL); + + g_object_set(webWindowFeatures, + "toolbar-visible", features.toolBarVisible, + "statusbar-visible", features.statusBarVisible, + "scrollbar-visible", features.scrollbarsVisible, + "menubar-visible", features.menuBarVisible, + "locationbar-visible", features.locationBarVisible, + "fullscreen", features.fullscreen, + NULL); + + return webWindowFeatures; +} + +} diff --git a/WebKit/gtk/webkit/webkitwebwindowfeaturesprivate.h b/WebKit/gtk/webkit/webkitwebwindowfeaturesprivate.h new file mode 100644 index 0000000..6ea919b --- /dev/null +++ b/WebKit/gtk/webkit/webkitwebwindowfeaturesprivate.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther + * Copyright (C) 2008 Jan Michael C. Alonzo + * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Igalia S.L. + * + * 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 webkitwebwindowfeaturesprivate_h +#define webkitwebwindowfeaturesprivate_h + +#include "webkitwebwindowfeatures.h" + +namespace WebKit { + +WebKitWebWindowFeatures* kitNew(const WebCore::WindowFeatures&); + +} + +#endif |