AX: Expose table size and cell indexes on iOS
authorn_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 17:46:40 +0000 (17:46 +0000)
committern_wang@apple.com <n_wang@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 17:46:40 +0000 (17:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150366

Source/WebCore:

Add support to expose table row/column count and cell indexes on iOS.

Reviewed by Chris Fleizach.

Test: accessibility/aria-table-attributes.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper tableParent]):
(-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]):
(-[WebAccessibilityObjectWrapper accessibilityRowCount]):
(-[WebAccessibilityObjectWrapper accessibilityColumnCount]):
(-[WebAccessibilityObjectWrapper accessibilityARIARowCount]):
(-[WebAccessibilityObjectWrapper accessibilityARIAColumnCount]):
(-[WebAccessibilityObjectWrapper accessibilityARIARowIndex]):
(-[WebAccessibilityObjectWrapper accessibilityARIAColumnIndex]):
(-[WebAccessibilityObjectWrapper accessibilityRowRange]):

Tools:

Reviewed by Chris Fleizach.

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::rowCount):
(AccessibilityUIElement::columnCount):
(AccessibilityUIElement::indexInTable):
(AccessibilityUIElement::numberAttributeValue):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::numberAttributeValue):
(WTR::AccessibilityUIElement::rowCount):
(WTR::AccessibilityUIElement::columnCount):
(WTR::AccessibilityUIElement::indexInTable):

LayoutTests:

Reviewed by Chris Fleizach.

* accessibility/aria-table-attributes-expected.txt: Added.
* accessibility/aria-table-attributes.html: Added.
* accessibility/mac/aria-table-attributes-expected.txt: Removed.
* accessibility/mac/aria-table-attributes.html: Removed.
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/win/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/accessibility/aria-table-attributes-expected.txt [moved from LayoutTests/accessibility/mac/aria-table-attributes-expected.txt with 95% similarity]
LayoutTests/accessibility/aria-table-attributes.html [moved from LayoutTests/accessibility/mac/aria-table-attributes.html with 95% similarity]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Tools/ChangeLog
Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

index 3a9d0e7..4b4c1af 100644 (file)
@@ -1,3 +1,18 @@
+2015-10-21  Nan Wang  <n_wang@apple.com>
+
+        AX: Expose table size and cell indexes on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=150366
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-table-attributes-expected.txt: Added.
+        * accessibility/aria-table-attributes.html: Added.
+        * accessibility/mac/aria-table-attributes-expected.txt: Removed.
+        * accessibility/mac/aria-table-attributes.html: Removed.
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator/TestExpectations:
+        * platform/win/TestExpectations:
+
 2015-10-21  Chris Dumez  <cdumez@apple.com>
 
         HTMLIFrameElement.sandbox should be a DOMSettableTokenList
@@ -5,6 +5,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 PASS grid.numberAttributeValue('AXARIAColumnCount') is 16
 PASS grid.numberAttributeValue('AXARIARowCount') is 30
+PASS grid.rowCount is 4
+PASS grid.columnCount is 4
 PASS cell1.numberAttributeValue('AXARIAColumnIndex') is 2
 PASS cell1.numberAttributeValue('AXARIARowIndex') is 7
 PASS cell2.numberAttributeValue('AXARIAColumnIndex') is 4
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
-<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/js-test-pre.js"></script>
 </head>
 <body id="body">
 
@@ -81,6 +81,8 @@
           // aria-colcount and aria-rowcount
           shouldBe("grid.numberAttributeValue('AXARIAColumnCount')", "16");
           shouldBe("grid.numberAttributeValue('AXARIARowCount')", "30");
+          shouldBe("grid.rowCount", "4");
+          shouldBe("grid.columnCount", "4");
           
           // aria-colindex and aria-rowindex
           shouldBe("cell1.numberAttributeValue('AXARIAColumnIndex')", "2");
 
 </script>
 
-<script src="../../resources/js-test-post.js"></script>
+<script src="../resources/js-test-post.js"></script>
 </body>
 </html>
index c858208..aec3bbf 100644 (file)
@@ -612,6 +612,9 @@ webkit.org/b/146731 fast/hidpi/filters-reference.html [ ImageOnlyFailure ]
 
 webkit.org/b/149016 accessibility/aria-current.html [ Skip ]
 
