summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /WebKit/gtk
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebKit/gtk')
-rw-r--r--WebKit/gtk/ChangeLog240
-rw-r--r--WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp6
-rw-r--r--WebKit/gtk/WebCoreSupport/DragClientGtk.cpp16
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp5
-rw-r--r--WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp50
-rw-r--r--WebKit/gtk/WebCoreSupport/InspectorClientGtk.h16
-rw-r--r--WebKit/gtk/docs/webkitgtk-docs.sgml6
-rw-r--r--WebKit/gtk/docs/webkitgtk-sections.txt13
-rw-r--r--WebKit/gtk/tests/testdomnode.c147
-rw-r--r--WebKit/gtk/tests/testhittestresult.c22
-rw-r--r--WebKit/gtk/webkit/webkithittestresult.cpp33
-rw-r--r--WebKit/gtk/webkit/webkitprivate.cpp20
-rw-r--r--WebKit/gtk/webkit/webkitprivate.h4
-rw-r--r--WebKit/gtk/webkit/webkitwebinspector.cpp1
-rw-r--r--WebKit/gtk/webkit/webkitwebview.cpp147
15 files changed, 640 insertions, 86 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index ec1727d..d1652dc 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,243 @@
+2010-06-14 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
+ data from inspected page to WebInspector as JSON string via http. The native
+ serialization to JSON string is supported by InspectorValue's classes. This patch
+ has the implementation of sendMessageToFrontend function. WebKit version of it still
+ uses ScriptFunctionCall and will be switched to another transport a little bit later.
+ https://bugs.webkit.org/show_bug.cgi?id=40134
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::releaseFrontendPage):
+ (WebKit::InspectorClient::sendMessageToFrontend):
+ * WebCoreSupport/InspectorClientGtk.h:
+
+2010-06-10 Eric Seidel <eric@webkit.org>
+
+ Reviewed by Adam Barth.
+
+ Reduce FrameView.h includes to speed up build times
+ https://bugs.webkit.org/show_bug.cgi?id=40408
+
+ * webkit/webkitwebinspector.cpp:
+ - Include RenderLayer.h
+
+2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r60889.
+ http://trac.webkit.org/changeset/60889
+ https://bugs.webkit.org/show_bug.cgi?id=40365
+
+ gtk bot has some kind of memory corruption (Requested by
+ loislo on #webkit).
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::InspectorClient):
+ (WebKit::InspectorClient::openInspectorFrontend):
+ (WebKit::InspectorFrontendClient::InspectorFrontendClient):
+ (WebKit::InspectorFrontendClient::destroyInspectorWindow):
+ * WebCoreSupport/InspectorClientGtk.h:
+
+2010-06-07 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
+ data from inspected page to WebInspector as JSON string via http. The native
+ serialization to JSON string is supported by InspectorValue's classes. This patch
+ has the implementation of sendMessageToFrontend function. WebKit version of it still
+ uses ScriptFunctionCall and will be switched to another transport a little bit later.
+ https://bugs.webkit.org/show_bug.cgi?id=40134
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::releaseFrontendPage):
+ (WebKit::InspectorClient::sendMessageToFrontend):
+ * WebCoreSupport/InspectorClientGtk.h:
+
+2010-06-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Unit testing for WebKitDOMNode hierarchy walk
+ https://bugs.webkit.org/show_bug.cgi?id=40171
+
+ Add some DOM node unit testing.
+
+ * tests/testdomnode.c: Added.
+ (finish_loading):
+ (dom_node_fixture_setup):
+ (dom_node_fixture_teardown):
+ (test_dom_node_hierarchy_navigation):
+ (main):
+
+2010-06-08 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Ojan Vafai and Darin Adler.
+
+ Refactor platform dependent editing behavior code out of Settings
+ https://bugs.webkit.org/show_bug.cgi?id=39854
+
+ EditingBehavior enum was renamed to EditingBehaviorTypes and moved out from Settings.h to
+ EditingBehaviorTypes.h . Call sites in WebKit/ adjusted accordingly.
+
+ * webkit/webkitprivate.cpp:
+ (WebKit::core):
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_update_settings):
+ (webkit_web_view_settings_notify):
+
+2010-06-08 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] Add inner-node property to WebKitHitTestResult
+ https://bugs.webkit.org/show_bug.cgi?id=40131
+
+ Add a 'inner-node' property to WebKitHitTestResult, carrying the
+ DOM node where the hit test happened.
+
+ * tests/testhittestresult.c:
+ (load_status_cb):
+ * webkit/webkithittestresult.cpp:
+ (webkit_hit_test_result_get_property):
+ (webkit_hit_test_result_set_property):
+ (webkit_hit_test_result_class_init):
+ * webkit/webkitprivate.cpp:
+ (WebKit::kit):
+
+2010-06-07 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] gtk_widget_get_window should replace widget->window
+ https://bugs.webkit.org/show_bug.cgi?id=40180
+
+ Replace uses of widget->window with gtk_widget_get_window.
+
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ (WebKit::ChromeClient::invalidateContentsAndWindow): Replace widget->window uses.
+ (WebKit::ChromeClient::scroll): Ditto.
+ (WebKit::widgetScreenPosition): Ditto.
+ * WebCoreSupport/DragClientGtk.cpp: Move gtk_widget_get_window define to GtkVersioning.h.
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_popup_menu_handler): Replace widget->window uses.
+ (webkit_web_view_button_press_event): Ditto.
+
+2010-06-04 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Drag gesture can take mouse grab indefinitely
+ https://bugs.webkit.org/show_bug.cgi?id=32840
+
+ Initiate drag events with the current GTK+ event instead of synthesizing
+ an event. Something about synthesized events is causing a drag freeze in
+ certain situations.
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::DragClient::startDrag): Start the drag with the current GTK+ event.
+
+2010-06-03 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r60632.
+ http://trac.webkit.org/changeset/60632
+ https://bugs.webkit.org/show_bug.cgi?id=40143
+
+ This change broke the 64-bit bots. (Requested by mrobinson on
+ #webkit).
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::DragClient::DragClient):
+ (WebKit::DragClient::startDrag):
+ * WebCoreSupport/DragClientGtk.h:
+
+2010-06-03 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Drag gesture can take mouse grab indefinitely
+ https://bugs.webkit.org/show_bug.cgi?id=32840
+
+ Start GTK+ drags with the previous mouse button down event instead of
+ synthesizing the event. The synthesized event was not completely valid
+ and froze some drags indefinitely.
+
+ * WebCoreSupport/DragClientGtk.cpp:
+ (WebKit::buttonPressEvent): Added.
+ (WebKit::DragClient::DragClient):
+ Connect to the 'button-press-event' signal of the WebView.
+ (WebKit::DragClient::startDrag):
+ Instead of synthesizing a button press event use the last real one.
+ * WebCoreSupport/DragClientGtk.h:
+ (WebKit::DragClient::setLastButtonPressEvent): Added.
+
+2010-06-01 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Memory Leak: The main resource of page is not free.
+ https://bugs.webkit.org/show_bug.cgi?id=39973
+
+ Fix refcount tracking of the main resource. Patch by Genhua Liu.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::dispatchDidFinishLoading):
+
+2010-06-01 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Fix-up for previous leak fix, the identifier was not always duped.
+
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_add_resource):
+
+2010-06-01 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Plug a small leak.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::assignIdentifierToInitialRequest):
+
+2010-06-01 Martin Robinson <mrobinson@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Double clicks cause three button press events
+ https://bugs.webkit.org/show_bug.cgi?id=38853
+
+ Handle click counting much like the Windows port. GTK+ only
+ counts triple-clicks natively, so use GTK+ double-click settings
+ to count clicks with even larger click counts. Also filter the
+ extra GDK_BUTTON_PRESS before GDK_{2,3}BUTTON_PRESS events using
+ gdk_event_peek().
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_button_press_event): Count clicks manually. Filter extra events.
+
+2010-05-31 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Missing links to documentation of general functions
+ https://bugs.webkit.org/show_bug.cgi?id=39964
+
+ Add global functions section, and move those functions that are
+ currently in WebKitWebView's source file to the bottom, along with
+ the description.
+
+ * docs/webkitgtk-docs.sgml:
+ * docs/webkitgtk-sections.txt:
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_get_dom_document):
+ (webkit_get_default_session):
+
2010-05-31 Martin Robinson <mrobinson@igalia.com>
Reviewed by Gustavo Noronha Silva.
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 8a1d48b..5759601 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -336,7 +336,7 @@ void ChromeClient::invalidateWindow(const IntRect&, bool)
void ChromeClient::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate)
{
GdkRectangle rect = updateRect;
- GdkWindow* window = GTK_WIDGET(m_webView)->window;
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(m_webView));
if (window) {
gdk_window_invalidate_rect(window, &rect, FALSE);
@@ -353,7 +353,7 @@ void ChromeClient::invalidateContentsForSlowScroll(const IntRect& updateRect, bo
void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, const IntRect& clipRect)
{
- GdkWindow* window = GTK_WIDGET(m_webView)->window;
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(m_webView));
if (!window)
return;
@@ -391,7 +391,7 @@ static IntPoint widgetScreenPosition(GtkWidget* widget)
IntPoint result(widgetX, widgetY);
int originX, originY;
- gdk_window_get_origin(window->window, &originX, &originY);
+ gdk_window_get_origin(gtk_widget_get_window(window), &originX, &originY);
result.move(originX, originY);
return result;
diff --git a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
index c1e8e74..6c395c7 100644
--- a/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp
@@ -26,17 +26,15 @@
#include "DragController.h"
#include "Element.h"
#include "Frame.h"
+#include "GOwnPtrGtk.h"
#include "GRefPtrGtk.h"
+#include "GtkVersioning.h"
#include "NotImplemented.h"
#include "PasteboardHelper.h"
#include "RenderObject.h"
#include "webkitprivate.h"
#include "webkitwebview.h"
-
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION(2, 14, 0)
-#define gtk_widget_get_window(widget) (widget)->window
-#endif
using namespace WebCore;
@@ -75,22 +73,16 @@ void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin,
WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
RefPtr<DataObjectGtk> dataObject = clipboardGtk->dataObject();
-
GRefPtr<GtkTargetList> targetList(clipboardGtk->helper()->targetListForDataObject(dataObject.get()));
- GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
- // This will be decremented by gdk_event_free() below.
- event->button.window = static_cast<GdkWindow*>(g_object_ref(gtk_widget_get_window(GTK_WIDGET(m_webView))));
- event->button.time = GDK_CURRENT_TIME;
+ GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event());
- GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, event);
+ GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get());
webView->priv->draggingDataObjects.set(context, dataObject);
if (image)
gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y());
else
gtk_drag_set_icon_default(context);
-
- gdk_event_free(event);
}
DragImageRef DragClient::createDragImageForLink(KURL&, const String&, Frame*)
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index fd2d7ed..021374c 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -235,7 +235,8 @@ void FrameLoaderClient::dispatchWillSendRequest(WebCore::DocumentLoader* loader,
void FrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const ResourceRequest& request)
{
- webkit_web_view_add_resource(getViewFromFrame(m_frame), toString(identifier),
+ GOwnPtr<gchar> identifierString(toString(identifier));
+ webkit_web_view_add_resource(getViewFromFrame(m_frame), identifierString.get(),
WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, "uri", request.url().string().utf8().data(), 0)));
}
@@ -930,7 +931,7 @@ void FrameLoaderClient::dispatchDidFinishLoading(WebCore::DocumentLoader* loader
return;
if (!coreResource)
- coreResource = loader->mainResource().releaseRef();
+ coreResource = loader->mainResource();
webkit_web_resource_init_with_core_resource(webResource, coreResource.get());
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index 317a058..5e69c31 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -19,6 +19,7 @@
#include "config.h"
#include "InspectorClientGtk.h"
+#include "Frame.h"
#include "webkitwebview.h"
#include "webkitwebinspector.h"
#include "webkitprivate.h"
@@ -38,8 +39,18 @@ static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorFrontendClie
InspectorClient::InspectorClient(WebKitWebView* webView)
: m_inspectedWebView(webView)
+ , m_frontendPage(0)
+ , m_frontendClient(0)
{}
+InspectorClient::~InspectorClient()
+{
+ if (m_frontendClient) {
+ m_frontendClient->disconnectInspectorClient();
+ m_frontendClient = 0;
+ }
+}
+
void InspectorClient::inspectorDestroyed()
{
delete this;
@@ -80,8 +91,14 @@ void InspectorClient::openInspectorFrontend(InspectorController* controller)
gtk_widget_show(GTK_WIDGET(inspectorWebView));
- Page* inspectorPage = core(inspectorWebView);
- inspectorPage->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, inspectorPage));
+ m_frontendPage = core(inspectorWebView);
+ m_frontendClient = new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this);
+ m_frontendPage->inspectorController()->setInspectorFrontendClient(m_frontendClient);
+}
+
+void InspectorClient::releaseFrontendPage()
+{
+ m_frontendPage = 0;
}
void InspectorClient::highlight(Node* node)
@@ -104,14 +121,34 @@ void InspectorClient::storeSetting(const String& key, const String& value)
notImplemented();
}
+bool InspectorClient::sendMessageToFrontend(const String& message)
+{
+ if (!m_frontendPage)
+ return false;
+
+ Frame* frame = m_frontendPage->mainFrame();
+ if (!frame)
+ return false;
+
+ ScriptController* scriptController = frame->script();
+ if (!scriptController)
+ return false;
+
+ String dispatchToFrontend("WebInspector.dispatchMessageToFrontend(");
+ dispatchToFrontend += message;
+ dispatchToFrontend += ");";
+ scriptController->executeScript(dispatchToFrontend);
+ return true;
+}
bool destroyed = TRUE;
-InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage)
+InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
: InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage)
, m_inspectorWebView(inspectorWebView)
, m_inspectedWebView(inspectedWebView)
, m_webInspector(webInspector)
+ , m_inspectorClient(inspectorClient)
{
g_signal_connect(m_inspectorWebView, "destroy",
G_CALLBACK(notifyWebViewDestroyed), (gpointer)this);
@@ -119,6 +156,10 @@ InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView
InspectorFrontendClient::~InspectorFrontendClient()
{
+ if (m_inspectorClient) {
+ m_inspectorClient->disconnectFrontendClient();
+ m_inspectorClient = 0;
+ }
ASSERT(!m_webInspector);
}
@@ -138,6 +179,9 @@ void InspectorFrontendClient::destroyInspectorWindow()
g_signal_emit_by_name(webInspector, "close-window", &handled);
ASSERT(handled);
+ if (m_inspectorClient)
+ m_inspectorClient->releaseFrontendPage();
+
/* we should now dispose our own reference */
g_object_unref(webInspector);
}
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
index cdb5375..fc9b6d8 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
@@ -42,9 +42,14 @@ namespace WebCore {
namespace WebKit {
+ class InspectorFrontendClient;
+
class InspectorClient : public WebCore::InspectorClient {
public:
InspectorClient(WebKitWebView* webView);
+ ~InspectorClient();
+
+ void disconnectFrontendClient() { m_frontendClient = 0; }
virtual void inspectorDestroyed();
@@ -56,13 +61,21 @@ namespace WebKit {
virtual void populateSetting(const WebCore::String& key, WebCore::String* value);
virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
+ virtual bool sendMessageToFrontend(const WebCore::String&);
+
+ void releaseFrontendPage();
+
private:
WebKitWebView* m_inspectedWebView;
+ WebCore::Page* m_frontendPage;
+ InspectorFrontendClient* m_frontendClient;
};
class InspectorFrontendClient : public WebCore::InspectorFrontendClientLocal {
public:
- InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage);
+ InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage, InspectorClient* inspectorClient);
+
+ void disconnectInspectorClient() { m_inspectorClient = 0; }
void destroyInspectorWindow();
@@ -86,6 +99,7 @@ namespace WebKit {
WebKitWebView* m_inspectorWebView;
WebKitWebView* m_inspectedWebView;
WebKitWebInspector* m_webInspector;
+ InspectorClient* m_inspectorClient;
};
}
diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml
index 6201ca5..c6539af 100644
--- a/WebKit/gtk/docs/webkitgtk-docs.sgml
+++ b/WebKit/gtk/docs/webkitgtk-docs.sgml
@@ -10,6 +10,11 @@
</bookinfo>
<chapter>
+ <title>Global functions</title>
+ <xi:include href="xml/webkit.xml"/>
+ </chapter>
+
+ <chapter>
<title>Class Overview</title>
<xi:include href="xml/webkitwebview.xml"/>
<xi:include href="xml/webkitwebframe.xml"/>
@@ -30,7 +35,6 @@
<xi:include href="xml/webkitsoupauthdialog.xml"/>
<xi:include href="xml/webkitsecurityorigin.xml"/>
<xi:include href="xml/webkitwebwindowfeatures.xml"/>
- <xi:include href="xml/webkitcachemodel.xml"/>
</chapter>
<chapter>
diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt
index 864b991..0083146 100644
--- a/WebKit/gtk/docs/webkitgtk-sections.txt
+++ b/WebKit/gtk/docs/webkitgtk-sections.txt
@@ -528,6 +528,7 @@ WebKitWebWindowFeaturesPrivate
<SECTION>
<FILE>webkit</FILE>
+<TITLE>Global functions</TITLE>
webkit_init
webkit_get_default_session
webkit_get_default_web_database_quota
@@ -535,6 +536,11 @@ webkit_get_web_database_directory_path
webkit_remove_all_web_databases
webkit_set_default_web_database_quota
webkit_set_web_database_directory_path
+<SUBSECTION CacheModel>
+WebKitCacheModel
+webkit_get_cache_model
+webkit_set_cache_model
+</SUBSECTION>
</SECTION>
<SECTION>
@@ -605,10 +611,3 @@ webkit_major_version
webkit_micro_version
webkit_minor_version
</SECTION>
-
-<SECTION>
-<FILE>webkitcachemodel</FILE>
-WebKitCacheModel
-webkit_get_cache_model
-webkit_set_cache_model
-</SECTION>
diff --git a/WebKit/gtk/tests/testdomnode.c b/WebKit/gtk/tests/testdomnode.c
new file mode 100644
index 0000000..1050587
--- /dev/null
+++ b/WebKit/gtk/tests/testdomnode.c
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+#include "test_utils.h"
+
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include <webkit/webkit.h>
+
+#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
+
+#define HTML_DOCUMENT_HIERARCHY_NAVIGATION "<html><head><title>This is the title</title></head><body><p>1</p><p>2</p><p>3</p></body></html>"
+
+typedef struct {
+ GtkWidget* webView;
+ GMainLoop* loop;
+} DomNodeFixture;
+
+static gboolean finish_loading(DomNodeFixture* fixture)
+{
+ if (g_main_loop_is_running(fixture->loop))
+ g_main_loop_quit(fixture->loop);
+
+ return FALSE;
+}
+
+static void dom_node_fixture_setup(DomNodeFixture* fixture, gconstpointer data)
+{
+ fixture->loop = g_main_loop_new(NULL, TRUE);
+ fixture->webView = webkit_web_view_new();
+ g_object_ref_sink(fixture->webView);
+
+ if (data != NULL)
+ webkit_web_view_load_string(WEBKIT_WEB_VIEW(fixture->webView), (const char*)data, NULL, NULL, NULL);
+
+ g_idle_add((GSourceFunc)finish_loading, fixture);
+ g_main_loop_run(fixture->loop);
+}
+
+static void dom_node_fixture_teardown(DomNodeFixture* fixture, gconstpointer data)
+{
+ g_object_unref(fixture->webView);
+ g_main_loop_unref(fixture->loop);
+}
+
+static void test_dom_node_hierarchy_navigation(DomNodeFixture* fixture, gconstpointer data)
+{
+ WebKitDOMDocument* document;
+ WebKitDOMHTMLHeadElement* head;
+ WebKitDOMHTMLBodyElement* body;
+ WebKitDOMNodeList* list;
+ WebKitDOMNode* ptr;
+ gulong i, length;
+
+ document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView));
+ g_assert(document);
+ g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+ head = webkit_dom_document_get_head(document);
+ g_assert(head);
+ g_assert(WEBKIT_DOM_IS_HTML_HEAD_ELEMENT(head));
+
+ /* Title, head's child */
+ g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(head)));
+ list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(head));
+ g_assert_cmpint(webkit_dom_node_list_get_length(list), ==, 1);
+ ptr = webkit_dom_node_list_item(list, 0);
+ g_assert(ptr);
+ g_assert(WEBKIT_DOM_IS_HTML_TITLE_ELEMENT(ptr));
+
+ /* Body, Head sibling */
+ ptr = webkit_dom_node_get_next_sibling(WEBKIT_DOM_NODE(head));
+ g_assert(ptr);
+ body = WEBKIT_DOM_HTML_BODY_ELEMENT(ptr);
+ g_assert(WEBKIT_DOM_IS_HTML_BODY_ELEMENT(body));
+
+ /* There is no third sibling */
+ ptr = webkit_dom_node_get_next_sibling(ptr);
+ g_assert(ptr == NULL);
+
+ /* Body's previous sibling is Head */
+ ptr = webkit_dom_node_get_previous_sibling(WEBKIT_DOM_NODE(body));
+ g_assert(ptr);
+ g_assert(WEBKIT_DOM_IS_HTML_HEAD_ELEMENT(ptr));
+
+ /* Body has 3 children */
+ g_assert(webkit_dom_node_has_child_nodes(WEBKIT_DOM_NODE(body)));
+ list = webkit_dom_node_get_child_nodes(WEBKIT_DOM_NODE(body));
+ length = webkit_dom_node_list_get_length(list);
+ g_assert_cmpint(length, ==, 3);
+
+ /* The three of them are P tags */
+ for (i = 0; i < length; i++) {
+ ptr = webkit_dom_node_list_item(list, i);
+ g_assert(ptr);
+ g_assert(WEBKIT_DOM_IS_HTML_PARAGRAPH_ELEMENT(ptr));
+ }
+
+ /* Go backwards */
+ for (i = 0; ptr; ptr = webkit_dom_node_get_previous_sibling(ptr), i++)
+ /* Nothing */;
+
+ g_assert_cmpint(i, ==, 3);
+}
+
+int main(int argc, char** argv)
+{
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+
+ gtk_test_init(&argc, &argv, NULL);
+
+ g_test_bug_base("https://bugs.webkit.org/");
+
+ g_test_add("/webkit/domnode/test_hierarchy_navigation",
+ DomNodeFixture, HTML_DOCUMENT_HIERARCHY_NAVIGATION,
+ dom_node_fixture_setup,
+ test_dom_node_hierarchy_navigation,
+ dom_node_fixture_teardown);
+
+ return g_test_run();
+}
+
+#else
+int main(int argc, char** argv)
+{
+ g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now.");
+ return 0;
+}
+
+#endif
diff --git a/WebKit/gtk/tests/testhittestresult.c b/WebKit/gtk/tests/testhittestresult.c
index defda7a..89fe95c 100644
--- a/WebKit/gtk/tests/testhittestresult.c
+++ b/WebKit/gtk/tests/testhittestresult.c
@@ -82,6 +82,8 @@ load_status_cb(WebKitWebView* webView,
WebKitHitTestResult* result;
guint context;
GdkEventButton event;
+ WebKitDOMNode* node;
+
event.type = GDK_BUTTON_PRESS;
/* Close enough to 0,0 */
event.x = 5;
@@ -89,8 +91,28 @@ load_status_cb(WebKitWebView* webView,
result = webkit_web_view_get_hit_test_result(webView, &event);
g_assert(result);
+
g_object_get(result, "context", &context, NULL);
g_assert(context & info->flag);
+
+ g_object_get(result, "inner-node", &node, NULL);
+ g_assert(node);
+ g_assert(WEBKIT_DOM_IS_NODE(node));
+ /* We can only test these node types at the moment. In the
+ * input case there seems to be an extra layer with a DIV on
+ * top of the input, which gets assigned to the inner-node.
+ * tag */
+ if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)
+ g_assert(WEBKIT_DOM_IS_HTML_HTML_ELEMENT(node));
+ else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE)
+ g_assert(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(node));
+ else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) {
+ /* The hit test will give us the inner text node, we want
+ * the A tag */
+ WebKitDOMNode* parent = webkit_dom_node_get_parent_node(node);
+ g_assert(WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(parent));
+ }
+
g_object_unref(result);
g_main_loop_quit(loop);
}
diff --git a/WebKit/gtk/webkit/webkithittestresult.cpp b/WebKit/gtk/webkit/webkithittestresult.cpp
index 1f8dce6..862d94a 100644
--- a/WebKit/gtk/webkit/webkithittestresult.cpp
+++ b/WebKit/gtk/webkit/webkithittestresult.cpp
@@ -22,6 +22,7 @@
#include "webkithittestresult.h"
#include "GOwnPtr.h"
+#include "WebKitDOMNode.h"
#include "webkitenumtypes.h"
#include "webkitprivate.h"
#include <wtf/text/CString.h>
@@ -43,6 +44,7 @@ struct _WebKitHitTestResultPrivate {
char* linkURI;
char* imageURI;
char* mediaURI;
+ WebKitDOMNode* innerNode;
};
#define WEBKIT_HIT_TEST_RESULT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultPrivate))
@@ -53,7 +55,8 @@ enum {
PROP_CONTEXT,
PROP_LINK_URI,
PROP_IMAGE_URI,
- PROP_MEDIA_URI
+ PROP_MEDIA_URI,
+ PROP_INNER_NODE
};
static void webkit_hit_test_result_finalize(GObject* object)
@@ -86,6 +89,9 @@ static void webkit_hit_test_result_get_property(GObject* object, guint propertyI
case PROP_MEDIA_URI:
g_value_set_string(value, priv->mediaURI);
break;
+ case PROP_INNER_NODE:
+ g_value_set_object(value, priv->innerNode);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec);
}
@@ -112,6 +118,9 @@ static void webkit_hit_test_result_set_property(GObject* object, guint propertyI
g_free (priv->mediaURI);
priv->mediaURI = g_value_dup_string(value);
break;
+ case PROP_INNER_NODE:
+ priv->innerNode = static_cast<WebKitDOMNode*>(g_value_get_object(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyID, pspec);
}
@@ -184,6 +193,28 @@ static void webkit_hit_test_result_class_init(WebKitHitTestResultClass* webHitTe
NULL,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)));
+ /**
+ * WebKitHitTestResult:inner-node:
+ *
+ * The DOM node at the coordinates where the hit test
+ * happened. Keep in mind that the node might not be
+ * representative of the information given in the context
+ * property, since WebKit uses a series of heuristics to figure
+ * out that information. One common example is inner-node having
+ * the text node inside the anchor (<a>) tag; WebKit knows the
+ * whole context and will put WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK
+ * in the 'context' property, but the user might be confused by
+ * the lack of any link tag in 'inner-node'.
+ *
+ * Since: 1.3.2
+ */
+ g_object_class_install_property(objectClass, PROP_INNER_NODE,
+ g_param_spec_object("inner-node",
+ _("Inner node"),
+ _("The inner DOM node associated with the hit test result."),
+ WEBKIT_TYPE_DOM_NODE,
+ static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+
g_type_class_add_private(webHitTestResultClass, sizeof(WebKitHitTestResultPrivate));
}
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index d274708..41de76e 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -41,6 +41,7 @@
#include "ResourceResponse.h"
#include "SecurityOrigin.h"
#include "TextEncodingRegistry.h"
+#include "WebKitDOMBinding.h"
#include "webkitnetworkresponse.h"
#include "webkitsoupauthdialog.h"
#include <libintl.h>
@@ -129,9 +130,9 @@ WebCore::ResourceResponse core(WebKitNetworkResponse* response)
return ResourceResponse();
}
-WebCore::EditingBehavior core(WebKitEditingBehavior type)
+WebCore::EditingBehaviorType core(WebKitEditingBehavior type)
{
- return (WebCore::EditingBehavior)type;
+ return (WebCore::EditingBehaviorType)type;
}
WebKitHitTestResult* kit(const WebCore::HitTestResult& result)
@@ -140,6 +141,7 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result)
GOwnPtr<char> linkURI(0);
GOwnPtr<char> imageURI(0);
GOwnPtr<char> mediaURI(0);
+ WebKitDOMNode* node = 0;
if (!result.absoluteLinkURL().isEmpty()) {
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK;
@@ -162,12 +164,16 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result)
if (result.isContentEditable())
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
+ if (result.innerNonSharedNode())
+ node = static_cast<WebKitDOMNode*>(kit(result.innerNonSharedNode()));
+
return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
- "link-uri", linkURI.get(),
- "image-uri", imageURI.get(),
- "media-uri", mediaURI.get(),
- "context", context,
- NULL));
+ "link-uri", linkURI.get(),
+ "image-uri", imageURI.get(),
+ "media-uri", mediaURI.get(),
+ "context", context,
+ "inner-node", node,
+ NULL));
}
PasteboardHelperGtk* pasteboardHelperInstance()
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 057b0e5..44ffc1e 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -95,7 +95,7 @@ namespace WebKit {
WebCore::ResourceResponse core(WebKitNetworkResponse* response);
- WebCore::EditingBehavior core(WebKitEditingBehavior type);
+ WebCore::EditingBehaviorType core(WebKitEditingBehavior type);
WebKitSecurityOrigin* kit(WebCore::SecurityOrigin*);
WebCore::SecurityOrigin* core(WebKitSecurityOrigin*);
@@ -241,7 +241,7 @@ extern "C" {
webkit_web_view_request_download(WebKitWebView* web_view, WebKitNetworkRequest* request, const WebCore::ResourceResponse& response = WebCore::ResourceResponse(), WebCore::ResourceHandle* handle = 0);
void
- webkit_web_view_add_resource(WebKitWebView*, char*, WebKitWebResource*);
+ webkit_web_view_add_resource(WebKitWebView*, const char*, WebKitWebResource*);
WebKitWebResource*
webkit_web_view_get_resource(WebKitWebView*, char*);
diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp
index 820b20f..2dc9315 100644
--- a/WebKit/gtk/webkit/webkitwebinspector.cpp
+++ b/WebKit/gtk/webkit/webkitwebinspector.cpp
@@ -30,6 +30,7 @@
#include "InspectorClientGtk.h"
#include "IntPoint.h"
#include "Page.h"
+#include "RenderLayer.h"
#include "RenderView.h"
#include "webkitmarshal.h"
#include "webkitprivate.h"
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 2c95558..6744732 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -63,6 +63,7 @@
#include "FrameView.h"
#include <glib/gi18n-lib.h>
#include <GOwnPtr.h>
+#include <GOwnPtrGtk.h>
#include "GraphicsContext.h"
#include "GtkVersioning.h"
#include "HitTestRequest.h"
@@ -370,7 +371,7 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
}
int x, y;
- gdk_window_get_origin(GTK_WIDGET(view->hostWindow()->platformPageClient())->window, &x, &y);
+ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(view->hostWindow()->platformPageClient())), &x, &y);
// FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element.
// Ideally we'd have the position of a context menu event be separate from its target node.
@@ -588,11 +589,52 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey
static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
{
+ // Eventually it may make sense for these to be per-view and per-device,
+ // but at this time the implementation matches the Windows port.
+ static int currentClickCount = 1;
+ static IntPoint previousPoint;
+ static guint previousButton;
+ static guint32 previousTime;
+
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
// FIXME: need to keep track of subframe focus for key events
gtk_widget_grab_focus(widget);
+ // For double and triple clicks GDK sends both a normal button press event
+ // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press
+ // coming up, ignore this event as it certainly generated the double or triple
+ // click. The consequence of not eating this event is two DOM button press events
+ // are generated.
+ GOwnPtr<GdkEvent> nextEvent(gdk_event_peek());
+ if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS))
+ return TRUE;
+
+ gint doubleClickDistance = 250;
+ gint doubleClickTime = 5;
+ GtkSettings* settings = gtk_settings_get_for_screen(gdk_drawable_get_screen(gtk_widget_get_window(widget)));
+ g_object_get(settings,
+ "gtk-double-click-distance", &doubleClickDistance,
+ "gtk-double-click-time", &doubleClickTime, NULL);
+
+ // GTK+ only counts up to triple clicks, but WebCore wants to know about
+ // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
+ // GDK logic for counting clicks.
+ if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
+ || ((abs(event->x - previousPoint.x()) < doubleClickDistance)
+ && (abs(event->y - previousPoint.y()) < doubleClickDistance)
+ && (event->time - previousTime < static_cast<guint>(doubleClickTime))
+ && (event->button == previousButton)))
+ currentClickCount++;
+ else
+ currentClickCount = 1;
+
+ PlatformMouseEvent platformEvent(event);
+ platformEvent.setClickCount(currentClickCount);
+ previousPoint = platformEvent.pos();
+ previousButton = event->button;
+ previousTime = event->time;
+
if (event->button == 3)
return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event));
@@ -600,7 +642,8 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu
if (!frame->view())
return FALSE;
- gboolean result = frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
+
+ gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent);
#if PLATFORM(X11)
/* Copy selection to the X11 selection clipboard */
@@ -2695,7 +2738,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
settings->setJavaScriptCanOpenWindowsAutomatically(javascriptCanOpenWindows);
settings->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache);
- settings->setEditingBehavior(core(editingBehavior));
+ settings->setEditingBehaviorType(core(editingBehavior));
settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI);
settings->setAllowFileAccessFromFileURLs(enableFileAccessFromFileURI);
settings->setDOMPasteAllowed(enableDOMPaste);
@@ -2796,7 +2839,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->setEditingBehavior(core(static_cast<WebKitEditingBehavior>(g_value_get_enum(&value))));
+ settings->setEditingBehaviorType(core(static_cast<WebKitEditingBehavior>(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"))
@@ -3892,24 +3935,6 @@ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom
}
/**
- * 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: the default #SoupSession
- *
- * Since: 1.1.1
- */
-SoupSession* webkit_get_default_session ()
-{
- webkit_init();
- return ResourceHandle::defaultSession();
-}
-
-/**
* webkit_web_view_get_load_status:
* @web_view: a #WebKitWebView
*
@@ -4152,7 +4177,7 @@ gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView)
}
// Internal subresource management
-void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebKitWebResource* webResource)
+void webkit_web_view_add_resource(WebKitWebView* webView, const char* identifier, WebKitWebResource* webResource)
{
WebKitWebViewPrivate* priv = webView->priv;
@@ -4162,7 +4187,7 @@ void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebK
return;
}
- g_hash_table_insert(priv->subResources, identifier, webResource);
+ g_hash_table_insert(priv->subResources, g_strdup(identifier), webResource);
}
WebKitWebResource* webkit_web_view_get_resource(WebKitWebView* webView, char* identifier)
@@ -4295,6 +4320,57 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
}
/**
+ * webkit_web_view_get_dom_document:
+ * @webView: a #WebKitWebView
+ *
+ * Returns: the #WebKitDOMDocument currently loaded in the @webView
+ *
+ * Since: 1.3.1
+ **/
+WebKitDOMDocument*
+webkit_web_view_get_dom_document(WebKitWebView* webView)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
+
+ Frame* coreFrame = core(webView)->mainFrame();
+ if (!coreFrame)
+ return 0;
+
+ Document* doc = coreFrame->document();
+ if (!doc)
+ return 0;
+
+ return static_cast<WebKitDOMDocument*>(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: 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
*
@@ -4375,26 +4451,3 @@ WebKitCacheModel webkit_get_cache_model()
return cacheModel;
}
-/**
- * webkit_web_view_get_dom_document:
- * @webView: a #WebKitWebView
- *
- * Returns: the #WebKitDOMDocument currently loaded in the @webView
- *
- * Since: 1.3.1
- **/
-WebKitDOMDocument*
-webkit_web_view_get_dom_document(WebKitWebView* webView)
-{
- g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
-
- Frame* coreFrame = core(webView)->mainFrame();
- if (!coreFrame)
- return 0;
-
- Document* doc = coreFrame->document();
- if (!doc)
- return 0;
-
- return static_cast<WebKitDOMDocument*>(kit(doc));
-}