Add accessibility object method to determine whether an element is inside a table...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Aug 2019 19:10:02 +0000 (19:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Aug 2019 19:10:02 +0000 (19:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200394
<rdar://problem/52914964>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-08-02
Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/ios-simulator/element-in-table-cell.html

Added _accessibilityIsInTableCell needed for iOS accessibility client.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):

Tools:

Glue code to exercise new method [WebAccessibilityObjectWrapper _accessibilityIsInTableCell].

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::isInTableCell const):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::isInTableCell const):

LayoutTests:

New test that exercises [WebAccessibilityObjectWrapper _accessibilityIsInTableCell].

* accessibility/ios-simulator/element-in-table-cell-expected.txt: Added.
* accessibility/ios-simulator/element-in-table-cell.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/element-in-table-cell-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/element-in-table-cell.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

index 1d528c3..7db0148 100644 (file)
@@ -1,3 +1,16 @@
+2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
+
+        Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
+        https://bugs.webkit.org/show_bug.cgi?id=200394
+        <rdar://problem/52914964>
+
+        Reviewed by Chris Fleizach.
+
+        New test that exercises [WebAccessibilityObjectWrapper _accessibilityIsInTableCell].
+
+        * accessibility/ios-simulator/element-in-table-cell-expected.txt: Added.
+        * accessibility/ios-simulator/element-in-table-cell.html: Added.
+
 2019-08-02  Chris Dumez  <cdumez@apple.com>
 
         DOMWindow properties may get GC'd before their Window object
diff --git a/LayoutTests/accessibility/ios-simulator/element-in-table-cell-expected.txt b/LayoutTests/accessibility/ios-simulator/element-in-table-cell-expected.txt
new file mode 100644 (file)
index 0000000..c4d9776
--- /dev/null
@@ -0,0 +1,16 @@
+apple  orange
+3      5
+2 4
+This tests the _accessibilityIsInTableCell method, used by VO to describe the element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.accessibleElementById('button1').isInTableCell() is true
+PASS accessibilityController.accessibleElementById('button2').isInTableCell() is false
+PASS accessibilityController.accessibleElementById('link1').isInTableCell() is true
+PASS accessibilityController.accessibleElementById('link2').isInTableCell() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/element-in-table-cell.html b/LayoutTests/accessibility/ios-simulator/element-in-table-cell.html
new file mode 100644 (file)
index 0000000..b743bf5
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<table>
+    <thead>
+        <tr>
+            <th scope="col">apple</th>
+            <th scope="col">orange</th>
+        </TR>
+    </thead>
+    <tbody>
+        <tr>
+            <td><button id="button1">3</button></td>
+            <td><a href="#" id="link1">5</a></td>
+        </TR>
+    </TBODY>
+</table>
+
+<button id="button2">2</button>
+<a href="#" id="link2">4</a>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests the _accessibilityIsInTableCell method, used by VO to describe the element.");
+
+    if (window.accessibilityController) {
+        shouldBeTrue("accessibilityController.accessibleElementById('button1').isInTableCell()")
+        shouldBeFalse("accessibilityController.accessibleElementById('button2').isInTableCell()")
+        shouldBeTrue("accessibilityController.accessibleElementById('link1').isInTableCell()")
+        shouldBeFalse("accessibilityController.accessibleElementById('link2').isInTableCell()")
+    }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 255de1f..31fe4df 100644 (file)
@@ -1,3 +1,17 @@
+2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
+
+        Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
+        https://bugs.webkit.org/show_bug.cgi?id=200394
+        <rdar://problem/52914964>
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/ios-simulator/element-in-table-cell.html
+
+        Added _accessibilityIsInTableCell needed for iOS accessibility client.
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
+
 2019-08-02  Eric Carlson  <eric.carlson@apple.com>
 
         [macOS, iOS] webaudio/silent-audio-interrupted-in-background.html sometimes crashes
index 9500c0a..de26d93 100644 (file)
@@ -599,6 +599,13 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
     return nil;
 }
 
+- (BOOL)_accessibilityIsInTableCell
+{
+    return AccessibilityObject::matchedParent(*m_object, false, [] (const AccessibilityObject& object) {
+        return object.roleValue() == AccessibilityRole::Cell;
+    });
+}
+
 - (AccessibilityObjectWrapper*)_accessibilityFieldsetAncestor
 {
     if (const AccessibilityObject* parent = AccessibilityObject::matchedParent(*m_object, false, [] (const AccessibilityObject& object) {
index efb492e..a594457 100644 (file)
@@ -1,3 +1,20 @@
+2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
+
+        Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
+        https://bugs.webkit.org/show_bug.cgi?id=200394
+        <rdar://problem/52914964>
+
+        Reviewed by Chris Fleizach.
+
+        Glue code to exercise new method [WebAccessibilityObjectWrapper _accessibilityIsInTableCell].
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::isInTableCell const):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::isInTableCell const):
+
 2019-08-02  Zhifei Fang  <zhifei_fang@apple.com>
 
         [results.webkit.org Timeline] Using transform matrix to calculate the tag rotation position
index 74a7188..95dcefb 100644 (file)
@@ -79,6 +79,7 @@ bool AccessibilityUIElement::isTextArea() const { return false; }
 RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeMatchesTextNearMarkers(JSStringRef, AccessibilityTextMarker*, AccessibilityTextMarker*) { return nullptr; }
 bool AccessibilityUIElement::dismiss() { return false; }
 JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForElement() { return nullptr; }
+bool AccessibilityUIElement::isInTableCell() const { return false; }
 #endif
     
 // Unsupported methods on various platforms. As they're implemented on other platforms this list should be modified.
index 36139fc..8d92df7 100644 (file)
@@ -189,6 +189,7 @@ public:
     JSRetainPtr<JSStringRef> attributesOfRows();
     JSRetainPtr<JSStringRef> attributesOfVisibleCells();
     JSRetainPtr<JSStringRef> attributesOfHeader();
+    bool isInTableCell() const;
     int indexInTable();
     JSRetainPtr<JSStringRef> rowIndexRange();
     JSRetainPtr<JSStringRef> columnIndexRange();
index 40f25a9..e26be90 100644 (file)
     AccessibilityUIElement disclosedByRow();
     AccessibilityUIElement disclosedRowAtIndex(unsigned long index);
     AccessibilityUIElement rowAtIndex(unsigned long index);
+    boolean isInTableCell();
     long indexInTable();
     DOMString rowIndexRange();
     DOMString columnIndexRange();
index cd1f2c8..8270cb3 100644 (file)
@@ -103,6 +103,7 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
 - (id)lineStartMarkerForMarker:(id)marker;
 - (id)lineEndMarkerForMarker:(id)marker;
 - (NSArray *)textMarkerRangeFromMarkers:(NSArray *)markers withText:(NSString *)text;
+- (BOOL)_accessibilityIsInTableCell;
 @end
 
 @interface NSObject (WebAccessibilityObjectWrapperPrivate)
@@ -794,6 +795,11 @@ int AccessibilityUIElement::columnCount()
     return [m_element accessibilityColumnCount];
 }
 
+bool AccessibilityUIElement::isInTableCell() const
+{
+    return [m_element _accessibilityIsInTableCell];
+}
+
 int AccessibilityUIElement::indexInTable()
 {
     return -1;