AX: Enable accessibility/aria-controls.html test for mac
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Aug 2015 06:49:45 +0000 (06:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Aug 2015 06:49:45 +0000 (06:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148458

Patch by Nan Wang <n_wang@apple.com> on 2015-08-25
Reviewed by Chris Fleizach.

Source/WebCore:

Re-enabled accessibility/aria-controls.html test for mac.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

Implemented ariaControlsElementAtIndex(unsigned index).

* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::ariaControlsElementAtIndex):
(AccessibilityUIElement::disclosedRowAtIndex):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::ariaControlsElementAtIndex):

LayoutTests:

* accessibility/aria-controls.html:
* platform/mac/TestExpectations:
* platform/mac/accessibility/aria-controls-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-controls.html
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/accessibility/aria-controls-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

index e697b8c..5c85a03 100644 (file)
@@ -1,3 +1,14 @@
+2015-08-25  Nan Wang  <n_wang@apple.com>
+
+        AX: Enable accessibility/aria-controls.html test for mac
+        https://bugs.webkit.org/show_bug.cgi?id=148458
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-controls.html:
+        * platform/mac/TestExpectations:
+        * platform/mac/accessibility/aria-controls-expected.txt: Added.
+
 2015-08-25  Myles C. Maxfield  <mmaxfield@apple.com>
 
         More test gardening of css3/line-break-language-sensitive.
index ee44dd3..3942256 100644 (file)
         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'");
+        if (accessibilityController.platformName == "mac") {
+            shouldBe("tab1.ariaControlsElementAtIndex(0).childAtIndex(0).stringValue", "'AXValue: Panel 1'");
+            shouldBe("tab1.ariaControlsElementAtIndex(1).childAtIndex(0).stringValue", "'AXValue: Panel 2'");
+        } else {
+            shouldBe("tab1.ariaControlsElementAtIndex(0).stringValue", "'AXValue: Panel 1'");
+            shouldBe("tab1.ariaControlsElementAtIndex(1).stringValue", "'AXValue: Panel 2'");
+        }
     }
 
 </script>
index a7223b6..60af5ca 100644 (file)
@@ -47,9 +47,6 @@ accessibility/multiselect-list-reports-active-option.html
 # Missing implementation of some functions in mac.
 webkit.org/b/129039 accessibility/select-element-at-index.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
 
diff --git a/LayoutTests/platform/mac/accessibility/aria-controls-expected.txt b/LayoutTests/platform/mac/accessibility/aria-controls-expected.txt
new file mode 100644 (file)
index 0000000..fb962bf
--- /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).childAtIndex(0).stringValue is 'AXValue: Panel 1'
+PASS tab1.ariaControlsElementAtIndex(1).childAtIndex(0).stringValue is 'AXValue: Panel 2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
index aab5d1e..9c9f79d 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-25  Nan Wang  <n_wang@apple.com>
+
+        AX: Enable accessibility/aria-controls.html test for mac
+        https://bugs.webkit.org/show_bug.cgi?id=148458
+
+        Reviewed by Chris Fleizach.
+
+        Re-enabled accessibility/aria-controls.html test for mac.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2015-08-25  Zalan Bujtas  <zalan@apple.com>
 
         Using the filter functional notation for background images results in wrong background-size rendering
index f915881..daa81b2 100644 (file)
@@ -241,6 +241,10 @@ using namespace HTMLNames;
 #define NSAccessibilityDocumentEncodingAttribute @"AXDocumentEncoding"
 #endif
 
+#ifndef NSAccessibilityAriaControlsAttribute
+#define NSAccessibilityAriaControlsAttribute @"AXARIAControls"
+#endif
+
 #define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
 #define NSAccessibilityDOMClassListAttribute @"AXDOMClassList"
 
@@ -3068,6 +3072,13 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return nil;
     }
     
+    // Aria controls element
+    if ([attributeName isEqualToString:NSAccessibilityAriaControlsAttribute]) {
+        AccessibilityObject::AccessibilityChildrenVector ariaControls;
+        m_object->ariaControlsElements(ariaControls);
+        return convertToNSArray(ariaControls);
+    }
+    
     return nil;
 }
 
index d0c3bc1..a664264 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-25  Nan Wang  <n_wang@apple.com>
+
+        AX: Enable accessibility/aria-controls.html test for mac
+        https://bugs.webkit.org/show_bug.cgi?id=148458
+
+        Reviewed by Chris Fleizach.
+
+        Implemented ariaControlsElementAtIndex(unsigned index).
+
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::ariaControlsElementAtIndex):
+        (AccessibilityUIElement::disclosedRowAtIndex):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::ariaControlsElementAtIndex):
+
 2015-08-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Remove python tests for PassRefPtr 
index a3b16fd..2f80969 100644 (file)
@@ -395,8 +395,13 @@ AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned
 
 AccessibilityUIElement AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
 {
-    // FIXME: implement
-    return 0;
+    BEGIN_AX_OBJC_EXCEPTIONS
+    NSArray* ariaControls = [m_element accessibilityAttributeValue:@"AXARIAControls"];
+    if (index < [ariaControls count])
+        return [ariaControls objectAtIndex:index];
+    END_AX_OBJC_EXCEPTIONS
+    
+    return nullptr;
 }
 
 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
index b74f18f..ed6d695 100644 (file)
@@ -458,7 +458,11 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIn
 
 PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
 {
-    // FIXME: implement
+    BEGIN_AX_OBJC_EXCEPTIONS
+    NSArray* ariaControls = [m_element accessibilityAttributeValue:@"AXARIAControls"];
+    if (index < [ariaControls count])
+        return AccessibilityUIElement::create([ariaControls objectAtIndex:index]);
+    END_AX_OBJC_EXCEPTIONS
     return nullptr;
 }