[ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
authork.czech@samsung.com <k.czech@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Feb 2014 09:16:54 +0000 (09:16 +0000)
committerk.czech@samsung.com <k.czech@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Feb 2014 09:16:54 +0000 (09:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127908

Reviewed by Chris Fleizach.

Source/WebCore:

Based on w3c, aria-controls could be exposed through ATK_RELATION_CONTROLLER_FOR.

Test: accessibility/aria-controls.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::supportsARIAControls):
(WebCore::AccessibilityObject::ariaControlsElements):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::supportsARIAFlowTo):
(WebCore::AccessibilityRenderObject::supportsARIAControls):
(WebCore::AccessibilityRenderObject::ariaControlsElements):
* accessibility/AccessibilityRenderObject.h:
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(setAtkRelationSetFromCoreObject):

Tools:

Updated AccessibilityUIElement both in WKTR and DRT so that aria-controls support could be tested properly.
Added empty stubs to not break mac builds.

* DumpRenderTree/AccessibilityUIElement.cpp:
(ariaControlsElementAtIndexCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(accessibilityElementAtIndex):
(AccessibilityUIElement::disclosedRowAtIndex):
(AccessibilityUIElement::ariaOwnsElementAtIndex):
(AccessibilityUIElement::ariaFlowToElementAtIndex):
(AccessibilityUIElement::ariaControlsElementAtIndex):
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::ariaControlsElementAtIndex):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::ariaControlsElementAtIndex):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::ariaControlsElementAtIndex):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::accessibilityElementAtIndex):
(WTR::AccessibilityUIElement::linkedUIElementAtIndex):
(WTR::AccessibilityUIElement::ariaOwnsElementAtIndex):
(WTR::AccessibilityUIElement::ariaFlowToElementAtIndex):
(WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::ariaControlsElementAtIndex):

LayoutTests:

Tests whether aria-controls returns correct element at the given index.

* accessibility/aria-controls-expected.txt: Added.
* accessibility/aria-controls.html: Added.
* platform/mac/TestExpectations: Skipped it, missing implementation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/aria-controls-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/aria-controls.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Tools/ChangeLog
Tools/DumpRenderTree/AccessibilityUIElement.cpp
Tools/DumpRenderTree/AccessibilityUIElement.h
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