+# ARIA 1.1 table related attributes are not supported
+webkit.org/b/148967 accessibility/aria-table-attributes.html [ Skip ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
 #////////////////////////////////////////////////////////////////////////////////////////
index 04d8bc7..0e86456 100644 (file)
@@ -2793,6 +2793,9 @@ css3/line-break-language-sensitive/line-break-normal-sound-marks.html [ ImageOnl
 # Enable "aria-current" test for iOS
 webkit.org/b/149297 accessibility/aria-current.html [ Pass ]
 
+# Enable "aria-table-attributes" test for iOS
+webkit.org/b/150366 accessibility/aria-table-attributes.html [ Pass ]
+
 # More flaky tests (Sept 18, 2015)
 
 fast/forms/select-element-focus-ring.html [ Failure Pass ]
index 5d9e682..339fc08 100644 (file)
@@ -621,6 +621,9 @@ animations/trigger-container-scroll-boundaries.html [ Skip ]
 # TODO aria-current is not supported
 webkit.org/b/149018 accessibility/aria-current.html [ Skip ]
 
+# TODO ARIA 1.1 table related attributes are not supported
+webkit.org/b/148967 accessibility/aria-table-attributes.html [ Skip ]
+
 # TODO webkit-font-smoothing is not supported.
 webkit.org/b/149245 imported/w3c/css/css-multicol-1/multicol-basic-001.html [ Skip ]
 webkit.org/b/149245 imported/w3c/css/css-multicol-1/multicol-basic-002.html [ Skip ]
index 2de2b3f..41a886a 100644 (file)
@@ -1,3 +1,25 @@
+2015-10-21  Nan Wang  <n_wang@apple.com>
+
+        AX: Expose table size and cell indexes on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=150366
+
+        Add support to expose table row/column count and cell indexes on iOS.
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/aria-table-attributes.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper tableParent]):
+        (-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]):
+        (-[WebAccessibilityObjectWrapper accessibilityRowCount]):
+        (-[WebAccessibilityObjectWrapper accessibilityColumnCount]):
+        (-[WebAccessibilityObjectWrapper accessibilityARIARowCount]):
+        (-[WebAccessibilityObjectWrapper accessibilityARIAColumnCount]):
+        (-[WebAccessibilityObjectWrapper accessibilityARIARowIndex]):
+        (-[WebAccessibilityObjectWrapper accessibilityARIAColumnIndex]):
+        (-[WebAccessibilityObjectWrapper accessibilityRowRange]):
+
 2015-10-21  Chris Dumez  <cdumez@apple.com>
 
         HTMLIFrameElement.sandbox should be a DOMSettableTokenList
index f9efe3d..7a1c4c2 100644 (file)
@@ -918,7 +918,7 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
 {
     // Find if the parent table for the table cell.
     AccessibilityObject* parentTable = nullptr;
-    for (parentTable = m_object; parentTable && !parentTable->isDataTable(); parentTable = parentTable->parentObject()) 
+    for (parentTable = m_object; parentTable && !(is<AccessibilityTable>(*parentTable) && downcast<AccessibilityTable>(*parentTable).isExposableThroughAccessibility()); parentTable = parentTable->parentObject())
     { }
     
     if (!parentTable)
@@ -1000,6 +1000,76 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
     return cell->wrapper();
 }
 
+- (NSUInteger)accessibilityRowCount
+{
+    if (![self _prepareAccessibilityCall])
+        return 0;
+    AccessibilityTable *table = [self tableParent];
+    if (!table)
+        return 0;
+    
+    return table->rowCount();
+}
+
+- (NSUInteger)accessibilityColumnCount
+{
+    if (![self _prepareAccessibilityCall])
+        return 0;
+    AccessibilityTable *table = [self tableParent];
+    if (!table)
+        return 0;
+    
+    return table->columnCount();
+}
+
+- (NSUInteger)accessibilityARIARowCount
+{
+    if (![self _prepareAccessibilityCall])
+        return 0;
+    AccessibilityTable *table = [self tableParent];
+    if (!table)
+        return 0;
+    
+    NSInteger rowCount = table->ariaRowCount();
+    return rowCount > 0 ? rowCount : 0;
+}
+
+- (NSUInteger)accessibilityARIAColumnCount
+{
+    if (![self _prepareAccessibilityCall])
+        return 0;
+    AccessibilityTable *table = [self tableParent];
+    if (!table)
+        return 0;
+    
+    NSInteger colCount = table->ariaColumnCount();
+    return colCount > 0 ? colCount : 0;
+}
+
+- (NSUInteger)accessibilityARIARowIndex
+{
+    if (![self _prepareAccessibilityCall])
+        return NSNotFound;
+    AccessibilityTableCell* tableCell = [self tableCellParent];
+    if (!tableCell)
+        return NSNotFound;
+    
+    NSInteger rowIndex = tableCell->ariaRowIndex();
+    return rowIndex > 0 ? rowIndex : NSNotFound;
+}
+
+- (NSUInteger)accessibilityARIAColumnIndex
+{
+    if (![self _prepareAccessibilityCall])
+        return NSNotFound;
+    AccessibilityTableCell* tableCell = [self tableCellParent];
+    if (!tableCell)
+        return NSNotFound;
+    
+    NSInteger columnIndex = tableCell->ariaColumnIndex();
+    return columnIndex > 0 ? columnIndex : NSNotFound;
+}
+
 - (NSRange)accessibilityRowRange
 {
     if (![self _prepareAccessibilityCall])
index 43ed5da..66ca1b9 100644 (file)
@@ -1,3 +1,21 @@
+2015-10-21  Nan Wang  <n_wang@apple.com>
+
+        AX: Expose table size and cell indexes on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=150366
+
+        Reviewed by Chris Fleizach.
+
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::rowCount):
+        (AccessibilityUIElement::columnCount):
+        (AccessibilityUIElement::indexInTable):
+        (AccessibilityUIElement::numberAttributeValue):
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::numberAttributeValue):
+        (WTR::AccessibilityUIElement::rowCount):
+        (WTR::AccessibilityUIElement::columnCount):
+        (WTR::AccessibilityUIElement::indexInTable):
+
 2015-10-21  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         W3C test importer should not import reference files as regular tests
