Title: [220065] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (220064 => 220065)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-07-31 14:37:34 UTC (rev 220064)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-07-31 14:37:37 UTC (rev 220065)
@@ -1,5 +1,19 @@
 2017-07-31  Jason Marcell  <[email protected]>
 
+        Cherry-pick r220042. rdar://problem/33619586
+
+    2017-07-29  Nan Wang  <[email protected]>
+
+            AX: findMatchingObjects doesn't work when the startObject is ignored
+            https://bugs.webkit.org/show_bug.cgi?id=174965
+
+            Reviewed by Chris Fleizach.
+
+            * accessibility/mac/search-predicate-from-ignored-element-expected.txt: Added.
+            * accessibility/mac/search-predicate-from-ignored-element.html: Added.
+
+2017-07-31  Jason Marcell  <[email protected]>
+
         Cherry-pick r220009. rdar://problem/33619585
 
     2017-07-28  Myles C. Maxfield  <[email protected]>

Added: branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt (0 => 220065)


--- branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt	2017-07-31 14:37:37 UTC (rev 220065)
@@ -0,0 +1,16 @@
+First line of text
+button 
+Third line of text
+This tests the ability to search for accessible elements from an ignored element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.stringForTextMarkerRange(markerRange) is 'First line of text'
+PASS element.stringForTextMarkerRange(lineRange) is 'button'
+PASS resultElement.stringValue is 'AXValue: Third line of text'
+PASS resultElement.stringValue is 'AXValue: First line of text'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html (0 => 220065)


--- branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html	2017-07-31 14:37:37 UTC (rev 220065)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="test">First line of text<br>
+<button id="button" aria-hidden="true">button</button>
+<br>Third line of text</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests the ability to search for accessible elements from an ignored element.");
+    
+    if (window.accessibilityController) {
+        
+        document.getElementById("body").focus();
+        var containerElement = accessibilityController.focusedElement;
+        
+        var element = accessibilityController.accessibleElementById("test").childAtIndex(0);
+        var markerRange = element.textMarkerRangeForElement(element);
+        shouldBe("element.stringForTextMarkerRange(markerRange)", "'First line of text'");
+        
+        // Try to get the ignored element using line text marker calls
+        var textMarker = element.endTextMarkerForTextMarkerRange(markerRange);
+        textMarker = element.nextTextMarker(textMarker);
+        textMarker = element.nextTextMarker(textMarker);
+        var lineRange = element.lineTextMarkerRangeForTextMarker(textMarker);
+        shouldBe("element.stringForTextMarkerRange(lineRange)", "'button'");
+        
+        textMarker = element.startTextMarkerForTextMarkerRange(lineRange);
+        var startElement = element.accessibilityElementForTextMarker(textMarker);
+        
+        // Search forward
+        var resultElement = containerElement.uiElementForSearchPredicate(startElement, true, "AXAnyTypeSearchKey", "", false);
+        shouldBe("resultElement.stringValue", "'AXValue: Third line of text'");
+        
+        // Search backward
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, false, "AXAnyTypeSearchKey", "", false);
+        shouldBe("resultElement.stringValue", "'AXValue: First line of text'");
+    }
+        
+</script>
+
+<script src=""
+</body>
+</html>
\ No newline at end of file

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (220064 => 220065)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-31 14:37:34 UTC (rev 220064)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-31 14:37:37 UTC (rev 220065)
@@ -1,5 +1,25 @@
 2017-07-31  Jason Marcell  <[email protected]>
 
+        Cherry-pick r220042. rdar://problem/33619586
+
+    2017-07-29  Nan Wang  <[email protected]>
+
+            AX: findMatchingObjects doesn't work when the startObject is ignored
+            https://bugs.webkit.org/show_bug.cgi?id=174965
+
+            Reviewed by Chris Fleizach.
+
+            findMatchingObjects would return a wrong element if we pass in an ignored
+            start object. To fix this, we should use the closest accessible sibling as
+            the start object.
+
+            Test: accessibility/mac/search-predicate-from-ignored-element.html
+
+            * accessibility/AccessibilityObject.cpp:
+            (WebCore::appendChildrenToArray):
+
+2017-07-31  Jason Marcell  <[email protected]>
+
         Cherry-pick r220009. rdar://problem/33619585
 
     2017-07-28  Myles C. Maxfield  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/accessibility/AccessibilityObject.cpp (220064 => 220065)


--- branches/safari-604-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-07-31 14:37:34 UTC (rev 220064)
+++ branches/safari-604-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2017-07-31 14:37:37 UTC (rev 220065)
@@ -610,7 +610,23 @@
     size_t startIndex = isForward ? childrenSize : 0;
     size_t endIndex = isForward ? 0 : childrenSize;
 
+    // If the startObject is ignored, we should use an accessible sibling as a start element instead.
+    if (startObject && startObject->accessibilityIsIgnored() && startObject->isDescendantOfObject(object)) {
+        AccessibilityObject* parentObject = startObject->parentObject();
+        // Go up the parent chain to find the highest ancestor that's also being ignored.
+        while (parentObject && parentObject->accessibilityIsIgnored()) {
+            if (parentObject == object)
+                break;
+            startObject = parentObject;
+            parentObject = parentObject->parentObject();
+        }
+        // Get the un-ignored sibling based on the search direction, and update the searchPosition.
+        while (startObject && startObject->accessibilityIsIgnored())
+            startObject = isForward ? startObject->previousSibling() : startObject->nextSibling();
+    }
+    
     size_t searchPosition = startObject ? searchChildren.find(startObject) : WTF::notFound;
+    
     if (searchPosition != WTF::notFound) {
         if (isForward)
             endIndex = searchPosition + 1;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to