Commit 46e9b260 authored by mario@webkit.org's avatar mario@webkit.org

[GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set

https://bugs.webkit.org/show_bug.cgi?id=72525

Reviewed by Xan Lopez.

Source/WebCore:

* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(webkit_accessible_get_parent): Call to the implementation of
atk_object_get_parent in AtkObject class to check whether a parent
AtkObject has been previously set, before trying to find one.

Source/WebKit/gtk:

* tests/testatk.c:
(testWebkitAtkSetParentForObject): New unit test to check that
calls to atk_object_get_parent() over a WebKitGTK's accessibility
wrapper object returns its parent AtkObject if previously set.
(main): Added new test.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 70796dd2
2011-11-17 Mario Sanchez Prada <msanchez@igalia.com>
[GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set
https://bugs.webkit.org/show_bug.cgi?id=72525
Reviewed by Xan Lopez.
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(webkit_accessible_get_parent): Call to the implementation of
atk_object_get_parent in AtkObject class to check whether a parent
AtkObject has been previously set, before trying to find one.
2011-11-17 Pavel Feldman <pfeldman@google.com>
Not reviewed: fix IE user agents strings in the inspector.
......@@ -295,6 +295,12 @@ static AtkObject* atkParentOfRootObject(AtkObject* object)
static AtkObject* webkit_accessible_get_parent(AtkObject* object)
{
// Check first if the parent has been already set.
AtkObject* accessibleParent = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->get_parent(object);
if (accessibleParent)
return accessibleParent;
// Parent not set yet, so try to find it in the hierarchy.
AccessibilityObject* coreObject = core(object);
if (!coreObject)
return 0;
......
2011-11-17 Mario Sanchez Prada <msanchez@igalia.com>
[GTK] Consider parent AtkObject in webkit_accessible_get_parent(), if already set
https://bugs.webkit.org/show_bug.cgi?id=72525
Reviewed by Xan Lopez.
* tests/testatk.c:
(testWebkitAtkSetParentForObject): New unit test to check that
calls to atk_object_get_parent() over a WebKitGTK's accessibility
wrapper object returns its parent AtkObject if previously set.
(main): Added new test.
2011-11-17 Mario Sanchez Prada <msanchez@igalia.com>
[GTK] ATK API tests failing because of patch for bug 72390
......
......@@ -1641,6 +1641,44 @@ static void testWebkitAtkParentForRootObject()
g_object_unref(box);
}
static void testWebkitAtkSetParentForObject()
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
GtkAllocation allocation = { 0, 0, 800, 600 };
gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
webkit_web_view_load_string(webView, contents, 0, 0, 0);
/* Put the webview in a window to check the normal behaviour keeps
working as expected when the webview is inside a container. */
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_object_ref_sink(window);
gtk_container_add(GTK_CONTAINER(window), webView);
AtkObject* axRoot = gtk_widget_get_accessible(GTK_WIDGET(webView));
g_assert(ATK_IS_OBJECT(axRoot));
AtkObject* axWindow = gtk_widget_get_accessible(window);
g_assert(ATK_IS_OBJECT(axWindow));
/* The parent of the root object is the window's a11y object. */
g_assert(atk_object_get_parent(axRoot) == axWindow);
/* We now need to use something as a an alternative parent for
the a11y object associated with the root of the DOM tree. */
GtkWidget* button = gtk_button_new();
g_object_ref_sink(button);
AtkObject* axButton = gtk_widget_get_accessible (button);
g_assert(ATK_IS_OBJECT(axButton));
/* Manually set the button's a11y object as the parent and check. */
atk_object_set_parent(axRoot, axButton);
g_assert(atk_object_get_parent(axRoot) == axButton);
g_object_unref(button);
g_object_unref(window);
}
int main(int argc, char** argv)
{
gtk_test_init(&argc, &argv, 0);
......@@ -1669,6 +1707,7 @@ int main(int argc, char** argv)
g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications);
g_test_add_func("/webkit/atk/parentForRootObject", testWebkitAtkParentForRootObject);
g_test_add_func("/webkit/atk/setParentForObject", testWebkitAtkSetParentForObject);
return g_test_run ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment