summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/gtk')
-rw-r--r--WebKit/gtk/ChangeLog624
-rw-r--r--WebKit/gtk/NEWS46
-rw-r--r--WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp37
-rw-r--r--WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp13
-rw-r--r--WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp46
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp42
-rw-r--r--WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h2
-rw-r--r--WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp8
-rw-r--r--WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp103
-rw-r--r--WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h2
-rw-r--r--WebKit/gtk/docs/webkitgtk-docs.sgml4
-rw-r--r--WebKit/gtk/docs/webkitgtk-sections.txt9
-rw-r--r--WebKit/gtk/tests/testatk.c100
-rw-r--r--WebKit/gtk/tests/testdownload.c43
-rw-r--r--WebKit/gtk/tests/testloading.c209
-rw-r--r--WebKit/gtk/tests/testmimehandling.c30
-rw-r--r--WebKit/gtk/tests/testwebdatasource.c49
-rw-r--r--WebKit/gtk/tests/testwebresource.c29
-rw-r--r--WebKit/gtk/tests/testwebview.c29
-rw-r--r--WebKit/gtk/tests/testwindow.c12
-rw-r--r--WebKit/gtk/webkit/webkitdownload.cpp20
-rw-r--r--WebKit/gtk/webkit/webkitprivate.cpp14
-rw-r--r--WebKit/gtk/webkit/webkitprivate.h4
-rw-r--r--WebKit/gtk/webkit/webkitwebframe.cpp37
-rw-r--r--WebKit/gtk/webkit/webkitwebhistoryitem.cpp27
-rw-r--r--WebKit/gtk/webkit/webkitwebhistoryitem.h3
-rw-r--r--WebKit/gtk/webkit/webkitwebnavigationaction.cpp9
-rw-r--r--WebKit/gtk/webkit/webkitwebresource.cpp6
-rw-r--r--WebKit/gtk/webkit/webkitwebsettings.cpp113
-rw-r--r--WebKit/gtk/webkit/webkitwebview.cpp232
-rw-r--r--WebKit/gtk/webkit/webkitwebview.h11
31 files changed, 1715 insertions, 198 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index a72e2c9..b112460 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,572 @@
+<<<<<<< HEAD
+=======
+2010-01-27 Martin Robinson <mrobinson@webkit.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Expose the IM context via the API
+ https://bugs.webkit.org/show_bug.cgi?id=33327
+
+ Expose the GtkIMMultiContext as a property of WebKitWebView. This will
+ allow embedders to generate the input method context menu entries and
+ make testing certain IM context behavior possible.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_get_property):
+ (DNDContentsRequest::webkit_web_view_get_im_context):
+ (DNDContentsRequest::webkit_web_view_class_init):
+
+2010-01-19 Joanmarie Diggs <joanmarie.diggs@gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30883
+ [Gtk] Implement AtkText for HTML elements which contain text
+
+ Adds two news tests.
+
+ * tests/testatk.c
+ (testWebkitAtkGetTextInParagraphAndBodySimple):
+ (testWebkitAtkGetTextInParagraphAndBodyModerate):
+ (main):
+
+2010-01-19 Gustavo Noronha Silva <gns@gnome.org>
+
+ Unreviewed. Changes to the test I forgot to make after a last
+ minute change before landing 53294 - this causes make distcheck to
+ fail.
+
+ * tests/testloading.c:
+ (load_error_status_changed_cb):
+ (test_loading_error):
+
+2010-01-19 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ News items for 1.1.19.
+
+ * NEWS:
+
+2010-01-19 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] More crashes related to the clipboard management
+ https://bugs.webkit.org/show_bug.cgi?id=33746
+
+ Pass the WebKitWebView object (which is a GObject, thus
+ ref-counted) to the clipboard functions instead of passing the
+ Page - this allows us to explicitely protect the object inbetween
+ the clipboard call and its callbacks, which fixes the crash.
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::respondToChangedSelection):
+ * WebCoreSupport/PasteboardHelperGtk.cpp:
+ (WebKit::getClipboardContentsCallback):
+ (WebKit::clearClipboardContentsCallback):
+ (WebKit::PasteboardHelperGtk::writeClipboardContents):
+
+2010-01-15 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Original patch by David Ronis <david.ronis@mcgill.ca>
+
+ Upgrade 1.1.17->1.1.18 fails: GTK_WIDGET_TOPLEVEL' was not declared in this scope
+ https://bugs.webkit.org/show_bug.cgi?id=33486
+
+ Deprecated symbols replaced for gtk+ versions over 2.18.
+
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ (WebKit::ChromeClient::windowRect):
+ * webkit/webkitprivate.cpp:
+ (currentToplevelCallback):
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_print_full):
+ (webkit_web_frame_print):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_focus_in_event):
+
+2010-01-14 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Crashes cleaning clipboard contents, with page cache enabled
+ https://bugs.webkit.org/show_bug.cgi?id=32900
+
+ Null-check the focus controller to avoid crashing. Could not find
+ a way to reproduce this consistently, thus no test.
+
+ * WebCoreSupport/PasteboardHelperGtk.cpp:
+ (WebKit::clearClipboardContentsCallback):
+
+2010-01-14 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Oliver Hunter.
+
+ [GTK] couple fixes for signal emissions, and property notifications
+ https://bugs.webkit.org/show_bug.cgi?id=33428
+
+ Do not emit signals and property notifications for error
+ pages. The notifications are not really useful for anything, you
+ can get them back by overriding the error pages, and it avoids a
+ number of hacks.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::FrameLoaderClient):
+ (WebKit::FrameLoaderClient::dispatchDidFinishLoad):
+ (WebKit::FrameLoaderClient::dispatchDidReceiveIcon):
+ (WebKit::FrameLoaderClient::dispatchDidStartProvisionalLoad):
+ (WebKit::FrameLoaderClient::dispatchDidReceiveTitle):
+ (WebKit::FrameLoaderClient::dispatchDidCommitLoad):
+ (WebKit::FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout):
+ (WebKit::FrameLoaderClient::dispatchDidFailLoad):
+ * WebCoreSupport/FrameLoaderClientGtk.h:
+ * tests/testloading.c:
+ (load_error_status_changed_cb):
+ (test_loading_error):
+
+2010-01-14 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Enable DOM clipboard and drag-and-drop access
+ https://bugs.webkit.org/show_bug.cgi?id=30623
+
+ Use DataObjectGtk when setting and clearing pasteboard data on
+ the GDK_SELECTION_PRIMARY clipboard.
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::respondToChangedSelection):
+ (WebKit::EditorClient::EditorClient):
+ * WebCoreSupport/EditorClientGtk.h:
+ * WebCoreSupport/PasteboardHelperGtk.cpp:
+ (WebKit::fillSelectionData):
+ (WebKit::targetListForDataObject):
+ (WebKit::getClipboardContentsCallback):
+ (WebKit::clearClipboardContentsCallback):
+ (WebKit::PasteboardHelperGtk::writeClipboardContents):
+ * WebCoreSupport/PasteboardHelperGtk.h:
+
+2010-01-14 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Review the tooltip implementation
+ https://bugs.webkit.org/show_bug.cgi?id=32819
+
+ Change the GTK tooltip implementation to avoid the workaround that
+ we are currently using. Now we use a new private API to set the
+ text and all the tooltip handling is done in the webview widget.
+
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_set_tooltip_text): Added, new private API.
+ (webkit_web_view_query_tooltip): Added
+
+2010-01-09 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] couple fixes for signal emissions, and property notifications
+ https://bugs.webkit.org/show_bug.cgi?id=33428
+
+ Fix commitedLoad being called where it should not, causing it to
+ be called one time too many in some cases. We now match Qt's and
+ Mac's behavior here.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::finishedLoading):
+ * tests/testloading.c:
+ (load_error_status_changed_cb):
+
+2010-01-08 Gustavo Noronha Silva <gns@gnome.org>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] loading test should use SoupServer instead of actual sites
+ https://bugs.webkit.org/show_bug.cgi?id=33353
+
+ Make all the loading tests use SoupServer, instead of fetching
+ stuff from the Internet.
+
+ * tests/testloading.c:
+ (server_callback):
+ (get_uri_for_path):
+ (test_loading_status):
+ (test_loading_error):
+ (test_loading_cancelled):
+ (load_wentback_status_changed_cb):
+ (load_error_test):
+ (test_loading_goback):
+ (main):
+
+2010-01-06 Joanmarie Diggs <joanmarie.diggs@gmail.com>
+
+ Reviewed by Xan Lopez.
+
+ https://bugs.webkit.org/show_bug.cgi?id=30883
+ [Gtk] Implement AtkText for HTML elements which contain text
+
+ * tests/testatk.c
+ (test_webkit_atk_get_text_at_offset):
+ (test_webkit_atk_get_text_at_offset_forms):
+ (test_webkit_atk_get_text_at_offset_newlines):
+
+2010-01-05 Gustavo Noronha Silva <gns@gnome.org>
+
+ Updated docs for 1.1.18 release.
+
+ * docs/webkitgtk-docs.sgml:
+ * docs/webkitgtk-sections.txt:
+
+2010-01-05 Xan Lopez <xlopez@igalia.com>
+
+ Update for 1.1.18 release.
+
+ * NEWS:
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Fisher.
+
+ Reorganize, document and rename OS() platform macros.
+ https://bugs.webkit.org/show_bug.cgi?id=33198
+
+ Adapt to name changes.
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_get_user_agent):
+
+2010-01-04 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Adam Barth.
+
+ Reorganize, document and rename CPU() platform macros.
+ https://bugs.webkit.org/show_bug.cgi?id=33145
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_get_user_agent):
+
+2009-12-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Remove emission of signal that does not exist.
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::inspectorDestroyed):
+ (WebKit::InspectorClient::webViewDestroyed):
+
+2009-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Unset the adjustments in our FrameView when detaching from
+ parent. Fixes some crashers when transitioning to a new page from
+ a scrolled page.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::detachedFromParent2):
+
+2009-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Disable the page cache by default since:
+
+ - It was previously off by default.
+ - There are still some issues when enabling it.
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_web_settings_class_init):
+
+2009-12-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Provides a new API to copy WebKitWebHistoryItem objects.
+
+ * webkit/webkitwebhistoryitem.cpp:
+ (webkit_web_history_item_copy):
+ * webkit/webkitwebhistoryitem.h:
+
+2009-12-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Make sure we get the URI that is being loaded when updating
+ WebKitWebFrame's knowledge of it. This was causing problems now
+ that page cache is enabled.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::dispatchDidCommitLoad):
+ * tests/testloading.c:
+ (load_goback_status_changed_cb):
+ (load_wentback_status_changed_cb):
+ (test_loading_goback):
+ (main):
+
+2009-12-20 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Cache control APIs
+ https://bugs.webkit.org/show_bug.cgi?id=24001
+
+ Original patch by Bobby Powers <bobby@laptop.org>
+
+ Added new API to specify cache models for GTK port.
+
+ * webkit/webkitprivate.cpp:
+ (webkit_init): set a default cache model.
+ * webkit/webkitwebview.cpp:
+ * webkit/webkitwebview.h:
+ (webkit_set_cache_model): Added function.
+ (webkit_get_cache_model): Added function.
+
+2009-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Revert the previous patch, it introduces some failures in the
+ bots.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::committedLoad):
+ (WebKit::FrameLoaderClient::transitionToCommittedForNewPage):
+
+2009-12-20 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ [GTK] crash when loading new page
+ https://bugs.webkit.org/show_bug.cgi?id=32752
+
+ Wait until the document is attached to adjust our alignments,
+ since we need to make sure the FrameView in the document content
+ render object matches the newly created FrameView for the new
+ page, otherwise we'll try to relayout the wrong view.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::committedLoad):
+ (WebKit::FrameLoaderClient::transitionToCommittedForNewPage):
+
+2009-12-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Create a new WebKitDataSource object when attaching to a frame, if
+ one does not exist. This may happen when we are fetching data from
+ the page cache.
+
+ * WebCoreSupport/DocumentLoaderGtk.cpp:
+ (WebKit::DocumentLoader::attachToFrame):
+ (WebKit::DocumentLoader::unrefDataSource):
+
+2009-12-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Rubber-stamped by Xan Lopez.
+
+ Make sure the text encoding machinery is initialized from the main
+ frame, before opening the icon database.
+
+ * webkit/webkitprivate.cpp:
+ (webkit_init):
+
+2009-12-19 Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ Fixed the problem when pasting in the same window with the
+ middle-button, now we store a reference to the range instead of
+ requesting it every time, and we do not release it until the
+ clipboard is requested.
+ https://bugs.webkit.org/show_bug.cgi?id=28153
+
+ * WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:
+ * WebKit/gtk/WebCoreSupport/EditorClientGtk.h:
+
+2009-12-19 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Protect download objects when reporting errors, to make sure the
+ download stays alive between the status change notification, and
+ the error signal emission.
+
+ * webkit/webkitdownload.cpp:
+ (webkit_download_error):
+
+2009-12-18 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Gustavo Noronha.
+
+ Fix gtk-doc of webkit_web_resource_new.
+
+ * webkit/webkitwebresource.cpp:
+
+2009-12-18 Adam Roben <aroben@apple.com>
+
+ GTK build fix
+
+ * webkit/webkitprivate.cpp: Added #include.
+
+2009-12-18 Kalle Vahlman <kalle.vahlman@movial.com> and Alejandro G. Castro <alex@igalia.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Add enable-page-cache property to WebSettings for disabling the Page Cache
+
+ * webkit/webkitwebsettings.cpp:
+ (_WebKitWebSettingsPrivate::):
+ (_WebKitWebSettingsPrivate::webkit_web_settings_class_init):
+ (_WebKitWebSettingsPrivate::webkit_web_settings_set_property):
+ (_WebKitWebSettingsPrivate::webkit_web_settings_get_property):
+ (_WebKitWebSettingsPrivate::webkit_web_settings_copy):
+ * webkit/webkitwebview.cpp:
+
+2009-12-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ More make distcheck fixes. Use a more robust solution to making
+ sure we are in the correct directory for running these tests.
+
+ * tests/testmimehandling.c:
+ (main):
+ * tests/testwebview.c:
+ (main):
+
+2009-12-17 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] Don't assume downloads are always synchronous
+ http://bugs.webkit.org/show_bug.cgi?id=32359
+
+ * tests/testdownload.c:
+ (download_requested_cb):
+ (set_filename):
+ (test_webkit_download_perform):
+ (test_webkit_download_synch):
+ (test_webkit_download_asynch):
+ (main): Test downloads synchronously and asynchronously.
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_class_init):
+ (webkit_web_view_request_download): Only try to start a requested
+ download if the destination URI is set and clarify the documentation.
+
+2009-12-17 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Xan Lopez.
+
+ Deprecate the title-changed signal of WebKitWebFrame.
+
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_class_init):
+
+2009-12-17 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] WebKit GTK needs a wrapper for ref counted glib/gobject structs
+ https://bugs.webkit.org/show_bug.cgi?id=21599
+
+ Convert a use of GOwnPtr for a reference counted type to GRefPtr.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::createPlugin):
+
+2009-12-17 Evan Martin <evan@chromium.org>
+
+ Reviewed by Xan Lopez.
+
+ Expose the page workarounds ("quirks") setting to the GTK+ WebKit API.
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_web_settings_class_init):
+ (webkit_web_settings_set_property):
+ (webkit_web_settings_get_property):
+ (webkit_web_settings_copy):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_update_settings):
+
+2009-12-16 Dan Winship <danw@gnome.org>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Content-Encoding support
+
+ https://bugs.webkit.org/show_bug.cgi?id=522772
+
+ * webkit/webkitprivate.cpp:
+ (webkit_init): add a SoupContentDecoder feature to the session
+
+2009-12-16 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Deprecate the old loading signals load-started, load-committed,
+ load-finished, load-progress-changed and change unit tests to use
+ load-status instead.
+
+ * tests/testmimehandling.c:
+ (idle_quit_loop_cb):
+ (test_mime_type): use notify::load-status
+ * tests/testwebdatasource.c:
+ (notify_load_status_unreachable_cb):
+ (notify_load_status_cb):
+ (test_webkit_web_data_source):
+ (test_webkit_web_data_source_unreachable_uri): Remove uses of
+ g_main_loop_is_running. It's an error if the loop is wrongly terminated.
+ * tests/testwebresource.c:
+ (notify_load_status_cb):
+ (test_web_resource_loading):
+ (notify_load_status_sub_cb):
+ (test_web_resource_sub_resource_loading): use notify::load-status
+ * tests/testwebview.c:
+ (idle_quit_loop_cb):
+ (test_webkit_web_view_icon_uri):
+ * tests/testwindow.c:
+ (notify_load_status_cb):
+ (test_webkit_window_scrollbar_policy): use notify::load-status
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_class_init):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_class_init): Deprecate old load signals.
+
+2009-12-16 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Take into account favicon.ico in the webresource test.
+
+ * tests/testwebresource.c:
+ (test_web_resource_sub_resource_loading):
+
+2009-12-16 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Rubber-stamped by Xan Lopez.
+
+ Add tab_key_cycles_through_elements to copies of
+ WebKitWebSettings.
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_web_settings_copy):
+
+2009-12-16 Martin Robinson <martin.james.robinson@gmail.com>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [GTK] webkit_web_navigation_action_get_button() documentation
+ https://bugs.webkit.org/show_bug.cgi?id=25555
+
+ Small documentation improvement for webkit_web_navigation_action_get_button.
+
+ * webkit/webkitwebnavigationaction.cpp:
+
+>>>>>>> webkit.org at r54127
2009-12-13 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
@@ -13,6 +582,61 @@
* webkit/webkitwebview.cpp:
(webkit_web_view_init):
+<<<<<<< HEAD
+=======
+2009-12-14 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ New setting to allow applications to completely suppress the
+ default context menu that is generated by WebKit. This allows them
+ to still pass the event to the default handler without needing to
+ use ugly hacks such as handling populate-popup, and removing all
+ the items from the default context menu.
+
+ * webkit/webkitwebsettings.cpp:
+ (webkit_web_settings_class_init):
+ (webkit_web_settings_set_property):
+ (webkit_web_settings_get_property):
+ (webkit_web_settings_copy):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_forward_context_menu_event):
+
+2009-12-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Xan Lopez.
+
+ Also give the right click event to the frame's event handler, if
+ there WebCore decides to not generate the default context
+ menu. This fixes some pages that handle right-button clicks for
+ things other than context menu creation.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_forward_context_menu_event):
+
+2009-12-13 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Holger Freyther.
+
+ http://bugs.webkit.org/show_bug.cgi?id=31014
+ [Gtk] Build fails with gtk+-2.10 (no tested with older releases)
+
+ Guard GTK+ 2.12 specific tooltip code with #ifdef.
+
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ (WebKit::ChromeClient::mouseDidMoveOverElement):
+
+2009-12-11 Christian Dywan <christian@twotoasts.de>
+
+ Reviewed by Eric Seidel.
+
+ [GTK] Build with --disable-svg is broken
+ http://bugs.webkit.org/show_bug.cgi?id=32361
+
+ * webkit/webkitwebframe.cpp:
+ (webkit_web_frame_pause_svg_animation): Fix ENABLE(SVG) guards.
+
+>>>>>>> webkit.org at r54127
2009-12-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS
index f40390e..18b5e3c 100644
--- a/WebKit/gtk/NEWS
+++ b/WebKit/gtk/NEWS
@@ -1,4 +1,50 @@
=================
+WebKitGTK+ 1.1.19
+=================
+
+What's new in WebKitGTK+ 1.1.19?
+
+ - Improvements to AtkText implementation
+ - RGBA colormap support has been added
+ - Improvements to the HTML5 media player
+ - Crashes related to clipboard handling, which were hitting many
+ users and seemed to be random have been fixed
+
+=================
+WebKitGTK+ 1.1.18
+=================
+
+What's new in WebKitGTK+ 1.1.18?
+
+ - Add methods to set and get a cache model in WebKitGTK+. We offer
+ two possibilites: document viewer (no caches are used) and browser
+ (similar to the previous defaults).
+ - Add WebKitWebSettings::enable-page-cache. Controls whether the
+ Page Cache is enabled or not. For details about what the page
+ cache is and does see
+ http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
+ The page cache is disabled by default, since the gtk+ port still
+ presents some small bugs when it's enabled.
+ - Add WebKitWebSettings::enable-site-specific-quirks. Controls
+ whether a series of page-specific workarounds are used by WebKit.
+ - Use Content-Encoding support available in libsoup 2.28.2 and
+ newer.
+ - Add WebKitWebSettings::enable-default-context-menu. Controls
+ whether webkitgtk+ will show a default context menu on right click
+ in the view. Note that even with the property set to FALSE right
+ clicks can be handled by the page, either by actions or by
+ ad-hoc in-page context menus.
+ - Make the WebKitWebView::icon-loaded signal carry a string with the
+ favicon's URI. This is an API break, but the signal already had a
+ broken signature and was useless anyway, so it's extremely
+ unlikely that anybody was using it. Also, add the 'icon-uri'
+ property to the view, holding the URI for its current favicon.
+ - Respect Content-Disposition header in downloads (fixes downloads
+ in gmail).
+ - Various accessibility improvements.
+ - Many bugfixes.
+
+=================
WebKitGTK+ 1.1.17
=================
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index d9a043b..8ea8991 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -64,7 +64,11 @@ void ChromeClient::chromeDestroyed()
FloatRect ChromeClient::windowRect()
{
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
+#if GTK_CHECK_VERSION(2, 18, 0)
+ if (gtk_widget_is_toplevel(window)) {
+#else
if (GTK_WIDGET_TOPLEVEL(window)) {
+#endif
gint left, top, width, height;
gtk_window_get_position(GTK_WINDOW(window), &left, &top);
gtk_window_get_size(GTK_WINDOW(window), &width, &height);
@@ -106,7 +110,11 @@ void ChromeClient::focus()
void ChromeClient::unfocus()
{
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
+#if GTK_CHECK_VERSION(2, 18, 0)
+ if (gtk_widget_is_toplevel(window))
+#else
if (GTK_WIDGET_TOPLEVEL(window))
+#endif
gtk_window_set_focus(GTK_WINDOW(window), NULL);
}
@@ -234,7 +242,11 @@ void ChromeClient::closeWindowSoon()
bool ChromeClient::canTakeFocus(FocusDirection)
{
+#if GTK_CHECK_VERSION(2, 18, 0)
+ return gtk_widget_get_can_focus(GTK_WIDGET(m_webView));
+#else
return GTK_WIDGET_CAN_FOCUS(m_webView);
+#endif
}
void ChromeClient::takeFocus(FocusDirection)
@@ -442,20 +454,6 @@ void ChromeClient::scrollbarsModeDidChange() const
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags)
{
- // If a tooltip must be displayed it will be, afterwards, when
- // setToolTip is called; this is just a work-around to make sure
- // it updates its location correctly; see
- // https://bugs.webkit.org/show_bug.cgi?id=15793.
- g_object_set(m_webView, "has-tooltip", FALSE, NULL);
-
- GdkDisplay* gdkDisplay;
- GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
- if (GTK_WIDGET_TOPLEVEL(window))
- gdkDisplay = gtk_widget_get_display(window);
- else
- gdkDisplay = gdk_display_get_default();
- gtk_tooltip_trigger_tooltip_query(gdkDisplay);
-
// check if the element is a link...
bool isLink = hit.isLiveLink();
if (isLink) {
@@ -475,16 +473,7 @@ void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned mo
void ChromeClient::setToolTip(const String& toolTip, TextDirection)
{
-#if GTK_CHECK_VERSION(2,12,0)
- if (toolTip.isEmpty())
- g_object_set(m_webView, "has-tooltip", FALSE, NULL);
- else
- gtk_widget_set_tooltip_text(GTK_WIDGET(m_webView), toolTip.utf8().data());
-#else
- // TODO: Support older GTK+ versions
- // See http://bugs.webkit.org/show_bug.cgi?id=15793
- notImplemented();
-#endif
+ webkit_web_view_set_tooltip_text(m_webView, toolTip.utf8().data());
}
void ChromeClient::print(Frame* frame)
diff --git a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp
index 0efc9fa..2b355cb 100644
--- a/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "DocumentLoaderGtk.h"
+#include "webkitprivate.h"
#include "webkitwebdatasource.h"
using namespace WebCore;
@@ -60,7 +61,16 @@ void DocumentLoader::attachToFrame()
{
WebCore::DocumentLoader::attachToFrame();
- refDataSource();
+ if (m_dataSource) {
+ refDataSource();
+ return;
+ }
+
+ // 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);
}
void DocumentLoader::detachFromFrame()
@@ -110,6 +120,7 @@ void DocumentLoader::unrefDataSource()
ASSERT(m_dataSource);
m_isDataSourceReffed = false;
g_object_unref(m_dataSource);
+ m_dataSource = 0;
}
} // end namespace WebKit
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 6ec6baf..02d1a53 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -24,6 +24,7 @@
#include "EditorClientGtk.h"
#include "CString.h"
+#include "DataObjectGtk.h"
#include "EditCommand.h"
#include "Editor.h"
#include <enchant.h>
@@ -35,6 +36,7 @@
#include "KeyboardEvent.h"
#include "NotImplemented.h"
#include "Page.h"
+#include "PasteboardHelperGtk.h"
#include "PlatformKeyboardEvent.h"
#include "markup.h"
#include "webkitprivate.h"
@@ -185,35 +187,11 @@ void EditorClient::respondToChangedContents()
notImplemented();
}
-static void clipboard_get_contents_cb(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data)
-{
- WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
- Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- PassRefPtr<Range> selectedRange = frame->selection()->toNormalizedRange();
-
- if (static_cast<gint>(info) == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) {
- String markup = createMarkup(selectedRange.get(), 0, AnnotateForInterchange);
- gtk_selection_data_set(selection_data, selection_data->target, 8,
- reinterpret_cast<const guchar*>(markup.utf8().data()), markup.utf8().length());
- } else {
- String text = selectedRange->text();
- gtk_selection_data_set_text(selection_data, text.utf8().data(), text.utf8().length());
- }
-}
-
-static void clipboard_clear_contents_cb(GtkClipboard* clipboard, gpointer data)
-{
- WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
- Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-
- // Collapse the selection without clearing it
- frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
-}
-
void EditorClient::respondToChangedSelection()
{
WebKitWebViewPrivate* priv = m_webView->priv;
- Frame* targetFrame = core(m_webView)->focusController()->focusedOrMainFrame();
+ WebCore::Page* corePage = core(m_webView);
+ Frame* targetFrame = corePage->focusController()->focusedOrMainFrame();
if (!targetFrame)
return;
@@ -221,16 +199,16 @@ void EditorClient::respondToChangedSelection()
if (targetFrame->editor()->ignoreCompositionSelectionChange())
return;
+#if PLATFORM(X11)
GtkClipboard* clipboard = gtk_widget_get_clipboard(GTK_WIDGET(m_webView), GDK_SELECTION_PRIMARY);
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+
if (targetFrame->selection()->isRange()) {
- GtkTargetList* targetList = webkit_web_view_get_copy_target_list(m_webView);
- gint targetCount;
- GtkTargetEntry* targets = gtk_target_table_new_from_list(targetList, &targetCount);
- gtk_clipboard_set_with_owner(clipboard, targets, targetCount,
- clipboard_get_contents_cb, clipboard_clear_contents_cb, G_OBJECT(m_webView));
- gtk_target_table_free(targets, targetCount);
- } else if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(m_webView))
- gtk_clipboard_clear(clipboard);
+ dataObject->clear();
+ dataObject->setRange(targetFrame->selection()->toNormalizedRange());
+ pasteboardHelperInstance()->writeClipboardContents(clipboard, m_webView);
+ }
+#endif
if (!targetFrame->editor()->hasComposition())
return;
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 0eaa7c8..8f1bec2 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -33,6 +33,7 @@
#include "FrameView.h"
#include "FrameTree.h"
#include "GOwnPtr.h"
+#include "GRefPtr.h"
#include "GtkPluginWidget.h"
#include "HTMLAppletElement.h"
#include "HTMLFormElement.h"
@@ -76,6 +77,7 @@ namespace WebKit {
FrameLoaderClient::FrameLoaderClient(WebKitWebFrame* frame)
: m_frame(frame)
, m_policyDecision(0)
+ , m_loadingErrorPage(false)
, m_pluginView(0)
, m_hasSentResponseToPlugin(false)
{
@@ -440,7 +442,7 @@ PassRefPtr<Widget> FrameLoaderClient::createPlugin(const IntSize& pluginSize, HT
CString mimeTypeString = mimeType.utf8();
ASSERT(paramNames.size() == paramValues.size());
- GOwnPtr<GHashTable> hash(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()),
@@ -567,6 +569,11 @@ bool FrameLoaderClient::hasWebView() const
void FrameLoaderClient::dispatchDidFinishLoad()
{
+ if (m_loadingErrorPage) {
+ m_loadingErrorPage = false;
+ return;
+ }
+
loadDone(m_frame, true);
}
@@ -639,7 +646,9 @@ void FrameLoaderClient::setCopiesOnScroll()
void FrameLoaderClient::detachedFromParent2()
{
- notImplemented();
+ FrameView *view = core(m_frame)->view();
+ if (view)
+ view->setGtkAdjustments(0, 0);
}
void FrameLoaderClient::detachedFromParent3()
@@ -700,6 +709,9 @@ void FrameLoaderClient::dispatchWillClose()
void FrameLoaderClient::dispatchDidReceiveIcon()
{
+ if (m_loadingErrorPage)
+ return;
+
WebKitWebView* webView = getViewFromFrame(m_frame);
// Avoid reporting favicons for non-main frames.
@@ -712,11 +724,17 @@ void FrameLoaderClient::dispatchDidReceiveIcon()
void FrameLoaderClient::dispatchDidStartProvisionalLoad()
{
+ if (m_loadingErrorPage)
+ return;
+
notifyStatus(m_frame, WEBKIT_LOAD_PROVISIONAL);
}
void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)
{
+ if (m_loadingErrorPage)
+ return;
+
WebKitWebFramePrivate* priv = m_frame->priv;
g_free(priv->title);
priv->title = g_strdup(title.utf8().data());
@@ -733,6 +751,9 @@ void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)
void FrameLoaderClient::dispatchDidCommitLoad()
{
+ if (m_loadingErrorPage)
+ return;
+
/* Update the URI once first data has been received.
* This means the URI is valid and successfully identify the page that's going to be loaded.
*/
@@ -740,7 +761,7 @@ void FrameLoaderClient::dispatchDidCommitLoad()
WebKitWebFramePrivate* priv = m_frame->priv;
g_free(priv->uri);
- priv->uri = g_strdup(core(m_frame)->loader()->url().prettyURL().utf8().data());
+ priv->uri = g_strdup(core(m_frame)->loader()->activeDocumentLoader()->url().prettyURL().utf8().data());
g_free(priv->title);
priv->title = NULL;
g_object_notify(G_OBJECT(m_frame), "uri");
@@ -773,6 +794,9 @@ void FrameLoaderClient::dispatchDidFirstLayout()
void FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
{
+ if (m_loadingErrorPage)
+ return;
+
notifyStatus(m_frame, WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT);
}
@@ -837,9 +861,10 @@ String FrameLoaderClient::generatedMIMETypeForURLScheme(const String&) const
void FrameLoaderClient::finishedLoading(WebCore::DocumentLoader* documentLoader)
{
- if (!m_pluginView)
- committedLoad(documentLoader, 0, 0);
- else {
+ if (!m_pluginView) {
+ FrameLoader* loader = documentLoader->frameLoader();
+ loader->setEncoding(m_response.textEncodingName(), false);
+ } else {
m_pluginView->didFinishLoading();
m_pluginView = 0;
m_hasSentResponseToPlugin = false;
@@ -933,6 +958,9 @@ void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& erro
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
{
+ if (m_loadingErrorPage)
+ return;
+
notifyStatus(m_frame, WEBKIT_LOAD_FAILED);
WebKitWebView* webView = getViewFromFrame(m_frame);
@@ -952,6 +980,8 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
return;
}
+ m_loadingErrorPage = true;
+
String content;
gchar* fileContent = 0;
gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL);
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
index cace770..b364873 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
@@ -184,6 +184,8 @@ namespace WebKit {
WebCore::ResourceResponse m_response;
WebKitWebPolicyDecision* m_policyDecision;
+ bool m_loadingErrorPage;
+
// Plugin view to redirect data to
WebCore::PluginView* m_pluginView;
bool m_hasSentResponseToPlugin;
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index a06ff50..99bc627 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -44,13 +44,8 @@ InspectorClient::InspectorClient(WebKitWebView* webView)
void InspectorClient::inspectorDestroyed()
{
- if (m_webView) {
- gboolean handled = FALSE;
- g_signal_emit_by_name(m_webInspector, "destroy", &handled);
-
- /* we can now dispose our own reference */
+ if (m_webInspector)
g_object_unref(m_webInspector);
- }
delete this;
}
@@ -64,6 +59,7 @@ void InspectorClient::webViewDestroyed()
// something else, and the inspector will be referenced again,
// there.
g_object_unref(m_webInspector);
+ m_webInspector = 0;
}
Page* InspectorClient::createPage()
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
index c71ef1b..8406ada 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
@@ -20,13 +20,14 @@
#include "config.h"
#include "PasteboardHelperGtk.h"
+#include "DataObjectGtk.h"
+#include "FocusController.h"
#include "Frame.h"
+#include <gtk/gtk.h>
#include "webkitwebframe.h"
#include "webkitwebview.h"
#include "webkitprivate.h"
-#include <gtk/gtk.h>
-
using namespace WebCore;
namespace WebKit {
@@ -79,4 +80,102 @@ gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const
return WEBKIT_WEB_VIEW_TARGET_INFO_HTML;
}
+static void fillSelectionData(GtkSelectionData* selectionData, guint info, DataObjectGtk* dataObject)
+{
+ if (info == WEBKIT_WEB_VIEW_TARGET_INFO_TEXT)
+ gtk_selection_data_set_text(selectionData, dataObject->text().utf8().data(), -1);
+ else if (info == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) {
+ GOwnPtr<gchar> markup(g_strdup(dataObject->markup().utf8().data()));
+ gtk_selection_data_set(selectionData, selectionData->target, 8,
+ reinterpret_cast<const guchar*>(markup.get()),
+ strlen(markup.get()));
+ }
+}
+
+static GtkTargetList* targetListForDataObject(DataObjectGtk* dataObject)
+{
+ GtkTargetList* list = gtk_target_list_new(0, 0);
+
+ if (dataObject->hasText())
+ gtk_target_list_add_text_targets(list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
+
+ if (dataObject->hasMarkup())
+ gtk_target_list_add(list, gdkMarkupAtom, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
+
+ return list;
+}
+
+static bool settingClipboard = false;
+static void getClipboardContentsCallback(GtkClipboard* clipboard, GtkSelectionData *selectionData, guint info, gpointer data)
+{
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ ASSERT(dataObject);
+ fillSelectionData(selectionData, info, dataObject);
+}
+
+static void clearClipboardContentsCallback(GtkClipboard* clipboard, gpointer data)
+{
+ // GTK will call the clear clipboard callback while setting clipboard data.
+ // We don't actually want to clear the DataObject during that time.
+ if (settingClipboard)
+ return;
+
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ ASSERT(dataObject);
+ dataObject->clear();
+
+ // This will be true for clipboards other than X11 primary.
+ if (!data)
+ return;
+
+ WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
+ WebCore::Page* corePage = core(webView);
+
+ if (!corePage || !corePage->focusController()) {
+ g_object_unref(webView);
+ return;
+ }
+
+ Frame* frame = corePage->focusController()->focusedOrMainFrame();
+
+ // Collapse the selection without clearing it
+ ASSERT(frame);
+ frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
+
+ g_object_unref(webView);
+}
+
+void PasteboardHelperGtk::writeClipboardContents(GtkClipboard* clipboard, gpointer data)
+{
+ DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
+ GtkTargetList* list = targetListForDataObject(dataObject);
+
+ int numberOfTargets;
+ GtkTargetEntry* table = gtk_target_table_new_from_list(list, &numberOfTargets);
+
+ if (numberOfTargets > 0 && table) {
+ settingClipboard = true;
+
+ // Protect the web view from being destroyed before one of the clipboard callbacks
+ // is called. Balanced in both getClipboardContentsCallback and
+ // clearClipboardContentsCallback.
+ WebKitWebView* webView = static_cast<WebKitWebView*>(data);
+ g_object_ref(webView);
+
+ gboolean succeeded = gtk_clipboard_set_with_data(clipboard, table, numberOfTargets,
+ getClipboardContentsCallback,
+ clearClipboardContentsCallback, data);
+ if (!succeeded)
+ g_object_unref(webView);
+
+ settingClipboard = false;
+ } else
+ gtk_clipboard_clear(clipboard);
+
+ if (table)
+ gtk_target_table_free(table, numberOfTargets);
+
+ gtk_target_list_unref(list);
+}
+
}
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
index 12ba207..97eff90 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
@@ -47,6 +47,8 @@ public:
virtual GtkTargetList* targetList() const;
virtual gint getWebViewTargetInfoHtml() const;
+ void writeClipboardContents(GtkClipboard* clipboard, gpointer data = 0);
+
private:
GtkTargetList* m_targetList;
};
diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml
index ca478f9..d61a4fd 100644
--- a/WebKit/gtk/docs/webkitgtk-docs.sgml
+++ b/WebKit/gtk/docs/webkitgtk-docs.sgml
@@ -29,6 +29,7 @@
<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>
@@ -96,4 +97,7 @@
<index id="index-1.1.17" role="1.1.17">
<title>Index of new symbols in 1.1.17</title>
</index>
+ <index id="index-1.1.18" role="1.1.18">
+ <title>Index of new symbols in 1.1.18</title>
+ </index>
</book>
diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt
index 1f4d1b7..9574280 100644
--- a/WebKit/gtk/docs/webkitgtk-sections.txt
+++ b/WebKit/gtk/docs/webkitgtk-sections.txt
@@ -58,6 +58,7 @@ WebKitWebBackForwardListClass
<FILE>webkitwebhistoryitem</FILE>
<TITLE>WebKitWebHistoryItem</TITLE>
WebKitWebHistoryItem
+webkit_web_history_item_copy
webkit_web_history_item_get_alternate_title
webkit_web_history_item_get_last_visited_time
webkit_web_history_item_get_original_uri
@@ -91,6 +92,7 @@ webkit_web_frame_get_global_context
webkit_web_frame_get_horizontal_scrollbar_policy
webkit_web_frame_get_load_status
webkit_web_frame_get_name
+webkit_web_frame_get_network_response
webkit_web_frame_get_parent
webkit_web_frame_get_provisional_data_source
webkit_web_frame_get_security_origin
@@ -419,6 +421,7 @@ webkit_web_view_get_encoding
webkit_web_view_get_focused_frame
webkit_web_view_get_full_content_zoom
webkit_web_view_get_hit_test_result
+webkit_web_view_get_icon_uri
webkit_web_view_get_inspector
webkit_web_view_get_load_status
webkit_web_view_get_main_frame
@@ -581,3 +584,9 @@ 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/testatk.c b/WebKit/gtk/tests/testatk.c
index c5f4db3..7db274a 100644
--- a/WebKit/gtk/tests/testatk.c
+++ b/WebKit/gtk/tests/testatk.c
@@ -34,6 +34,10 @@ static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is
static const char* contentsInTextInput = "<html><body><input type='text' size='80' value='This is a test. This is the second sentence. And this the third.'/></body></html>";
+static const char* contentsInParagraphAndBodySimple = "<html><body><p>This is a test.</p>Hello world.</body></html>";
+
+static const char* contentsInParagraphAndBodyModerate = "<html><body><p>This is a test.</p>Hello world.<br /><font color='#00cc00'>This sentence is green.</font><br />This one is not.</body></html>";
+
static gboolean bail_out(GMainLoop* loop)
{
if (g_main_loop_is_running(loop))
@@ -221,8 +225,6 @@ static void test_webkit_atk_get_text_at_offset_forms(void)
g_assert(obj);
obj = atk_object_ref_accessible_child(obj, 0);
g_assert(obj);
- obj = atk_object_ref_accessible_child(obj, 0);
- g_assert(obj);
text_obj = ATK_TEXT(obj);
g_assert(ATK_IS_TEXT(text_obj));
@@ -254,8 +256,6 @@ static void test_webkit_atk_get_text_at_offset(void)
g_assert(obj);
obj = atk_object_ref_accessible_child(obj, 0);
g_assert(obj);
- obj = atk_object_ref_accessible_child(obj, 0);
- g_assert(obj);
text_obj = ATK_TEXT(obj);
g_assert(ATK_IS_TEXT(text_obj));
@@ -287,8 +287,6 @@ static void test_webkit_atk_get_text_at_offset_newlines(void)
g_assert(obj);
obj = atk_object_ref_accessible_child(obj, 0);
g_assert(obj);
- obj = atk_object_ref_accessible_child(obj, 0);
- g_assert(obj);
text_obj = ATK_TEXT(obj);
g_assert(ATK_IS_TEXT(text_obj));
@@ -364,6 +362,94 @@ static void test_webkit_atk_get_text_at_offset_text_input(void)
g_object_unref(webView);
}
+static void testWebkitAtkGetTextInParagraphAndBodySimple(void)
+{
+ WebKitWebView* webView;
+ AtkObject* obj;
+ AtkObject* obj1;
+ AtkObject* obj2;
+ GMainLoop* loop;
+ AtkText* textObj1;
+ AtkText* textObj2;
+
+ webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_object_ref_sink(webView);
+ GtkAllocation alloc = { 0, 0, 800, 600 };
+ gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
+ webkit_web_view_load_string(webView, contentsInParagraphAndBodySimple, NULL, NULL, NULL);
+ loop = g_main_loop_new(NULL, TRUE);
+
+ g_timeout_add(100, (GSourceFunc)bail_out, loop);
+ g_main_loop_run(loop);
+
+ /* Get to the inner AtkText object */
+ obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
+ g_assert(obj);
+ obj1 = atk_object_ref_accessible_child(obj, 0);
+ g_assert(obj1);
+ obj2 = atk_object_ref_accessible_child(obj, 1);
+ g_assert(obj2);
+
+ textObj1 = ATK_TEXT(obj1);
+ g_assert(ATK_IS_TEXT(textObj1));
+ textObj2 = ATK_TEXT(obj2);
+ g_assert(ATK_IS_TEXT(textObj2));
+
+ char *text = atk_text_get_text(textObj1, 0, -1);
+ g_assert_cmpstr(text, ==, "This is a test.");
+
+ text = atk_text_get_text(textObj2, 0, 12);
+ g_assert_cmpstr(text, ==, "Hello world.");
+
+ g_object_unref(obj1);
+ g_object_unref(obj2);
+ g_object_unref(webView);
+}
+
+static void testWebkitAtkGetTextInParagraphAndBodyModerate(void)
+{
+ WebKitWebView* webView;
+ AtkObject* obj;
+ AtkObject* obj1;
+ AtkObject* obj2;
+ GMainLoop* loop;
+ AtkText* textObj1;
+ AtkText* textObj2;
+
+ webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_object_ref_sink(webView);
+ GtkAllocation alloc = { 0, 0, 800, 600 };
+ gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
+ webkit_web_view_load_string(webView, contentsInParagraphAndBodyModerate, NULL, NULL, NULL);
+ loop = g_main_loop_new(NULL, TRUE);
+
+ g_timeout_add(100, (GSourceFunc)bail_out, loop);
+ g_main_loop_run(loop);
+
+ /* Get to the inner AtkText object */
+ obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
+ g_assert(obj);
+ obj1 = atk_object_ref_accessible_child(obj, 0);
+ g_assert(obj1);
+ obj2 = atk_object_ref_accessible_child(obj, 1);
+ g_assert(obj2);
+
+ textObj1 = ATK_TEXT(obj1);
+ g_assert(ATK_IS_TEXT(textObj1));
+ textObj2 = ATK_TEXT(obj2);
+ g_assert(ATK_IS_TEXT(textObj2));
+
+ char *text = atk_text_get_text(textObj1, 0, -1);
+ g_assert_cmpstr(text, ==, "This is a test.");
+
+ text = atk_text_get_text(textObj2, 0, 53);
+ g_assert_cmpstr(text, ==, "Hello world.\nThis sentence is green.\nThis one is not.");
+
+ g_object_unref(obj1);
+ g_object_unref(obj2);
+ g_object_unref(webView);
+}
+
int main(int argc, char** argv)
{
g_thread_init(NULL);
@@ -375,6 +461,8 @@ int main(int argc, char** argv)
g_test_add_func("/webkit/atk/get_text_at_offset_newlines", test_webkit_atk_get_text_at_offset_newlines);
g_test_add_func("/webkit/atk/get_text_at_offset_textarea", test_webkit_atk_get_text_at_offset_textarea);
g_test_add_func("/webkit/atk/get_text_at_offset_text_input", test_webkit_atk_get_text_at_offset_text_input);
+ g_test_add_func("/webkit/atk/getTextInParagraphAndBodySimple", testWebkitAtkGetTextInParagraphAndBodySimple);
+ g_test_add_func("/webkit/atk/getTextInParagraphAndBodyModerate", testWebkitAtkGetTextInParagraphAndBodyModerate);
return g_test_run ();
}
diff --git a/WebKit/gtk/tests/testdownload.c b/WebKit/gtk/tests/testdownload.c
index 0d964ed..05c3a8d 100644
--- a/WebKit/gtk/tests/testdownload.c
+++ b/WebKit/gtk/tests/testdownload.c
@@ -26,6 +26,7 @@
GMainLoop* loop;
char* temporaryFilename = NULL;
+WebKitDownload* theDownload = NULL;
static void
test_webkit_download_create(void)
@@ -87,6 +88,7 @@ download_requested_cb(WebKitWebView* web_view,
WebKitDownload* download,
gboolean* beenThere)
{
+ theDownload = download;
*beenThere = TRUE;
if (temporaryFilename) {
gchar *uri = g_filename_to_uri(temporaryFilename, NULL, NULL);
@@ -101,8 +103,19 @@ download_requested_cb(WebKitWebView* web_view,
return TRUE;
}
+static gboolean
+set_filename(gchar* filename)
+{
+ gchar *uri = g_filename_to_uri(filename, NULL, NULL);
+ webkit_download_set_destination_uri(theDownload, uri);
+ g_free(uri);
+ temporaryFilename = filename;
+ webkit_download_start(theDownload);
+ return FALSE;
+}
+
static void
-test_webkit_download_perform(void)
+test_webkit_download_perform(gboolean asynch)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -121,16 +134,23 @@ test_webkit_download_perform(void)
* utilities file, because we have a very similar one in
* testwebframe.c */
GError *error = NULL;
- int fd = g_file_open_tmp ("webkit-testwebdownload-XXXXXX",
- &temporaryFilename, &error);
+ gchar* filename;
+ int fd = g_file_open_tmp("webkit-testwebdownload-XXXXXX", &filename, &error);
close(fd);
if (error)
g_critical("Failed to open a temporary file for writing: %s.", error->message);
- if (g_unlink(temporaryFilename) == -1)
+ if (g_unlink(filename) == -1)
g_critical("Failed to delete the temporary file: %s.", g_strerror(errno));
+ if (asynch)
+ g_idle_add((GSourceFunc)set_filename, filename);
+ else
+ temporaryFilename = filename;
+
+ theDownload = NULL;
+
loop = g_main_loop_new(NULL, TRUE);
webkit_web_view_load_uri(webView, "http://gnome.org/");
g_main_loop_run(loop);
@@ -145,6 +165,18 @@ test_webkit_download_perform(void)
g_object_unref(webView);
}
+static void
+test_webkit_download_synch(void)
+{
+ test_webkit_download_perform(FALSE);
+}
+
+static void
+test_webkit_download_asynch(void)
+{
+ test_webkit_download_perform(TRUE);
+}
+
int main(int argc, char** argv)
{
g_thread_init(NULL);
@@ -152,7 +184,8 @@ int main(int argc, char** argv)
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/download/create", test_webkit_download_create);
- g_test_add_func("/webkit/download/perform", test_webkit_download_perform);
+ g_test_add_func("/webkit/download/synch", test_webkit_download_synch);
+ g_test_add_func("/webkit/download/asynch", test_webkit_download_asynch);
return g_test_run ();
}
diff --git a/WebKit/gtk/tests/testloading.c b/WebKit/gtk/tests/testloading.c
index c1f0fac..fd9a05c 100644
--- a/WebKit/gtk/tests/testloading.c
+++ b/WebKit/gtk/tests/testloading.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Gustavo Noronha Silva
+ * Copyright (C) 2009, 2010 Gustavo Noronha Silva
* Copyright (C) 2009 Igalia S.L.
*
* This library is free software; you can redistribute it and/or
@@ -19,10 +19,45 @@
*/
#include <gtk/gtk.h>
+#include <libsoup/soup.h>
+#include <string.h>
#include <webkit/webkit.h>
#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
+/* This string has to be rather big because of the cancelled test - it
+ * looks like soup refuses to send or receive a too small chunk */
+#define HTML_STRING "<html><body>Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!Testing!</body></html>"
+
+SoupURI* base_uri;
+
+/* For real request testing */
+static void
+server_callback(SoupServer* server, SoupMessage* msg,
+ const char* path, GHashTable* query,
+ SoupClientContext* context, gpointer data)
+{
+ if (msg->method != SOUP_METHOD_GET) {
+ soup_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED);
+ return;
+ }
+
+ soup_message_set_status(msg, SOUP_STATUS_OK);
+
+ if (g_str_equal(path, "/test_loading_status") || g_str_equal(path, "/test_loading_status2"))
+ soup_message_body_append(msg->response_body, SOUP_MEMORY_STATIC, HTML_STRING, strlen(HTML_STRING));
+ else if (g_str_equal(path, "/test_load_error")) {
+ soup_message_set_status(msg, SOUP_STATUS_CANT_CONNECT);
+ } else if (g_str_equal(path, "/test_loading_cancelled")) {
+ soup_message_headers_set_encoding(msg->response_headers, SOUP_ENCODING_CHUNKED);
+ soup_message_body_append(msg->response_body, SOUP_MEMORY_STATIC, HTML_STRING, strlen(HTML_STRING));
+ soup_server_unpause_message(server, msg);
+ return;
+ }
+
+ soup_message_body_complete(msg->response_body);
+}
+
typedef struct {
WebKitWebView* webView;
GMainLoop *loop;
@@ -53,6 +88,18 @@ static void web_loading_fixture_teardown(WebLoadingFixture* fixture, gconstpoint
g_main_loop_unref(fixture->loop);
}
+static char* get_uri_for_path(const char* path)
+{
+ SoupURI* uri;
+ char* uri_string;
+
+ uri = soup_uri_new_with_base(base_uri, path);
+ uri_string = soup_uri_to_string(uri, FALSE);
+ soup_uri_free (uri);
+
+ return uri_string;
+}
+
static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, WebLoadingFixture* fixture)
{
g_assert(fixture->has_been_provisional);
@@ -98,6 +145,8 @@ static void status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixt
static void test_loading_status(WebLoadingFixture* fixture, gconstpointer data)
{
+ char* uri_string;
+
g_assert_cmpint(webkit_web_view_get_load_status(fixture->webView), ==, WEBKIT_LOAD_PROVISIONAL);
g_object_connect(G_OBJECT(fixture->webView),
@@ -105,10 +154,13 @@ static void test_loading_status(WebLoadingFixture* fixture, gconstpointer data)
"signal::load-finished", G_CALLBACK(load_finished_cb), fixture,
NULL);
+ uri_string = get_uri_for_path("/test_loading_status");
+
/* load_uri will trigger the navigation-policy-decision-requested
* signal emission;
*/
- webkit_web_view_load_uri(fixture->webView, "http://gnome.org/");
+ webkit_web_view_load_uri(fixture->webView, uri_string);
+ g_free(uri_string);
g_main_loop_run(fixture->loop);
}
@@ -119,23 +171,24 @@ static void load_error_status_changed_cb(GObject* object, GParamSpec* pspec, Web
switch(status) {
case WEBKIT_LOAD_PROVISIONAL:
- /* We are going to go through here twice, so don't assert
- * anything */
+ g_assert(!fixture->has_been_provisional);
fixture->has_been_provisional = TRUE;
break;
+ case WEBKIT_LOAD_COMMITTED:
+ g_assert(!fixture->has_been_committed);
+ fixture->has_been_committed = TRUE;
+ break;
case WEBKIT_LOAD_FINISHED:
g_assert(fixture->has_been_provisional);
g_assert(fixture->has_been_load_error);
g_assert(fixture->has_been_failed);
- /* We are checking that only one FINISHED is received in the
- whole cycle, so assert it's FALSE */
g_assert(!fixture->has_been_finished);
fixture->has_been_finished = TRUE;
- g_main_loop_quit(fixture->loop);
break;
case WEBKIT_LOAD_FAILED:
g_assert(!fixture->has_been_failed);
fixture->has_been_failed = TRUE;
+ g_main_loop_quit(fixture->loop);
break;
default:
break;
@@ -153,13 +206,24 @@ static gboolean load_error_cb(WebKitWebView* webView, WebKitWebFrame* frame, con
static void test_loading_error(WebLoadingFixture* fixture, gconstpointer data)
{
+ char* uri_string;
+
g_test_bug("28842");
g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_error_cb), fixture);
g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_error_status_changed_cb), fixture);
- webkit_web_view_load_uri(fixture->webView, "http://snoetuhsetuhseoutoeutc.com/");
+ uri_string = get_uri_for_path("/test_load_error");
+ webkit_web_view_load_uri(fixture->webView, uri_string);
+ g_free(uri_string);
+
g_main_loop_run(fixture->loop);
+
+ g_assert(fixture->has_been_provisional);
+ g_assert(!fixture->has_been_committed);
+ g_assert(fixture->has_been_load_error);
+ g_assert(fixture->has_been_failed);
+ g_assert(!fixture->has_been_finished);
}
/* Cancelled load */
@@ -211,20 +275,142 @@ static void load_cancelled_status_changed_cb(GObject* object, GParamSpec* pspec,
static void test_loading_cancelled(WebLoadingFixture* fixture, gconstpointer data)
{
+ char* uri_string;
+
g_test_bug("29644");
g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_cancelled_cb), fixture);
g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_cancelled_status_changed_cb), fixture);
- webkit_web_view_load_uri(fixture->webView, "http://google.com/");
+ uri_string = get_uri_for_path("/test_loading_cancelled");
+ webkit_web_view_load_uri(fixture->webView, uri_string);
+ g_free(uri_string);
+
g_main_loop_run(fixture->loop);
}
+static void load_goback_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
+{
+ WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));
+
+ switch(status) {
+ case WEBKIT_LOAD_PROVISIONAL:
+ g_assert(!fixture->has_been_provisional);
+ fixture->has_been_provisional = TRUE;
+ break;
+ case WEBKIT_LOAD_COMMITTED:
+ g_assert(fixture->has_been_provisional);
+ fixture->has_been_committed = TRUE;
+ break;
+ case WEBKIT_LOAD_FAILED:
+ g_assert_not_reached();
+ break;
+ case WEBKIT_LOAD_FINISHED:
+ g_assert(fixture->has_been_provisional);
+ g_assert(fixture->has_been_committed);
+ fixture->has_been_finished = TRUE;
+ g_main_loop_quit(fixture->loop);
+ break;
+ default:
+ break;
+ }
+}
+
+static void load_wentback_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
+{
+ WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));
+ char* uri_string;
+ char* uri_string2;
+
+ uri_string = get_uri_for_path("/test_loading_status");
+ uri_string2 = get_uri_for_path("/test_loading_status2");
+
+ switch(status) {
+ case WEBKIT_LOAD_PROVISIONAL:
+ g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string2);
+ break;
+ case WEBKIT_LOAD_COMMITTED:
+ g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
+ break;
+ case WEBKIT_LOAD_FAILED:
+ g_assert_not_reached();
+ break;
+ case WEBKIT_LOAD_FINISHED:
+ g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
+ g_main_loop_quit(fixture->loop);
+ break;
+ default:
+ break;
+ }
+
+ g_free(uri_string);
+ g_free(uri_string2);
+}
+
+static void load_error_test(WebKitWebView* webview, WebKitWebFrame* frame, const char* uri, GError* error)
+{
+ g_debug("Error: %s", error->message);
+}
+
+static void test_loading_goback(WebLoadingFixture* fixture, gconstpointer data)
+{
+ char* uri_string;
+
+ g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_goback_status_changed_cb), fixture);
+
+ g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_error_test), fixture);
+
+ uri_string = get_uri_for_path("/test_loading_status");
+ webkit_web_view_load_uri(fixture->webView, uri_string);
+ g_free(uri_string);
+
+ g_main_loop_run(fixture->loop);
+
+ fixture->has_been_provisional = FALSE;
+ fixture->has_been_committed = FALSE;
+ fixture->has_been_first_visually_non_empty_layout = FALSE;
+ fixture->has_been_finished = FALSE;
+ fixture->has_been_failed = FALSE;
+ fixture->has_been_load_error = FALSE;
+
+ uri_string = get_uri_for_path("/test_loading_status2");
+ webkit_web_view_load_uri(fixture->webView, uri_string);
+ g_free(uri_string);
+
+ g_main_loop_run(fixture->loop);
+
+ g_signal_handlers_disconnect_by_func(fixture->webView, load_goback_status_changed_cb, fixture);
+
+ fixture->has_been_provisional = FALSE;
+ fixture->has_been_committed = FALSE;
+ fixture->has_been_first_visually_non_empty_layout = FALSE;
+ fixture->has_been_finished = FALSE;
+ fixture->has_been_failed = FALSE;
+ fixture->has_been_load_error = FALSE;
+
+ g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_wentback_status_changed_cb), fixture);
+ webkit_web_view_go_back(fixture->webView);
+
+ g_main_loop_run(fixture->loop);
+
+ g_signal_handlers_disconnect_by_func(fixture->webView, load_wentback_status_changed_cb, fixture);
+}
+
int main(int argc, char** argv)
{
+ SoupServer* server;
+
g_thread_init(NULL);
gtk_test_init(&argc, &argv, NULL);
+ server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
+ soup_server_run_async(server);
+
+ soup_server_add_handler(server, NULL, server_callback, NULL, NULL);
+
+ base_uri = soup_uri_new("http://127.0.0.1/");
+ soup_uri_set_port(base_uri, soup_server_get_port(server));
+
g_test_bug_base("https://bugs.webkit.org/");
g_test_add("/webkit/loading/status",
WebLoadingFixture, NULL,
@@ -241,6 +427,11 @@ int main(int argc, char** argv)
web_loading_fixture_setup,
test_loading_cancelled,
web_loading_fixture_teardown);
+ g_test_add("/webkit/loading/goback",
+ WebLoadingFixture, NULL,
+ web_loading_fixture_setup,
+ test_loading_goback,
+ web_loading_fixture_teardown);
return g_test_run();
}
diff --git a/WebKit/gtk/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c
index e68dcdf..bfe3148 100644
--- a/WebKit/gtk/tests/testmimehandling.c
+++ b/WebKit/gtk/tests/testmimehandling.c
@@ -23,6 +23,7 @@
#include <libsoup/soup.h>
#include <string.h>
#include <webkit/webkit.h>
+#include <unistd.h>
#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
@@ -87,10 +88,11 @@ server_callback(SoupServer *server, SoupMessage *msg,
soup_message_body_complete(msg->response_body);
}
-static gboolean idle_quit_loop_cb(gpointer data)
+static void idle_quit_loop_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- g_main_loop_quit(loop);
- return FALSE;
+ if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED ||
+ webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FAILED)
+ g_main_loop_quit(loop);
}
static gboolean mime_type_policy_decision_requested_cb(WebKitWebView* view, WebKitWebFrame* frame,
@@ -138,7 +140,7 @@ static void test_mime_type(const char* name)
loop = g_main_loop_new(NULL, TRUE);
g_object_connect(G_OBJECT(view),
- "signal::load-finished", idle_quit_loop_cb, NULL,
+ "signal::notify::load-status", idle_quit_loop_cb, NULL,
"signal::mime-type-policy-decision-requested", mime_type_policy_decision_requested_cb, g_strdup(name),
NULL);
@@ -175,22 +177,20 @@ int main(int argc, char** argv)
{
SoupServer* server;
SoupURI* soup_uri;
- char* test_dir;
- char* resources_dir;
g_thread_init(NULL);
gtk_test_init(&argc, &argv, NULL);
/* Hopefully make test independent of the path it's called from. */
- test_dir = g_path_get_dirname(argv[0]);
- resources_dir = g_build_path(G_DIR_SEPARATOR_S, test_dir,
- "..", "..", "..", "..",
- "WebKit", "gtk", "tests", "resources",
- NULL);
- g_free(test_dir);
-
- g_chdir(resources_dir);
- g_free(resources_dir);
+ while (!g_file_test ("WebKit/gtk/tests/resources/test.html", G_FILE_TEST_EXISTS)) {
+ char path_name[PATH_MAX];
+
+ g_chdir("..");
+
+ g_assert(!g_str_equal(getcwd(path_name, PATH_MAX), "/"));
+ }
+
+ g_chdir("WebKit/gtk/tests/resources/");
server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
soup_server_run_async(server);
diff --git a/WebKit/gtk/tests/testwebdatasource.c b/WebKit/gtk/tests/testwebdatasource.c
index fe5c62f..5c0568e 100644
--- a/WebKit/gtk/tests/testwebdatasource.c
+++ b/WebKit/gtk/tests/testwebdatasource.c
@@ -55,35 +55,45 @@ static void test_webkit_web_data_source_get_initial_request()
g_object_unref(view);
}
-static void load_finished_unreachable_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop)
+static void notify_load_status_unreachable_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
{
+ WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+ WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
+
+ if (status != WEBKIT_LOAD_FINISHED)
+ return;
+
if (waitTimer) {
g_source_remove(waitTimer);
waitTimer = 0;
}
- WebKitWebDataSource* datasource;
- frame = webkit_web_view_get_main_frame(view);
- datasource = webkit_web_frame_get_data_source(frame);
+ WebKitWebDataSource* datasource = webkit_web_frame_get_data_source(frame);
g_assert_cmpstr("http://this.host.does.not.exist/doireallyexist.html", ==,
webkit_web_data_source_get_unreachable_uri(datasource));
- if (g_main_loop_is_running(loop))
- g_main_loop_quit(loop);
+ g_main_loop_quit(loop);
}
-static void load_finished_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop)
+static void notify_load_status_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
{
+ WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+ WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
+ WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);
+
+ if (status == WEBKIT_LOAD_COMMITTED) {
+ g_assert(webkit_web_data_source_is_loading(dataSource));
+ return;
+ }
+ else if (status != WEBKIT_LOAD_FINISHED)
+ return;
+
if (waitTimer) {
g_source_remove(waitTimer);
waitTimer = 0;
}
- WebKitWebDataSource* dataSource;
- frame = webkit_web_view_get_main_frame(view);
- dataSource = webkit_web_frame_get_data_source(frame);
-
/* Test get_request */
g_test_message("Testing webkit_web_data_source_get_request");
WebKitNetworkRequest* request = webkit_web_data_source_get_request(dataSource);
@@ -102,21 +112,13 @@ static void load_finished_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLo
/* FIXME: Add test for get_encoding */
- if (g_main_loop_is_running(loop))
- g_main_loop_quit(loop);
-}
-
-static void load_committed_cb(WebKitWebView* view, WebKitWebFrame* frame)
-{
- WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);
- g_assert(webkit_web_data_source_is_loading(dataSource));
+ g_main_loop_quit(loop);
}
static gboolean wait_timer_fired(GMainLoop* loop)
{
waitTimer = 0;
- if (g_main_loop_is_running(loop))
- g_main_loop_quit(loop);
+ g_main_loop_quit(loop);
return FALSE;
}
@@ -129,8 +131,7 @@ static void test_webkit_web_data_source()
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(view);
loop = g_main_loop_new(NULL, TRUE);
- g_signal_connect(view, "load-committed", G_CALLBACK(load_committed_cb), loop);
- g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_cb), loop);
+ g_signal_connect(view, "notify::load-status", G_CALLBACK(notify_load_status_cb), loop);
webkit_web_view_load_uri(view, "http://webkit.org");
if (!waitTimer)
@@ -148,7 +149,7 @@ static void test_webkit_web_data_source_unreachable_uri()
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(view);
loop = g_main_loop_new(NULL, TRUE);
- g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_unreachable_cb), loop);
+ g_signal_connect(view, "notify::load-status", G_CALLBACK(notify_load_status_unreachable_cb), loop);
webkit_web_view_load_uri(view, "http://this.host.does.not.exist/doireallyexist.html");
if (!waitTimer)
diff --git a/WebKit/gtk/tests/testwebresource.c b/WebKit/gtk/tests/testwebresource.c
index b9cd40b..81457a4 100644
--- a/WebKit/gtk/tests/testwebresource.c
+++ b/WebKit/gtk/tests/testwebresource.c
@@ -163,14 +163,16 @@ static void resource_request_starting_cb(WebKitWebView* web_view, WebKitWebFrame
}
}
-static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- gboolean* been_there = data;
- *been_there = TRUE;
+ if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED) {
+ gboolean* been_there = data;
+ *been_there = TRUE;
- g_assert_cmpstr(webkit_web_view_get_uri(web_view), ==, "about:blank");
+ g_assert_cmpstr(webkit_web_view_get_uri(web_view), ==, "about:blank");
- g_main_loop_quit(loop);
+ g_main_loop_quit(loop);
+ }
}
static void test_web_resource_loading()
@@ -189,8 +191,8 @@ static void test_web_resource_loading()
G_CALLBACK(resource_request_starting_cb),
&been_to_resource_request_starting);
- g_signal_connect(web_view, "load-finished",
- G_CALLBACK(load_finished_cb),
+ g_signal_connect(web_view, "notify::load-status",
+ G_CALLBACK(notify_load_status_cb),
&been_to_load_finished);
webkit_web_view_load_uri(web_view, base_uri);
@@ -220,9 +222,10 @@ static void resource_request_starting_sub_cb(WebKitWebView* web_view, WebKitWebF
sub_resource = g_object_ref(web_resource);
}
-static void load_finished_sub_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_sub_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- g_main_loop_quit(loop);
+ if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED)
+ g_main_loop_quit(loop);
}
static gboolean idle_quit_loop_cb(gpointer data)
@@ -249,8 +252,8 @@ static void test_web_resource_sub_resource_loading()
G_CALLBACK(resource_request_starting_sub_cb),
NULL);
- g_signal_connect(web_view, "load-finished",
- G_CALLBACK(load_finished_sub_cb),
+ g_signal_connect(web_view, "notify::load-status",
+ G_CALLBACK(notify_load_status_sub_cb),
NULL);
webkit_web_view_load_uri(web_view, uri);
@@ -271,8 +274,10 @@ static void test_web_resource_sub_resource_loading()
g_object_unref(main_resource);
sub_resources = webkit_web_data_source_get_subresources(data_source);
+ // Expected resources: javascripts.js, favicon.ico
g_assert(sub_resources);
- g_assert(!sub_resources->next);
+ g_assert(sub_resources->next);
+ g_assert(!sub_resources->next->next);
g_assert(WEBKIT_WEB_RESOURCE(sub_resources->data) == sub_resource);
diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c
index e0921c0..7482747 100644
--- a/WebKit/gtk/tests/testwebview.c
+++ b/WebKit/gtk/tests/testwebview.c
@@ -63,10 +63,11 @@ server_callback(SoupServer* server, SoupMessage* msg,
soup_message_body_complete(msg->response_body);
}
-static gboolean idle_quit_loop_cb(gpointer data)
+static void idle_quit_loop_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- g_main_loop_quit(loop);
- return FALSE;
+ if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED ||
+ webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FAILED)
+ g_main_loop_quit(loop);
}
static void icon_uri_changed_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
@@ -105,7 +106,7 @@ static void test_webkit_web_view_icon_uri()
loop = g_main_loop_new(NULL, TRUE);
g_object_connect(G_OBJECT(view),
- "signal::load-finished", idle_quit_loop_cb, NULL,
+ "signal::notify::progress", idle_quit_loop_cb, NULL,
"signal::notify::icon-uri", icon_uri_changed_cb, &been_to_uri_changed,
"signal::icon-loaded", icon_loaded_cb, &been_to_icon_loaded,
NULL);
@@ -124,22 +125,20 @@ int main(int argc, char** argv)
{
SoupServer* server;
SoupURI* soup_uri;
- char* test_dir;
- char* resources_dir;
g_thread_init(NULL);
gtk_test_init(&argc, &argv, NULL);
/* Hopefully make test independent of the path it's called from. */
- test_dir = g_path_get_dirname(argv[0]);
- resources_dir = g_build_path(G_DIR_SEPARATOR_S, test_dir,
- "..", "..", "..", "..",
- "WebKit", "gtk", "tests", "resources",
- NULL);
- g_free(test_dir);
-
- g_chdir(resources_dir);
- g_free(resources_dir);
+ while (!g_file_test ("WebKit/gtk/tests/resources/test.html", G_FILE_TEST_EXISTS)) {
+ char path_name[PATH_MAX];
+
+ g_chdir("..");
+
+ g_assert(!g_str_equal(getcwd(path_name, PATH_MAX), "/"));
+ }
+
+ g_chdir("WebKit/gtk/tests/resources/");
server = soup_server_new(SOUP_SERVER_PORT, 0, NULL);
soup_server_run_async(server);
diff --git a/WebKit/gtk/tests/testwindow.c b/WebKit/gtk/tests/testwindow.c
index 41ff323..106f934 100644
--- a/WebKit/gtk/tests/testwindow.c
+++ b/WebKit/gtk/tests/testwindow.c
@@ -22,11 +22,13 @@
#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
-static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- GMainLoop* loop = (GMainLoop*)data;
+ if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED) {
+ GMainLoop* loop = (GMainLoop*)data;
- g_main_loop_quit(loop);
+ g_main_loop_quit(loop);
+ }
}
static void test_webkit_window_scrollbar_policy(void)
@@ -47,8 +49,8 @@ static void test_webkit_window_scrollbar_policy(void)
webView = webkit_web_view_new();
g_object_ref_sink(webView);
- g_signal_connect(webView, "load-finished",
- G_CALLBACK(load_finished_cb), loop);
+ g_signal_connect(webView, "notify::load-status",
+ G_CALLBACK(notify_load_status_cb), loop);
gtk_container_add(GTK_CONTAINER(scrolledWindow), webView);
diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp
index dd6629b..1912a12 100644
--- a/WebKit/gtk/webkit/webkitdownload.cpp
+++ b/WebKit/gtk/webkit/webkitdownload.cpp
@@ -22,6 +22,7 @@
#include "CString.h"
#include <glib/gi18n-lib.h>
+#include "GRefPtr.h"
#include "Noncopyable.h"
#include "NotImplemented.h"
#include "ResourceHandleClient.h"
@@ -853,22 +854,24 @@ static void webkit_download_received_data(WebKitDownload* download, const gchar*
if (priv->currentSize > webkit_download_get_total_size(download))
g_object_notify(G_OBJECT(download), "total-size");
- gdouble lastProgress = webkit_download_get_progress(download);
-
// Throttle progress notification to not consume high amounts of
- // CPU on fast links, except when the progress is >= 3%, or we
- // reached the end.
+ // CPU on fast links, except when the last notification occured
+ // in more then 0.7 secs from now, or the last notified progress
+ // is passed in 1% or we reached the end.
+ static gdouble lastProgress = 0;
static gdouble lastElapsed = 0;
gdouble currentElapsed = g_timer_elapsed(priv->timer, NULL);
+ gdouble currentProgress = webkit_download_get_progress(download);
if (lastElapsed
- && (currentElapsed - lastElapsed) < 0.1
- && (webkit_download_get_progress(download) - lastProgress) < 0.03
- && webkit_download_get_progress(download) < 1.0) {
- lastElapsed = currentElapsed;
+ && lastProgress
+ && (currentElapsed - lastElapsed) < 0.7
+ && (currentProgress - lastProgress) < 0.01
+ && currentProgress < 1.0) {
return;
}
lastElapsed = currentElapsed;
+ lastProgress = currentProgress;
g_object_notify(G_OBJECT(download), "progress");
}
@@ -890,6 +893,7 @@ static void webkit_download_error(WebKitDownload* download, const ResourceError&
webkit_download_close_stream(download);
WebKitDownloadPrivate* priv = download->priv;
+ GRefPtr<WebKitDownload> protect(download);
g_timer_stop(priv->timer);
webkit_download_set_status(download, WEBKIT_DOWNLOAD_STATUS_ERROR);
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index c80160c..be88bb5 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -23,6 +23,7 @@
#include "webkitsoupauthdialog.h"
#include "webkitprivate.h"
#include "ApplicationCacheStorage.h"
+#include "Chrome.h"
#include "ChromeClientGtk.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -42,6 +43,7 @@
#include <runtime/InitializeThreading.h>
#include "SecurityOrigin.h"
#include <stdlib.h>
+#include "TextEncodingRegistry.h"
#include "webkitnetworkresponse.h"
#if ENABLE(DATABASE)
@@ -221,7 +223,11 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes
return NULL;
GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient()));
+#if GTK_CHECK_VERSION(2, 18, 0)
+ if (gtk_widget_is_toplevel(toplevel))
+#else
if (GTK_WIDGET_TOPLEVEL(toplevel))
+#endif
return toplevel;
else
return NULL;
@@ -245,10 +251,14 @@ void webkit_init()
JSC::initializeThreading();
WebCore::InitializeLoggingChannelsIfNecessary();
+ // We make sure the text codecs have been initialized, because
+ // that may only be done by the main thread.
+ atomicCanonicalTextEncodingName("UTF-8");
+
// Page cache capacity (in pages). Comment from Mac port:
// (Research indicates that value / page drops substantially after 3 pages.)
// FIXME: Expose this with an API and/or calculate based on available resources
- WebCore::pageCache()->setCapacity(3);
+ webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER);
#if ENABLE(DATABASE)
gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
@@ -280,6 +290,8 @@ void webkit_init()
SoupSessionFeature* sniffer = static_cast<SoupSessionFeature*>(g_object_new(SOUP_TYPE_CONTENT_SNIFFER, NULL));
soup_session_add_feature(session, sniffer);
g_object_unref(sniffer);
+
+ soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_DECODER);
}
void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains)
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index e17e79e..e9d61a6 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -152,6 +152,7 @@ extern "C" {
WebKitWebResource* mainResource;
char* mainResourceIdentifier;
GHashTable* subResources;
+ char* tooltipText;
};
#define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
@@ -254,6 +255,9 @@ extern "C" {
GList*
webkit_web_view_get_subresources(WebKitWebView*);
+ void
+ webkit_web_view_set_tooltip_text(WebKitWebView*, const char*);
+
WebKitDownload*
webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response);
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index 64fdc40..35d9524 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -54,7 +54,9 @@
#include "JSDOMBinding.h"
#include "ScriptController.h"
#include "SubstituteData.h"
+#if ENABLE(SVG)
#include "SVGSMILElement.h"
+#endif
#include <atk/atk.h>
#include <JavaScriptCore/APICast.h>
@@ -182,6 +184,14 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ * WebKitWebFrame::load-done
+ * @web_frame: the object on which the signal is emitted
+ *
+ * Emitted when frame loading is done.
+ *
+ * Deprecated: Use the "load-status" property instead.
+ */
webkit_web_frame_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)G_SIGNAL_RUN_LAST,
@@ -197,7 +207,7 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
*
* Emitted when frame loading is done.
*
- * Deprecated: Use WebKitWebView::load-finished instead, and/or
+ * Deprecated: Use the "load-status" property instead, and/or
* WebKitWebView::load-error to be notified of load errors
*/
webkit_web_frame_signals[LOAD_DONE] = g_signal_new("load-done",
@@ -210,6 +220,15 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
+ /**
+ * WebKitWebFrame::title-changed:
+ * @frame: the object on which the signal is emitted
+ * @title: the new title
+ *
+ * When a #WebKitWebFrame changes the document title this signal is emitted.
+ *
+ * Deprecated: 1.1.18: Use "notify::title" instead.
+ */
webkit_web_frame_signals[TITLE_CHANGED] = g_signal_new("title-changed",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)G_SIGNAL_RUN_LAST,
@@ -891,7 +910,12 @@ GtkPrintOperationResult webkit_web_frame_print_full(WebKitWebFrame* frame, GtkPr
g_return_val_if_fail(GTK_IS_PRINT_OPERATION(operation), GTK_PRINT_OPERATION_RESULT_ERROR);
GtkWidget* topLevel = gtk_widget_get_toplevel(GTK_WIDGET(webkit_web_frame_get_web_view(frame)));
+
+#if GTK_CHECK_VERSION(2, 18, 0)
+ if (!gtk_widget_is_toplevel(topLevel))
+#else
if (!GTK_WIDGET_TOPLEVEL(topLevel))
+#endif
topLevel = NULL;
Frame* coreFrame = core(frame);
@@ -930,11 +954,20 @@ void webkit_web_frame_print(WebKitWebFrame* frame)
if (error) {
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(priv->webView));
+#if GTK_CHECK_VERSION(2, 18, 0)
+ GtkWidget* dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(window) ? GTK_WINDOW(window) : 0,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", error->message);
+#else
GtkWidget* dialog = gtk_message_dialog_new(GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : 0,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
+#endif
+
g_error_free(error);
g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
@@ -963,13 +996,13 @@ bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name,
bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId)
{
ASSERT(core(frame));
+#if ENABLE(SVG)
Document* document = core(frame)->document();
if (!document || !document->svgExtensions())
return false;
Element* coreElement = document->getElementById(AtomicString(animationId));
if (!coreElement || !SVGSMILElement::isSMILElement(coreElement))
return false;
-#if ENABLE(SVG)
return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreElement), time);
#else
return false;
diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp
index aab8b51..f2811ea 100644
--- a/WebKit/gtk/webkit/webkitwebhistoryitem.cpp
+++ b/WebKit/gtk/webkit/webkitwebhistoryitem.cpp
@@ -432,6 +432,33 @@ gdouble webkit_web_history_item_get_last_visited_time(WebKitWebHistoryItem* webH
return item->lastVisitedTime();
}
+/**
+ * webkit_web_history_item_copy :
+ * @web_history_item: a #WebKitWebHistoryItem
+ *
+ * Makes a copy of the item for use with other WebView objects.
+ *
+ * Since: 1.1.18
+ *
+ * Return value: the new #WebKitWebHistoryItem.
+ */
+WebKitWebHistoryItem* webkit_web_history_item_copy(WebKitWebHistoryItem* self)
+{
+ WebKitWebHistoryItemPrivate* selfPrivate = self->priv;
+
+ WebKitWebHistoryItem* item = WEBKIT_WEB_HISTORY_ITEM(g_object_new(WEBKIT_TYPE_WEB_HISTORY_ITEM, 0));
+ WebKitWebHistoryItemPrivate* priv = item->priv;
+
+ priv->title = selfPrivate->title;
+ priv->alternateTitle = selfPrivate->alternateTitle;
+ priv->uri = selfPrivate->uri;
+ priv->originalUri = selfPrivate->originalUri;
+
+ priv->historyItem = selfPrivate->historyItem->copy().releaseRef();
+
+ return item;
+}
+
/* private methods */
G_CONST_RETURN gchar* webkit_web_history_item_get_target(WebKitWebHistoryItem* webHistoryItem)
diff --git a/WebKit/gtk/webkit/webkitwebhistoryitem.h b/WebKit/gtk/webkit/webkitwebhistoryitem.h
index cafeb36..1820736 100644
--- a/WebKit/gtk/webkit/webkitwebhistoryitem.h
+++ b/WebKit/gtk/webkit/webkitwebhistoryitem.h
@@ -82,6 +82,9 @@ webkit_web_history_item_get_original_uri (WebKitWebHistoryItem *web_history
WEBKIT_API gdouble
webkit_web_history_item_get_last_visited_time (WebKitWebHistoryItem *web_history_item);
+WEBKIT_API WebKitWebHistoryItem*
+webkit_web_history_item_copy (WebKitWebHistoryItem *web_history_item);
+
G_END_DECLS
#endif /* webkitwebhistoryitem_h */
diff --git a/WebKit/gtk/webkit/webkitwebnavigationaction.cpp b/WebKit/gtk/webkit/webkitwebnavigationaction.cpp
index c866c0f..f421f40 100644
--- a/WebKit/gtk/webkit/webkitwebnavigationaction.cpp
+++ b/WebKit/gtk/webkit/webkitwebnavigationaction.cpp
@@ -177,7 +177,9 @@ static void webkit_web_navigation_action_class_init(WebKitWebNavigationActionCla
/**
* WebKitWebNavigationAction:button:
*
- * The button used to click if the action was a mouse event.
+ * The DOM identifier for the mouse button used to click. DOM button values
+ * are 0, 1 and 2 for left, middle and right buttons. If the action was not
+ * initiated by a mouse click the value will be -1.
*
* Since: 1.0.3
*/
@@ -308,8 +310,9 @@ void webkit_web_navigation_action_set_original_uri(WebKitWebNavigationAction* na
* webkit_web_navigation_action_get_button:
* @navigationAction: a #WebKitWebNavigationAction
*
- * Returns the mouse button used to click if the action was a mouse event.
- * Otherwise returns -1.
+ * Returns the DOM identifier for the mouse button used to click.
+ * DOM button values are 0, 1 and 2 for left, middle and right buttons.
+ * If the action was not initiated by a mouse click, returns -1.
*
* Return value: the mouse button used to click
*
diff --git a/WebKit/gtk/webkit/webkitwebresource.cpp b/WebKit/gtk/webkit/webkitwebresource.cpp
index e995e08..bd3cd69 100644
--- a/WebKit/gtk/webkit/webkitwebresource.cpp
+++ b/WebKit/gtk/webkit/webkitwebresource.cpp
@@ -245,13 +245,13 @@ void webkit_web_resource_init_with_core_resource(WebKitWebResource* webResource,
/**
* webkit_web_resource_new:
* @data: the data to initialize the #WebKitWebResource
- * @length: the length of @data
+ * @size: the length of @data
* @uri: the uri of the #WebKitWebResource
* @mime_type: the MIME type of the #WebKitWebResource
- * @text_encoding_name: the text encoding name of the #WebKitWebResource
+ * @encoding: the text encoding name of the #WebKitWebResource
* @frame_name: the frame name of the #WebKitWebResource
*
- * Returns a new #WebKitWebResource. The @text_encoding_name can be %NULL. The
+ * Returns a new #WebKitWebResource. The @encoding can be %NULL. The
* @frame_name argument can be used if the resource represents contents of an
* entire HTML frame, otherwise pass %NULL.
*
diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp
index 143ae06..1e2f8cc 100644
--- a/WebKit/gtk/webkit/webkitwebsettings.cpp
+++ b/WebKit/gtk/webkit/webkitwebsettings.cpp
@@ -4,6 +4,8 @@
* Copyright (C) 2008 Collabora Ltd.
* Copyright (C) 2008 Holger Hans Peter Freyther
* Copyright (C) 2009 Jan Michael Alonzo
+ * Copyright (C) 2009 Movial Creative Technologies Inc.
+ * Copyright (C) 2009 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
@@ -35,7 +37,7 @@
#include "PlatformString.h"
#include <glib/gi18n-lib.h>
-#if PLATFORM(UNIX)
+#if OS(UNIX)
#include <sys/utsname.h>
#endif
@@ -98,6 +100,9 @@ struct _WebKitWebSettingsPrivate {
gboolean enable_universal_access_from_file_uris;
gboolean enable_dom_paste;
gboolean tab_key_cycles_through_elements;
+ gboolean enable_default_context_menu;
+ gboolean enable_site_specific_quirks;
+ gboolean enable_page_cache;
};
#define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate))
@@ -139,7 +144,10 @@ enum {
PROP_EDITING_BEHAVIOR,
PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS,
PROP_ENABLE_DOM_PASTE,
- PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS
+ PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS,
+ PROP_ENABLE_DEFAULT_CONTEXT_MENU,
+ PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
+ PROP_ENABLE_PAGE_CACHE
};
// Create a default user agent string
@@ -152,7 +160,7 @@ static String webkit_get_user_agent()
#if PLATFORM(X11)
platform = g_strdup("X11");
-#elif PLATFORM(WIN_OS)
+#elif OS(WINDOWS)
platform = g_strdup("Windows");
#elif PLATFORM(MAC)
platform = g_strdup("Macintosh");
@@ -163,22 +171,22 @@ static String webkit_get_user_agent()
#endif
// FIXME: platform/version detection can be shared.
-#if PLATFORM(DARWIN)
+#if OS(DARWIN)
-#if PLATFORM(X86)
+#if CPU(X86)
osVersion = g_strdup("Intel Mac OS X");
#else
osVersion = g_strdup("PPC Mac OS X");
#endif
-#elif PLATFORM(UNIX)
+#elif OS(UNIX)
struct utsname name;
if (uname(&name) != -1)
osVersion = g_strdup_printf("%s %s", name.sysname, name.machine);
else
osVersion = g_strdup("Unknown");
-#elif PLATFORM(WIN_OS)
+#elif OS(WINDOWS)
// FIXME: Compute the Windows version
osVersion = g_strdup("Windows");
@@ -686,6 +694,71 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
TRUE,
flags));
+ /**
+ * WebKitWebSettings:enable-default-context-menu:
+ *
+ * Whether right-clicks should be handled automatically to create,
+ * and display the context menu. Turning this off will make
+ * WebKitGTK+ not emit the populate-popup signal. Notice that the
+ * default button press event handler may still handle right
+ * clicks for other reasons, such as in-page context menus, or
+ * right-clicks that are handled by the page itself.
+ *
+ * Since: 1.1.18
+ */
+ g_object_class_install_property(gobject_class,
+ PROP_ENABLE_DEFAULT_CONTEXT_MENU,
+ g_param_spec_boolean(
+ "enable-default-context-menu",
+ _("Enable Default Context Menu"),
+ _("Enables the handling of right-clicks for the creation of the default context menu"),
+ TRUE,
+ flags));
+
+ /**
+ * WebKitWebSettings::enable-site-specific-quirks
+ *
+ * Whether to turn on site-specific hacks. Turning this on will
+ * tell WebKitGTK+ to use some site-specific workarounds for
+ * better web compatibility. For example, older versions of
+ * MediaWiki will incorrectly send WebKit a css file with KHTML
+ * workarounds. By turning on site-specific quirks, WebKit will
+ * special-case this and other cases to make the sites work.
+ *
+ * Since: 1.1.18
+ */
+ g_object_class_install_property(gobject_class,
+ PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
+ g_param_spec_boolean(
+ "enable-site-specific-quirks",
+ _("Enable Site Specific Quirks"),
+ _("Enables the site-specific compatibility workarounds"),
+ FALSE,
+ flags));
+
+ /**
+ * WebKitWebSettings:enable-page-cache:
+ *
+ * Enable or disable the page cache. Disabling the page cache is
+ * generally only useful for special circumstances like low-memory
+ * scenarios or special purpose applications like static HTML
+ * viewers. This setting only controls the Page Cache, this cache
+ * is different than the disk-based or memory-based traditional
+ * resource caches, its point is to make going back and forth
+ * between pages much faster. For details about the different types
+ * of caches and their purposes see:
+ * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
+ *
+ * Since: 1.1.18
+ */
+ g_object_class_install_property(gobject_class,
+ PROP_ENABLE_PAGE_CACHE,
+ g_param_spec_boolean("enable-page-cache",
+ _("Enable page cache"),
+ _("Whether the page cache should be used"),
+ FALSE,
+ flags));
+
g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate));
}
@@ -883,7 +956,16 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
priv->enable_dom_paste = g_value_get_boolean(value);
break;
case PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS:
- priv->tab_key_cycles_through_elements = g_value_get_boolean(value);
+ priv->tab_key_cycles_through_elements = g_value_get_boolean(value);
+ break;
+ case PROP_ENABLE_DEFAULT_CONTEXT_MENU:
+ priv->enable_default_context_menu = g_value_get_boolean(value);
+ break;
+ case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
+ priv->enable_site_specific_quirks = g_value_get_boolean(value);
+ break;
+ case PROP_ENABLE_PAGE_CACHE:
+ priv->enable_page_cache = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -1002,7 +1084,16 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa
case PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS:
g_value_set_boolean(value, priv->tab_key_cycles_through_elements);
break;
- default:
+ case PROP_ENABLE_DEFAULT_CONTEXT_MENU:
+ g_value_set_boolean(value, priv->enable_default_context_menu);
+ break;
+ case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
+ g_value_set_boolean(value, priv->enable_site_specific_quirks);
+ break;
+ case PROP_ENABLE_PAGE_CACHE:
+ g_value_set_boolean(value, priv->enable_page_cache);
+ break;
+ default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
@@ -1067,6 +1158,10 @@ WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings)
"editing-behavior", priv->editing_behavior,
"enable-universal-access-from-file-uris", priv->enable_universal_access_from_file_uris,
"enable-dom-paste", priv->enable_dom_paste,
+ "tab-key-cycles-through-elements", priv->tab_key_cycles_through_elements,
+ "enable-default-context-menu", priv->enable_default_context_menu,
+ "enable-site-specific-quirks", priv->enable_site_specific_quirks,
+ "enable-page-cache", priv->enable_page_cache,
NULL));
return copy;
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 211f671..ad13895 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -8,6 +8,8 @@
* Copyright (C) 2008 Nuanti Ltd.
* Copyright (C) 2008, 2009 Collabora Ltd.
* Copyright (C) 2009 Igalia S.L.
+ * Copyright (C) 2009 Movial Creative Technologies Inc.
+ * Copyright (C) 2009 Bobby Powers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -40,6 +42,7 @@
#include "AXObjectCache.h"
#include "NotImplemented.h"
#include "BackForwardList.h"
+#include "Cache.h"
#include "CString.h"
#include "ChromeClientGtk.h"
#include "ContextMenu.h"
@@ -64,6 +67,7 @@
#include "FrameLoader.h"
#include "FrameView.h"
#include "MouseEventWithHitTestResults.h"
+#include "PageCache.h"
#include "Pasteboard.h"
#include "PasteboardHelper.h"
#include "PasteboardHelperGtk.h"
@@ -112,6 +116,7 @@
*/
static const double defaultDPI = 96.0;
+static WebKitCacheModel cacheModel;
using namespace WebKit;
using namespace WebCore;
@@ -174,7 +179,8 @@ enum {
PROP_PROGRESS,
PROP_ENCODING,
PROP_CUSTOM_ENCODING,
- PROP_ICON_URI
+ PROP_ICON_URI,
+ PROP_IM_CONTEXT
};
static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
@@ -184,6 +190,8 @@ G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
+static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*);
+
static void destroy_menu_cb(GtkObject* object, gpointer data)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(data);
@@ -207,8 +215,28 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
if (!handledEvent)
return FALSE;
+ // If coreMenu is NULL, this means WebCore decided to not create
+ // the default context menu; this may still mean that the frame
+ // wants to consume the event - this happens when the page is
+ // handling the right-click for reasons other than a context menu,
+ // so we give it to it.
ContextMenu* coreMenu = page->contextMenuController()->contextMenu();
- if (!coreMenu)
+ if (!coreMenu) {
+ Frame* frame = core(webView)->mainFrame();
+ if (frame->view() && frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event)))
+ return TRUE;
+
+ return FALSE;
+ }
+
+ // If we reach here, it's because WebCore is going to show the
+ // default context menu. We check our setting to figure out
+ // whether we want it or not.
+ WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
+ gboolean enableDefaultContextMenu;
+ g_object_get(settings, "enable-default-context-menu", &enableDefaultContextMenu, NULL);
+
+ if (!enableDefaultContextMenu)
return FALSE;
GtkMenu* menu = GTK_MENU(coreMenu->platformDescription());
@@ -359,6 +387,9 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue*
case PROP_ICON_URI:
g_value_set_string(value, webkit_web_view_get_icon_uri(webView));
break;
+ case PROP_IM_CONTEXT:
+ g_value_set_object(value, webkit_web_view_get_im_context(webView));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -625,7 +656,11 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus*
// TODO: Improve focus handling as suggested in
// http://bugs.webkit.org/show_bug.cgi?id=16910
GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
+#if GTK_CHECK_VERSION(2, 18, 0)
+ if (gtk_widget_is_toplevel(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
+#else
if (GTK_WIDGET_TOPLEVEL(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
+#endif
WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
FocusController* focusController = core(webView)->focusController();
@@ -814,7 +849,11 @@ static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebF
}
window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
+#if GTK_CHECK_VERSION(2, 18, 0)
+ dialog = gtk_message_dialog_new(gtk_widget_is_toplevel(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, messageType, buttons, "%s", message);
+#else
dialog = gtk_message_dialog_new(GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, messageType, buttons, "%s", message);
+#endif
gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL);
gtk_window_set_title(GTK_WINDOW(dialog), title);
g_free(title);
@@ -1028,6 +1067,7 @@ static void webkit_web_view_finalize(GObject* object)
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
WebKitWebViewPrivate* priv = webView->priv;
+ g_free(priv->tooltipText);
g_free(priv->mainResourceIdentifier);
g_free(priv->encoding);
g_free(priv->customEncoding);
@@ -1251,6 +1291,26 @@ static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* con
clipboard_contents_received, contents_request);
}
+#if GTK_CHECK_VERSION(2, 12, 0)
+static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip)
+{
+ WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget);
+
+ if (priv->tooltipText) {
+ gtk_tooltip_set_text(tooltip, priv->tooltipText);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+#endif
+
+static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
+{
+ g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
+ return GTK_IM_CONTEXT(webView->priv->imContext);
+}
+
static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
{
GtkBindingSet* binding_set;
@@ -1521,9 +1581,10 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @return: %TRUE if the download should be performed, %FALSE to cancel it.
*
* A new Download is being requested. By default, if the signal is
- * not handled, the download is cancelled. Notice that while
- * handling this signal you must set the target URI using
- * webkit_download_set_target_uri().
+ * not handled, the download is cancelled. If you handle the download
+ * and call webkit_download_set_destination_uri(), it will be
+ * started for you. If you need to set the destination asynchronously
+ * you are responsible for starting or cancelling it yourself.
*
* If you intend to handle downloads yourself rather than using
* the #WebKitDownload helper object you must handle this signal,
@@ -1558,6 +1619,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @frame: the frame going to do the load
*
* When a #WebKitWebFrame begins to load this signal is emitted.
+ *
+ * Deprecated: Use the "load-status" property instead.
*/
webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1575,6 +1638,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* @frame: the main frame that received the first data
*
* When a #WebKitWebFrame loaded the first data this signal is emitted.
+ *
+ * Deprecated: Use the "load-status" property instead.
*/
webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1591,6 +1656,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
* WebKitWebView::load-progress-changed:
* @web_view: the #WebKitWebView
* @progress: the global progress
+ *
+ * Deprecated: Use the "progress" property instead.
*/
webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
G_TYPE_FROM_CLASS(webViewClass),
@@ -1627,6 +1694,13 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_TYPE_STRING,
G_TYPE_POINTER);
+ /**
+ * WebKitWebView::load-finished:
+ * @web_view: the #WebKitWebView
+ * @frame: the #WebKitWebFrame
+ *
+ * Deprecated: Use the "load-status" property instead.
+ */
webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)G_SIGNAL_RUN_LAST,
@@ -2106,6 +2180,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
widgetClass->screen_changed = webkit_web_view_screen_changed;
widgetClass->drag_end = webkit_web_view_drag_end;
widgetClass->drag_data_get = webkit_web_view_drag_data_get;
+#if GTK_CHECK_VERSION(2, 12, 0)
+ widgetClass->query_tooltip = webkit_web_view_query_tooltip;
+#endif
GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass);
containerClass->add = webkit_web_view_container_add;
@@ -2369,6 +2446,16 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
*
* Determines the current status of the load.
*
+ * Connect to "notify::load-status" to monitor loading.
+ *
+ * Some versions of WebKitGTK+ emitted this signal for the default
+ * error page, while loading it. This behavior was considered bad,
+ * because it was essentially exposing an implementation
+ * detail. From 1.1.19 onwards this signal is no longer emitted for
+ * the default error pages, but keep in mind that if you override
+ * the error pages by using webkit_web_frame_load_alternate_string()
+ * the signals will be emitted.
+ *
* Since: 1.1.7
*/
g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
@@ -2406,6 +2493,23 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
_("The URI for the favicon for the #WebKitWebView."),
NULL,
WEBKIT_PARAM_READABLE));
+ /**
+ * WebKitWebView:im-context:
+ *
+ * The GtkIMMulticontext for the #WebKitWebView.
+ *
+ * This is the input method context used for all text entry widgets inside
+ * the #WebKitWebView. It can be used to generate context menu items for
+ * controlling the active input method.
+ *
+ * Since: 1.1.20
+ */
+ g_object_class_install_property(objectClass, PROP_IM_CONTEXT,
+ g_param_spec_object("im-context",
+ "IM Context",
+ "The GtkIMMultiContext for the #WebKitWebView.",
+ GTK_TYPE_IM_CONTEXT,
+ WEBKIT_PARAM_READABLE));
g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate));
}
@@ -2421,7 +2525,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas,
enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage,
enableXSSAuditor, javascriptCanOpenWindows, enableOfflineWebAppCache,
- enableUniversalAccessFromFileURI, enableDOMPaste, tabKeyCyclesThroughElements;
+ enableUniversalAccessFromFileURI, enableDOMPaste, tabKeyCyclesThroughElements,
+ enableSiteSpecificQuirks, usePageCache;
WebKitEditingBehavior editingBehavior;
@@ -2452,6 +2557,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
"enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI,
"enable-dom-paste", &enableDOMPaste,
"tab-key-cycles-through-elements", &tabKeyCyclesThroughElements,
+ "enable-site-specific-quirks", &enableSiteSpecificQuirks,
+ "enable-page-cache", &usePageCache,
NULL);
settings->setDefaultTextEncodingName(defaultEncoding);
@@ -2479,6 +2586,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
settings->setEditingBehavior(core(editingBehavior));
settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI);
settings->setDOMPasteAllowed(enableDOMPaste);
+ settings->setNeedsSiteSpecificQuirks(enableSiteSpecificQuirks);
+ settings->setUsesPageCache(usePageCache);
Page* page = core(webView);
if (page)
@@ -2575,7 +2684,10 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
Page* page = core(webView);
if (page)
page->setTabKeyCyclesThroughElements(g_value_get_boolean(&value));
- }
+ } else if (name == g_intern_string("enable-site-specific-quirks"))
+ settings->setNeedsSiteSpecificQuirks(g_value_get_boolean(&value));
+ else if (name == g_intern_string("enable-page-cache"))
+ settings->setUsesPageCache(g_value_get_boolean(&value));
else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name))
g_warning("Unexpected setting '%s'", name);
g_value_unset(&value);
@@ -2618,6 +2730,8 @@ static void webkit_web_view_init(WebKitWebView* webView)
priv->webWindowFeatures = webkit_web_window_features_new();
priv->subResources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref);
+
+ priv->tooltipText = 0;
}
GtkWidget* webkit_web_view_new(void)
@@ -2656,7 +2770,10 @@ void webkit_web_view_request_download(WebKitWebView* webView, WebKitNetworkReque
return;
}
- webkit_download_start(download);
+ /* Start the download now if it has a destination URI, otherwise it
+ may be handled asynchronously by the application. */
+ if (webkit_download_get_destination_uri(download))
+ webkit_download_start(download);
}
bool webkit_web_view_use_primary_for_paste(WebKitWebView* webView)
@@ -3969,6 +4086,27 @@ static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& window
return view ? view->windowToContents(windowPoint) : windowPoint;
}
+void webkit_web_view_set_tooltip_text(WebKitWebView* webView, const char* tooltip)
+{
+#if GTK_CHECK_VERSION(2, 12, 0)
+ WebKitWebViewPrivate* priv = webView->priv;
+ g_free(priv->tooltipText);
+ if (tooltip && *tooltip != '\0') {
+ priv->tooltipText = g_strdup(tooltip);
+ gtk_widget_set_has_tooltip(GTK_WIDGET(webView), TRUE);
+ } else {
+ priv->tooltipText = 0;
+ gtk_widget_set_has_tooltip(GTK_WIDGET(webView), FALSE);
+ }
+
+ gtk_widget_trigger_tooltip_query(GTK_WIDGET(webView));
+#else
+ // TODO: Support older GTK+ versions
+ // See http://bugs.webkit.org/show_bug.cgi?id=15793
+ notImplemented();
+#endif
+}
+
/**
* webkit_web_view_get_hit_test_result:
* @webView: a #WebKitWebView
@@ -4019,3 +4157,81 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
priv->iconURI = g_strdup(iconURL.utf8().data());
return priv->iconURI;
}
+
+/**
+ * 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)
+{
+ 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:
+ 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()
+{
+ return cacheModel;
+}
diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h
index 8dd7f39..e69de0a 100644
--- a/WebKit/gtk/webkit/webkitwebview.h
+++ b/WebKit/gtk/webkit/webkitwebview.h
@@ -49,6 +49,11 @@ typedef enum {
WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD
} WebKitNavigationResponse;
+typedef enum {
+ WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER = 1,
+ WEBKIT_CACHE_MODEL_WEB_BROWSER
+} WebKitCacheModel;
+
typedef enum
{
WEBKIT_WEB_VIEW_TARGET_INFO_HTML,
@@ -370,6 +375,12 @@ 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);
+
G_END_DECLS
#endif