Diff
Modified: trunk/LayoutTests/ChangeLog (102030 => 102031)
--- trunk/LayoutTests/ChangeLog 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/LayoutTests/ChangeLog 2011-12-05 20:59:24 UTC (rev 102031)
@@ -1,3 +1,15 @@
+2011-12-05 Chris Fleizach <[email protected]>
+
+ platform/mac/accessibility/search-when-element-starts-in-table.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=73751
+
+ Updated tests to be more comprehensive.
+
+ Reviewed by Darin Adler.
+
+ * platform/mac/accessibility/search-when-element-starts-in-table-expected.txt:
+ * platform/mac/accessibility/search-when-element-starts-in-table.html:
+
2011-12-05 Alok Priyadarshi <[email protected]>
Rebaseline tests after the patch for BUGWK73247
Modified: trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt (102030 => 102031)
--- trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table-expected.txt 2011-12-05 20:59:24 UTC (rev 102031)
@@ -11,7 +11,14 @@
PASS resultElement.role is 'AXRole: AXHeading'
PASS resultElement.title is 'AXTitle: outside heading'
PASS resultElement.role is 'AXRole: '
+PASS resultElement.role is 'AXRole: AXHeading'
PASS resultElement.role is 'AXRole: AXCell'
+PASS resultElement.role is 'AXRole: AXRow'
+PASS resultElement.role is 'AXRole: AXStaticText'
+PASS resultElement.stringValue is 'AXValue: Column'
+PASS resultElement.role is 'AXRole: AXCell'
+PASS resultElement.rowIndexRange() is '{0, 1}'
+PASS resultElement.columnIndexRange() is '{0, 1}'
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html (102030 => 102031)
--- trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/LayoutTests/platform/mac/accessibility/search-when-element-starts-in-table.html 2011-12-05 20:59:24 UTC (rev 102031)
@@ -26,19 +26,37 @@
var heading = accessibilityController.focusedElement;
// The next heading should be outside the table
- searchKey = "AXHeadingSearchKey";
- resultElement = containerElement.uiElementForSearchPredicate(heading, true, searchKey, "");
+ resultElement = containerElement.uiElementForSearchPredicate(heading, true, "AXHeadingSearchKey", "");
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, "");
+ resultElement = containerElement.uiElementForSearchPredicate(heading, false, "AXHeadingSearchKey", "");
shouldBe("resultElement.role", "'AXRole: '");
- // The previous any type of element should be an AXCell.
- searchKey = "AXAnyTypeSearchKey";
- resultElement = containerElement.uiElementForSearchPredicate(heading.childAtIndex(0), false, searchKey, "");
+ // When asking the child of the heading for the previous element, it should return the heading.
+ resultElement = containerElement.uiElementForSearchPredicate(heading.childAtIndex(0), false, "AXAnyTypeSearchKey", "");
+ shouldBe("resultElement.role", "'AXRole: AXHeading'");
+
+ // When asking the heading for the previous element, it should return the cell.
+ resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "");
shouldBe("resultElement.role", "'AXRole: AXCell'");
+
+ // When asking the cell for the previous element, it should return the row.
+ resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "");
+ shouldBe("resultElement.role", "'AXRole: AXRow'");
+
+ // Now when trying to find the previous static text, it should go into the table's children to find the text in the first cell.
+ resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXStaticTextSearchKey", "");
+ shouldBe("resultElement.role", "'AXRole: AXStaticText'");
+ shouldBe("resultElement.stringValue", "'AXValue: Column'");
+
+ // When asking the text for the previous element it should return the first cell of the table.
+ resultElement = containerElement.uiElementForSearchPredicate(resultElement, false, "AXAnyTypeSearchKey", "");
+ shouldBe("resultElement.role", "'AXRole: AXCell'");
+ shouldBe("resultElement.rowIndexRange()", "'{0, 1}'");
+ shouldBe("resultElement.columnIndexRange()", "'{0, 1}'");
+
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (102030 => 102031)
--- trunk/Source/WebCore/ChangeLog 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/Source/WebCore/ChangeLog 2011-12-05 20:59:24 UTC (rev 102031)
@@ -1,3 +1,22 @@
+2011-12-05 Chris Fleizach <[email protected]>
+
+ platform/mac/accessibility/search-when-element-starts-in-table.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=73751
+
+ When encountering a table, the rows() and not the cells() should be queried (otherwise
+ we can end up finding the element we started with).
+
+ When searching in reverse, we also need to account for searching elements within the
+ parent hierarchy. because technically it is "behind" the start element.
+
+ Reviewed by Darin Adler.
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::appendChildrenToArray):
+ (WebCore::AccessibilityObject::objectMatchesSearchCriteriaWithResultLimit):
+ (WebCore::AccessibilityObject::findMatchingObjects):
+ * accessibility/AccessibilityObject.h:
+
2011-12-02 Jer Noble <[email protected]>
<video> elements should disable the system and display sleep when playing on OS X.
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (102030 => 102031)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-12-05 20:59:24 UTC (rev 102031)
@@ -359,9 +359,9 @@
{
AccessibilityObject::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.
+ // The rows from the table should be queried, since those are direct descendants of the table, and they contain content.
if (object->isAccessibilityTable())
- toAccessibilityTable(object)->cells(searchChildren);
+ searchChildren = toAccessibilityTable(object)->rows();
else
searchChildren = object->children();
@@ -388,7 +388,21 @@
results.append(searchChildren.at(i).get());
}
}
+
+// Returns true if the number of results is now >= the number of results desired.
+bool AccessibilityObject::objectMatchesSearchCriteriaWithResultLimit(AccessibilityObject* object, AccessibilitySearchCriteria* criteria, AccessibilityChildrenVector& results)
+{
+ if (isAccessibilityObjectSearchMatch(object, criteria) && isAccessibilityTextSearchMatch(object, criteria)) {
+ results.append(object);
+
+ // Enough results were found to stop searching.
+ if (results.size() >= criteria->resultsLimit)
+ return true;
+ }
+ return false;
+}
+
void AccessibilityObject::findMatchingObjects(AccessibilitySearchCriteria* criteria, AccessibilityChildrenVector& results)
{
ASSERT(criteria);
@@ -427,13 +441,8 @@
AccessibilityObject* searchObject = searchStack.last().get();
searchStack.removeLast();
- if (isAccessibilityObjectSearchMatch(searchObject, criteria) && isAccessibilityTextSearchMatch(searchObject, criteria)) {
- results.append(searchObject);
-
- // Enough results were found to stop searching.
- if (results.size() >= criteria->resultsLimit)
- break;
- }
+ if (objectMatchesSearchCriteriaWithResultLimit(searchObject, criteria, results))
+ break;
appendChildrenToArray(searchObject, isForward, 0, searchStack);
}
@@ -441,6 +450,10 @@
if (results.size() >= criteria->resultsLimit)
break;
+ // When moving backwards, the parent object needs to be checked, because technically it's "before" the starting element.
+ if (!isForward && objectMatchesSearchCriteriaWithResultLimit(startObject, criteria, results))
+ break;
+
previousObject = startObject;
}
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (102030 => 102031)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-12-05 20:47:59 UTC (rev 102030)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2011-12-05 20:59:24 UTC (rev 102031)
@@ -690,7 +690,8 @@
virtual bool isDetached() const { return true; }
static bool isAccessibilityObjectSearchMatch(AccessibilityObject*, AccessibilitySearchCriteria*);
static bool isAccessibilityTextSearchMatch(AccessibilityObject*, AccessibilitySearchCriteria*);
-
+ static bool objectMatchesSearchCriteriaWithResultLimit(AccessibilityObject*, AccessibilitySearchCriteria*, AccessibilityChildrenVector&);
+
#if PLATFORM(GTK)
bool allowsTextRanges() const;
unsigned getLengthForTextRange() const;