diff options
author | Steve Block <steveblock@google.com> | 2009-12-15 10:12:09 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-17 17:41:10 +0000 |
commit | 643ca7872b450ea4efacab6188849e5aac2ba161 (patch) | |
tree | 6982576c228bcd1a7efe98afed544d840751094c /WebKit/gtk | |
parent | d026980fde6eb3b01c1fe49441174e89cd1be298 (diff) | |
download | external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2 |
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebKit/gtk')
31 files changed, 1319 insertions, 108 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 62aa3da..ac80deb 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,438 @@ +2009-12-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Add a missing null-check, that is causing some crash reports. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::committedLoad): + +2009-12-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Should provide an API to control the IconDatabase + https://bugs.webkit.org/show_bug.cgi?id=32334 + + First step towards a full IconDatabase API. This provides + notification for pages with favicons, and lets clients handle + them. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::registerForIconNotification): + (WebKit::FrameLoaderClient::dispatchDidReceiveIcon): + * tests/resources/blank.ico: Added. + * tests/testwebview.c: Added. + (server_callback): + (idle_quit_loop_cb): + (icon_uri_changed_cb): + (icon_loaded_cb): + (test_webkit_web_view_icon_uri): + (main): + * webkit/webkitprivate.cpp: + (closeIconDatabaseOnExit): + (webkit_init): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_get_property): + (webkit_web_view_finalize): + (webkit_web_view_class_init): + (webkit_web_view_get_icon_uri): + * webkit/webkitwebview.h: + +2009-12-08 Christian Dywan <christian@twotoasts.de> + + Reviewed by Gustavo Noronha Silva. + + Point out the meaning of "Content-Disposition" when implementing the + mime-type-policy-decision-requested signal. + + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + +2009-12-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Doesn't respect Content-Disposition for downloads, and provides no way for apps to do that + https://bugs.webkit.org/show_bug.cgi?id=32247 + + Provide a way for applications to respect Content-Disposition, by + fetching the WebKitNetworkResponse from the frame during + mime-type-policy-decision-requested. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDecidePolicyForMIMEType): Download + content when Content-Disposition is attachment. + * tests/testmimehandling.c: + (server_callback): + (mime_type_policy_decision_requested_cb): + * tests/testwebframe.c: + (test_webkit_web_frame_response): + (main): + * webkit/webkitprivate.cpp: + (WebKit::core): + * webkit/webkitwebframe.cpp: + (webkit_web_frame_get_network_response): + * webkit/webkitwebframe.h: + +2009-12-07 Gyuyoung Kim <gyuyoung@gmail.com> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=32024 + [GTK] WebKit does not compile without JAVASCRIPT_DEBUGGER + + Fix build errors when javascript-debugger is disabled on GTK + + * webkit/webkitwebinspector.cpp: + (webkit_web_inspector_set_property): + (webkit_web_inspector_get_property): + +2009-12-07 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25415 + [GTK][ATK] Please implement support for get_text_at_offset + + Eliminate the segfaults which occur when accessing the text interface now + implemented by text controls. + + * tests/testatk.c + (test_webkit_atk_get_text_at_offset_textarea): + (test_webkit_atk_get_text_at_offset_text_input): + (main): + +2009-12-06 Gustavo Noronha Silva <gns@gnome.org> + + Reviewed by Xan Lopez. + + New test to make sure we do not regress this feature anymore. All + test files were created by me. + + [GTK] REGRESSION: webkit thinks it can render PDFs + https://bugs.webkit.org/show_bug.cgi?id=32183 + + * tests/resources/test.html: Added. + * tests/resources/test.ogg: Added. + * tests/resources/test.pdf: Added. + * tests/resources/test.txt: Added. + * tests/testmimehandling.c: Added. + (server_callback): + (idle_quit_loop_cb): + (mime_type_policy_decision_requested_cb): + (test_mime_type): + (test_mime_pdf): + (test_mime_html): + (test_mime_text): + (test_mime_ogg): + (main): + +2009-12-05 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Use a better URI for the unreachable test. localhost:80 is very + likely to be open. + + * tests/testwebdatasource.c: + (load_finished_unreachable_cb): + (test_webkit_web_data_source_unreachable_uri): + +2009-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7214236> and http://webkit.org/b/32052 - Implement HTML5 state object history API + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidPushStateWithinPage): + (WebKit::FrameLoaderClient::dispatchDidReplaceStateWithinPage): + (WebKit::FrameLoaderClient::dispatchDidPopStateWithinPage): + * WebCoreSupport/FrameLoaderClientGtk.h: + +2009-12-03 Pavel Feldman <pfeldman@dhcp-172-28-174-220.spb.corp.google.com> + + Reviewed by Timothy Hatcher. + + Web Inspector: Simplify the settings support in inspector controller. + + https://bugs.webkit.org/show_bug.cgi?id=32076 + + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::populateSetting): + (WebKit::InspectorClient::storeSetting): + * WebCoreSupport/InspectorClientGtk.h: + +2009-12-03 Ben Murdoch <benm@google.com> + + Reviewed by Brady Eidson. + + [Android] The FrameLoaderClient is unaware of BackForwardList changes. + https://bugs.webkit.org/show_bug.cgi?id=31914 + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidAddBackForwardItem): Add an empty implementation. Method added to FrameLoaderClient by Android (see bug). + (WebKit::FrameLoaderClient::dispatchDidRemoveBackForwardItem): ditto. + (WebKit::FrameLoaderClient::dispatchDidChangeBackForwardIndex): ditto. + * WebCoreSupport/FrameLoaderClientGtk.h: + +2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Simon Fraser. + + Add SVG animation test framework with 'snapshot' functionality + https://bugs.webkit.org/show_bug.cgi?id=31897 + + Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method, + forwarding the call to SVGDocumentExtensions, if SVG is enabled. + + Implemented just like the existing pauseAnimation* methods for CSS animations. + + * webkit/webkitprivate.h: + * webkit/webkitwebframe.cpp: + (webkit_web_frame_pause_svg_animation): + +2009-11-30 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Prepare for 1.1.17 release. + + * NEWS: + * docs/webkitgtk-docs.sgml: + * docs/webkitgtk-sections.txt: + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + +2009-11-26 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Oliver Hunt. + + Move GOwnPtr* from wtf to wtf/gtk + https://bugs.webkit.org/show_bug.cgi?id=31793 + + * webkit/webkitwebview.cpp: Change the path for GOwnPtr.h. + +2009-11-24 Joanmarie Diggs <joanmarie.diggs@gmail.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=25415 + [GTK][ATK] Please implement support for get_text_at_offset + + When building up the pango layout from text boxes, only append a + newline char after verifying there are no more boxes on this line. + + * tests/testatk.c + (test_webkit_atk_get_text_at_offset_newlines): + (main): + +2009-11-19 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Gustavo Noronha Silva. + + Web Inspector: Implement "show inspector" in WebKit GTK + API and enable console tests. + + https://bugs.webkit.org/show_bug.cgi?id=31669 + + * webkit/webkitwebinspector.cpp: + (webkit_web_inspector_show): + * webkit/webkitwebinspector.h: + +2009-11-18 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] Tab key does not cycle through elements by default + https://bugs.webkit.org/show_bug.cgi?id=31505 + + Properly localize documentation strings for the + tab-key-cycles-through-elements property. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + +2009-11-17 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] Tab key does not cycle through elements by default + https://bugs.webkit.org/show_bug.cgi?id=31505 + + Ensure that WebKitWebSettings tab-key-cycles-through-elements + property is true by default with the G_PARAM_CONSTRUCT_FLAG. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + +2009-11-18 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Failing test media/video-document-types.html + https://bugs.webkit.org/show_bug.cgi?id=31352 + + Match what Mac has been doing since r36001: cancel the main load, + and handle failures caused by 'will be handled by plugin' errors. + + Covered by test media/video-document-types.html + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::committedLoad): + (WebKit::FrameLoaderClient::shouldFallBack): + +2009-11-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Make DRT show web inspector for tests in inspector/ folder. + - Updated DRT to show/close inspector for all tests under /inspector + - Introduced LayoutTestController::setTimelineProfilingEnabled and + WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled + - Removed reload on each inspector test + - Renamed fast/inspector to fast/inspector-support in order not to trigger + inspector for those. + - Reimplemented timeline tests in order to get rid of reload there. + - Moved tests that don't require harness into the fast group. + + https://bugs.webkit.org/show_bug.cgi?id=31472 + + * webkit/webkitwebinspector.cpp: + (webkit_web_inspector_class_init): + (webkit_web_inspector_set_property): + (webkit_web_inspector_get_property): + +2009-11-13 Adam Roben <aroben@apple.com> + + Update for changes to FrameLoaderClient + + Fixes <http://webkit.org/b/31124> Tell the WebFrameLoadDelegate when + window objects in isolated worlds are cleared + + Reviewed by Dave Hyatt. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidClearWindowObjectInWorld): + * WebCoreSupport/FrameLoaderClientGtk.h: + Replaced windowObjectCleared with this function. Does nothing if the + passed-in world is not the mainThreadNormalWorld(). + +2009-11-12 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + externalRepresentation should take Frame as the argument + https://bugs.webkit.org/show_bug.cgi?id=31393 + + No new tests as this is just a refactoring. + + * webkit/webkitwebframe.cpp: + (webkit_web_frame_dump_render_tree): + +2009-11-11 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + Should not print javascript console messages to stdout + https://bugs.webkit.org/show_bug.cgi?id=31346 + + * webkit/webkitwebview.cpp: + (webkit_web_view_real_console_message): Print console messages to + stderr instead, using the recommended method (a g_log variant). + +2009-11-11 Philippe Normand <pnormand@igalia.com> + + Reviewed by Xan Lopez. + + https://bugs.webkit.org/show_bug.cgi?id=30221 + [GTK] fails to load media embedded in iframe element + + The FrameLoader can show Media if the audio/video support is + enabled at compile time. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::canShowMIMEType): + +2009-11-10 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Jan Alonzo. + + [GTK] Remove WebSocket configuration from WebKitWebSettings + https://bugs.webkit.org/show_bug.cgi?id=31244 + + Remove non-functional enable-web-sockets property from WebKitWebSettings. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + (webkit_web_settings_set_property): + (webkit_web_settings_get_property): + (webkit_web_settings_copy): + +2009-11-09 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Jan Alonzo. + + [GTK] Expose Page::tabKeyCyclesThroughElements in the API + https://bugs.webkit.org/show_bug.cgi?id=30482 + + Expose Page::tabKeyCyclesThroughElements as a property of + WebKitWebSettings. + + * webkit/webkitwebsettings.cpp: + (webkit_web_settings_class_init): + (webkit_web_settings_set_property): + (webkit_web_settings_get_property): + * webkit/webkitwebview.cpp: + (webkit_web_view_update_settings): + (webkit_web_view_settings_notify): + +2009-11-04 Martin Robinson <martin.james.robinson@gmail.com> + + Reviewed by Jan Alonzo. + + [GTK] Enable DOM clipboard and drag-and-drop access + https://bugs.webkit.org/show_bug.cgi?id=30623 + + Move handling of target list to PasteboardHelperGtk. + + * WebCoreSupport/PasteboardHelperGtk.cpp: + (WebKit::PasteboardHelperGtk::PasteboardHelperGtk): + (WebKit::PasteboardHelperGtk::~PasteboardHelperGtk): + (WebKit::PasteboardHelperGtk::fullTargetList): + * WebCoreSupport/PasteboardHelperGtk.h: + * webkit/webkitprivate.cpp: + (WebKit::pasteboardHelperInstance): + (webkit_init): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_dispose): + (webkit_web_view_init): + (webkit_web_view_get_copy_target_list): + (webkit_web_view_get_paste_target_list): + +2009-10-30 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + Notify the chrome when the focused node has changed. + https://bugs.webkit.org/show_bug.cgi?id=30832 + + Added stub implementation for new ChromeClient function. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::focusedNodeChanged): + * WebCoreSupport/ChromeClientGtk.h: + +2009-10-29 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed. Trivial fix - move public API declaration into the + public subsection of the doc. + + * docs/webkitgtk-sections.txt: + 2009-10-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> Reviewed by Jan Alonzo. diff --git a/WebKit/gtk/NEWS b/WebKit/gtk/NEWS index b901f4b..f40390e 100644 --- a/WebKit/gtk/NEWS +++ b/WebKit/gtk/NEWS @@ -1,4 +1,18 @@ ================= +WebKitGTK+ 1.1.17 +================= + +What's new in WebKitGTK+ 1.1.17? + + - New APIs to show and close the web inspector and to inspect an + element at the given coordinates. + - New property, WebKitWebSettings::tab-key-cycles-through-elements, + controls whether TAB is simply interpreted as another keystroke or + is used to cycle through the elements in a page. + - Many a11y improvements. + - The usual amount of random bugfixes. + +================= WebKitGTK+ 1.1.16 ================= diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 8d31af3..d9a043b 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -242,6 +242,10 @@ void ChromeClient::takeFocus(FocusDirection) unfocus(); } +void ChromeClient::focusedNodeChanged(Node*) +{ +} + bool ChromeClient::canRunBeforeUnloadConfirmPanel() { return true; diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index e321c35..beb7a08 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -47,6 +47,8 @@ namespace WebKit { virtual bool canTakeFocus(WebCore::FocusDirection); virtual void takeFocus(WebCore::FocusDirection); + virtual void focusedNodeChanged(WebCore::Node*); + virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); virtual void show(); diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 7286625..0eaa7c8 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -149,6 +149,10 @@ void FrameLoaderClient::committedLoad(WebCore::DocumentLoader* loader, const cha frameLoader->setEncoding(encoding, userChosen); if (data) frameLoader->addData(data, length); + + Frame* coreFrame = loader->frame(); + if (coreFrame && coreFrame->document() && coreFrame->document()->isMediaDocument()) + loader->cancelMainResourceLoad(frameLoader->client()->pluginWillHandleLoadError(loader->response())); } if (m_pluginView) { @@ -301,10 +305,19 @@ void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction poli if (isHandled) return; + GOwnPtr<WebKitNetworkResponse> networkResponse(webkit_web_frame_get_network_response(m_frame)); + if (networkResponse) { + ResourceResponse response = core(networkResponse.get()); + if (response.isAttachment()) { + webkit_web_policy_decision_download(policyDecision); + return; + } + } + if (canShowMIMEType(mimeType)) - webkit_web_policy_decision_use (policyDecision); + webkit_web_policy_decision_use(policyDecision); else - webkit_web_policy_decision_ignore (policyDecision); + webkit_web_policy_decision_ignore(policyDecision); } static WebKitWebNavigationAction* getNavigationAction(const NavigationAction& action, const char* targetFrame) @@ -500,8 +513,11 @@ String FrameLoaderClient::overrideMediaType() const return String(); } -void FrameLoaderClient::windowObjectCleared() +void FrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { + if (world != mainThreadNormalWorld()) + return; + // Is this obsolete now? g_signal_emit_by_name(m_frame, "cleared"); @@ -533,7 +549,7 @@ void FrameLoaderClient::didPerformFirstNavigation() const { } -void FrameLoaderClient::registerForIconNotification(bool) +void FrameLoaderClient::registerForIconNotification(bool shouldRegister) { notImplemented(); } @@ -662,6 +678,21 @@ void FrameLoaderClient::dispatchDidChangeLocationWithinPage() g_object_notify(G_OBJECT(webView), "uri"); } +void FrameLoaderClient::dispatchDidPushStateWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClient::dispatchDidReplaceStateWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClient::dispatchDidPopStateWithinPage() +{ + notImplemented(); +} + void FrameLoaderClient::dispatchWillClose() { notImplemented(); @@ -671,7 +702,12 @@ void FrameLoaderClient::dispatchDidReceiveIcon() { WebKitWebView* webView = getViewFromFrame(m_frame); - g_signal_emit_by_name(webView, "icon-loaded", m_frame); + // Avoid reporting favicons for non-main frames. + if (m_frame != webkit_web_view_get_main_frame(webView)) + return; + + g_object_notify(G_OBJECT(webView), "icon-uri"); + g_signal_emit_by_name(webView, "icon-loaded", webkit_web_view_get_icon_uri(webView)); } void FrameLoaderClient::dispatchDidStartProvisionalLoad() @@ -781,8 +817,10 @@ bool FrameLoaderClient::canHandleRequest(const ResourceRequest&) const bool FrameLoaderClient::canShowMIMEType(const String& type) const { - return MIMETypeRegistry::isSupportedImageMIMEType(type) || MIMETypeRegistry::isSupportedNonImageMIMEType(type) || - PluginDatabase::installedPlugins()->isMIMETypeRegistered(type); + return (MIMETypeRegistry::isSupportedImageMIMEType(type) + || MIMETypeRegistry::isSupportedNonImageMIMEType(type) + || MIMETypeRegistry::isSupportedMediaMIMEType(type) + || PluginDatabase::installedPlugins()->isMIMETypeRegistered(type)); } bool FrameLoaderClient::representationExistsForURLScheme(const String&) const @@ -993,9 +1031,7 @@ ResourceError FrameLoaderClient::pluginWillHandleLoadError(const ResourceRespons bool FrameLoaderClient::shouldFallBack(const ResourceError& error) { - // FIXME: Mac checks for WebKitErrorPlugInWillHandleLoad here to avoid - // loading plugin content twice. Do we need it? - return !(error.isCancellation() || error.errorCode() == WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE); + return !(error.isCancellation() || error.errorCode() == WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE || error.errorCode() == WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD); } bool FrameLoaderClient::canCachePage() const diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 997ea64..cace770 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -76,6 +76,9 @@ namespace WebKit { virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double, double); virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); @@ -114,7 +117,7 @@ namespace WebKit { virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WebCore::String>& paramNames, const WTF::Vector<WebCore::String>& paramValues); virtual WebCore::String overrideMediaType() const; - virtual void windowObjectCleared(); + virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index 78f5543..a06ff50 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -204,18 +204,12 @@ void InspectorClient::inspectorWindowObjectCleared() notImplemented(); } - -void InspectorClient::populateSetting(const String& key, InspectorController::Setting& setting) -{ - notImplemented(); -} - -void InspectorClient::storeSetting(const String& key, const InspectorController::Setting& setting) +void InspectorClient::populateSetting(const String& key, String* value) { notImplemented(); } -void InspectorClient::removeSetting(const String& key) +void InspectorClient::storeSetting(const String& key, const String& value) { notImplemented(); } diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h index ed9fe08..297fd8f 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h @@ -66,9 +66,8 @@ namespace WebKit { virtual void hideHighlight(); virtual void inspectedURLChanged(const WebCore::String& newURL); - virtual void populateSetting(const WebCore::String& key, WebCore::InspectorController::Setting&); - virtual void storeSetting(const WebCore::String& key, const WebCore::InspectorController::Setting&); - virtual void removeSetting(const WebCore::String& key); + virtual void populateSetting(const WebCore::String& key, WebCore::String* value); + virtual void storeSetting(const WebCore::String& key, const WebCore::String& value); virtual void inspectorWindowObjectCleared(); diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp index f2ea316..c71ef1b 100644 --- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp @@ -31,6 +31,20 @@ using namespace WebCore; namespace WebKit { +static GdkAtom gdkMarkupAtom = gdk_atom_intern("text/html", FALSE); + +PasteboardHelperGtk::PasteboardHelperGtk() + : m_targetList(gtk_target_list_new(0, 0)) +{ + gtk_target_list_add_text_targets(m_targetList, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT); + gtk_target_list_add(m_targetList, gdkMarkupAtom, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML); +} + +PasteboardHelperGtk::~PasteboardHelperGtk() +{ + gtk_target_list_unref(m_targetList); +} + GtkClipboard* PasteboardHelperGtk::getCurrentTarget(Frame* frame) const { WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); @@ -55,16 +69,9 @@ GtkClipboard* PasteboardHelperGtk::getPrimary(Frame* frame) const GDK_SELECTION_PRIMARY); } -GtkTargetList* PasteboardHelperGtk::getCopyTargetList(Frame* frame) const -{ - WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); - return webkit_web_view_get_copy_target_list(webView); -} - -GtkTargetList* PasteboardHelperGtk::getPasteTargetList(Frame* frame) const +GtkTargetList* PasteboardHelperGtk::targetList() const { - WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame)); - return webkit_web_view_get_paste_target_list(webView); + return m_targetList; } gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h index 849b417..12ba207 100644 --- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h +++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h @@ -39,13 +39,16 @@ namespace WebKit { class PasteboardHelperGtk : public PasteboardHelper { public: - PasteboardHelperGtk() { } + PasteboardHelperGtk(); + ~PasteboardHelperGtk(); virtual GtkClipboard* getCurrentTarget(Frame*) const; virtual GtkClipboard* getClipboard(Frame*) const; virtual GtkClipboard* getPrimary(Frame*) const; - virtual GtkTargetList* getCopyTargetList(Frame*) const; - virtual GtkTargetList* getPasteTargetList(Frame*) const; + virtual GtkTargetList* targetList() const; virtual gint getWebViewTargetInfoHtml() const; + +private: + GtkTargetList* m_targetList; }; } diff --git a/WebKit/gtk/docs/webkitgtk-docs.sgml b/WebKit/gtk/docs/webkitgtk-docs.sgml index 7719336..ca478f9 100644 --- a/WebKit/gtk/docs/webkitgtk-docs.sgml +++ b/WebKit/gtk/docs/webkitgtk-docs.sgml @@ -93,4 +93,7 @@ <index id="index-1.1.16" role="1.1.16"> <title>Index of new symbols in 1.1.16</title> </index> + <index id="index-1.1.17" role="1.1.17"> + <title>Index of new symbols in 1.1.17</title> + </index> </book> diff --git a/WebKit/gtk/docs/webkitgtk-sections.txt b/WebKit/gtk/docs/webkitgtk-sections.txt index 8bdd3b3..1f4d1b7 100644 --- a/WebKit/gtk/docs/webkitgtk-sections.txt +++ b/WebKit/gtk/docs/webkitgtk-sections.txt @@ -282,6 +282,9 @@ WebKitSoupAuthDialogClass WebKitWebInspector webkit_web_inspector_get_inspected_uri webkit_web_inspector_get_web_view +webkit_web_inspector_inspect_coordinates +webkit_web_inspector_show +webkit_web_inspector_close <SUBSECTION Standard> WEBKIT_WEB_INSPECTOR WEBKIT_IS_WEB_INSPECTOR @@ -349,6 +352,7 @@ WebKitWebPolicyDecisionPrivate <FILE>webkitnetworkrequest</FILE> <TITLE>WebKitNetworkRequest</TITLE> WebKitNetworkRequest +webkit_network_request_new webkit_network_request_get_uri webkit_network_request_get_message webkit_network_request_set_uri @@ -361,7 +365,6 @@ WEBKIT_IS_NETWORK_REQUEST_CLASS WEBKIT_NETWORK_REQUEST_GET_CLASS <SUBSECTION Private> webkit_network_request_get_type -webkit_network_request_new WebKitNetworkRequestPrivate WebKitNetworkRequest WebKitNetworkRequestClass diff --git a/WebKit/gtk/tests/resources/blank.ico b/WebKit/gtk/tests/resources/blank.ico Binary files differnew file mode 100644 index 0000000..ea848b9 --- /dev/null +++ b/WebKit/gtk/tests/resources/blank.ico diff --git a/WebKit/gtk/tests/resources/test.html b/WebKit/gtk/tests/resources/test.html new file mode 100644 index 0000000..98f7d4f --- /dev/null +++ b/WebKit/gtk/tests/resources/test.html @@ -0,0 +1,6 @@ +<html> +<head><title>test</title></head> +<body>test</body> +</html>></head> +<body>test</body> +</html> diff --git a/WebKit/gtk/tests/resources/test.ogg b/WebKit/gtk/tests/resources/test.ogg Binary files differnew file mode 100644 index 0000000..7f3a3b9 --- /dev/null +++ b/WebKit/gtk/tests/resources/test.ogg diff --git a/WebKit/gtk/tests/resources/test.pdf b/WebKit/gtk/tests/resources/test.pdf Binary files differnew file mode 100644 index 0000000..2424c19 --- /dev/null +++ b/WebKit/gtk/tests/resources/test.pdf diff --git a/WebKit/gtk/tests/resources/test.txt b/WebKit/gtk/tests/resources/test.txt new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/WebKit/gtk/tests/resources/test.txt @@ -0,0 +1 @@ +test diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index e47898b..c5f4db3 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -28,6 +28,12 @@ static const char* contents = "<html><body><p>This is a test. This is the second sentence. And this the third.</p></body></html>"; +static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nThis\n is the second sentence. And this the third.</p></body></html>"; + +static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is a test. This is the second sentence. And this the third.</textarea></body></html>"; + +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 gboolean bail_out(GMainLoop* loop) { if (g_main_loop_is_running(loop)) @@ -259,6 +265,105 @@ static void test_webkit_atk_get_text_at_offset(void) g_object_unref(webView); } +static void test_webkit_atk_get_text_at_offset_newlines(void) +{ + WebKitWebView* webView; + AtkObject* obj; + GMainLoop* loop; + AtkText* text_obj; + + 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, contentsWithNewlines, 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); + 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)); + + run_get_text_tests(text_obj); + + g_object_unref(webView); +} + +static void test_webkit_atk_get_text_at_offset_textarea(void) +{ + WebKitWebView* webView; + AtkObject* obj; + GMainLoop* loop; + AtkText* text_obj; + + 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, contentsInTextarea, 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); + 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)); + + run_get_text_tests(text_obj); + + g_object_unref(webView); +} + +static void test_webkit_atk_get_text_at_offset_text_input(void) +{ + WebKitWebView* webView; + AtkObject* obj; + GMainLoop* loop; + AtkText* text_obj; + + 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, contentsInTextInput, 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); + 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)); + + run_get_text_tests(text_obj); + + g_object_unref(webView); +} + int main(int argc, char** argv) { g_thread_init(NULL); @@ -267,6 +372,9 @@ int main(int argc, char** argv) g_test_bug_base("https://bugs.webkit.org/"); g_test_add_func("/webkit/atk/get_text_at_offset", test_webkit_atk_get_text_at_offset); g_test_add_func("/webkit/atk/get_text_at_offset_forms", test_webkit_atk_get_text_at_offset_forms); + 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); return g_test_run (); } diff --git a/WebKit/gtk/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c new file mode 100644 index 0000000..e68dcdf --- /dev/null +++ b/WebKit/gtk/tests/testmimehandling.c @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2009 Jan Michael Alonzo + * Copyright (C) 2009 Gustavo Noronha Silva + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <glib.h> +#include <glib/gstdio.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) + +GMainLoop* loop; +SoupSession *session; +char* 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); + + /* PDF */ + if (g_str_equal(path, "/pdf")) { + char* contents; + gsize length; + GError* error = NULL; + + g_file_get_contents("test.pdf", &contents, &length, &error); + g_assert(!error); + + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length); + } else if (g_str_equal(path, "/html")) { + char* contents; + gsize length; + GError* error = NULL; + + g_file_get_contents("test.html", &contents, &length, &error); + g_assert(!error); + + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length); + } else if (g_str_equal(path, "/text")) { + char* contents; + gsize length; + GError* error = NULL; + + soup_message_headers_append(msg->response_headers, "Content-Disposition", "attachment; filename=test.txt"); + + g_file_get_contents("test.txt", &contents, &length, &error); + g_assert(!error); + + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length); + } else if (g_str_equal(path, "/ogg")) { + char* contents; + gsize length; + GError* error = NULL; + + g_file_get_contents("test.ogg", &contents, &length, &error); + g_assert(!error); + + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length); + } + + soup_message_body_complete(msg->response_body); +} + +static gboolean idle_quit_loop_cb(gpointer data) +{ + g_main_loop_quit(loop); + return FALSE; +} + +static gboolean mime_type_policy_decision_requested_cb(WebKitWebView* view, WebKitWebFrame* frame, + WebKitNetworkRequest* request, const char* mime_type, + WebKitWebPolicyDecision* decision, gpointer data) +{ + char* type = (char*)data; + + if (g_str_equal(type, "pdf")) { + g_assert_cmpstr(mime_type, ==, "application/pdf"); + g_assert(!webkit_web_view_can_show_mime_type(view, mime_type)); + } else if (g_str_equal(type, "html")) { + g_assert_cmpstr(mime_type, ==, "text/html"); + g_assert(webkit_web_view_can_show_mime_type(view, mime_type)); + } else if (g_str_equal(type, "text")) { + WebKitNetworkResponse* response = webkit_web_frame_get_network_response(frame); + SoupMessage* message = webkit_network_response_get_message(response); + char* disposition; + + g_assert(message); + soup_message_headers_get_content_disposition(message->response_headers, + &disposition, NULL); + g_object_unref(response); + + g_assert_cmpstr(disposition, ==, "attachment"); + g_free(disposition); + + g_assert_cmpstr(mime_type, ==, "text/plain"); + g_assert(webkit_web_view_can_show_mime_type(view, mime_type)); + } else if (g_str_equal(type, "ogg")) { + g_assert_cmpstr(mime_type, ==, "audio/ogg"); + g_assert(webkit_web_view_can_show_mime_type(view, mime_type)); + } + + g_free(type); + + return FALSE; +} + +static void test_mime_type(const char* name) +{ + WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(G_OBJECT(view)); + + loop = g_main_loop_new(NULL, TRUE); + + g_object_connect(G_OBJECT(view), + "signal::load-finished", idle_quit_loop_cb, NULL, + "signal::mime-type-policy-decision-requested", mime_type_policy_decision_requested_cb, g_strdup(name), + NULL); + + char* effective_uri = g_strdup_printf("%s%s", base_uri, name); + webkit_web_view_load_uri(view, effective_uri); + g_free(effective_uri); + + g_main_loop_run(loop); + + g_object_unref(view); +} + +static void test_mime_pdf() +{ + test_mime_type("pdf"); +} + +static void test_mime_html() +{ + test_mime_type("html"); +} + +static void test_mime_text() +{ + test_mime_type("text"); +} + +static void test_mime_ogg() +{ + test_mime_type("pdf"); +} + +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); + + server = soup_server_new(SOUP_SERVER_PORT, 0, NULL); + soup_server_run_async(server); + + soup_server_add_handler(server, NULL, server_callback, NULL, NULL); + + soup_uri = soup_uri_new("http://127.0.0.1/"); + soup_uri_set_port(soup_uri, soup_server_get_port(server)); + + base_uri = soup_uri_to_string(soup_uri, FALSE); + soup_uri_free(soup_uri); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add_func("/webkit/mime/PDF", test_mime_pdf); + g_test_add_func("/webkit/mime/HTML", test_mime_html); + g_test_add_func("/webkit/mime/TEXT", test_mime_text); + g_test_add_func("/webkit/mime/OGG", test_mime_ogg); + + return g_test_run(); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/tests/testwebdatasource.c b/WebKit/gtk/tests/testwebdatasource.c index de2430f..fe5c62f 100644 --- a/WebKit/gtk/tests/testwebdatasource.c +++ b/WebKit/gtk/tests/testwebdatasource.c @@ -66,7 +66,7 @@ static void load_finished_unreachable_cb(WebKitWebView* view, WebKitWebFrame* fr frame = webkit_web_view_get_main_frame(view); datasource = webkit_web_frame_get_data_source(frame); - g_assert_cmpstr("http://localhost/doireallyexist.html", ==, + 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)) @@ -149,7 +149,7 @@ static void test_webkit_web_data_source_unreachable_uri() 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); - webkit_web_view_load_uri(view, "http://localhost/doireallyexist.html"); + webkit_web_view_load_uri(view, "http://this.host.does.not.exist/doireallyexist.html"); if (!waitTimer) waitTimer = g_timeout_add_seconds(defaultTimeout, (GSourceFunc)wait_timer_fired, loop); diff --git a/WebKit/gtk/tests/testwebframe.c b/WebKit/gtk/tests/testwebframe.c index 068e2cf..620c9c9 100644 --- a/WebKit/gtk/tests/testwebframe.c +++ b/WebKit/gtk/tests/testwebframe.c @@ -155,6 +155,14 @@ cleanup: g_free(temporaryFilename); } +static void test_webkit_web_frame_response() +{ + WebKitWebFrame* frame = g_object_new(WEBKIT_TYPE_WEB_FRAME, NULL); + WebKitNetworkResponse* response = webkit_web_frame_get_network_response(frame); + g_assert(!response); + g_object_unref(frame); +} + int main(int argc, char** argv) { g_thread_init(NULL); @@ -164,6 +172,7 @@ int main(int argc, char** argv) g_test_add_func("/webkit/webview/create_destroy", test_webkit_web_frame_create_destroy); g_test_add_func("/webkit/webframe/lifetime", test_webkit_web_frame_lifetime); g_test_add_func("/webkit/webview/printing", test_webkit_web_frame_printing); + g_test_add_func("/webkit/webview/response", test_webkit_web_frame_response); return g_test_run (); } diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c new file mode 100644 index 0000000..e0921c0 --- /dev/null +++ b/WebKit/gtk/tests/testwebview.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2008 Holger Hans Peter Freyther + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include <errno.h> +#include <unistd.h> +#include <string.h> + +#include <glib.h> +#include <glib/gstdio.h> +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0) + +GMainLoop* loop; +SoupSession *session; +char* 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, "/favicon.ico")) { + char* contents; + gsize length; + GError* error = NULL; + + g_file_get_contents("blank.ico", &contents, &length, &error); + g_assert(!error); + + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, length); + } else { + char* contents = g_strdup("<html><body>test</body></html>"); + soup_message_body_append(msg->response_body, SOUP_MEMORY_TAKE, contents, strlen(contents)); + } + + soup_message_body_complete(msg->response_body); +} + +static gboolean idle_quit_loop_cb(gpointer data) +{ + g_main_loop_quit(loop); + return FALSE; +} + +static void icon_uri_changed_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data) +{ + gboolean* been_here = (gboolean*)data; + char* expected_uri; + + g_assert_cmpstr(g_param_spec_get_name(pspec), ==, "icon-uri"); + + expected_uri = g_strdup_printf("%sfavicon.ico", base_uri); + g_assert_cmpstr(webkit_web_view_get_icon_uri(web_view), ==, expected_uri); + g_free(expected_uri); + + *been_here = TRUE; +} + +static void icon_loaded_cb(WebKitWebView* web_view, char* icon_uri, gpointer data) +{ + gboolean* been_here = (gboolean*)data; + char* expected_uri = g_strdup_printf("%sfavicon.ico", base_uri); + g_assert_cmpstr(icon_uri, ==, expected_uri); + g_free(expected_uri); + + g_assert_cmpstr(icon_uri, ==, webkit_web_view_get_icon_uri(web_view)); + + *been_here = TRUE; +} + +static void test_webkit_web_view_icon_uri() +{ + gboolean been_to_uri_changed = FALSE; + gboolean been_to_icon_loaded = FALSE; + WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(G_OBJECT(view)); + + loop = g_main_loop_new(NULL, TRUE); + + g_object_connect(G_OBJECT(view), + "signal::load-finished", 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); + + webkit_web_view_load_uri(view, base_uri); + + g_main_loop_run(loop); + + g_assert(been_to_uri_changed); + g_assert(been_to_icon_loaded); + + g_object_unref(view); +} + +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); + + server = soup_server_new(SOUP_SERVER_PORT, 0, NULL); + soup_server_run_async(server); + + soup_server_add_handler(server, NULL, server_callback, NULL, NULL); + + soup_uri = soup_uri_new("http://127.0.0.1/"); + soup_uri_set_port(soup_uri, soup_server_get_port(server)); + + base_uri = soup_uri_to_string(soup_uri, FALSE); + soup_uri_free(soup_uri); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add_func("/webkit/webview/icon-uri", test_webkit_web_view_icon_uri); + + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp index 4425dcd..c80160c 100644 --- a/WebKit/gtk/webkit/webkitprivate.cpp +++ b/WebKit/gtk/webkit/webkitprivate.cpp @@ -28,6 +28,7 @@ #include "FrameLoader.h" #include "FrameLoaderClientGtk.h" #include "HitTestResult.h" +#include "IconDatabase.h" #include <libintl.h> #include "Logging.h" #include "PageCache.h" @@ -37,8 +38,11 @@ #include "ResourceHandle.h" #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" +#include "ResourceResponse.h" #include <runtime/InitializeThreading.h> #include "SecurityOrigin.h" +#include <stdlib.h> +#include "webkitnetworkresponse.h" #if ENABLE(DATABASE) #include "DatabaseTracker.h" @@ -112,6 +116,15 @@ WebCore::ResourceRequest core(WebKitNetworkRequest* request) return ResourceRequest(url); } +WebCore::ResourceResponse core(WebKitNetworkResponse* response) +{ + SoupMessage* soupMessage = webkit_network_response_get_message(response); + if (soupMessage) + return ResourceResponse(soupMessage); + + return ResourceResponse(); +} + WebCore::EditingBehavior core(WebKitEditingBehavior type) { return (WebCore::EditingBehavior)type; @@ -153,6 +166,12 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result) NULL)); } +PasteboardHelperGtk* pasteboardHelperInstance() +{ + static PasteboardHelperGtk* helper = new PasteboardHelperGtk(); + return helper; +} + } /** end namespace WebKit */ namespace WTF { @@ -208,6 +227,11 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes return NULL; } +static void closeIconDatabaseOnExit() +{ + iconDatabase()->close(); +} + void webkit_init() { static bool isInitialized = false; @@ -237,7 +261,14 @@ void webkit_init() PageGroup::setShouldTrackVisitedLinks(true); - Pasteboard::generalPasteboard()->setHelper(new WebKit::PasteboardHelperGtk()); + Pasteboard::generalPasteboard()->setHelper(WebKit::pasteboardHelperInstance()); + + iconDatabase()->setEnabled(true); + + GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_user_data_dir(), "webkit", "icondatabase", NULL)); + iconDatabase()->open(iconDatabasePath.get()); + + atexit(closeIconDatabaseOnExit); SoupSession* session = webkit_get_default_session(); diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 088175f..e17e79e 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -70,6 +70,7 @@ class DownloadClient; namespace WebKit { class DocumentLoader; + class PasteboardHelperGtk; WebKitWebView* getViewFromFrame(WebKitWebFrame*); @@ -97,6 +98,8 @@ namespace WebKit { WebCore::SecurityOrigin* core(WebKitSecurityOrigin*); WebKitHitTestResult* kit(const WebCore::HitTestResult&); + + WebKit::PasteboardHelperGtk* pasteboardHelperInstance(); } typedef struct { @@ -129,9 +132,6 @@ extern "C" { bool editable; GtkIMContext* imContext; - GtkTargetList* copy_target_list; - GtkTargetList* paste_target_list; - gboolean transparent; GtkAdjustment* horizontalAdjustment; @@ -142,6 +142,8 @@ extern "C" { char* encoding; char* customEncoding; + char* iconURI; + gboolean disposing; gboolean usePrimaryForPaste; @@ -301,6 +303,9 @@ extern "C" { WEBKIT_API bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element); + WEBKIT_API bool + webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId); + WEBKIT_API unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame); diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp index 843f923..64fdc40 100644 --- a/WebKit/gtk/webkit/webkitwebframe.cpp +++ b/WebKit/gtk/webkit/webkitwebframe.cpp @@ -54,6 +54,7 @@ #include "JSDOMBinding.h" #include "ScriptController.h" #include "SubstituteData.h" +#include "SVGSMILElement.h" #include <atk/atk.h> #include <JavaScriptCore/APICast.h> @@ -794,7 +795,7 @@ gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame) if (view && view->layoutPending()) view->layout(); - String string = externalRepresentation(coreFrame->contentRenderer()); + String string = externalRepresentation(coreFrame); return g_strdup(string.utf8().data()); } @@ -959,6 +960,22 @@ bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, return core(frame)->animation()->pauseTransitionAtTime(coreElement->renderer(), AtomicString(name), time); } +bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId) +{ + ASSERT(core(frame)); + 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; +#endif +} + unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame) { Frame* coreFrame = core(frame); @@ -1124,3 +1141,29 @@ void webkit_web_frame_layout(WebKitWebFrame* frame) view->layout(); } + +/** + * webkit_web_frame_get_network_response: + * @frame: a #WebKitWebFrame + * + * Returns a #WebKitNetworkResponse object representing the response + * that was given to the request for the given frame, or NULL if the + * frame was not created by a load. You must unref the object when you + * are done with it. + * + * Return value: a #WebKitNetworkResponse object + * + * Since: 1.1.18 + */ +WebKitNetworkResponse* webkit_web_frame_get_network_response(WebKitWebFrame* frame) +{ + Frame* coreFrame = core(frame); + if (!coreFrame) + return NULL; + + WebCore::DocumentLoader* loader = coreFrame->loader()->activeDocumentLoader(); + if (!loader) + return NULL; + + return webkit_network_response_new_with_core_response(loader->response()); +} diff --git a/WebKit/gtk/webkit/webkitwebframe.h b/WebKit/gtk/webkit/webkitwebframe.h index 7a95545..28d7113 100644 --- a/WebKit/gtk/webkit/webkitwebframe.h +++ b/WebKit/gtk/webkit/webkitwebframe.h @@ -172,6 +172,9 @@ webkit_web_frame_get_provisional_data_source (WebKitWebFrame *frame); WEBKIT_API WebKitSecurityOrigin* webkit_web_frame_get_security_origin (WebKitWebFrame *frame); +WEBKIT_API WebKitNetworkResponse* +webkit_web_frame_get_network_response (WebKitWebFrame *frame); + G_END_DECLS #endif diff --git a/WebKit/gtk/webkit/webkitwebinspector.cpp b/WebKit/gtk/webkit/webkitwebinspector.cpp index ee2815c..2feb064 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.cpp +++ b/WebKit/gtk/webkit/webkitwebinspector.cpp @@ -83,7 +83,8 @@ enum { PROP_WEB_VIEW, PROP_INSPECTED_URI, - PROP_JAVASCRIPT_PROFILING_ENABLED + PROP_JAVASCRIPT_PROFILING_ENABLED, + PROP_TIMELINE_PROFILING_ENABLED }; G_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT) @@ -300,6 +301,22 @@ static void webkit_web_inspector_class_init(WebKitWebInspectorClass* klass) FALSE, WEBKIT_PARAM_READWRITE)); + /** + * WebKitWebInspector:timeline-profiling-enabled + * + * This is enabling Timeline profiling in the Inspector. + * + * Since: 1.1.17 + */ + g_object_class_install_property(gobject_class, + PROP_TIMELINE_PROFILING_ENABLED, + g_param_spec_boolean( + "timeline-profiling-enabled", + _("Enable Timeline profiling"), + _("Profile the WebCore instrumentation."), + FALSE, + WEBKIT_PARAM_READWRITE)); + g_type_class_add_private(klass, sizeof(WebKitWebInspectorPrivate)); } @@ -329,12 +346,25 @@ static void webkit_web_inspector_set_property(GObject* object, guint prop_id, co switch(prop_id) { case PROP_JAVASCRIPT_PROFILING_ENABLED: { +#if ENABLE(JAVASCRIPT_DEBUGGER) bool enabled = g_value_get_boolean(value); WebCore::InspectorController* controller = priv->page->inspectorController(); if (enabled) controller->enableProfiler(); else controller->disableProfiler(); +#else + g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n"); +#endif + break; + } + case PROP_TIMELINE_PROFILING_ENABLED: { + bool enabled = g_value_get_boolean(value); + WebCore::InspectorController* controller = priv->page->inspectorController(); + if (enabled) + controller->startTimelineProfiler(); + else + controller->stopTimelineProfiler(); break; } default: @@ -356,7 +386,14 @@ static void webkit_web_inspector_get_property(GObject* object, guint prop_id, GV g_value_set_string(value, priv->inspected_uri); break; case PROP_JAVASCRIPT_PROFILING_ENABLED: +#if ENABLE(JAVASCRIPT_DEBUGGER) g_value_set_boolean(value, priv->page->inspectorController()->profilerEnabled()); +#else + g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n"); +#endif + break; + case PROP_TIMELINE_PROFILING_ENABLED: + g_value_set_boolean(value, priv->page->inspectorController()->timelineAgent() != 0); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -437,6 +474,29 @@ webkit_web_inspector_set_inspector_client(WebKitWebInspector* web_inspector, Web } /** + * webkit_web_inspector_show: + * @web_inspector: the #WebKitWebInspector that will be shown + * + * Causes the Web Inspector to be shown. + * + * Since: 1.1.17 + */ +void webkit_web_inspector_show(WebKitWebInspector* webInspector) +{ + g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector)); + + WebKitWebInspectorPrivate* priv = webInspector->priv; + + Frame* frame = priv->page->focusController()->focusedOrMainFrame(); + FrameView* view = frame->view(); + + if (!view) + return; + + priv->page->inspectorController()->show(); +} + +/** * webkit_web_inspector_inspect_coordinates: * @web_inspector: the #WebKitWebInspector that will do the inspection * @x: the X coordinate of the node to be inspected diff --git a/WebKit/gtk/webkit/webkitwebinspector.h b/WebKit/gtk/webkit/webkitwebinspector.h index 94fd806..bde4854 100644 --- a/WebKit/gtk/webkit/webkitwebinspector.h +++ b/WebKit/gtk/webkit/webkitwebinspector.h @@ -64,8 +64,10 @@ WEBKIT_API void webkit_web_inspector_inspect_coordinates(WebKitWebInspector* web_inspector, gdouble x, gdouble y); WEBKIT_API void -webkit_web_inspector_close(WebKitWebInspector* webInspector); +webkit_web_inspector_show(WebKitWebInspector* webInspector); +WEBKIT_API void +webkit_web_inspector_close(WebKitWebInspector* webInspector); G_END_DECLS #endif /* webkitwebinspector_h */ diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp index 89c5233..143ae06 100644 --- a/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -96,8 +96,8 @@ struct _WebKitWebSettingsPrivate { gboolean enable_offline_web_application_cache; WebKitEditingBehavior editing_behavior; gboolean enable_universal_access_from_file_uris; - gboolean enable_web_sockets; gboolean enable_dom_paste; + gboolean tab_key_cycles_through_elements; }; #define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate)) @@ -138,8 +138,8 @@ enum { PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE, PROP_EDITING_BEHAVIOR, PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS, - PROP_ENABLE_WEB_SOCKETS, - PROP_ENABLE_DOM_PASTE + PROP_ENABLE_DOM_PASTE, + PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS }; // Create a default user agent string @@ -652,24 +652,6 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) flags)); /** - * WebKitWebSettings:enable-web-sockets - * - * Whether to enable support for Web Sockets. - * - * Implementation of Web Sockets is currently considered experimental. - * Name of this property and the behavior could change in the future. - * - * Since: 1.1.16 - */ - g_object_class_install_property(gobject_class, - PROP_ENABLE_WEB_SOCKETS, - g_param_spec_boolean("enable-web-sockets", - _("Enable Web Sockets"), - _("Whether to enable Web Sockets"), - FALSE, - flags)); - - /** * WebKitWebSettings:enable-dom-paste * * Whether to enable DOM paste. If set to %TRUE, document.execCommand("Paste") @@ -684,6 +666,25 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) _("Whether to enable DOM paste"), FALSE, flags)); + /** + * WebKitWebSettings:tab-key-cycles-through-elements: + * + * Whether the tab key cycles through elements on the page. + * + * If @flag is %TRUE, pressing the tab key will focus the next element in + * the @web_view. If @flag is %FALSE, the @web_view will interpret tab + * key presses as normal key presses. If the selected element is editable, the + * tab key will cause the insertion of a tab character. + * + * Since: 1.1.17 + */ + g_object_class_install_property(gobject_class, + PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS, + g_param_spec_boolean("tab-key-cycles-through-elements", + _("Tab key cycles through elements"), + _("Whether the tab key cycles through elements on the page."), + TRUE, + flags)); g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate)); } @@ -878,12 +879,12 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con case PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS: priv->enable_universal_access_from_file_uris = g_value_get_boolean(value); break; - case PROP_ENABLE_WEB_SOCKETS: - priv->enable_web_sockets = g_value_get_boolean(value); - break; case PROP_ENABLE_DOM_PASTE: 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); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -995,12 +996,12 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa case PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS: g_value_set_boolean(value, priv->enable_universal_access_from_file_uris); break; - case PROP_ENABLE_WEB_SOCKETS: - g_value_set_boolean(value, priv->enable_web_sockets); - break; case PROP_ENABLE_DOM_PASTE: g_value_set_boolean(value, priv->enable_dom_paste); break; + case PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS: + g_value_set_boolean(value, priv->tab_key_cycles_through_elements); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -1065,7 +1066,6 @@ WebKitWebSettings* webkit_web_settings_copy(WebKitWebSettings* web_settings) "enable-offline-web-application-cache", priv->enable_offline_web_application_cache, "editing-behavior", priv->editing_behavior, "enable-universal-access-from-file-uris", priv->enable_universal_access_from_file_uris, - "enable-web-sockets", priv->enable_web_sockets, "enable-dom-paste", priv->enable_dom_paste, NULL)); diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 9f668f4..bebd01a 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -59,11 +59,14 @@ #include "HitTestResult.h" #include <glib/gi18n-lib.h> #include "GraphicsContext.h" +#include "IconDatabase.h" #include "InspectorClientGtk.h" #include "FrameLoader.h" #include "FrameView.h" #include "MouseEventWithHitTestResults.h" +#include "Pasteboard.h" #include "PasteboardHelper.h" +#include "PasteboardHelperGtk.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "ProgressTracker.h" @@ -71,7 +74,7 @@ #include "RenderView.h" #include "ScriptValue.h" #include "Scrollbar.h" -#include <wtf/GOwnPtr.h> +#include <wtf/gtk/GOwnPtr.h> #include <gdk/gdkkeysyms.h> @@ -131,7 +134,7 @@ enum { HOVERING_OVER_LINK, POPULATE_POPUP, STATUS_BAR_TEXT_CHANGED, - ICOND_LOADED, + ICON_LOADED, SELECTION_CHANGED, CONSOLE_MESSAGE, SCRIPT_ALERT, @@ -170,7 +173,8 @@ enum { PROP_LOAD_STATUS, PROP_PROGRESS, PROP_ENCODING, - PROP_CUSTOM_ENCODING + PROP_CUSTOM_ENCODING, + PROP_ICON_URI }; static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, }; @@ -352,6 +356,9 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* case PROP_PROGRESS: g_value_set_double(value, webkit_web_view_get_progress(webView)); break; + case PROP_ICON_URI: + g_value_set_string(value, webkit_web_view_get_icon_uri(webView)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } @@ -865,7 +872,7 @@ static gboolean webkit_web_view_real_script_prompt(WebKitWebView* webView, WebKi static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, const gchar* message, unsigned int line, const gchar* sourceId) { - g_print("console message: %s @%d: %s\n", sourceId, line, message); + g_message("console message: %s @%d: %s\n", sourceId, line, message); return TRUE; } @@ -1001,12 +1008,6 @@ static void webkit_web_view_dispose(GObject* object) g_object_unref(priv->imContext); priv->imContext = NULL; - - gtk_target_list_unref(priv->copy_target_list); - priv->copy_target_list = NULL; - - gtk_target_list_unref(priv->paste_target_list); - priv->paste_target_list = NULL; } if (priv->mainResource) { @@ -1030,6 +1031,7 @@ static void webkit_web_view_finalize(GObject* object) g_free(priv->mainResourceIdentifier); g_free(priv->encoding); g_free(priv->customEncoding); + g_free(priv->iconURI); G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object); } @@ -1456,11 +1458,14 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * Decide whether or not to display the given MIME type. If this * signal is not handled, the default behavior is to show the * content of the requested URI if WebKit can show this MIME - * type; if WebKit is not able to show the MIME type nothing - * happens. + * type and the content disposition is not a download; if WebKit + * is not able to show the MIME type nothing happens. * * Notice that if you return TRUE, meaning that you handled the - * signal, you are expected to have decided what to do, by calling + * signal, you are expected to be aware of the "Content-Disposition" + * header. A value of "attachment" usually indicates a download + * regardless of the MIME type, see also + * soup_message_headers_get_content_disposition(). And you must call * webkit_web_policy_decision_ignore(), * webkit_web_policy_decision_use(), or * webkit_web_policy_decision_download() on the @policy_decision @@ -1730,14 +1735,24 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_NONE, 1, G_TYPE_STRING); - webkit_web_view_signals[ICOND_LOADED] = g_signal_new("icon-loaded", + /** + * WebKitWebView::icon-loaded: + * @web_view: the object on which the signal is emitted + * @icon_uri: the URI for the icon + * + * This signal is emitted when the main frame has got a favicon. + * + * Since: 1.1.18 + */ + webkit_web_view_signals[ICON_LOADED] = g_signal_new("icon-loaded", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed", G_TYPE_FROM_CLASS(webViewClass), @@ -2378,6 +2393,20 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) 0.0, 1.0, 1.0, WEBKIT_PARAM_READABLE)); + /** + * WebKitWebView:icon-uri: + * + * The URI for the favicon for the #WebKitWebView. + * + * Since: 1.1.18 + */ + g_object_class_install_property(objectClass, PROP_ICON_URI, + g_param_spec_string("icon-uri", + _("Icon URI"), + _("The URI for the favicon for the #WebKitWebView."), + NULL, + WEBKIT_PARAM_READABLE)); + g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); } @@ -2392,7 +2421,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas, enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage, enableXSSAuditor, javascriptCanOpenWindows, enableOfflineWebAppCache, - enableUniversalAccessFromFileURI, enableDOMPaste; + enableUniversalAccessFromFileURI, enableDOMPaste, tabKeyCyclesThroughElements; WebKitEditingBehavior editingBehavior; @@ -2422,6 +2451,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) "editing-behavior", &editingBehavior, "enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI, "enable-dom-paste", &enableDOMPaste, + "tab-key-cycles-through-elements", &tabKeyCyclesThroughElements, NULL); settings->setDefaultTextEncodingName(defaultEncoding); @@ -2450,6 +2480,10 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI); settings->setDOMPasteAllowed(enableDOMPaste); + Page* page = core(webView); + if (page) + page->setTabKeyCyclesThroughElements(tabKeyCyclesThroughElements); + g_free(defaultEncoding); g_free(cursiveFontFamily); g_free(defaultFontFamily); @@ -2537,6 +2571,11 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value)); else if (name == g_intern_string("enable-dom-paste")) settings->setDOMPasteAllowed(g_value_get_boolean(&value)); + else if (name == g_intern_string("tab-key-cycles-through-elements")) { + Page* page = core(webView); + if (page) + page->setTabKeyCyclesThroughElements(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); @@ -2572,17 +2611,6 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->zoomFullContent = FALSE; - GdkAtom textHtml = gdk_atom_intern_static_string("text/html"); - /* Targets for copy */ - priv->copy_target_list = gtk_target_list_new(NULL, 0); - gtk_target_list_add(priv->copy_target_list, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML); - gtk_target_list_add_text_targets(priv->copy_target_list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT); - - /* Targets for pasting */ - priv->paste_target_list = gtk_target_list_new(NULL, 0); - gtk_target_list_add(priv->paste_target_list, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML); - gtk_target_list_add_text_targets(priv->paste_target_list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT); - priv->webSettings = webkit_web_settings_new(); webkit_web_view_update_settings(webView); g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView); @@ -3386,10 +3414,7 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag) **/ GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->copy_target_list; + return pasteboardHelperInstance()->targetList(); } /** @@ -3406,10 +3431,7 @@ GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView) **/ GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView) { - g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); - - WebKitWebViewPrivate* priv = webView->priv; - return priv->paste_target_list; + return pasteboardHelperInstance()->targetList(); } /** @@ -3973,3 +3995,27 @@ WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, return kit(mev.hitTestResult()); } + +/** + * webkit_web_view_get_icon_uri: + * @web_view: the #WebKitWebView object + * + * Obtains the URI for the favicon for the given #WebKitWebView, or + * %NULL if there is none. + * + * Return value: the URI for the favicon, or %NULL + * + * Since: 1.1.18 + */ +G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL); + + Page* corePage = core(webView); + String iconURL = iconDatabase()->iconURLForPageURL(corePage->mainFrame()->loader()->url().prettyURL()); + + WebKitWebViewPrivate* priv = webView->priv; + g_free(priv->iconURI); + priv->iconURI = g_strdup(iconURL.utf8().data()); + return priv->iconURI; +} diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h index 1297695..8dd7f39 100644 --- a/WebKit/gtk/webkit/webkitwebview.h +++ b/WebKit/gtk/webkit/webkitwebview.h @@ -366,6 +366,10 @@ webkit_web_view_get_view_source_mode (WebKitWebView *web_view) WEBKIT_API WebKitHitTestResult* webkit_web_view_get_hit_test_result (WebKitWebView *webView, GdkEventButton *event); + +WEBKIT_API G_CONST_RETURN gchar * +webkit_web_view_get_icon_uri (WebKitWebView *webView); + G_END_DECLS #endif |