2011-01-07 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Chris Fleizach.
GTK: AX: atk tests need to be updated after recent changes
https://bugs.webkit.org/show_bug.cgi?id=51932
Make sure we can always get the right accesssible parent for an
AtkObject when traversing the hierarchy bottom up.
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(isRootObject): New function to check whether an
AccessibilityObject is the root one or not, according to the
latest changes in the hierarchy.
(atkParentOfRootObject): Gets the appropriate AtkObject from GTK's
GAIL as the parent of the root AtkObject from WebCore.
(webkit_accessible_get_parent): Use atkParentOfRootObject.
(webkit_accessible_get_index_in_parent): Ditto.
(atkRole): Expose AccessibilityObjects with ScrollAreaRole as
AtkObject's of role ATK_ROLE_SCROLLED_PANE.
2011-01-07 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Chris Fleizach.
GTK: AX: atk tests need to be updated after recent changes
https://bugs.webkit.org/show_bug.cgi?id=51932
Fix gtk_widget_get_accessible() in WebKitWebView to keep returning
the AtkObject of role ATK_ROLE_DOCUMENT_FRAME.
With the change to support WK2 accessibility, the root object of
the AX hierarchy is different from what GTK expects as the current
hirarchy right now includes a new accessible object as the parent
of the accessible web area (AXScrollView).
* webkit/webkitwebview.cpp:
(webkit_web_view_get_accessible): Return the first child of the
wrapper associated to the root accessible object in the document,
to keep everything in the GTK port working as it used to be.
Re-enable skipped ATK unit tests now they are passing again.
* tests/testatk.c:
(main): Re-enable skipped tests.
* tests/testatkroles.c:
(main): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index 5beffd2..7489034 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -234,21 +234,36 @@
static gpointer webkit_accessible_parent_class = 0;
-static AtkObject* atkParentOfWebView(AtkObject* object)
+static bool isRootObject(AccessibilityObject* coreObject)
{
- AccessibilityObject* coreParent = core(object)->parentObjectUnignored();
+ // The root accessible object in WebCore is always an object with
+ // the ScrolledArea role with one child with the WebArea role.
+ if (!coreObject || !coreObject->isScrollView())
+ return false;
- // The top level web view claims to not have a parent. This makes it
+ AccessibilityObject* firstChild = coreObject->firstChild();
+ if (!firstChild || !firstChild->isWebArea())
+ return false;
+
+ return true;
+}
+
+static AtkObject* atkParentOfRootObject(AtkObject* object)
+{
+ AccessibilityObject* coreObject = core(object);
+ AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
+
+ // The top level object claims to not have a parent. This makes it
// impossible for assistive technologies to ascend the accessible
// hierarchy all the way to the application. (Bug 30489)
- if (!coreParent && core(object)->isWebArea()) {
- HostWindow* hostWindow = core(object)->document()->view()->hostWindow();
+ if (!coreParent && isRootObject(coreObject)) {
+ HostWindow* hostWindow = coreObject->document()->view()->hostWindow();
if (hostWindow) {
- PlatformPageClient webView = hostWindow->platformPageClient();
- if (webView) {
- GtkWidget* webViewParent = gtk_widget_get_parent(webView);
- if (webViewParent)
- return gtk_widget_get_accessible(webViewParent);
+ PlatformPageClient scrollView = hostWindow->platformPageClient();
+ if (scrollView) {
+ GtkWidget* scrollViewParent = gtk_widget_get_parent(scrollView);
+ if (scrollViewParent)
+ return gtk_widget_get_accessible(scrollViewParent);
}
}
}
@@ -261,9 +276,10 @@
static AtkObject* webkit_accessible_get_parent(AtkObject* object)
{
- AccessibilityObject* coreParent = core(object)->parentObjectUnignored();
- if (!coreParent && core(object)->isWebArea())
- return atkParentOfWebView(object);
+ AccessibilityObject* coreObject = core(object);
+ AccessibilityObject* coreParent = coreObject->parentObjectUnignored();
+ if (!coreParent && isRootObject(coreObject))
+ return atkParentOfRootObject(object);
if (!coreParent)
return 0;
@@ -300,8 +316,8 @@
AccessibilityObject* coreObject = core(object);
AccessibilityObject* parent = coreObject->parentObjectUnignored();
- if (!parent && core(object)->isWebArea()) {
- AtkObject* atkParent = atkParentOfWebView(object);
+ if (!parent && isRootObject(coreObject)) {
+ AtkObject* atkParent = atkParentOfRootObject(object);
if (!atkParent)
return -1;
@@ -416,6 +432,8 @@
return ATK_ROLE_LIST;
case ScrollBarRole:
return ATK_ROLE_SCROLL_BAR;
+ case ScrollAreaRole:
+ return ATK_ROLE_SCROLL_PANE;
case GridRole: // Is this right?
case TableRole:
return ATK_ROLE_TABLE;