index e3011e7..06f254f 100644 (file)
@@ -1,3 +1,16 @@
+2014-02-03  Krzysztof Czech  <k.czech@samsung.com>
+
+        [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
+        https://bugs.webkit.org/show_bug.cgi?id=127908
+
+        Reviewed by Chris Fleizach.
+
+        Tests whether aria-controls returns correct element at the given index.
+
+        * accessibility/aria-controls-expected.txt: Added.
+        * accessibility/aria-controls.html: Added.
+        * platform/mac/TestExpectations: Skipped it, missing implementation.
+
 2014-01-30  Oliver Hunt  <oliver@apple.com>
         Push DOM attributes into the prototype chain
         https://bugs.webkit.org/show_bug.cgi?id=127969
diff --git a/LayoutTests/accessibility/aria-controls-expected.txt b/LayoutTests/accessibility/aria-controls-expected.txt
new file mode 100644 (file)
index 0000000..48d708c
--- /dev/null
@@ -0,0 +1,13 @@
+Panel 1
+Panel 2
+This tests that aria-controls returns correct element at the given index
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS tab1.ariaControlsElementAtIndex(0).stringValue is 'AXValue: Panel 1'
+PASS tab1.ariaControlsElementAtIndex(1).stringValue is 'AXValue: Panel 2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/aria-controls.html b/LayoutTests/accessibility/aria-controls.html
new file mode 100644 (file)
index 0000000..ee44dd3
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<ul id="tablist" role="tablist">
+<li id="tab1" role="tab" aria-controls="panel1 panel2"></li>
+</ul>
+
+<div id="panel1">Panel 1</div>
+<div id="panel2">Panel 2</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that aria-controls returns correct element at the given index");
+
+    if (window.accessibilityController) {
+        var tablist = accessibilityController.accessibleElementById("tablist");
+        var tab1 = tablist.childAtIndex(0);
+
+        shouldBe("tab1.ariaControlsElementAtIndex(0).stringValue", "'AXValue: Panel 1'");
+        shouldBe("tab1.ariaControlsElementAtIndex(1).stringValue", "'AXValue: Panel 2'");
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index 918f837..6dd15e8 100644 (file)
@@ -50,6 +50,9 @@ accessibility/multiselect-list-reports-active-option.html
 # isIndeterminate is not implemented in mac
 webkit.org/b/125855 accessibility/aria-checked-mixed-value.html [ Skip ]
 
+# ariaControlsElementAtIndex is not implemented in mac
+webkit.org/b/127908 accessibility/aria-controls.html [ Skip ]
+
 # Need to add functionality to DumpRenderTree to handle error pages
 fast/history/back-forward-reset-after-error-handling.html
 
index 9778b69..ef4a1b8 100644 (file)
@@ -1,3 +1,25 @@
+2014-02-03  Krzysztof Czech  <k.czech@samsung.com>
+
+        [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
+        https://bugs.webkit.org/show_bug.cgi?id=127908
+
+        Reviewed by Chris Fleizach.
+
+        Based on w3c, aria-controls could be exposed through ATK_RELATION_CONTROLLER_FOR.
+
+        Test: accessibility/aria-controls.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::supportsARIAControls):
+        (WebCore::AccessibilityObject::ariaControlsElements):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::supportsARIAFlowTo):
+        (WebCore::AccessibilityRenderObject::supportsARIAControls):
+        (WebCore::AccessibilityRenderObject::ariaControlsElements):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (setAtkRelationSetFromCoreObject):
+
 2014-02-03  Andreas Kling  <akling@apple.com>
 
         RenderSVGResource::removeClientFromCache() should take RenderElement&.
index 390ae2f..26e0cc4 100644 (file)
@@ -555,6 +555,8 @@ public:
     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
     virtual bool supportsARIADescribedBy() const { return false; }
     virtual void ariaDescribedByElements(AccessibilityChildrenVector&) const { }
+    virtual bool supportsARIAControls() const { return false; }
+    virtual void ariaControlsElements(AccessibilityChildrenVector&) const { }
     virtual bool ariaHasPopup() const { return false; }
     virtual bool ariaPressedIsPresent() const;
     bool ariaIsMultiline() const;
index b37d025..80c2184 100644 (file)
@@ -1041,6 +1041,16 @@ void AccessibilityRenderObject::ariaDescribedByElements(AccessibilityChildrenVec
     ariaElementsFromAttribute(ariaDescribedBy, aria_describedbyAttr);
 }
 
+bool AccessibilityRenderObject::supportsARIAControls() const
+{
+    return !getAttribute(aria_controlsAttr).isEmpty();
+}
+
+void AccessibilityRenderObject::ariaControlsElements(AccessibilityChildrenVector& ariaControls) const
+{
+    ariaElementsFromAttribute(ariaControls, aria_controlsAttr);
+}
+
 bool AccessibilityRenderObject::supportsARIADropping() const 
 {
     const AtomicString& dropEffect = getAttribute(aria_dropeffectAttr);
index 35ad2d2..cdffa0d 100644 (file)
@@ -182,6 +182,8 @@ public:
     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const override;
     virtual bool supportsARIADescribedBy() const override;
     virtual void ariaDescribedByElements(AccessibilityChildrenVector&) const override;
+    virtual bool supportsARIAControls() const override;
+    virtual void ariaControlsElements(AccessibilityChildrenVector&) const override;
     virtual bool ariaHasPopup() const override;
 
     virtual bool supportsARIADropping() const override;
index ece59cc..b43ecf8 100644 (file)
@@ -254,6 +254,15 @@ static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, Atk
         for (const auto& accessibilityObject : ariaDescribedByElements)
             atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_DESCRIBED_BY, accessibilityObject->wrapper());
     }
