2009-10-20 Joanmarie Diggs <joanmarie.diggs@gmail.com>
Reviewed by Xan Lopez.
https://bugs.webkit.org/show_bug.cgi?id=25411
[GTK] ATK accessible ancestry broken
Work around for the problem of bogus additional objects in the ancestry.
We now set the parent when we ref the child, then ask the Atk child if
it knows its parent. This solves the bulk of the cases. For those it
doesn't, fall back to the existing logic.
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(webkit_accessible_get_parent):
(webkit_accessible_ref_child):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index c33e375..4dfb1c5 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -132,8 +132,16 @@
return returnString(core(object)->accessibilityDescription());
}
+static gpointer webkit_accessible_parent_class = NULL;
+
static AtkObject* webkit_accessible_get_parent(AtkObject* object)
{
+ // To work around bogus additional objects in the ancestry, we set the
+ // parent when we ref the child. If the child knows its parent, use that.
+ AtkObject* parent = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->get_parent(object);
+ if (parent)
+ return parent;
+
AccessibilityObject* coreParent = core(object)->parentObject();
// The top level web view claims to not have a parent. This makes it
@@ -175,8 +183,7 @@
return NULL;
AtkObject* child = coreChild->wrapper();
- // TODO: Should we call atk_object_set_parent() here?
- //atk_object_set_parent(child, object);
+ atk_object_set_parent(child, object);
g_object_ref(child);
return child;
@@ -399,8 +406,6 @@
atk_state_set_add_state(stateSet, ATK_STATE_VISITED);
}
-static gpointer webkit_accessible_parent_class = NULL;
-
static AtkStateSet* webkit_accessible_ref_state_set(AtkObject* object)
{
AtkStateSet* stateSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_state_set(object);