Title: [214851] trunk
Revision
214851
Author
n_w...@apple.com
Date
2017-04-03 16:06:25 -0700 (Mon, 03 Apr 2017)

Log Message

AX: Expose link children when doing search predication on iOS
https://bugs.webkit.org/show_bug.cgi?id=170424
<rdar://problem/31413335>

Source/WebCore:

The children of links are accessible elements on iOS instead of the link itself,
so we should expose the children when doing predicated searches as well.

Reviewed by Chris Fleizach.

Test: accessibility/ios-simulator/ios-search-predicate-link-children.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):

Tools:

Reviewed by Chris Fleizach.

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

LayoutTests:

Reviewed by Chris Fleizach.

* accessibility/ios-simulator/ios-search-predicate-link-children-expected.txt: Added.
* accessibility/ios-simulator/ios-search-predicate-link-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214850 => 214851)


--- trunk/LayoutTests/ChangeLog	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/LayoutTests/ChangeLog	2017-04-03 23:06:25 UTC (rev 214851)
@@ -1,3 +1,14 @@
+2017-04-03  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose link children when doing search predication on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=170424
+        <rdar://problem/31413335>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/ios-search-predicate-link-children-expected.txt: Added.
+        * accessibility/ios-simulator/ios-search-predicate-link-children.html: Added.
+
 2017-04-03  Dave Hyatt  <hy...@apple.com>
 
         Japanese fonts in vertical text should support synthesized italics

Added: trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children-expected.txt (0 => 214851)


--- trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children-expected.txt	2017-04-03 23:06:25 UTC (rev 214851)
@@ -0,0 +1,22 @@
+start text
+
+heading text
+
+sub text
+start text 2
+
+link2 text link3
+This tests the ability to search for exposed link children.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS resultElement.description is 'AXLabel: heading text'
+PASS resultElement.description is 'AXLabel: sub text'
+PASS resultElement.description is 'AXLabel: heading text'
+PASS resultElement.description is 'AXLabel: link2 text'
+PASS resultElement.description is 'AXLabel: link3'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children.html (0 => 214851)


--- trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-link-children.html	2017-04-03 23:06:25 UTC (rev 214851)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<p id="start">start text</p>
+<a id="link" href=''>
+<h3>heading text</h3>
+<div>sub text</div>
+</a>
+
+<p id="start2">start text 2</p>
+<a id="link2" href=''>
+<span>link2</span>
+<span> text</span>
+</a>
+<a href=""
+    
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests the ability to search for exposed link children.");
+    
+    if (window.accessibilityController) {
+        window.testRunner.keepWebHistory();
+        
+        var containerElement = accessibilityController.rootElement;
+        var startElement = accessibilityController.accessibleElementById("start");
+        var resultElement;
+        
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, "AXLinkSearchKey", "", false);
+        shouldBe("resultElement.description", "'AXLabel: heading text'");
+        
+        startElement = resultElement;
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, "AXLinkSearchKey", "", false);
+        shouldBe("resultElement.description", "'AXLabel: sub text'");
+        
+        // Search backwards.
+        startElement = resultElement;
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, false, "AXLinkSearchKey", "", false);
+        shouldBe("resultElement.description", "'AXLabel: heading text'");
+        
+        // Test the case where the link itself is not ignored.
+        startElement = accessibilityController.accessibleElementById("start2");
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, "AXLinkSearchKey", "", false);
+        shouldBe("resultElement.description", "'AXLabel: link2 text'");
+        
+        startElement = resultElement;
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, "AXLinkSearchKey", "", false);
+        shouldBe("resultElement.description", "'AXLabel: link3'");
+    }
+    
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (214850 => 214851)


--- trunk/Source/WebCore/ChangeLog	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/Source/WebCore/ChangeLog	2017-04-03 23:06:25 UTC (rev 214851)
@@ -1,3 +1,19 @@
+2017-04-03  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose link children when doing search predication on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=170424
+        <rdar://problem/31413335>
+
+        The children of links are accessible elements on iOS instead of the link itself, 
+        so we should expose the children when doing predicated searches as well.
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/ios-simulator/ios-search-predicate-link-children.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
+
 2017-04-03  Jer Noble  <jer.no...@apple.com>
 
         No audio output for MediaStream-backed audio elements on iOS

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (214850 => 214851)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-04-03 23:06:25 UTC (rev 214851)
@@ -201,8 +201,14 @@
     case LandmarkSearchKey:
         return axObject->isLandmark();
         
-    case LinkSearchKey:
-        return axObject->isLink();
+    case LinkSearchKey: {
+        bool isLink = axObject->isLink();
+#if PLATFORM(IOS)
+        if (!isLink)
+            isLink = axObject->isDescendantOfRole(WebCoreLinkRole);
+#endif
+        return isLink;
+    }
         
     case ListSearchKey:
         return axObject->isList();

Modified: trunk/Tools/ChangeLog (214850 => 214851)


--- trunk/Tools/ChangeLog	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/Tools/ChangeLog	2017-04-03 23:06:25 UTC (rev 214851)
@@ -1,3 +1,16 @@
+2017-04-03  Nan Wang  <n_w...@apple.com>
+
+        AX: Expose link children when doing search predication on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=170424
+        <rdar://problem/31413335>
+
+        Reviewed by Chris Fleizach.
+
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::uiElementForSearchPredicate):
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::uiElementForSearchPredicate):
+
 2017-04-03  Brian Burg  <bb...@apple.com>
 
         run-safari should support launching with custom language and locale

Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (214850 => 214851)


--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm	2017-04-03 23:06:25 UTC (rev 214851)
@@ -1123,11 +1123,15 @@
 
 AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
 {
-    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
+    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 5, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
     id value = [m_element accessibilityFindMatchingObjects:parameterizedAttribute];
     if (![value isKindOfClass:[NSArray class]])
         return nullptr;
-    return AccessibilityUIElement([value lastObject]);
+    for (id element in value) {
+        if ([element isAccessibilityElement])
+            return AccessibilityUIElement(element);
+    }
+    return AccessibilityUIElement([value firstObject]);
 }
 
 JSStringRef AccessibilityUIElement::selectTextWithCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (214850 => 214851)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2017-04-03 23:04:40 UTC (rev 214850)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2017-04-03 23:06:25 UTC (rev 214851)
@@ -662,11 +662,15 @@
 
 RefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
 {
-    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
+    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 5, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
     id value = [m_element accessibilityFindMatchingObjects:parameterizedAttribute];
     if (![value isKindOfClass:[NSArray class]])
         return nullptr;
-    return AccessibilityUIElement::create([value lastObject]);
+    for (id element in value) {
+        if ([element isAccessibilityElement])
+            return AccessibilityUIElement::create(element);
+    }
+    return AccessibilityUIElement::create([value firstObject]);
 }
 
 JSRetainPtr<JSStringRef> AccessibilityUIElement::selectTextWithCriteria(JSContextRef, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to