+
+    // Check whether object supports aria-controls. It provides information about elements that are controlled by the current object.
+    if (coreObject->supportsARIAControls()) {
+        removeAtkRelationByType(relationSet, ATK_RELATION_CONTROLLER_FOR);
+        AccessibilityObject::AccessibilityChildrenVector ariaControls;
+        coreObject->ariaControlsElements(ariaControls);
+        for (const auto& accessibilityObject : ariaControls)
+            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_CONTROLLER_FOR, accessibilityObject->wrapper());
+    }
 }
 
 static gpointer webkitAccessibleParentClass = 0;
index e563097..3d4c219 100644 (file)
@@ -1,3 +1,42 @@
+2014-02-03  Krzysztof Czech  <k.czech@samsung.com>
+
+        [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
+        https://bugs.webkit.org/show_bug.cgi?id=127908
+
+        Reviewed by Chris Fleizach.
+
+        Updated AccessibilityUIElement both in WKTR and DRT so that aria-controls support could be tested properly.
+        Added empty stubs to not break mac builds.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (ariaControlsElementAtIndexCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+        (accessibilityElementAtIndex):
+        (AccessibilityUIElement::disclosedRowAtIndex):
+        (AccessibilityUIElement::ariaOwnsElementAtIndex):
+        (AccessibilityUIElement::ariaFlowToElementAtIndex):
+        (AccessibilityUIElement::ariaControlsElementAtIndex):
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::ariaControlsElementAtIndex):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::ariaControlsElementAtIndex):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::ariaControlsElementAtIndex):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::accessibilityElementAtIndex):
+        (WTR::AccessibilityUIElement::linkedUIElementAtIndex):
+        (WTR::AccessibilityUIElement::ariaOwnsElementAtIndex):
+        (WTR::AccessibilityUIElement::ariaFlowToElementAtIndex):
+        (WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
+
 2014-02-02  Daniel Bates  <dabates@apple.com>
 
         WebKit Bot Watcher's Dashboard: Access restricted queue should only prompt for HTTP credentials once per page load
index 793b310..97e7a93 100644 (file)
@@ -369,6 +369,15 @@ static JSValueRef ariaFlowToElementAtIndexCallback(JSContextRef context, JSObjec
     return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaFlowToElementAtIndex(indexNumber));
 }
 
+static JSValueRef ariaControlsElementAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int indexNumber = 0;
+    if (argumentCount == 1)
+        indexNumber = JSValueToNumber(context, arguments[0], exception);
+
+    return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->ariaControlsElementAtIndex(indexNumber));
+}
+
 static JSValueRef selectedRowAtIndexCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     int indexNumber = 0;
@@ -1519,6 +1528,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "disclosedRowAtIndex", disclosedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "ariaOwnsElementAtIndex", ariaOwnsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "ariaFlowToElementAtIndex", ariaFlowToElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "ariaControlsElementAtIndex", ariaControlsElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedRowAtIndex", selectedRowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "rowAtIndex", rowAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isEqual", isEqualCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index f1f21b6..61c2131 100644 (file)
@@ -191,6 +191,7 @@ public:
     // ARIA specific
     AccessibilityUIElement ariaOwnsElementAtIndex(unsigned);
     AccessibilityUIElement ariaFlowToElementAtIndex(unsigned);
+    AccessibilityUIElement ariaControlsElementAtIndex(unsigned);
 
     // ARIA Drag and Drop
     bool ariaIsGrabbed() const;
index 41317bd..f64b9f3 100644 (file)
@@ -1330,26 +1330,16 @@ void AccessibilityUIElement::showMenu()
     // FIXME: implement
 }
 
-AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
+AccessibilityUIElement accessibilityElementAtIndex(AtkObject* element, AtkRelationType relationType, unsigned index)
 {
-    return nullptr;
-}
-
-AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
-{
-    return nullptr;
-}
-
-AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
-{
-    if (!ATK_IS_OBJECT(m_element))
+    if (!ATK_IS_OBJECT(element))
         return nullptr;
 
-    AtkRelationSet* relationSet = atk_object_ref_relation_set(ATK_OBJECT(m_element));
+    AtkRelationSet* relationSet = atk_object_ref_relation_set(element);
     if (!relationSet)
         return nullptr;
 
-    AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO);
+    AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, relationType);
     if (!relation)
         return nullptr;
 
