diff options
Diffstat (limited to 'WebKit/gtk')
-rw-r--r-- | WebKit/gtk/ChangeLog | 185 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 7 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/ChromeClientGtk.h | 2 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp | 56 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h | 39 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 13 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h | 5 | ||||
-rw-r--r-- | WebKit/gtk/tests/testatk.c | 120 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.h | 11 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebbackforwardlist.cpp | 42 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 115 |
11 files changed, 558 insertions, 37 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index cde04c9..cd11751 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,188 @@ +2010-10-29 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Change BackForwardList clients to use BackForwardListImpl to prepare for further refactoring + https://bugs.webkit.org/show_bug.cgi?id=48574 + + * webkit/webkitprivate.h: + * webkit/webkitwebbackforwardlist.cpp: + (webkit_web_back_forward_list_dispose): + (webkit_web_back_forward_list_new_with_web_view): + (webkit_web_back_forward_list_go_forward): + (webkit_web_back_forward_list_go_back): + (webkit_web_back_forward_list_contains_item): + (webkit_web_back_forward_list_go_to_item): + (webkit_web_back_forward_list_get_forward_list_with_limit): + (webkit_web_back_forward_list_get_back_list_with_limit): + (webkit_web_back_forward_list_get_back_item): + (webkit_web_back_forward_list_get_current_item): + (webkit_web_back_forward_list_get_forward_item): + (webkit_web_back_forward_list_get_nth_item): + (webkit_web_back_forward_list_get_back_length): + (webkit_web_back_forward_list_get_forward_length): + (webkit_web_back_forward_list_get_limit): + (webkit_web_back_forward_list_set_limit): + (webkit_web_back_forward_list_add_item): + (webkit_web_back_forward_list_clear): + (WebKit::core): + * webkit/webkitwebview.cpp: + (webkit_web_view_set_maintains_back_forward_list): + (webkit_web_view_get_back_forward_list): + Use BackForwardListImpl. + +2010-10-29 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48576 + Let WebKit2 client know when a frame is a frameset + + Added a blank implementation of the new FrameLoaderClient method. + + * WebCoreSupport/FrameLoaderClientGtk.h: + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidBecomeFrameset): + +2010-10-29 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Add the GtkScrollablePolicy property to the webview + https://bugs.webkit.org/show_bug.cgi?id=48357 + + Added the GtkScrollablePolicy properties to the webview widget, it + is now required for GtkScrollable widgets in GTK+ 3.x. + + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (setHorizontalScrollPolicy): Added. + (setVerticalScrollPolicy): Added. + (getHorizontalScrollPolicy): Added. + (getVerticalScrollPolicy): Added. + (webkit_web_view_get_property): + (webkit_web_view_set_property): + (webkit_web_view_class_init): + +2010-10-28 Sergio Villar Senin <svillar@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] WebKitWebFrame's load-status is not properly notified to the tests + https://bugs.webkit.org/show_bug.cgi?id=48048 + + "frame-created" signal must be issued before loading any data, + that way clients can correctly capture all the loading related + signals for that frame. + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::createFrame): + +2010-10-27 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Martin Robinson. + + getTextAtOffset returns incorrect results if a link includes text and an image + https://bugs.webkit.org/show_bug.cgi?id=47365 + + New test to make sure this bug is actually fixed. + + * tests/testatk.c: + (testWebkitAtkLinksWithInlineImages): New test. + (main): Added new test. + +2010-10-26 Antonio Gomes <agomes@rim.com> + + Reviewed by Martin Robinson. + + [GTK] Implement DumpRenderTreeSupportGtk (similarly to DumpRenderTreeSupportQt idea) + https://bugs.webkit.org/show_bug.cgi?id=48199 + + Implemented an initial version of the DumpRenderTreeSupportGtk class. + The main idea is that it groups together the bodies of many LayoutTestController + methods, so they can directly access WebCore features. This way we eliminate the + need of adding APIs to WebKitGTK just to expand its test coverage through DRT. + + The DumpRenderTreeSupportGtk class so far includes a getter and setter for the WebKitTabToLinksPreferenceKey + property as a sample implementation. Also it makes it possible to unskip fast/events/tab-focus-anchor.html and + to fix stderr messages from all 22 spatial-navigation tests in fast/events/spatial-navigation. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::tabsToLinks): + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: Added. + (DumpRenderTreeSupportGtk::DumpRenderTreeSupportGtk): + (DumpRenderTreeSupportGtk::~DumpRenderTreeSupportGtk): + (DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled): + (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled): Getter to the WebKitTabToLinksPreferenceKey property. + (DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain): Setter to the WebKitTabToLinksPreferenceKey property. + (DumpRenderTreeSupportGtk::linksIncludedInFocusChain): + * WebCoreSupport/DumpRenderTreeSupportGtk.h: Added. + +2010-10-26 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Resource tracking failure when trying to move a frame between documents + https://bugs.webkit.org/show_bug.cgi?id=44713 + + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::transferLoadingResourceFromPage): + Empty method. + * WebCoreSupport/FrameLoaderClientGtk.h: + +2010-10-26 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [Gtk] Layout tables should indicate that they are not data tables via an object attribute + https://bugs.webkit.org/show_bug.cgi?id=35422 + + New unit test to check the 'layout-guess' attribute in tables. + + * tests/testatk.c: + (atkAttributeSetAttributeNameHasValue): New, looks for a attribute + with a specific value, by the name of attribute. + (atkAttributeSetContainsAttributeName): New, just checks whether + an attribute with a specified name is present in the set. + (atkAttributeSetAttributeHasValue): Modified to relay on the new + function atkAttributeSetAttributeNameHasValue(). + (testWebkitAtkLayoutAndDataTables): New test. + (main): Added the new test. + +2010-10-26 Xan Lopez <xlopez@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Port to new GtkScrollable interface in GTK+ 3.x + https://bugs.webkit.org/show_bug.cgi?id=48202 + + Use the new GtkScrollable interface when compiling against GTK+ + 3.x. + + * webkit/webkitwebview.cpp: + (setHorizontalAdjustment): + (setVerticalAdjustment): + (getHorizontalAdjustment): + (getVerticalAdjustment): + (webkit_web_view_get_property): + (webkit_web_view_set_property): + (webkit_web_view_class_init): + +2010-10-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 needs to pass the current event modifier flags when requesting a new window + https://bugs.webkit.org/show_bug.cgi?id=48140 + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::createWindow): + * WebCoreSupport/ChromeClientGtk.h: + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchCreatePage): + * WebCoreSupport/FrameLoaderClientGtk.h: + Add NavigationAction parameter. + 2010-10-20 Philippe Normand <pnormand@igalia.com> Reviewed by Xan Lopez. diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 7e4090b..e864ea7 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -25,6 +25,7 @@ #include "ChromeClientGtk.h" #include "Console.h" +#include "DumpRenderTreeSupportGtk.h" #include "FileSystem.h" #include "FileChooser.h" #include "FloatRect.h" @@ -35,6 +36,7 @@ #include "HitTestResult.h" #include "Icon.h" #include "KURL.h" +#include "NavigationAction.h" #include "PlatformString.h" #include "PopupMenuClient.h" #include "PopupMenuGtk.h" @@ -137,7 +139,7 @@ void ChromeClient::unfocus() gtk_window_set_focus(GTK_WINDOW(window), NULL); } -Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& coreFeatures) +Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& coreFeatures, const NavigationAction&) { WebKitWebView* webView = 0; @@ -330,6 +332,9 @@ bool ChromeClient::shouldInterruptJavaScript() bool ChromeClient::tabsToLinks() const { + if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) + return DumpRenderTreeSupportGtk::linksIncludedInFocusChain(); + return true; } diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index 21c4677..b925313 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -56,7 +56,7 @@ namespace WebKit { virtual void focusedNodeChanged(WebCore::Node*); - virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); + virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&); virtual void show(); virtual bool canRunModal(); diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp new file mode 100644 index 0000000..8296206 --- /dev/null +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DumpRenderTreeSupportGtk.h" + +#include "webkitwebview.h" +#include "webkitprivate.h" + +using namespace WebCore; + +bool DumpRenderTreeSupportGtk::s_drtRun = false; +bool DumpRenderTreeSupportGtk::s_linksIncludedInTabChain = true; + +DumpRenderTreeSupportGtk::DumpRenderTreeSupportGtk() +{ +} + +DumpRenderTreeSupportGtk::~DumpRenderTreeSupportGtk() +{ +} + +void DumpRenderTreeSupportGtk::setDumpRenderTreeModeEnabled(bool enabled) +{ + s_drtRun = enabled; +} + +bool DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled() +{ + return s_drtRun; +} +void DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(bool enabled) +{ + s_linksIncludedInTabChain = enabled; +} + +bool DumpRenderTreeSupportGtk::linksIncludedInFocusChain() +{ + return s_linksIncludedInTabChain; +} + diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h new file mode 100644 index 0000000..5b494ff --- /dev/null +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DumpRenderTreeSupportGtk_h +#define DumpRenderTreeSupportGtk_h + +class DumpRenderTreeSupportGtk { + +public: + DumpRenderTreeSupportGtk(); + ~DumpRenderTreeSupportGtk(); + + static void setDumpRenderTreeModeEnabled(bool); + static bool dumpRenderTreeModeEnabled(); + + static void setLinksIncludedInFocusChain(bool); + static bool linksIncludedInFocusChain(); + +private: + static bool s_drtRun; + static bool s_linksIncludedInTabChain; +}; + +#endif diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index fa17632..20aafc2 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -592,13 +592,14 @@ PassRefPtr<Frame> FrameLoaderClient::createFrame(const KURL& url, const String& if (!childFrame->page()) return 0; + g_signal_emit_by_name(webView, "frame-created", kitFrame); + childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); // The frame's onload handler may have removed it from the document. if (!childFrame->tree()->parent()) return 0; - g_signal_emit_by_name(webView, "frame-created", kitFrame); return childFrame.release(); } @@ -619,6 +620,10 @@ void FrameLoaderClient::didTransferChildFrameToNewDocument(WebCore::Page*) ASSERT(core(getViewFromFrame(m_frame)) == coreFrame->page()); } +void FrameLoaderClient::transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*) +{ +} + void FrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) { ASSERT(!m_pluginView); @@ -1200,7 +1205,7 @@ bool FrameLoaderClient::canCachePage() const return true; } -Frame* FrameLoaderClient::dispatchCreatePage() +Frame* FrameLoaderClient::dispatchCreatePage(const NavigationAction&) { WebKitWebView* webView = getViewFromFrame(m_frame); WebKitWebView* newWebView = 0; @@ -1308,6 +1313,10 @@ void FrameLoaderClient::transitionToCommittedForNewPage() postCommitFrameViewSetup(m_frame, frame->view(), true); } +void FrameLoaderClient::dispatchDidBecomeFrameset(bool) +{ +} + PassRefPtr<FrameNetworkingContext> FrameLoaderClient::createNetworkingContext() { return FrameNetworkingContextGtk::create(core(m_frame)); diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 206e780..ffb3c56 100644 --- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -91,7 +91,7 @@ namespace WebKit { virtual void dispatchDidFirstLayout(); virtual void dispatchDidFirstVisuallyNonEmptyLayout(); - virtual WebCore::Frame* dispatchCreatePage(); + virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WTF::String& MIMEType, const WebCore::ResourceRequest&); @@ -115,6 +115,7 @@ namespace WebKit { virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual void didTransferChildFrameToNewDocument(WebCore::Page*); + virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WTF::String>&, const WTF::Vector<WTF::String>&, const WTF::String&, bool); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues); @@ -180,6 +181,8 @@ namespace WebKit { virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); + virtual void dispatchDidBecomeFrameset(bool); + virtual bool canCachePage() const; virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c index c8df4ef..bd6473a 100644 --- a/WebKit/gtk/tests/testatk.c +++ b/WebKit/gtk/tests/testatk.c @@ -46,6 +46,10 @@ static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo< static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>"; +static const char* layoutAndDataTables = "<html><body><table><tr><th>Odd</th><th>Even</th></tr><tr><td>1</td><td>2</td></tr></table><table><tr><td>foo</td><td>bar</td></tr></table></body></html>"; + +static const char* linksWithInlineImages = "<html><head><style>a.http:before {content: url(no-image.png);}</style><body><p><a class='http' href='foo'>foo</a> bar baz</p><p>foo <a class='http' href='bar'>bar</a> baz</p><p>foo bar <a class='http' href='baz'>baz</a></p></body></html>"; + static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>"; static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p></body></html>"; @@ -596,15 +600,25 @@ static gint compAtkAttributeName(AtkAttribute* a1, AtkAttribute* a2) return g_strcmp0(a1->name, a2->name); } -static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value) +static gboolean atkAttributeSetAttributeNameHasValue(AtkAttributeSet* set, const gchar* attributeName, const gchar* value) { - GSList *element; + GSList* element; AtkAttribute at; - gboolean result; - at.name = (gchar *)atk_text_attribute_get_name(attribute); + at.name = (gchar*)attributeName; element = g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName); - result = element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value); - return result; + return element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value); +} + +static gboolean atkAttributeSetContainsAttributeName(AtkAttributeSet* set, const gchar* attributeName) +{ + AtkAttribute at; + at.name = (gchar*)attributeName; + return g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName) ? true : false; +} + +static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value) +{ + return atkAttributeSetAttributeNameHasValue(set, atk_text_attribute_get_name(attribute), value); } static gboolean atkAttributeSetAreEqual(AtkAttributeSet* set1, AtkAttributeSet* set2) @@ -964,6 +978,98 @@ static void testWebkitAtkGetExtents(void) g_object_unref(webView); } +static void testWebkitAtkLayoutAndDataTables(void) +{ + WebKitWebView* 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, layoutAndDataTables, 0, 0, 0); + + // Manually spin the main context to get the accessible objects + while (g_main_context_pending(0)) + g_main_context_iteration(0, TRUE); + + AtkObject* obj = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(obj); + + // Check the non-layout table (data table) + + AtkObject* table1 = atk_object_ref_accessible_child(obj, 0); + g_assert(ATK_IS_TABLE(table1)); + AtkAttributeSet* set1 = atk_object_get_attributes(table1); + g_assert(set1); + g_assert(!atkAttributeSetContainsAttributeName(set1, "layout-guess")); + atk_attribute_set_free(set1); + + // Check the layout table + + AtkObject* table2 = atk_object_ref_accessible_child(obj, 1); + g_assert(ATK_IS_TABLE(table2)); + AtkAttributeSet* set2 = atk_object_get_attributes(table2); + g_assert(set2); + g_assert(atkAttributeSetContainsAttributeName(set2, "layout-guess")); + g_assert(atkAttributeSetAttributeNameHasValue(set2, "layout-guess", "true")); + atk_attribute_set_free(set2); + + g_object_unref(table1); + g_object_unref(table2); + g_object_unref(webView); +} + +static void testWebkitAtkLinksWithInlineImages(void) +{ + WebKitWebView* 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, linksWithInlineImages, 0, 0, 0); + + // Manually spin the main context to get the accessible objects + while (g_main_context_pending(0)) + g_main_context_iteration(0, TRUE); + + AtkObject* object = gtk_widget_get_accessible(GTK_WIDGET(webView)); + g_assert(object); + + // First paragraph (link at the beginning) + AtkObject* paragraph = atk_object_ref_accessible_child(object, 0); + g_assert(ATK_IS_TEXT(paragraph)); + gint startOffset; + gint endOffset; + gchar* text = atk_text_get_text_at_offset(ATK_TEXT(paragraph), 0, ATK_TEXT_BOUNDARY_LINE_START, &startOffset, &endOffset); + g_assert(text); + g_assert_cmpstr(text, ==, "foo bar baz"); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 11); + g_free(text); + g_object_unref(paragraph); + + // Second paragraph (link in the middle) + paragraph = atk_object_ref_accessible_child(object, 1); + g_assert(ATK_IS_TEXT(paragraph)); + text = atk_text_get_text_at_offset(ATK_TEXT(paragraph), 0, ATK_TEXT_BOUNDARY_LINE_START, &startOffset, &endOffset); + g_assert(text); + g_assert_cmpstr(text, ==, "foo bar baz"); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 11); + g_free(text); + g_object_unref(paragraph); + + // Third paragraph (link at the end) + paragraph = atk_object_ref_accessible_child(object, 2); + g_assert(ATK_IS_TEXT(paragraph)); + text = atk_text_get_text_at_offset(ATK_TEXT(paragraph), 0, ATK_TEXT_BOUNDARY_LINE_START, &startOffset, &endOffset); + g_assert(text); + g_assert_cmpstr(text, ==, "foo bar baz"); + g_assert_cmpint(startOffset, ==, 0); + g_assert_cmpint(endOffset, ==, 11); + g_free(text); + g_object_unref(paragraph); + + g_object_unref(webView); +} + static void testWebkitAtkListsOfItems(void) { WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); @@ -1116,6 +1222,8 @@ int main(int argc, char** argv) g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes); g_test_add_func("/webkit/atk/textSelections", testWekitAtkTextSelections); g_test_add_func("/webkit/atk/getExtents", testWebkitAtkGetExtents); + g_test_add_func("/webkit/atk/layoutAndDataTables", testWebkitAtkLayoutAndDataTables); + g_test_add_func("/webkit/atk/linksWithInlineImages", testWebkitAtkLinksWithInlineImages); g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems); g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications); return g_test_run (); diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 616ee6b..261c437 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -46,7 +46,7 @@ #include <webkit/webkitsecurityorigin.h> #include "ArchiveResource.h" -#include "BackForwardList.h" +#include "BackForwardListImpl.h" #include "DataObjectGtk.h" #include "DragActions.h" #include "Frame.h" @@ -92,7 +92,7 @@ namespace WebKit { WebCore::HistoryItem* core(WebKitWebHistoryItem*); WebKitWebHistoryItem* kit(PassRefPtr<WebCore::HistoryItem>); - WebCore::BackForwardList* core(WebKitWebBackForwardList*); + WebCore::BackForwardListImpl* core(WebKitWebBackForwardList*); WebKitWebNavigationReason kit(WebCore::NavigationType type); WebCore::NavigationType core(WebKitWebNavigationReason reason); @@ -154,6 +154,13 @@ extern "C" { PlatformRefPtr<GtkAdjustment> horizontalAdjustment; PlatformRefPtr<GtkAdjustment> verticalAdjustment; +#ifndef GTK_API_VERSION_2 + // GtkScrollablePolicy needs to be checked when + // driving the scrollable adjustment values + GtkScrollablePolicy horizontalScrollingPolicy; + GtkScrollablePolicy verticalScrollingPolicy; +#endif + gboolean zoomFullContent; WebKitLoadStatus loadStatus; CString encoding; diff --git a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp index 4789de9..c5913fd 100644 --- a/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp +++ b/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp @@ -27,7 +27,7 @@ #include <glib.h> -#include "BackForwardList.h" +#include "BackForwardListImpl.h" #include "HistoryItem.h" /** @@ -53,7 +53,7 @@ using namespace WebKit; struct _WebKitWebBackForwardListPrivate { - WebCore::BackForwardList* backForwardList; + WebCore::BackForwardListImpl* backForwardList; gboolean disposed; }; @@ -64,7 +64,7 @@ G_DEFINE_TYPE(WebKitWebBackForwardList, webkit_web_back_forward_list, G_TYPE_OBJ static void webkit_web_back_forward_list_dispose(GObject* object) { WebKitWebBackForwardList* list = WEBKIT_WEB_BACK_FORWARD_LIST(object); - WebCore::BackForwardList* backForwardList = core(list); + WebCore::BackForwardListImpl* backForwardList = core(list); WebKitWebBackForwardListPrivate* priv = list->priv; if (!priv->disposed) { @@ -115,7 +115,7 @@ WebKitWebBackForwardList* webkit_web_back_forward_list_new_with_web_view(WebKitW webBackForwardList = WEBKIT_WEB_BACK_FORWARD_LIST(g_object_new(WEBKIT_TYPE_WEB_BACK_FORWARD_LIST, NULL)); WebKitWebBackForwardListPrivate* priv = webBackForwardList->priv; - priv->backForwardList = core(webView)->backForwardList(); + priv->backForwardList = static_cast<BackForwardListImpl*>(core(webView)->backForwardList()); priv->backForwardList->setEnabled(TRUE); return webBackForwardList; @@ -131,7 +131,7 @@ void webkit_web_back_forward_list_go_forward(WebKitWebBackForwardList* webBackFo { g_return_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList)); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (backForwardList->enabled()) backForwardList->goForward(); } @@ -146,7 +146,7 @@ void webkit_web_back_forward_list_go_back(WebKitWebBackForwardList* webBackForwa { g_return_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList)); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (backForwardList->enabled()) backForwardList->goBack(); } @@ -169,7 +169,7 @@ gboolean webkit_web_back_forward_list_contains_item(WebKitWebBackForwardList* we g_return_val_if_fail(historyItem != NULL, FALSE); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); return (backForwardList->enabled() ? backForwardList->containsItem(historyItem) : FALSE); } @@ -187,7 +187,7 @@ void webkit_web_back_forward_list_go_to_item(WebKitWebBackForwardList* webBackFo g_return_if_fail(WEBKIT_IS_WEB_HISTORY_ITEM(webHistoryItem)); WebCore::HistoryItem* historyItem = core(webHistoryItem); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (backForwardList->enabled() && historyItem) backForwardList->goToItem(historyItem); @@ -206,7 +206,7 @@ GList* webkit_web_back_forward_list_get_forward_list_with_limit(WebKitWebBackFor { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return NULL; @@ -236,7 +236,7 @@ GList* webkit_web_back_forward_list_get_back_list_with_limit(WebKitWebBackForwar { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return NULL; @@ -265,7 +265,7 @@ WebKitWebHistoryItem* webkit_web_back_forward_list_get_back_item(WebKitWebBackFo { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return NULL; @@ -288,7 +288,7 @@ WebKitWebHistoryItem* webkit_web_back_forward_list_get_current_item(WebKitWebBac { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return NULL; @@ -311,7 +311,7 @@ WebKitWebHistoryItem* webkit_web_back_forward_list_get_forward_item(WebKitWebBac { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return NULL; @@ -333,7 +333,7 @@ WebKitWebHistoryItem* webkit_web_back_forward_list_get_nth_item(WebKitWebBackFor { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList) return NULL; @@ -354,7 +354,7 @@ gint webkit_web_back_forward_list_get_back_length(WebKitWebBackForwardList* webB { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), 0); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return 0; @@ -373,7 +373,7 @@ gint webkit_web_back_forward_list_get_forward_length(WebKitWebBackForwardList* w { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), 0); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return 0; @@ -392,7 +392,7 @@ gint webkit_web_back_forward_list_get_limit(WebKitWebBackForwardList* webBackFor { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), 0); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled()) return 0; @@ -412,7 +412,7 @@ void webkit_web_back_forward_list_set_limit(WebKitWebBackForwardList* webBackFor { g_return_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList)); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (backForwardList) backForwardList->setCapacity(limit); } @@ -435,7 +435,7 @@ void webkit_web_back_forward_list_add_item(WebKitWebBackForwardList *webBackForw g_object_ref(webHistoryItem); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); WebCore::HistoryItem* historyItem = core(webHistoryItem); backForwardList->addItem(historyItem); @@ -454,7 +454,7 @@ void webkit_web_back_forward_list_clear(WebKitWebBackForwardList* webBackForward { g_return_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList)); - WebCore::BackForwardList* backForwardList = core(webBackForwardList); + WebCore::BackForwardListImpl* backForwardList = core(webBackForwardList); if (!backForwardList || !backForwardList->enabled() || !backForwardList->entries().size()) return; @@ -464,7 +464,7 @@ void webkit_web_back_forward_list_clear(WebKitWebBackForwardList* webBackForward backForwardList->setCapacity(capacity); } -WebCore::BackForwardList* WebKit::core(WebKitWebBackForwardList* webBackForwardList) +WebCore::BackForwardListImpl* WebKit::core(WebKitWebBackForwardList* webBackForwardList) { g_return_val_if_fail(WEBKIT_IS_WEB_BACK_FORWARD_LIST(webBackForwardList), NULL); diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index f5d0ef6..a295fce 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -42,7 +42,7 @@ #include "AXObjectCache.h" #include "AbstractDatabase.h" -#include "BackForwardList.h" +#include "BackForwardListImpl.h" #include "Cache.h" #include "ChromeClientGtk.h" #include "ClipboardUtilitiesGtk.h" @@ -196,12 +196,25 @@ enum { PROP_CUSTOM_ENCODING, PROP_ICON_URI, PROP_IM_CONTEXT, +#ifdef GTK_API_VERSION_2 PROP_VIEW_MODE +#else + PROP_VIEW_MODE, + PROP_HADJUSTMENT, + PROP_VADJUSTMENT, + PROP_HSCROLL_POLICY, + PROP_VSCROLL_POLICY +#endif }; static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, }; +#ifdef GTK_API_VERSION_2 G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER) +#else +G_DEFINE_TYPE_WITH_CODE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER, + G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, 0)) +#endif 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); @@ -385,6 +398,65 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event); } +#ifndef GTK_API_VERSION_2 +static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment) +{ + if (!core(webView)) + return; + + webView->priv->horizontalAdjustment = adjustment; + FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); + if (!view) + return; + view->setHorizontalAdjustment(adjustment); +} + +static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment) +{ + if (!core(webView)) + return; + + webView->priv->verticalAdjustment = adjustment; + FrameView* view = core(webkit_web_view_get_main_frame(webView))->view(); + if (!view) + return; + view->setVerticalAdjustment(adjustment); +} + +static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView) +{ + return webView->priv->horizontalAdjustment.get(); +} + +static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView) +{ + return webView->priv->verticalAdjustment.get(); +} + +static void setHorizontalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy) +{ + webView->priv->horizontalScrollingPolicy = policy; + gtk_widget_queue_resize(GTK_WIDGET(webView)); +} + +static void setVerticalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy) +{ + webView->priv->verticalScrollingPolicy = policy; + gtk_widget_queue_resize(GTK_WIDGET(webView)); +} + +static GtkScrollablePolicy getHorizontalScrollPolicy(WebKitWebView* webView) +{ + return webView->priv->horizontalScrollingPolicy; +} + +static GtkScrollablePolicy getVerticalScrollPolicy(WebKitWebView* webView) +{ + return webView->priv->verticalScrollingPolicy; +} + +#endif + static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); @@ -444,6 +516,20 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* case PROP_VIEW_MODE: g_value_set_enum(value, webkit_web_view_get_view_mode(webView)); break; +#ifndef GTK_API_VERSION_2 + case PROP_HADJUSTMENT: + g_value_set_object(value, getHorizontalAdjustment(webView)); + break; + case PROP_VADJUSTMENT: + g_value_set_object(value, getVerticalAdjustment(webView)); + break; + case PROP_HSCROLL_POLICY: + g_value_set_enum(value, getHorizontalScrollPolicy(webView)); + break; + case PROP_VSCROLL_POLICY: + g_value_set_enum(value, getVerticalScrollPolicy(webView)); + break; +#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } @@ -478,6 +564,20 @@ static void webkit_web_view_set_property(GObject* object, guint prop_id, const G case PROP_VIEW_MODE: webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value))); break; +#ifndef GTK_API_VERSION_2 + case PROP_HADJUSTMENT: + setHorizontalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value))); + break; + case PROP_VADJUSTMENT: + setVerticalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value))); + break; + case PROP_HSCROLL_POLICY: + setHorizontalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value))); + break; + case PROP_VSCROLL_POLICY: + setVerticalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value))); + break; +#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } @@ -908,6 +1008,7 @@ static void webkit_web_view_realize(GtkWidget* widget) gtk_im_context_set_client_window(priv->imContext.get(), window); } +#ifdef GTK_API_VERSION_2 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj) { if (!core(webView)) @@ -921,6 +1022,7 @@ static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAd return; view->setGtkAdjustments(hadj, vadj); } +#endif static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget) { @@ -2525,6 +2627,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) /* * make us scrollable (e.g. addable to a GtkScrolledWindow) */ +#ifdef GTK_API_VERSION_2 webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments; GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments", G_TYPE_FROM_CLASS(webViewClass), @@ -2534,6 +2637,12 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) webkit_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); +#else + g_object_class_override_property(objectClass, PROP_HADJUSTMENT, "hadjustment"); + g_object_class_override_property(objectClass, PROP_VADJUSTMENT, "vadjustment"); + g_object_class_override_property(objectClass, PROP_HSCROLL_POLICY, "hscroll-policy"); + g_object_class_override_property(objectClass, PROP_VSCROLL_POLICY, "vscroll-policy"); +#endif /* * Key bindings @@ -3322,7 +3431,7 @@ void webkit_web_view_set_maintains_back_forward_list(WebKitWebView* webView, gbo { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - core(webView)->backForwardList()->setEnabled(flag); + static_cast<BackForwardListImpl*>(core(webView)->backForwardList())->setEnabled(flag); } /** @@ -3337,7 +3446,7 @@ void webkit_web_view_set_maintains_back_forward_list(WebKitWebView* webView, gbo WebKitWebBackForwardList* webkit_web_view_get_back_forward_list(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); - if (!core(webView) || !core(webView)->backForwardList()->enabled()) + if (!core(webView) || !static_cast<BackForwardListImpl*>(core(webView)->backForwardList())->enabled()) return 0; return webView->priv->backForwardList.get(); } |