diff options
author | Steve Block <steveblock@google.com> | 2011-05-06 11:45:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-12 13:44:10 +0100 |
commit | cad810f21b803229eb11403f9209855525a25d57 (patch) | |
tree | 29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /WebKit/gtk | |
parent | 121b0cf4517156d0ac5111caf9830c51b69bae8f (diff) | |
download | external_webkit-cad810f21b803229eb11403f9209855525a25d57.zip external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2 |
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'WebKit/gtk')
55 files changed, 1136 insertions, 597 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 59f09af..1bf56f2 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,352 @@ +2011-01-07 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Move WebCore to Source + https://bugs.webkit.org/show_bug.cgi?id=52050 + + * GNUmakefile.am: + +2011-01-07 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + GTK: AX: atk tests need to be updated after recent changes + https://bugs.webkit.org/show_bug.cgi?id=51932 + + Fix gtk_widget_get_accessible() in WebKitWebView to keep returning + the AtkObject of role ATK_ROLE_DOCUMENT_FRAME. + + With the change to support WK2 accessibility, the root object of + the AX hierarchy is different from what GTK expects as the current + hirarchy right now includes a new accessible object as the parent + of the accessible web area (AXScrollView). + + * webkit/webkitwebview.cpp: + (webkit_web_view_get_accessible): Return the first child of the + wrapper associated to the root accessible object in the document, + to keep everything in the GTK port working as it used to be. + + Re-enable skipped ATK unit tests now they are passing again. + + * tests/testatk.c: + (main): Re-enable skipped tests. + * tests/testatkroles.c: + (main): Ditto. + +2011-01-06 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + GTK: AX: atk tests need to be updated after recent changes + https://bugs.webkit.org/show_bug.cgi?id=51932 + + Skip ATK unit tests until we can look into what is causing these failures. + + * tests/testatk.c: + (main): Skip all tests. + * tests/testatkroles.c: + (main): Ditto. + +2011-01-06 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + Include a new header in the static headers list. This is necessary + so that "make install" installs the header. + + * GNUmakefile.am: Include webkitglobals.h in the header list. + +2011-01-05 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha. + + Build fix for GTK+ 3.x. Remove the call to gtk_range_set_update_policy. + GTK+ 3.x has removed this method and the default in GTK+ 2.x is continuous, + so this call is unnecessary. + + * WebCoreSupport/FullscreenVideoController.cpp: + (FullscreenVideoController::createHud): Remove call to gtk_range_set_update_policy(). + +2011-01-04 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Martin Robinson. + + GTK: AX: DRT needs to use correct root object method. + https://bugs.webkit.org/show_bug.cgi?id=51911 + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::getRootAccessibleElement): + (DumpRenderTreeSupportGtk::getFocusedAccessibleElement): + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + +2011-01-04 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Sam Weinig. + + WK2: Support Accessibility + https://bugs.webkit.org/show_bug.cgi?id=51859 + + Use rootObject() method to get top of ax tree. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::getFocusedAccessibleElement): + * webkit/webkitwebview.cpp: + (webkit_web_view_get_accessible): + +2011-01-03 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Darin Adler. + + Remove the last non-GObject usage of PlatformRefPtr and move the code to GRefPtr + https://bugs.webkit.org/show_bug.cgi?id=51846 + + Changed all references to PlatformRefPtr in GTK+ code to GRefPtr. + +2011-01-03 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Martin Robinson. + + [GTK] Split webkitprivate.{cpp,h} in more manageable chunks + https://bugs.webkit.org/show_bug.cgi?id=50698 + + Final patch, removing webkitprivate.{cpp,h}, and adding a + webkitglobals module to hold non-object-specific functions and + definitions that do not make sense on their own. + + * GNUmakefile.am: + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::createWindow): + * WebCoreSupport/ContextMenuClientGtk.cpp: + * WebCoreSupport/DocumentLoaderGtk.cpp: + (WebKit::DocumentLoader::attachToFrame): + * WebCoreSupport/DragClientGtk.cpp: + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::ignoreWordInSpellDocument): + (WebKit::EditorClient::learnWord): + (WebKit::EditorClient::checkSpellingOfString): + (WebKit::EditorClient::getGuessesForWord): + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::createDocumentLoader): + * WebCoreSupport/InspectorClientGtk.cpp: + * webkit/webkit.h: + * webkit/webkitapplicationcache.cpp: + (webkit_application_cache_set_maximum_size): + * webkit/webkitdownload.cpp: + (webkit_download_class_init): + * webkit/webkitgeolocationpolicydecision.cpp: + * webkit/webkitglobals.cpp: Added. + (webkit_get_default_session): + (webkit_set_cache_model): + (webkit_get_cache_model): + (webkit_get_web_plugin_database): + (currentToplevelCallback): + (closeIconDatabaseOnExit): + (webkitInit): + (WebKit::pasteboardHelperInstance): + * webkit/webkitglobals.h: Added. + * webkit/webkitglobalsprivate.h: Copied from WebKit/gtk/webkit/webkitwebsettingsprivate.h. + * webkit/webkithittestresult.cpp: + (webkit_hit_test_result_class_init): + * webkit/webkitnetworkrequest.cpp: + (webkit_network_request_class_init): + * webkit/webkitnetworkresponse.cpp: + (webkit_network_response_class_init): + * webkit/webkitprivate.cpp: Removed. + * webkit/webkitprivate.h: Removed. + * webkit/webkitsecurityorigin.cpp: + * webkit/webkitviewportattributes.cpp: + * webkit/webkitwebbackforwardlist.cpp: + (webkit_web_back_forward_list_class_init): + * webkit/webkitwebdatabase.cpp: + * webkit/webkitwebdatasource.cpp: + (webkit_web_data_source_class_init): + (webkit_web_data_source_new_with_request): + (WebKit::kitNew): + * webkit/webkitwebframe.cpp: + (webkit_web_frame_class_init): + * webkit/webkitwebframeprivate.h: + * webkit/webkitwebhistoryitem.cpp: + (webkit_web_history_item_class_init): + * webkit/webkitwebinspector.cpp: + * webkit/webkitwebnavigationaction.cpp: + * webkit/webkitwebplugin.cpp: + (webkit_web_plugin_class_init): + * webkit/webkitwebplugindatabase.cpp: + (webkit_web_plugin_database_class_init): + * webkit/webkitwebpluginprivate.h: + * webkit/webkitwebpolicydecision.cpp: + * webkit/webkitwebresource.cpp: + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + (webkitWebViewGetEnchantDicts): + (WebKit::core): + * webkit/webkitwebsettingsprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + (webkit_web_view_update_settings): + (webkit_web_view_settings_notify): + * webkit/webkitwebview.h: + * webkit/webkitwebwindowfeatures.cpp: + (webkit_web_window_features_class_init): + (WebKit::kitNew): + +2011-01-02 Xan Lopez <xlopez@igalia.com> + + Fix GTK+ build. + + * GNUmakefile.am: tests do actually include JSC. + +2011-01-02 Xan Lopez <xlopez@igalia.com> + + Fix GTK+ build. + + * GNUmakefile.am: remove individual -I$(srcdir)/Source when we'll + already get them from javascriptcore_cppflags, and add it for the + introspection build (which is not tested in the bots). + +2011-01-02 Adam Barth <abarth@webkit.org> + + Speculative build fix for GTK. Add Source to the include paths. + + * GNUmakefile.am: + +2011-01-01 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move JavaScriptCore to Source + https://bugs.webkit.org/show_bug.cgi?id=51604 + + * GNUmakefile.am: + * docs/GNUmakefile.am: + - Point to JavaScriptCore in its new location. + +2010-12-29 Martin Robinson <mrobinson@igalia.com> + + Build fix for GTK+. + + * webkit/webkitwebinspector.cpp: Add missing DumpRenderTreeSupportGtk include. + +2010-12-29 Martin Robinson <mrobinson@igalia.com> + + [GTK] GSettings warning is concealing real warnings on the build bots + https://bugs.webkit.org/show_bug.cgi?id=51691 + + Reviewed by Xan Lopez. + + Do not print the GSettings warning message when running in DumpRenderTree. + + * webkit/webkitwebinspector.cpp: + (inspectorGSettings): Do not print the GSettings warning if we are running + in DumpRenderTree. This should clean up the test results page a great deal. + +2010-12-28 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Closing a window during an onload event can trigger serious GLib warnings + https://bugs.webkit.org/show_bug.cgi?id=51686 + + Don't emit the close-web-view signal immediately during execution of closeWindowSoon. + The signal handler may choose to destroy the web view while handling that signal, + which may remove the last reference to the web view. FrameLoaderClient depends on the + view still existing though. Instead, let the caller finish executing and emit the signal + after a 0 length timeout. This matches the behavior on the Windows and Mac ports. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::ChromeClient): Initialize the timer id. + (WebKit::emitCloseWebViewSignalLater): Callback for the timer. + (WebKit::ChromeClient::closeWindowSoon): Do the actual signal invocation after + the caller finishes its tasks. + * WebCoreSupport/ChromeClientGtk.h: Add a new member for the timer id. We + can use this to prevent emitting the close-web-view signal twice. + +2010-12-28 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Eric Seidel. + + [GTK] Clean up usage of NULL in webkitwebframe.cpp + https://bugs.webkit.org/show_bug.cgi?id=51685 + + Replace occurrences of NULL with 0, in webkitwebframe.cpp. Not all + uses of NULL have been changed, as certain GLib functions require + an explicit NULL as a sentinel. + + * webkit/webkitwebframe.cpp: + (webkit_web_frame_get_data_source_from_core_loader): + (webkit_web_frame_class_init): + (webkit_web_frame_new): + (webkit_web_frame_get_title): + (webkit_web_frame_get_uri): + (webkit_web_frame_get_web_view): + (webkit_web_frame_get_name): + (webkit_web_frame_get_parent): + (webkit_web_frame_load_string): + (webkit_web_frame_load_alternate_string): + (webkit_web_frame_find_frame): + (webkit_web_frame_get_global_context): + (webkit_web_frame_get_data_source): + (webkit_web_frame_get_provisional_data_source): + (webkit_web_frame_print_full): + (webkit_web_frame_get_security_origin): + (webkit_web_frame_get_network_response): + +2010-12-27 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Ryosuke Niwa. + + [GTK] EditorClient::generateEditorCommands queues up "null string" commands + https://bugs.webkit.org/show_bug.cgi?id=51569 + + Prevent adding "null string" editor commands by first checking whether or not + the command string is null in generateEditorCommands before appending it to the + list of pending editor command strings. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::EditorClient::generateEditorCommands): Check for the null string (no + command for this key combination) before appending a command string to the list of + pending editor commands. + (WebKit::EditorClient::executePendingEditorCommands): Add an ASSERT which detects + null command strings. + +2010-12-27 Xan Lopez <xlopez@igalia.com> + + Reviewed by Martin Robinson. + + Remove unneeded includes from our headers. + + * WebCoreSupport/PasteboardHelperGtk.h: ditto. + * webkit/webkitprivate.h: ditto. + * webkit/webkitsoupauthdialog.h: ditto. + +2010-12-21 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Seidel. + + [GTK] minimal build with --database fails + https://bugs.webkit.org/show_bug.cgi?id=51394 + + * webkit/webkitprivate.cpp: + (webkit_init): Use cacheStorage() only if the + OFFLINE_WEB_APPLICATIONS feature is enabled. + +2010-12-22 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + WebKit2 needs to mirror the frame tree in the UIProcess + https://bugs.webkit.org/show_bug.cgi?id=51546 + + - Add client functions to notify that a frame has been added or + removed from the page cache. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::didSaveToPageCache): + (WebKit::FrameLoaderClient::didRestoreFromPageCache): + * WebCoreSupport/FrameLoaderClientGtk.h: + 2010-12-22 Xan Lopez <xlopez@igalia.com> Reviewed by Gustavo Noronha. diff --git a/WebKit/gtk/GNUmakefile.am b/WebKit/gtk/GNUmakefile.am index 256122c..59ac8ac 100644 --- a/WebKit/gtk/GNUmakefile.am +++ b/WebKit/gtk/GNUmakefile.am @@ -108,12 +108,13 @@ libwebkitgtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_LIBA $(OLE32_LIBS) webkitgtk_static_h_api += \ - $(srcdir)/WebCore/platform/network/soup/cache/webkit/soup-cache.h \ + $(srcdir)/Source/WebCore/platform/network/soup/cache/webkit/soup-cache.h \ $(srcdir)/WebKit/gtk/webkit/webkit.h \ $(srcdir)/WebKit/gtk/webkit/webkitdefines.h \ $(srcdir)/WebKit/gtk/webkit/webkitdownload.h \ $(srcdir)/WebKit/gtk/webkit/webkiterror.h \ $(srcdir)/WebKit/gtk/webkit/webkitgeolocationpolicydecision.h \ + $(srcdir)/WebKit/gtk/webkit/webkitglobals.h \ $(srcdir)/WebKit/gtk/webkit/webkithittestresult.h \ $(srcdir)/WebKit/gtk/webkit/webkitnetworkrequest.h \ $(srcdir)/WebKit/gtk/webkit/webkitnetworkresponse.h \ @@ -154,6 +155,21 @@ webkitgtk_built_sources += \ BUILT_SOURCES += $(webkitgtk_built_sources) webkitgtk_sources += \ + Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp \ + Source/WebCore/bindings/gobject/ConvertToUTF8String.h \ + Source/WebCore/bindings/gobject/DOMObjectCache.cpp \ + Source/WebCore/bindings/gobject/DOMObjectCache.h \ + Source/WebCore/bindings/gobject/GObjectEventListener.cpp \ + Source/WebCore/bindings/gobject/GObjectEventListener.h \ + Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp \ + Source/WebCore/bindings/gobject/WebKitDOMBinding.h \ + Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp \ + Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h \ + Source/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h \ + Source/WebCore/bindings/gobject/WebKitDOMObject.cpp \ + Source/WebCore/bindings/gobject/WebKitDOMObject.h \ + Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \ + Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \ WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \ WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \ WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \ @@ -176,18 +192,20 @@ webkitgtk_sources += \ WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \ WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \ WebKit/gtk/webkit/webkitapplicationcache.cpp \ + WebKit/gtk/webkit/webkitapplicationcacheprivate.h \ WebKit/gtk/webkit/webkitdownload.cpp \ WebKit/gtk/webkit/webkitdownloadprivate.h \ WebKit/gtk/webkit/webkiterror.cpp \ WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp \ + WebKit/gtk/webkit/webkitglobals.cpp \ + WebKit/gtk/webkit/webkitglobals.h \ + WebKit/gtk/webkit/webkitglobalsprivate.h \ WebKit/gtk/webkit/webkithittestresult.cpp \ WebKit/gtk/webkit/webkithittestresultprivate.h \ WebKit/gtk/webkit/webkitnetworkrequest.cpp \ WebKit/gtk/webkit/webkitnetworkrequestprivate.h \ WebKit/gtk/webkit/webkitnetworkresponse.cpp \ WebKit/gtk/webkit/webkitnetworkresponseprivate.h \ - WebKit/gtk/webkit/webkitprivate.cpp \ - WebKit/gtk/webkit/webkitprivate.h \ WebKit/gtk/webkit/webkitsecurityorigin.cpp \ WebKit/gtk/webkit/webkitsecurityoriginprivate.h \ WebKit/gtk/webkit/webkitsoupauthdialog.c \ @@ -249,12 +267,13 @@ $(WEBKIT_GIRSOURCES): $(G_IR_SCANNER) $(JSCORE_GIRSOURCES) libwebkitgtk-@WEBKITG --output=$@ \ --add-include-path=$(WebKit) \ --add-include-path=$(top_builddir) \ - -I$(top_srcdir)/WebCore/platform/network/soup/cache \ + -I$(srcdir)/Source \ + -I$(top_srcdir)/Source/WebCore/platform/network/soup/cache \ -I$(WebKit) \ -I$(GENSOURCES) \ -I$(GENSOURCES_WEBKIT) \ -I$(top_builddir)/WebKit/gtk \ - -I$(top_srcdir)/JavaScriptCore/ForwardingHeaders \ + -I$(top_srcdir)/Source/JavaScriptCore/ForwardingHeaders \ -I$(top_srcdir) \ $(GENSOURCES_WEBKIT)/webkitenumtypes.h \ $(webkitgtk_h_api) \ @@ -366,15 +385,16 @@ dist_resources_DATA = \ noinst_PROGRAMS += $(TEST_PROGS) webkit_tests_cflags = \ -fno-strict-aliasing \ - -I$(srcdir)/JavaScriptCore/ForwardingHeaders \ + -I$(srcdir)/Source/JavaScriptCore/ForwardingHeaders \ -I$(WebCore)/platform/network/soup/cache \ -I$(WebKit) \ -I$(GENSOURCES) \ -I$(top_builddir)/WebKit/gtk \ - -I$(top_srcdir)/WebCore/bindings \ - -I$(top_srcdir)/WebCore/bindings/gobject \ + -I$(top_srcdir)/Source/WebCore/bindings \ + -I$(top_srcdir)/Source/WebCore/bindings/gobject \ $(global_cppflags) \ $(global_cflags) \ + $(javascriptcore_cppflags) \ $(GLIB_CFLAGS) \ $(GTK_CFLAGS) \ $(LIBSOUP_CFLAGS) @@ -529,10 +549,10 @@ Programs_unittests_testkeyevents_LDADD = $(webkit_tests_ldadd) Programs_unittests_testkeyevents_LDFLAGS = $(webkit_tests_ldflags) Programs_unittests_testcopyandpaste_SOURCES = WebKit/gtk/tests/testcopyandpaste.c \ - WebCore/platform/gtk/GtkVersioning.c + Source/WebCore/platform/gtk/GtkVersioning.c Programs_unittests_testcopyandpaste_CFLAGS = $(webkit_tests_cflags) \ - -I$(srcdir)/WebCore/platform/gtk \ - -I$(srcdir)/WebCore + -I$(srcdir)/Source/WebCore/platform/gtk \ + -I$(srcdir)/Source/WebCore Programs_unittests_testcopyandpaste_LDADD = $(webkit_tests_ldadd) Programs_unittests_testcopyandpaste_LDFLAGS = $(webkit_tests_ldflags) diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 12f4f14..7f39d37 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -48,13 +48,14 @@ #include "SecurityOrigin.h" #include "WindowFeatures.h" #include "webkitgeolocationpolicydecision.h" +#include "webkitgeolocationpolicydecisionprivate.h" #include "webkitnetworkrequest.h" -#include "webkitprivate.h" #include "webkitsecurityoriginprivate.h" #include "webkitviewportattributesprivate.h" #include "webkitwebframeprivate.h" #include "webkitwebview.h" #include "webkitwebviewprivate.h" +#include "webkitwebwindowfeaturesprivate.h" #include <glib.h> #include <glib/gi18n-lib.h> #include <gtk/gtk.h> @@ -70,6 +71,7 @@ namespace WebKit { ChromeClient::ChromeClient(WebKitWebView* webView) : m_webView(webView) + , m_closeSoonTimer(0) { ASSERT(m_webView); } @@ -155,9 +157,8 @@ Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoad if (!webView) return 0; - WebKitWebWindowFeatures* webWindowFeatures = webkit_web_window_features_new_from_core_features(coreFeatures); - g_object_set(webView, "window-features", webWindowFeatures, NULL); - g_object_unref(webWindowFeatures); + GRefPtr<WebKitWebWindowFeatures> webWindowFeatures(adoptGRef(kitNew(coreFeatures))); + g_object_set(webView, "window-features", webWindowFeatures.get(), NULL); if (!frameLoadRequest.isEmpty()) webkit_web_view_open(webView, frameLoadRequest.resourceRequest().url().string().utf8().data()); @@ -249,19 +250,37 @@ void ChromeClient::setResizable(bool) // Ignored for now } +static gboolean emitCloseWebViewSignalLater(WebKitWebView* view) +{ + gboolean isHandled; + g_signal_emit_by_name(view, "close-web-view", &isHandled); + return FALSE; +} + void ChromeClient::closeWindowSoon() { // We may not have a WebView as create-web-view can return NULL. if (!m_webView) return; + if (m_closeSoonTimer) // Don't call close-web-view more than once. + return; - webkit_web_view_stop_loading(m_webView); + // We need to remove the parent WebView from WebViewSets here, before it actually + // closes, to make sure that JavaScript code that executes before it closes + // can't find it. Otherwise, window.open will select a closed WebView instead of + // opening a new one <rdar://problem/3572585>. + m_webView->priv->corePage->setGroupName(""); - gboolean isHandled = false; - g_signal_emit_by_name(m_webView, "close-web-view", &isHandled); + // We also need to stop the load to prevent further parsing or JavaScript execution + // after the window has torn down <rdar://problem/4161660>. + webkit_web_view_stop_loading(m_webView); - if (isHandled) - return; + // Clients commonly destroy the web view during the close-web-view signal, but our caller + // may need to send more signals to the web view. For instance, if this happened in the + // onload handler, it will need to call FrameLoaderClient::dispatchDidHandleOnloadEvents. + // Instead of firing the close-web-view signal now, fire it after the caller finishes. + // This seems to match the Mac/Windows port behavior. + m_closeSoonTimer = g_timeout_add(0, reinterpret_cast<GSourceFunc>(emitCloseWebViewSignalLater), m_webView); } bool ChromeClient::canTakeFocus(FocusDirection) @@ -638,7 +657,7 @@ void ChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocatio WebKitWebFrame* webFrame = kit(frame); WebKitWebView* webView = getViewFromFrame(webFrame); - PlatformRefPtr<WebKitGeolocationPolicyDecision> policyDecision(adoptPlatformRef(webkit_geolocation_policy_decision_new(webFrame, geolocation))); + GRefPtr<WebKitGeolocationPolicyDecision> policyDecision(adoptGRef(webkit_geolocation_policy_decision_new(webFrame, geolocation))); gboolean isHandled = FALSE; g_signal_emit_by_name(webView, "geolocation-policy-decision-requested", webFrame, policyDecision.get(), &isHandled); diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index e9f1c83..d607c54 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -154,6 +154,7 @@ namespace WebKit { private: WebKitWebView* m_webView; WebCore::KURL m_hoveredLinkURL; + unsigned int m_closeSoonTimer; }; } diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp index 137f9ab..d9c59d0 100644 --- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp @@ -26,7 +26,6 @@ #include "KURL.h" #include "NotImplemented.h" #include "Page.h" -#include "webkitprivate.h" #include "webkitwebviewprivate.h" #include <glib-object.h> #include <glib/gi18n-lib.h> diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp index 2b355cb..6031b62 100644 --- a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp @@ -30,8 +30,9 @@ #include "config.h" #include "DocumentLoaderGtk.h" -#include "webkitprivate.h" +#include "GRefPtr.h" #include "webkitwebdatasource.h" +#include "webkitwebdatasourceprivate.h" using namespace WebCore; @@ -68,9 +69,8 @@ void DocumentLoader::attachToFrame() // We may get to here without having a datasource, when the data // is coming from the page cache. - WebKitWebDataSource* dataSource = webkit_web_data_source_new_with_loader(this); - setDataSource(dataSource); - g_object_unref(dataSource); + GRefPtr<WebKitWebDataSource> dataSource(adoptGRef(kitNew(this))); + setDataSource(dataSource.get()); } void DocumentLoader::detachFromFrame() diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp index 5f391ec..c92c083 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp @@ -32,7 +32,6 @@ #include "NotImplemented.h" #include "PasteboardHelper.h" #include "RenderObject.h" -#include "webkitprivate.h" #include "webkitwebframeprivate.h" #include "webkitwebviewprivate.h" #include "webkitwebview.h" @@ -104,7 +103,7 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject(); - PlatformRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get())); + GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get())); GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event()); GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get()); diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.h b/WebKit/gtk/WebCoreSupport/DragClientGtk.h index 086ec69..9c6d948 100644 --- a/WebKit/gtk/WebCoreSupport/DragClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.h @@ -59,7 +59,7 @@ namespace WebKit { private: WebKitWebView* m_webView; WebCore::IntPoint m_startPos; - PlatformRefPtr<GtkWidget> m_dragIconWindow; + GRefPtr<GtkWidget> m_dragIconWindow; RefPtr<cairo_surface_t> m_dragImage; }; } diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index a751c77..dabe4b5 100644 --- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -21,15 +21,16 @@ #include "config.h" #include "DumpRenderTreeSupportGtk.h" -#include "AccessibilityObjectWrapperAtk.h" -#include "AnimationController.h" #include "APICast.h" #include "AXObjectCache.h" +#include "AccessibilityObjectWrapperAtk.h" +#include "AnimationController.h" +#include "DOMWrapperWorld.h" #include "Document.h" #include "FocusController.h" #include "FrameLoaderClientGtk.h" -#include "FrameView.h" #include "FrameTree.h" +#include "FrameView.h" #include "GCController.h" #include "GraphicsContext.h" #include "JSDOMWindow.h" @@ -43,21 +44,20 @@ #include "PlatformString.h" #include "PrintContext.h" #include "RenderListItem.h" -#include "RenderView.h" #include "RenderTreeAsText.h" +#include "RenderView.h" #include "SecurityOrigin.h" -#if ENABLE(SVG) -#include "SVGSMILElement.h" -#endif #include "WorkerThread.h" -#include "webkitprivate.h" +#include "webkitwebframe.h" #include "webkitwebframeprivate.h" -#include "webkitwebviewprivate.h" #include "webkitwebview.h" -#include "webkitwebframe.h" -#include "DOMWrapperWorld.h" +#include "webkitwebviewprivate.h" #include <JavaScriptCore/APICast.h> +#if ENABLE(SVG) +#include "SVGSMILElement.h" +#endif + using namespace JSC; using namespace WebCore; using namespace WebKit; @@ -413,7 +413,7 @@ void DumpRenderTreeSupportGtk::clearMainFrameName(WebKitWebFrame* frame) core(frame)->tree()->clearName(); } -AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame* frame) +AtkObject* DumpRenderTreeSupportGtk::getRootAccessibleElement(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0); @@ -425,11 +425,20 @@ AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame* if (!priv->coreFrame || !priv->coreFrame->document()) return 0; - RenderView* root = toRenderView(priv->coreFrame->document()->renderer()); - if (!root) + AtkObject* wrapper = priv->coreFrame->document()->axObjectCache()->rootObject()->wrapper(); + if (!wrapper) return 0; - AtkObject* wrapper = priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper(); + return wrapper; +#else + return 0; +#endif +} + +AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame* frame) +{ +#if HAVE(ACCESSIBILITY) + AtkObject* wrapper = getRootAccessibleElement(frame); if (!wrapper) return 0; diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 61764ab..663f13a 100644 --- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -64,6 +64,7 @@ public: static void resumeAnimations(WebKitWebFrame*); static void clearMainFrameName(WebKitWebFrame*); static AtkObject* getFocusedAccessibleElement(WebKitWebFrame*); + static AtkObject* getRootAccessibleElement(WebKitWebFrame*); static void layoutFrame(WebKitWebFrame*); // WebKitWebView diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index 0522f87..ee9bf9a 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -44,8 +44,8 @@ #include "WebKitDOMNodePrivate.h" #include "WebKitDOMRangePrivate.h" #include "WindowsKeyboardCodes.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" #include "webkitwebsettingsprivate.h" #include "webkitwebviewprivate.h" #include <wtf/text/CString.h> @@ -270,7 +270,7 @@ void EditorClient::setInputMethodState(bool active) bool EditorClient::shouldDeleteRange(Range* range) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); g_signal_emit_by_name(m_webView, "should-delete-range", kitRange.get(), &accept); return accept; } @@ -278,7 +278,7 @@ bool EditorClient::shouldDeleteRange(Range* range) bool EditorClient::shouldShowDeleteInterface(HTMLElement* element) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMHTMLElement> kitElement(adoptPlatformRef(kit(element))); + GRefPtr<WebKitDOMHTMLElement> kitElement(adoptGRef(kit(element))); g_signal_emit_by_name(m_webView, "should-show-delete-interface-for-element", kitElement.get(), &accept); return accept; } @@ -310,7 +310,7 @@ bool EditorClient::shouldBeginEditing(WebCore::Range* range) clearPendingComposition(); gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); g_signal_emit_by_name(m_webView, "should-begin-editing", kitRange.get(), &accept); return accept; } @@ -320,7 +320,7 @@ bool EditorClient::shouldEndEditing(WebCore::Range* range) clearPendingComposition(); gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); g_signal_emit_by_name(m_webView, "should-end-editing", kitRange.get(), &accept); return accept; } @@ -342,7 +342,7 @@ static WebKitInsertAction kit(EditorInsertAction action) bool EditorClient::shouldInsertText(const String& string, Range* range, EditorInsertAction action) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); g_signal_emit_by_name(m_webView, "should-insert-text", string.utf8().data(), kitRange.get(), kit(action), &accept); return accept; } @@ -362,8 +362,8 @@ static WebKitSelectionAffinity kit(EAffinity affinity) bool EditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitFromRange(fromRange ? adoptPlatformRef(kit(fromRange)) : 0); - PlatformRefPtr<WebKitDOMRange> kitToRange(toRange ? adoptPlatformRef(kit(toRange)) : 0); + GRefPtr<WebKitDOMRange> kitFromRange(fromRange ? adoptGRef(kit(fromRange)) : 0); + GRefPtr<WebKitDOMRange> kitToRange(toRange ? adoptGRef(kit(toRange)) : 0); g_signal_emit_by_name(m_webView, "should-change-selected-range", kitFromRange.get(), kitToRange.get(), kit(affinity), stillSelecting, &accept); return accept; @@ -372,8 +372,8 @@ bool EditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, E bool EditorClient::shouldApplyStyle(WebCore::CSSStyleDeclaration* declaration, WebCore::Range* range) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMCSSStyleDeclaration> kitDeclaration(kit(declaration)); - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); + GRefPtr<WebKitDOMCSSStyleDeclaration> kitDeclaration(kit(declaration)); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); g_signal_emit_by_name(m_webView, "should-apply-style", kitDeclaration.get(), kitRange.get(), &accept); return accept; } @@ -543,8 +543,8 @@ void EditorClient::redo() bool EditorClient::shouldInsertNode(Node* node, Range* range, EditorInsertAction action) { gboolean accept = TRUE; - PlatformRefPtr<WebKitDOMRange> kitRange(adoptPlatformRef(kit(range))); - PlatformRefPtr<WebKitDOMNode> kitNode(adoptPlatformRef(kit(node))); + GRefPtr<WebKitDOMRange> kitRange(adoptGRef(kit(range))); + GRefPtr<WebKitDOMNode> kitNode(adoptGRef(kit(node))); g_signal_emit_by_name(m_webView, "should-insert-node", kitNode.get(), kitRange.get(), kit(action), &accept); return accept; } @@ -652,24 +652,23 @@ void EditorClient::generateEditorCommands(const KeyboardEvent* event) if (event->ctrlKey()) modifiers |= CtrlKey; - - if (event->type() == eventNames().keydownEvent) { - int mapKey = modifiers << 16 | event->keyCode(); - if (mapKey) - m_pendingEditorCommands.append(keyDownCommandsMap.get(mapKey)); + // For keypress events, we want charCode(), but keyCode() does that. + int mapKey = modifiers << 16 | event->keyCode(); + if (!mapKey) return; - } - - int mapKey = modifiers << 16 | event->charCode(); - if (mapKey) - m_pendingEditorCommands.append(keyPressCommandsMap.get(mapKey)); + HashMap<int, const char*>* commandMap = event->type() == eventNames().keydownEvent ? + &keyDownCommandsMap : &keyPressCommandsMap; + if (const char* commandString = commandMap->get(mapKey)) + m_pendingEditorCommands.append(commandString); } bool EditorClient::executePendingEditorCommands(Frame* frame, bool allowTextInsertion) { Vector<Editor::Command> commands; for (size_t i = 0; i < m_pendingEditorCommands.size(); i++) { - Editor::Command command = frame->editor()->command(m_pendingEditorCommands.at(i)); + const char* commandString = m_pendingEditorCommands.at(i); + ASSERT(commandString); + Editor::Command command = frame->editor()->command(commandString); if (command.isTextInsertion() && !allowTextInsertion) return false; @@ -890,7 +889,7 @@ void EditorClient::textDidChangeInTextArea(Element*) void EditorClient::ignoreWordInSpellDocument(const String& text) { - GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView); + GSList* dicts = webkitWebViewGetEnchantDicts(m_webView); for (; dicts; dicts = dicts->next) { EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); @@ -901,7 +900,7 @@ void EditorClient::ignoreWordInSpellDocument(const String& text) void EditorClient::learnWord(const String& text) { - GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView); + GSList* dicts = webkitWebViewGetEnchantDicts(m_webView); for (; dicts; dicts = dicts->next) { EnchantDict* dict = static_cast<EnchantDict*>(dicts->data); @@ -912,7 +911,7 @@ void EditorClient::learnWord(const String& text) void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) { - GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView); + GSList* dicts = webkitWebViewGetEnchantDicts(m_webView); if (!dicts) return; @@ -1005,7 +1004,7 @@ bool EditorClient::spellingUIIsShowing() void EditorClient::getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses) { - GSList* dicts = webkit_web_settings_get_enchant_dicts(m_webView); + GSList* dicts = webkitWebViewGetEnchantDicts(m_webView); guesses.clear(); for (; dicts; dicts = dicts->next) { diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h index f2db1d9..214dbd6 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h @@ -140,7 +140,7 @@ namespace WebKit { bool m_treatContextCommitAsKeyEvent; GOwnPtr<gchar> m_pendingComposition; Vector<const char*> m_pendingEditorCommands; - PlatformRefPtr<GtkWidget> m_nativeWidget; + GRefPtr<GtkWidget> m_nativeWidget; }; } diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 9bac2d0..13cbc59 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -58,14 +58,17 @@ #include "ResourceHandle.h" #include "ResourceRequest.h" #include "ScriptController.h" +#include "Settings.h" #include "webkiterror.h" +#include "webkitglobals.h" +#include "webkitglobalsprivate.h" #include "webkitnetworkrequest.h" #include "webkitnetworkrequestprivate.h" #include "webkitnetworkresponse.h" #include "webkitnetworkresponseprivate.h" -#include "webkitprivate.h" #include "webkitviewportattributes.h" #include "webkitviewportattributesprivate.h" +#include "webkitwebdatasourceprivate.h" #include "webkitwebframe.h" #include "webkitwebframeprivate.h" #include "webkitwebnavigationaction.h" @@ -74,6 +77,7 @@ #include "webkitwebpolicydecisionprivate.h" #include "webkitwebresource.h" #include "webkitwebresourceprivate.h" +#include "webkitwebsettingsprivate.h" #include "webkitwebview.h" #include "webkitwebviewprivate.h" #include <JavaScriptCore/APICast.h> @@ -240,9 +244,8 @@ WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader { RefPtr<WebKit::DocumentLoader> loader = WebKit::DocumentLoader::create(request, substituteData); - WebKitWebDataSource* webDataSource = webkit_web_data_source_new_with_loader(loader.get()); - loader->setDataSource(webDataSource); - g_object_unref(webDataSource); + GRefPtr<WebKitWebDataSource> webDataSource(adoptGRef(kitNew(loader.get()))); + loader->setDataSource(webDataSource.get()); return loader.release(); } @@ -309,19 +312,19 @@ static char* toString(unsigned long identifier) void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) { - PlatformRefPtr<WebKitNetworkResponse> networkResponse(0); + GRefPtr<WebKitNetworkResponse> networkResponse(0); // We are adding one more resource to the load, or maybe we are // just redirecting a load. if (redirectResponse.isNull()) static_cast<WebKit::DocumentLoader*>(loader)->increaseLoadCount(identifier); else - networkResponse = adoptPlatformRef(kitNew(redirectResponse)); + networkResponse = adoptGRef(kitNew(redirectResponse)); WebKitWebView* webView = getViewFromFrame(m_frame); GOwnPtr<gchar> identifierString(toString(identifier)); WebKitWebResource* webResource = webkit_web_view_get_resource(webView, identifierString.get()); - PlatformRefPtr<WebKitNetworkRequest> networkRequest(adoptPlatformRef(kitNew(request))); + GRefPtr<WebKitNetworkRequest> networkRequest(adoptGRef(kitNew(request))); if (!redirectResponse.isNull()) { // This is a redirect, so we need to update the WebResource's knowledge @@ -415,7 +418,7 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli } WebKitWebView* page = getViewFromFrame(m_frame); - PlatformRefPtr<WebKitNetworkRequest> request(adoptPlatformRef(kitNew(resourceRequest))); + GRefPtr<WebKitNetworkRequest> request(adoptGRef(kitNew(resourceRequest))); WebKitWebPolicyDecision* policyDecision = webkit_web_policy_decision_new(m_frame, policyFunction); if (m_policyDecision) @@ -428,7 +431,7 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli if (isHandled) return; - PlatformRefPtr<WebKitNetworkResponse> networkResponse(adoptPlatformRef(webkit_web_frame_get_network_response(m_frame))); + GRefPtr<WebKitNetworkResponse> networkResponse(adoptGRef(webkit_web_frame_get_network_response(m_frame))); if (networkResponse) { ResourceResponse response = core(networkResponse.get()); if (response.isAttachment()) { @@ -495,8 +498,8 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti m_policyDecision = policyDecision; WebKitWebView* webView = getViewFromFrame(m_frame); - PlatformRefPtr<WebKitNetworkRequest> request(adoptPlatformRef(webkit_network_request_new(resourceRequest.url().string().utf8().data()))); - PlatformRefPtr<WebKitWebNavigationAction> navigationAction(adoptPlatformRef(getNavigationAction(action, frameName.utf8().data()))); + GRefPtr<WebKitNetworkRequest> request(adoptGRef(webkit_network_request_new(resourceRequest.url().string().utf8().data()))); + GRefPtr<WebKitWebNavigationAction> navigationAction(adoptGRef(getNavigationAction(action, frameName.utf8().data()))); gboolean isHandled = false; g_signal_emit_by_name(webView, "new-window-policy-decision-requested", m_frame, request.get(), navigationAction.get(), policyDecision, &isHandled); @@ -519,7 +522,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct } WebKitWebView* webView = getViewFromFrame(m_frame); - PlatformRefPtr<WebKitNetworkRequest> request(adoptPlatformRef(kitNew(resourceRequest))); + GRefPtr<WebKitNetworkRequest> request(adoptGRef(kitNew(resourceRequest))); WebKitNavigationResponse response; /* * We still support the deprecated navigation-requested signal, if the @@ -540,7 +543,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunct g_object_unref(m_policyDecision); m_policyDecision = policyDecision; - PlatformRefPtr<WebKitWebNavigationAction> navigationAction(adoptPlatformRef(getNavigationAction(action, 0))); + GRefPtr<WebKitWebNavigationAction> navigationAction(adoptGRef(getNavigationAction(action, 0))); gboolean isHandled = false; g_signal_emit_by_name(webView, "navigation-policy-decision-requested", m_frame, request.get(), navigationAction.get(), policyDecision, &isHandled); @@ -556,7 +559,7 @@ PassRefPtr<Widget> FrameLoaderClient::createPlugin(const IntSize& pluginSize, HT CString mimeTypeString = mimeType.utf8(); ASSERT(paramNames.size() == paramValues.size()); - PlatformRefPtr<GHashTable> hash = adoptPlatformRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free)); + GRefPtr<GHashTable> hash = adoptGRef(g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free)); for (unsigned i = 0; i < paramNames.size(); ++i) { g_hash_table_insert(hash.get(), g_strdup(paramNames[i].utf8().data()), @@ -1168,7 +1171,7 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest&, const ResourceResponse& response) { - PlatformRefPtr<WebKitNetworkRequest> networkRequest(adoptPlatformRef(kitNew(request))); + GRefPtr<WebKitNetworkRequest> networkRequest(adoptGRef(kitNew(request))); WebKitWebView* view = getViewFromFrame(m_frame); webkit_web_view_request_download(view, networkRequest.get(), response, handle); @@ -1256,7 +1259,7 @@ void FrameLoaderClient::setMainDocumentError(WebCore::DocumentLoader*, const Res void FrameLoaderClient::startDownload(const ResourceRequest& request) { - PlatformRefPtr<WebKitNetworkRequest> networkRequest(adoptPlatformRef(kitNew(request))); + GRefPtr<WebKitNetworkRequest> networkRequest(adoptGRef(kitNew(request))); WebKitWebView* view = getViewFromFrame(m_frame); webkit_web_view_request_download(view, networkRequest.get()); @@ -1297,7 +1300,7 @@ static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo g_object_notify(G_OBJECT(containingWindow->priv->viewportAttributes.get()), "valid"); if (priv->currentMenu) { - PlatformRefPtr<GtkMenu> menu(priv->currentMenu); + GRefPtr<GtkMenu> menu(priv->currentMenu); priv->currentMenu.clear(); gtk_menu_popdown(menu.get()); } @@ -1341,6 +1344,14 @@ void FrameLoaderClient::transitionToCommittedForNewPage() postCommitFrameViewSetup(m_frame, frame->view(), true); } +void FrameLoaderClient::didSaveToPageCache() +{ +} + +void FrameLoaderClient::didRestoreFromPageCache() +{ +} + void FrameLoaderClient::dispatchDidBecomeFrameset(bool) { } diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index ffb3c56..d8d3684 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -181,6 +181,9 @@ namespace WebKit { virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); + virtual void didSaveToPageCache(); + virtual void didRestoreFromPageCache(); + virtual void dispatchDidBecomeFrameset(bool); virtual bool canCachePage() const; diff --git a/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp b/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp index 158a3b8..c042b5e 100644 --- a/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp +++ b/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp @@ -545,7 +545,6 @@ void FullscreenVideoController::createHud() m_timeHScale = gtk_hscale_new(adjustment); gtk_scale_set_draw_value(GTK_SCALE(m_timeHScale), FALSE); gtk_range_set_show_fill_level(GTK_RANGE(m_timeHScale), TRUE); - gtk_range_set_update_policy(GTK_RANGE(m_timeHScale), GTK_UPDATE_CONTINUOUS); g_signal_connect(m_timeHScale, "button-press-event", G_CALLBACK(timeScaleButtonPressed), this); g_signal_connect(m_timeHScale, "button-release-event", G_CALLBACK(timeScaleButtonReleased), this); m_hscaleUpdateId = g_signal_connect(m_timeHScale, "value-changed", G_CALLBACK(timeScaleValueChanged), this); diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index c269078..31af243 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -24,7 +24,6 @@ #include "InspectorController.h" #include "NotImplemented.h" #include "PlatformString.h" -#include "webkitprivate.h" #include "webkitversion.h" #include "webkitwebinspector.h" #include "webkitwebinspectorprivate.h" @@ -180,7 +179,7 @@ void InspectorClient::populateSetting(const String& key, String* value) if (!settings) return; - PlatformRefPtr<GVariant> variant = adoptPlatformRef(g_settings_get_value(settings, toGSettingName(key).utf8().data())); + GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, toGSettingName(key).utf8().data())); if (key == "resourceTrackingEnabled" || key == "xhrMonitor" || key == "debuggerEnabled" || key == "profilerEnabled") @@ -198,15 +197,15 @@ void InspectorClient::storeSetting(const String& key, const String& value) if (!settings) return; - PlatformRefPtr<GVariant> variant(0); + GRefPtr<GVariant> variant(0); // Set the key with the appropriate type, and also avoid setting // unknown keys to avoid aborting the execution. if (key == "resourceTrackingEnabled" || key == "xhrMonitor" || key == "debuggerEnabled" || key == "profilerEnabled") - variant = adoptPlatformRef(variantFromTruthString(value)); + variant = adoptGRef(variantFromTruthString(value)); else if (key == "frontendSettings") - variant = adoptPlatformRef(g_variant_new_string(value.utf8().data())); + variant = adoptGRef(g_variant_new_string(value.utf8().data())); if (!variant) return; diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h index 64fcdba..d00333c 100644 --- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h +++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h @@ -32,8 +32,6 @@ #include "Frame.h" #include "PasteboardHelper.h" -#include <gtk/gtk.h> - using namespace WebCore; namespace WebKit { diff --git a/WebKit/gtk/docs/GNUmakefile.am b/WebKit/gtk/docs/GNUmakefile.am index d38a7aa..565f535 100644 --- a/WebKit/gtk/docs/GNUmakefile.am +++ b/WebKit/gtk/docs/GNUmakefile.am @@ -73,10 +73,10 @@ INCLUDES= \ $(global_cppflags) \ $(global_cflags) \ -I$(top_srcdir) \ - -I$(top_srcdir)/JavaScriptCore \ - -I$(top_srcdir)/JavaScriptCore/ForwardingHeaders \ - -I$(top_srcdir)/JavaScriptCore/parser \ - -I$(top_srcdir)/JavaScriptCore/wtf \ + -I$(top_srcdir)/Source/JavaScriptCore \ + -I$(top_srcdir)/Source/JavaScriptCore/ForwardingHeaders \ + -I$(top_srcdir)/Source/JavaScriptCore/parser \ + -I$(top_srcdir)/Source/JavaScriptCore/wtf \ -I$(top_builddir)/DerivedSources \ -I$(top_srcdir)/WebCore/platform/network/soup/cache \ $(GLOBALDEPS_CFLAGS) \ 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 |