index 37a68c7..42ee5c6 100644 (file)
@@ -84,6 +84,12 @@ AccessibilityUIElement::~AccessibilityUIElement()
 - (void)_accessibilityActivate;
 - (UIAccessibilityTraits)_axSelectedTrait;
 - (NSString *)accessibilityARIACurrentStatus;
+- (NSUInteger)accessibilityRowCount;
+- (NSUInteger)accessibilityColumnCount;
+- (NSUInteger)accessibilityARIARowCount;
+- (NSUInteger)accessibilityARIAColumnCount;
+- (NSUInteger)accessibilityARIARowIndex;
+- (NSUInteger)accessibilityARIAColumnIndex;
 @end
 
 @interface NSObject (WebAccessibilityObjectWrapperPrivate)
@@ -647,12 +653,12 @@ JSStringRef AccessibilityUIElement::attributesOfHeader()
 
 int AccessibilityUIElement::rowCount()
 {
-    return -1;
+    return [m_element accessibilityRowCount];
 }
 
 int AccessibilityUIElement::columnCount()
 {
-    return -1;
+    return [m_element accessibilityColumnCount];
 }
 
 int AccessibilityUIElement::indexInTable()
@@ -863,7 +869,16 @@ JSStringRef AccessibilityUIElement::selectTextWithCriteria(JSContextRef context,
 
 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
 {
-    // FIXME: implement
+    // Support test for table related attributes.
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIAColumnCount"))
+        return [m_element accessibilityARIAColumnCount];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIARowCount"))
+        return [m_element accessibilityARIARowCount];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIAColumnIndex"))
+        return [m_element accessibilityARIAColumnIndex];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIARowIndex"))
+        return [m_element accessibilityARIARowIndex];
+    
     return 0;
 }
 
index ccf90d1..321c410 100644 (file)
@@ -61,6 +61,12 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
 - (void)_accessibilityActivate;
 - (UIAccessibilityTraits)_axSelectedTrait;
 - (NSString *)accessibilityARIACurrentStatus;
+- (NSUInteger)accessibilityRowCount;
+- (NSUInteger)accessibilityColumnCount;
+- (NSUInteger)accessibilityARIARowCount;
+- (NSUInteger)accessibilityARIAColumnCount;
+- (NSUInteger)accessibilityARIARowIndex;
+- (NSUInteger)accessibilityARIAColumnIndex;
 @end
 
 @interface NSObject (WebAccessibilityObjectWrapperPrivate)
@@ -323,6 +329,16 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRe
 
 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
 {
+    // Support test for table related attributes.
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIAColumnCount"))
+        return [m_element accessibilityARIAColumnCount];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIARowCount"))
+        return [m_element accessibilityARIARowCount];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIAColumnIndex"))
+        return [m_element accessibilityARIAColumnIndex];
+    if (JSStringIsEqualToUTF8CString(attribute, "AXARIARowIndex"))
+        return [m_element accessibilityARIARowIndex];
+    
     return 0;
 }
 
@@ -658,12 +674,12 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier()
 
 int AccessibilityUIElement::rowCount()
 {
-    return -1;
+    return [m_element accessibilityRowCount];
 }
 
 int AccessibilityUIElement::columnCount()
 {
-    return -1;
+    return [m_element accessibilityColumnCount];
 }
 
 int AccessibilityUIElement::indexInTable()