Title: [164615] trunk
Revision
164615
Author
samuel_wh...@apple.com
Date
2014-02-24 16:08:50 -0800 (Mon, 24 Feb 2014)

Log Message

AX: findMatchingObjects backwards start position inconsistent with forwards start position when startObject == nullptr.
https://bugs.webkit.org/show_bug.cgi?id=129266

Reviewed by Chris Fleizach.

Source/WebCore:

When searching forward with no start object, the first thing considered is the first child of
the container. However, when searching backwards with no start object nothing in the container
is considered; this basically negates the search. This patch makes backwards searching without
a start object start from the last child of the container to match forward search expectations.

Test: platform/mac/accessibility/search-predicate-start-not-specified.html

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

LayoutTests:

Added test to ensure that searching backward & forward without a start object produces similar
results. Backward will begin from the end of the container and forward will begin from the start.

* platform/mac/accessibility/search-predicate-start-not-specified-expected.txt: Added.
* platform/mac/accessibility/search-predicate-start-not-specified.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164614 => 164615)


--- trunk/LayoutTests/ChangeLog	2014-02-24 23:25:25 UTC (rev 164614)
+++ trunk/LayoutTests/ChangeLog	2014-02-25 00:08:50 UTC (rev 164615)
@@ -1,3 +1,16 @@
+2014-02-24  Samuel White  <samuel_wh...@apple.com>
+
+        AX: findMatchingObjects backwards start position inconsistent with forwards start position when startObject == nullptr.
+        https://bugs.webkit.org/show_bug.cgi?id=129266
+
+        Reviewed by Chris Fleizach.
+
+        Added test to ensure that searching backward & forward without a start object produces similar
+        results. Backward will begin from the end of the container and forward will begin from the start.
+
+        * platform/mac/accessibility/search-predicate-start-not-specified-expected.txt: Added.
+        * platform/mac/accessibility/search-predicate-start-not-specified.html: Added.
+
 2014-02-24  Zoltan Horvath  <zol...@webkit.org>
 
         [CSS Shapes] Adjust lineTop position to the next available wrapping location at shape-outsides

Added: trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified-expected.txt (0 => 164615)


--- trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified-expected.txt	2014-02-25 00:08:50 UTC (rev 164615)
@@ -0,0 +1,11 @@
+This tests that search predicate results are accurate when no start element is specified.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS backwardResult.description is 'AXDescription: last'
+PASS forwardResult.description is 'AXDescription: first'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified.html (0 => 164615)


--- trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-predicate-start-not-specified.html	2014-02-25 00:08:50 UTC (rev 164615)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<title>Search Predicate Start Not Specified</title>
+</head>
+<body>
+
+<ul id="container"><li aria-label="first">item</li><li aria-label="middle">item</li><li aria-label="last">item</li></ul>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that search predicate results are accurate when no start element is specified.");
+    
+    if (window.accessibilityController) {
+        var containerElement = accessibilityController.accessibleElementById("container");
+        
+        // Backward search with no start element.
+        var backwardResult = containerElement.uiElementForSearchPredicate(null, false, "AXAnyTypeSearchKey", "", false);
+        shouldBe("backwardResult.description", "'AXDescription: last'");
+        
+        // Forward search with no start element.
+        var forwardResult = containerElement.uiElementForSearchPredicate(null, true, "AXAnyTypeSearchKey", "", false);
+        shouldBe("forwardResult.description", "'AXDescription: first'");
+        
+        // Hide superfluous text.
+        document.getElementById("container").style.display = "none";
+    }
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (164614 => 164615)


--- trunk/Source/WebCore/ChangeLog	2014-02-24 23:25:25 UTC (rev 164614)
+++ trunk/Source/WebCore/ChangeLog	2014-02-25 00:08:50 UTC (rev 164615)
@@ -1,3 +1,20 @@
+2014-02-24  Samuel White  <samuel_wh...@apple.com>
+
+        AX: findMatchingObjects backwards start position inconsistent with forwards start position when startObject == nullptr.
+        https://bugs.webkit.org/show_bug.cgi?id=129266
+
+        Reviewed by Chris Fleizach.
+
+        When searching forward with no start object, the first thing considered is the first child of
+        the container. However, when searching backwards with no start object nothing in the container
+        is considered; this basically negates the search. This patch makes backwards searching without
+        a start object start from the last child of the container to match forward search expectations.
+
+        Test: platform/mac/accessibility/search-predicate-start-not-specified.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::findMatchingObjects):
+
 2014-02-24  Andreas Kling  <akl...@apple.com>
 
         Prune dead code for Web Inspector canvas instrumentation.

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (164614 => 164615)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-02-24 23:25:25 UTC (rev 164614)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-02-25 00:08:50 UTC (rev 164615)
@@ -475,10 +475,11 @@
     
     bool isForward = criteria->searchDirection == SearchDirectionNext;
     
-    // In the first iteration of the loop, it will examine the children of the start object for matches.
-    // However, when going backwards, those children should not be considered, so the loop is skipped ahead.
+    // The first iteration of the outer loop will examine the children of the start object for matches. However, when
+    // iterating backwards, the start object children should not be considered, so the loop is skipped ahead. We make an
+    // exception when no start object was specified because we want to search everything regardless of search direction.
     AccessibilityObject* previousObject = 0;
-    if (!isForward) {
+    if (!isForward && startObject != this) {
         previousObject = startObject;
         startObject = startObject->parentObjectUnignored();
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to