@@ -1357,12 +1347,32 @@ AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned
     if (!targetList || !targetList->len || index >= targetList->len)
         return nullptr;
 
+    AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
     g_object_unref(relationSet);
 
-    AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
     return target ? AccessibilityUIElement(target) : nullptr;
 }
 
+AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
+{
+    return nullptr;
+}
+
+AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
+{
+    return nullptr;
+}
+
+AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+{
+    return accessibilityElementAtIndex(m_element, ATK_RELATION_FLOWS_TO, index);
+}
+
+AccessibilityUIElement AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    return accessibilityElementAtIndex(m_element, ATK_RELATION_CONTROLLER_FOR, index);
+}
+
 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
 {
     return nullptr;
index c764ab1..51b8324 100644 (file)
@@ -262,6 +262,11 @@ AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned
     return 0;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     return 0;
index 7bb93ea..4504970 100644 (file)
@@ -342,6 +342,12 @@ AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned
     return nullptr;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    // FIXME: implement
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
index ed17c7b..92ed538 100644 (file)
@@ -690,6 +690,11 @@ AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned
     return 0;
 }
 
+AccessibilityUIElement AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
 {
     return 0;
index f03fd07..9172007 100644 (file)
@@ -187,6 +187,7 @@ public:
     // ARIA specific
     PassRefPtr<AccessibilityUIElement> ariaOwnsElementAtIndex(unsigned);
     PassRefPtr<AccessibilityUIElement> ariaFlowToElementAtIndex(unsigned);
+    PassRefPtr<AccessibilityUIElement> ariaControlsElementAtIndex(unsigned);
 
     // ARIA Drag and Drop
     bool ariaIsGrabbed() const;
index ffb480c..5e5fdf1 100644 (file)
@@ -144,6 +144,7 @@ interface AccessibilityUIElement {
 
     AccessibilityUIElement ariaOwnsElementAtIndex(unsigned long index);
     AccessibilityUIElement ariaFlowToElementAtIndex(unsigned long index);
+    AccessibilityUIElement ariaControlsElementAtIndex(unsigned long index);
 
     // Paramaterized attributes.
     DOMString parameterizedAttributeNames();
index d787dbc..c821cca 100644 (file)
@@ -642,28 +642,16 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::childAtIndex(unsigned
     return nullptr;
 }
 
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
-{
-    // FIXME: implement
-    return nullptr;
-}
-
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
-{
-    // FIXME: implement
-    return nullptr;
-}
-
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+static PassRefPtr<AccessibilityUIElement> accessibilityElementAtIndex(AtkObject* element, AtkRelationType relationType, unsigned index)
 {
-    if (!ATK_IS_OBJECT(m_element.get()))
+    if (!ATK_IS_OBJECT(element))
         return nullptr;
 
-    AtkRelationSet* relationSet = atk_object_ref_relation_set(ATK_OBJECT(m_element.get()));
+    AtkRelationSet* relationSet = atk_object_ref_relation_set(element);
     if (!relationSet)
         return nullptr;
 
-    AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO);
+    AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, relationType);
     if (!relation)
         return nullptr;
 
@@ -671,12 +659,34 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIn
     if (!targetList || !targetList->len || index >= targetList->len)
         return nullptr;
 
+    AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
     g_object_unref(relationSet);
 
-    AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
     return target ? AccessibilityUIElement::create(target) : nullptr;
 }
 
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
+{
+    // FIXME: implement
+    return nullptr;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
+{
+    // FIXME: implement
+    return nullptr;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
+{
+    return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_FLOWS_TO, index);
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_CONTROLLER_FOR, index);
+}
+
 PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     // FIXME: implement
index 897e9bf..b8ecfd9 100644 (file)
@@ -123,6 +123,11 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIn
     return 0;
 }
 
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    return 0;
+}
+
 PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     return 0;
index 1fdfab3..8c9682d 100644 (file)
@@ -404,6 +404,12 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIn
     return nullptr;
 }
 
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
+{
+    // FIXME: implement
+    return nullptr;
+}
+
 PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
 {
     BEGIN_AX_OBJC_EXCEPTIONS