Title: [101560] trunk
Revision
101560
Author
cfleiz...@apple.com
Date
2011-11-30 15:25:40 -0800 (Wed, 30 Nov 2011)

Log Message

AX: Searching mechanism gets stuck when searching tables
https://bugs.webkit.org/show_bug.cgi?id=72519

Source/WebCore: 

When searching through the elements within a data table, the children() method should not
be used, since that contains elements (like a table header column) which have the same children
as the table itself. Instead the cells() should be searched.

Reviewed by Beth Dakin.

Test: platform/mac/accessibility/search-when-element-starts-in-table.html

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

LayoutTests: 

Reviewed by Beth Dakin.

* platform/mac/accessibility/search-when-element-starts-in-table-expected.txt: Added.
* platform/mac/accessibility/search-when-element-starts-in-table.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101559 => 101560)


--- trunk/LayoutTests/ChangeLog	2011-11-30 23:15:28 UTC (rev 101559)
+++ trunk/LayoutTests/ChangeLog	2011-11-30 23:25:40 UTC (rev 101560)
@@ -1,3 +1,13 @@
+2011-11-30  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: Searching mechanism gets stuck when searching tables
+        https://bugs.webkit.org/show_bug.cgi?id=72519
+
+        Reviewed by Beth Dakin.
+
+        * platform/mac/accessibility/search-when-element-starts-in-table-expected.txt: Added.
+        * platform/mac/accessibility/search-when-element-starts-in-table.html: Added.
+
 2011-11-30  Vincent Scheib  <sch...@chromium.org>
 
         Rebasing many SVG text & pixel tests due to r101517 Add new renderer for SVGRectElement.

Added: trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt (0 => 101560)


--- trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt	2011-11-30 23:25:40 UTC (rev 101560)
@@ -0,0 +1,18 @@
+Column
+heading
+
+outside heading
+
+This tests that when we start searching from an element within a table, we do not get as a result, the same element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS resultElement.role is 'AXRole: AXHeading'
+PASS resultElement.title is 'AXTitle: outside heading'
+PASS resultElement.role is 'AXRole: '
+PASS resultElement.role is 'AXRole: AXCell'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html (0 => 101560)


--- trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html	2011-11-30 23:25:40 UTC (rev 101560)
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<table border=1>
+<tr><th>Column</th></tr>
+<tr><td><h1 tabindex="0" id="heading">heading</h1></td></tr>
+</table>
+
+<h1>outside heading</h1>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that when we start searching from an element within a table, we do not get as a result, the same element.");
+    
+    if (window.accessibilityController) {
+        document.getElementById("body").focus();
+        var containerElement = accessibilityController.focusedElement;
+
+        document.getElementById("heading").focus();
+        var heading = accessibilityController.focusedElement;
+
+        // The next heading should be outside the table
+        searchKey = "AXHeadingSearchKey";
+        resultElement = containerElement.uiElementForSearchPredicate(heading, true, searchKey, "");
+        shouldBe("resultElement.role", "'AXRole: AXHeading'");
+        shouldBe("resultElement.title", "'AXTitle: outside heading'");        
+
+        // A search for the previous heading should return nothing.
+        resultElement = containerElement.uiElementForSearchPredicate(heading, false, searchKey, "");
+        shouldBe("resultElement.role", "'AXRole: '");
+
+        // The previous any type of element should be an AXCell.
+        searchKey = "AXAnyTypeSearchKey";
+        resultElement = containerElement.uiElementForSearchPredicate(heading.childAtIndex(0), false, searchKey, "");
+        shouldBe("resultElement.role", "'AXRole: AXCell'");
+    }
+    
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (101559 => 101560)


--- trunk/Source/WebCore/ChangeLog	2011-11-30 23:15:28 UTC (rev 101559)
+++ trunk/Source/WebCore/ChangeLog	2011-11-30 23:25:40 UTC (rev 101560)
@@ -1,3 +1,19 @@
+2011-11-30 Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: Searching mechanism gets stuck when searching tables
+        https://bugs.webkit.org/show_bug.cgi?id=72519
+
+        When searching through the elements within a data table, the children() method should not
+        be used, since that contains elements (like a table header column) which have the same children
+        as the table itself. Instead the cells() should be searched.
+
+        Reviewed by Beth Dakin.
+
+        Test: platform/mac/accessibility/search-when-element-starts-in-table.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::findMatchingObjects):
+
 2011-11-29  Ryosuke Niwa  <rn...@webkit.org>
 
         Assertion failure (m_nestedIsolateCount >= 1) in BidiResolver::exitIsolate()

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (101559 => 101560)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2011-11-30 23:15:28 UTC (rev 101559)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2011-11-30 23:25:40 UTC (rev 101560)
@@ -31,6 +31,7 @@
 
 #include "AXObjectCache.h"
 #include "AccessibilityRenderObject.h"
+#include "AccessibilityTable.h"
 #include "FloatRect.h"
 #include "FocusController.h"
 #include "Frame.h"
@@ -384,7 +385,14 @@
         } else if (searchObject == startObject)
             didFindStartObject = true;
         
-        AccessibilityChildrenVector searchChildren = searchObject->children();
+        AccessibilityChildrenVector searchChildren;
+        // A table's children includes elements whose own children are also the table's children (due to the way the Mac exposes tables).
+        // The table's cells are what are desired in this case, since that's where the content resides.
+        if (searchObject->isAccessibilityTable())
+            toAccessibilityTable(searchObject)->cells(searchChildren);
+        else
+            searchChildren = searchObject->children();
+        
         size_t childrenSize = searchChildren.size();
         for (size_t i = isForward ? childrenSize : 0; isForward ? i > 0 : i < childrenSize; isForward ? i-- : i++) {
             // FIXME: Handle attachments.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to