AX: aria-sort is not exposed on iOS
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Nov 2016 00:03:52 +0000 (00:03 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Nov 2016 00:03:52 +0000 (00:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164245

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed the aria-sort attribute value in accessibilitySortDirection.

Test: accessibility/ios-simulator/aria-sort-ios.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilitySortDirection]):

Tools:

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::stringAttributeValue):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::stringAttributeValue):

LayoutTests:

* accessibility/ios-simulator/aria-sort-ios-expected.txt: Added.
* accessibility/ios-simulator/aria-sort-ios.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/aria-sort-ios.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Tools/ChangeLog
Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

index 516b9cf..e02dbf3 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-31  Nan Wang  <n_wang@apple.com>
+
+        AX: aria-sort is not exposed on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=164245
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/aria-sort-ios-expected.txt: Added.
+        * accessibility/ios-simulator/aria-sort-ios.html: Added.
+
 2016-10-31  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r208178.
diff --git a/LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt b/LayoutTests/accessibility/ios-simulator/aria-sort-ios-expected.txt
new file mode 100644 (file)
index 0000000..9d5e84b
--- /dev/null
@@ -0,0 +1,15 @@
+column column column
+row
+This tests that aria-sort is exposed correctly to the iOS accessibility API.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS col1.stringAttributeValue('AXSortDirection') is 'ascending'
+PASS col2.stringAttributeValue('AXSortDirection') is 'descending'
+PASS col3.stringAttributeValue('AXSortDirection') is 'other'
+PASS row1.stringAttributeValue('AXSortDirection') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/aria-sort-ios.html b/LayoutTests/accessibility/ios-simulator/aria-sort-ios.html
new file mode 100644 (file)
index 0000000..9aaffa6
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<div role="grid">
+<div role="row">
+<span role="gridcell"></span>
+<!-- Ascending aria-sort direction. -->
+<span aria-sort="ascending" aria-label="label" id="col1" role="columnheader">column</span>
+<!-- Descending aria-sort direction. -->
+<span aria-sort="descending" id="col2" role="columnheader">column</span>
+<!-- Other aria-sort direction. -->
+<span aria-sort="other" id="col3" role="columnheader">column</span>
+</div>
+<div role="row">
+<!-- No aria-sort direction. -->
+<span id="row1" role="rowheader">row</span>
+<span role="gridcell"></span>
+</div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that aria-sort is exposed correctly to the iOS accessibility API.");
+    
+    if (window.accessibilityController) {
+        var col1 = accessibilityController.accessibleElementById("col1");
+        shouldBe("col1.stringAttributeValue('AXSortDirection')", "'ascending'");
+        
+        var col2 = accessibilityController.accessibleElementById("col2");
+        shouldBe("col2.stringAttributeValue('AXSortDirection')", "'descending'");
+        
+        var col3 = accessibilityController.accessibleElementById("col3");
+        shouldBe("col3.stringAttributeValue('AXSortDirection')", "'other'");
+        
+        var row1 = accessibilityController.accessibleElementById("row1");
+        shouldBe("row1.stringAttributeValue('AXSortDirection')", "null");
+    }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 74e78c7..7bcf72c 100644 (file)
@@ -1,3 +1,17 @@
+2016-10-31  Nan Wang  <n_wang@apple.com>
+
+        AX: aria-sort is not exposed on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=164245
+
+        Reviewed by Chris Fleizach.
+
+        Exposed the aria-sort attribute value in accessibilitySortDirection.
+
+        Test: accessibility/ios-simulator/aria-sort-ios.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
+
 2016-10-31  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r208178.
index a8586a8..9bcb954 100644 (file)
@@ -2758,6 +2758,24 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     }
 }
 
+- (NSString *)accessibilitySortDirection
+{
+    if (![self _prepareAccessibilityCall])
+        return nil;
+    
+    switch (m_object->sortDirection()) {
+    case SortDirectionAscending:
+        return @"ascending";
+    case SortDirectionDescending:
+        return @"descending";
+    case SortDirectionOther:
+        return @"other";
+    default:
+    case SortDirectionNone:
+        return nil;
+    }
+}
+
 - (WebAccessibilityObjectWrapper *)accessibilityMathRootIndexObject
 {
     if (![self _prepareAccessibilityCall])
index 5107d05..589d533 100644 (file)
@@ -1,3 +1,15 @@
+2016-10-31  Nan Wang  <n_wang@apple.com>
+
+        AX: aria-sort is not exposed on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=164245
+
+        Reviewed by Chris Fleizach.
+
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::stringAttributeValue):
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::stringAttributeValue):
+
 2016-10-31  Simon Fraser  <simon.fraser@apple.com>
 
         Implement IntersectionObserver
index d2ad3e7..954221e 100644 (file)
@@ -97,6 +97,7 @@ AccessibilityUIElement::~AccessibilityUIElement()
 - (id)_accessibilityFieldsetAncestor;
 - (BOOL)_accessibilityHasTouchEventListener;
 - (NSString *)accessibilityExpandedTextValue;
+- (NSString *)accessibilitySortDirection;
 - (BOOL)accessibilityIsExpanded;
 
 // TextMarker related
@@ -660,6 +661,9 @@ JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
     if (JSStringIsEqualToUTF8CString(attribute, "AXExpandedTextValue"))
         return [[m_element accessibilityExpandedTextValue] createJSStringRef];
     
+    if (JSStringIsEqualToUTF8CString(attribute, "AXSortDirection"))
+        return [[m_element accessibilitySortDirection] createJSStringRef];
+    
     return JSStringCreateWithCharacters(0, 0);
 }
 
index 4eb552e..c1b63f4 100644 (file)
@@ -74,6 +74,7 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
 - (id)_accessibilityFieldsetAncestor;
 - (BOOL)_accessibilityHasTouchEventListener;
 - (NSString *)accessibilityExpandedTextValue;
+- (NSString *)accessibilitySortDirection;
 - (BOOL)accessibilityIsExpanded;
 
 // TextMarker related
@@ -346,6 +347,9 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRe
 
     if (JSStringIsEqualToUTF8CString(attribute, "AXExpandedTextValue"))
         return [[m_element accessibilityExpandedTextValue] createJSStringRef];
+    
+    if (JSStringIsEqualToUTF8CString(attribute, "AXSortDirection"))
+        return [[m_element accessibilitySortDirection] createJSStringRef];
 
     return JSStringCreateWithCharacters(0, 0);
 }