Diff
Modified: trunk/LayoutTests/ChangeLog (159467 => 159468)
--- trunk/LayoutTests/ChangeLog 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/LayoutTests/ChangeLog 2013-11-19 00:32:44 UTC (rev 159468)
@@ -1,3 +1,15 @@
+2013-11-18 Samuel White <[email protected]>
+
+ AX: Add ability to fetch only visible table rows.
+ https://bugs.webkit.org/show_bug.cgi?id=124430
+
+ Reviewed by Chris Fleizach.
+
+ Adding test to make sure AXVisibleRows behaves correctly.
+
+ * platform/mac/accessibility/table-visible-rows-expected.txt: Added.
+ * platform/mac/accessibility/table-visible-rows.html: Added.
+
2013-11-18 Ryosuke Niwa <[email protected]>
Simplify and reformat the output of performance tests inside test runners
Added: trunk/LayoutTests/platform/mac/accessibility/table-visible-rows-expected.txt (0 => 159468)
--- trunk/LayoutTests/platform/mac/accessibility/table-visible-rows-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/table-visible-rows-expected.txt 2013-11-19 00:32:44 UTC (rev 159468)
@@ -0,0 +1,11 @@
+This tests that AXVisibleRows returns visible rows correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rows is 5
+PASS visibleRows is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/table-visible-rows.html (0 => 159468)
--- trunk/LayoutTests/platform/mac/accessibility/table-visible-rows.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/table-visible-rows.html 2013-11-19 00:32:44 UTC (rev 159468)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+ .offscreen {
+ position:relative;
+ top:9999px;
+ }
+</style>
+<title>Table Visible Rows</title>
+</head>
+<body>
+
+<div id="table" role="grid">
+<div class="onscreen" role="row"><span role="gridcell">A</span></div>
+<div class="onscreen" role="row"><span role="gridcell">B</span></div>
+<div class="onscreen" role="row"><span role="gridcell">C</span></div>
+<div class="offscreen" role="row"><span role="gridcell">D</span></div>
+<div class="offscreen" role="row"><span role="gridcell">E</span></div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that AXVisibleRows returns visible rows correctly.");
+
+ if (window.accessibilityController) {
+ var table = accessibilityController.accessibleElementById("table");
+
+ // All rows.
+ var rows = table.uiElementArrayAttributeValue("AXRows").length;
+ shouldBe("rows", "5");
+
+ // Visible rows.
+ var visibleRows = table.uiElementArrayAttributeValue("AXVisibleRows").length;
+ shouldBe("visibleRows", "3");
+
+ // Hide superfluous text.
+ document.getElementById("table").style.display = "none";
+ }
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (159467 => 159468)
--- trunk/Source/WebCore/ChangeLog 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Source/WebCore/ChangeLog 2013-11-19 00:32:44 UTC (rev 159468)
@@ -1,3 +1,23 @@
+2013-11-18 Samuel White <[email protected]>
+
+ AX: Add ability to fetch only visible table rows.
+ https://bugs.webkit.org/show_bug.cgi?id=124430
+
+ Reviewed by Chris Fleizach.
+
+ Adding AccessibilityTable::visibleRows method to support AXVisibleRows attribute mac platform.
+
+ Test: platform/mac/accessibility/table-visible-rows.html
+
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::columnHeaders):
+ (WebCore::AccessibilityTable::rowHeaders):
+ (WebCore::AccessibilityTable::visibleRows):
+ * accessibility/AccessibilityTable.h:
+ * accessibility/AccessibilityTableRow.h:
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
2013-11-18 Simon Fraser <[email protected]>
At some scales, opaque compositing layers have garbage pixels around the edges
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (159467 => 159468)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2013-11-19 00:32:44 UTC (rev 159468)
@@ -421,7 +421,21 @@
return m_rows;
}
+
+void AccessibilityTable::columnHeaders(AccessibilityChildrenVector& headers)
+{
+ if (!m_renderer)
+ return;
+ updateChildrenIfNecessary();
+
+ size_t columnCount = m_columns.size();
+ for (size_t i = 0; i < columnCount; ++i) {
+ if (AccessibilityObject* header = toAccessibilityTableColumn(m_columns[i].get())->headerObject())
+ headers.append(header);
+ }
+}
+
void AccessibilityTable::rowHeaders(AccessibilityChildrenVector& headers)
{
if (!m_renderer)
@@ -429,31 +443,28 @@
updateChildrenIfNecessary();
- unsigned rowCount = m_rows.size();
- for (unsigned k = 0; k < rowCount; ++k) {
- AccessibilityObject* header = toAccessibilityTableRow(m_rows[k].get())->headerObject();
- if (!header)
- continue;
- headers.append(header);
+ size_t rowCount = m_rows.size();
+ for (size_t i = 0; i < rowCount; ++i) {
+ if (AccessibilityObject* header = toAccessibilityTableRow(m_rows[i].get())->headerObject())
+ headers.append(header);
}
}
-void AccessibilityTable::columnHeaders(AccessibilityChildrenVector& headers)
+void AccessibilityTable::visibleRows(AccessibilityChildrenVector& rows)
{
if (!m_renderer)
return;
updateChildrenIfNecessary();
- unsigned colCount = m_columns.size();
- for (unsigned k = 0; k < colCount; ++k) {
- AccessibilityObject* header = toAccessibilityTableColumn(m_columns[k].get())->headerObject();
- if (!header)
- continue;
- headers.append(header);
+ size_t rowCount = m_rows.size();
+ for (size_t i = 0; i < rowCount; ++i) {
+ AccessibilityObject* row = m_rows[i].get();
+ if (row && !row->isOffScreen())
+ rows.append(row);
}
}
-
+
void AccessibilityTable::cells(AccessibilityObject::AccessibilityChildrenVector& cells)
{
if (!m_renderer)
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.h (159467 => 159468)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.h 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.h 2013-11-19 00:32:44 UTC (rev 159468)
@@ -69,7 +69,8 @@
void columnHeaders(AccessibilityChildrenVector&);
void rowHeaders(AccessibilityChildrenVector&);
-
+ void visibleRows(AccessibilityChildrenVector&);
+
// an object that contains, as children, all the objects that act as headers
AccessibilityObject* headerContainer();
@@ -98,7 +99,7 @@
};
ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityTable, isTable())
-
+
} // namespace WebCore
#endif // AccessibilityTable_h
Modified: trunk/Source/WebCore/accessibility/AccessibilityTableRow.h (159467 => 159468)
--- trunk/Source/WebCore/accessibility/AccessibilityTableRow.h 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableRow.h 2013-11-19 00:32:44 UTC (rev 159468)
@@ -65,7 +65,7 @@
};
ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityTableRow, isTableRow())
-
+
} // namespace WebCore
#endif // AccessibilityTableRow_h
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (159467 => 159468)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2013-11-19 00:32:44 UTC (rev 159468)
@@ -2353,11 +2353,15 @@
}
if (m_object->isAccessibilityTable()) {
- // TODO: distinguish between visible and non-visible rows
- if ([attributeName isEqualToString:NSAccessibilityRowsAttribute] ||
- [attributeName isEqualToString:NSAccessibilityVisibleRowsAttribute]) {
+ if ([attributeName isEqualToString:NSAccessibilityRowsAttribute])
return convertToNSArray(toAccessibilityTable(m_object)->rows());
+
+ if ([attributeName isEqualToString:NSAccessibilityVisibleRowsAttribute]) {
+ AccessibilityObject::AccessibilityChildrenVector visibleRows;
+ toAccessibilityTable(m_object)->visibleRows(visibleRows);
+ return convertToNSArray(visibleRows);
}
+
// TODO: distinguish between visible and non-visible columns
if ([attributeName isEqualToString:NSAccessibilityColumnsAttribute] ||
[attributeName isEqualToString:NSAccessibilityVisibleColumnsAttribute]) {
Modified: trunk/Tools/ChangeLog (159467 => 159468)
--- trunk/Tools/ChangeLog 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/ChangeLog 2013-11-19 00:32:44 UTC (rev 159468)
@@ -1,3 +1,33 @@
+2013-11-18 Samuel White <[email protected]>
+
+ AX: Add ability to fetch only visible table rows.
+ https://bugs.webkit.org/show_bug.cgi?id=124430
+
+ Reviewed by Chris Fleizach.
+
+ Adding method to fetch array of AccessibilityUIElements to help with test brevity and test breakage. Specifically, we
+ have a good deal of churn any time we add or update an element attribute. This happens because the number of tests
+ that rely on a simple element description text dump to verify a single attribute is non trivial. So any time you
+ change add an attribute, you have to update all the tests that are now implicitly verifying this new attribute. But
+ as the test guidelines state, our tests should be more focused and specific about what they test.
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (uiElementArrayAttributeValueCallback):
+ (AccessibilityUIElement::uiElementArrayAttributeValue):
+ (AccessibilityUIElement::getJSClass):
+ * DumpRenderTree/AccessibilityUIElement.h:
+ * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+ (AccessibilityUIElement::uiElementArrayAttributeValue):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+ (WTR::AccessibilityUIElement::uiElementArrayAttributeValue):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+ (WTR::AccessibilityUIElement::uiElementArrayAttributeValue):
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::AccessibilityUIElement::getUIElementsWithAttribute):
+ (WTR::AccessibilityUIElement::uiElementArrayAttributeValue):
+
2013-11-18 Ryosuke Niwa <[email protected]>
Simplify and reformat the output of performance tests inside test runners
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (159467 => 159468)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp 2013-11-19 00:32:44 UTC (rev 159468)
@@ -462,6 +462,24 @@
return result;
}
+static JSValueRef uiElementArrayAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount != 1)
+ return JSValueMakeUndefined(context);
+
+ JSRetainPtr<JSStringRef> attribute(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+
+ Vector<AccessibilityUIElement> elements;
+ toAXElement(thisObject)->uiElementArrayAttributeValue(attribute.get(), elements);
+
+ size_t elementCount = elements.size();
+ auto valueElements = std::make_unique<JSValueRef[]>(elementCount);
+ for (size_t i = 0; i < elementCount; ++i)
+ valueElements[i] = AccessibilityUIElement::makeJSAccessibilityUIElement(context, elements[i]);
+
+ return JSObjectMakeArray(context, elementCount, valueElements.get(), exception);
+}
+
static JSValueRef uiElementAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
JSRetainPtr<JSStringRef> attribute;
@@ -1161,6 +1179,10 @@
JSStringRef AccessibilityUIElement::pathDescription() const { return 0; }
#endif
+#if !PLATFORM(MAC)
+void AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef, Vector<AccessibilityUIElement>&) const { }
+#endif
+
#if !PLATFORM(WIN)
bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)
{
@@ -1386,6 +1408,7 @@
{ "titleUIElement", titleUIElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setSelectedTextRange", setSelectedTextRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "stringAttributeValue", stringAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "uiElementArrayAttributeValue", uiElementArrayAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "uiElementAttributeValue", uiElementAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberAttributeValue", numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "boolAttributeValue", boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (159467 => 159468)
--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h 2013-11-19 00:32:44 UTC (rev 159468)
@@ -106,6 +106,7 @@
// Attributes - platform-independent implementations
JSStringRef stringAttributeValue(JSStringRef attribute);
double numberAttributeValue(JSStringRef attribute);
+ void uiElementArrayAttributeValue(JSStringRef attribute, Vector<AccessibilityUIElement>& elements) const;
AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
bool isAttributeSupported(JSStringRef attribute);
Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (159467 => 159468)
--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm 2013-11-19 00:32:44 UTC (rev 159468)
@@ -416,6 +416,15 @@
return nullptr;
}
+void AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef attribute, Vector<AccessibilityUIElement>& elements) const
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]];
+ if ([value isKindOfClass:[NSArray class]])
+ convertNSArrayToVector(value, elements);
+ END_AX_OBJC_EXCEPTIONS
+}
+
AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const
{
BEGIN_AX_OBJC_EXCEPTIONS
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (159467 => 159468)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp 2013-11-19 00:32:44 UTC (rev 159468)
@@ -80,6 +80,7 @@
void AccessibilityUIElement::showMenu() { }
void AccessibilityUIElement::press() { }
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRef) { return 0; }
+JSValueRef AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef) const { return nullptr; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(JSStringRef) const { return 0; }
double AccessibilityUIElement::numberAttributeValue(JSStringRef) { return 0; }
bool AccessibilityUIElement::boolAttributeValue(JSStringRef) { return false; }
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (159467 => 159468)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h 2013-11-19 00:32:44 UTC (rev 159468)
@@ -102,6 +102,7 @@
// Attributes - platform-independent implementations
JSRetainPtr<JSStringRef> stringAttributeValue(JSStringRef attribute);
double numberAttributeValue(JSStringRef attribute);
+ JSValueRef uiElementArrayAttributeValue(JSStringRef attribute) const;
PassRefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
bool isAttributeSupported(JSStringRef attribute);
@@ -254,6 +255,8 @@
void getLinkedUIElements(Vector<RefPtr<AccessibilityUIElement> >&);
void getDocumentLinks(Vector<RefPtr<AccessibilityUIElement> >&);
+
+ void getUIElementsWithAttribute(JSStringRef, Vector<RefPtr<AccessibilityUIElement> >&) const;
#endif
#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (159467 => 159468)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl 2013-11-19 00:32:44 UTC (rev 159468)
@@ -56,6 +56,7 @@
DOMString stringAttributeValue(DOMString attr);
double numberAttributeValue(DOMString attr);
+ object uiElementArrayAttributeValue(DOMString attr);
AccessibilityUIElement uiElementAttributeValue(DOMString attr);
boolean boolAttributeValue(DOMString attr);
boolean isAttributeSupported(DOMString attr);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (159467 => 159468)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2013-11-19 00:32:44 UTC (rev 159468)
@@ -731,6 +731,12 @@
return 0;
}
+JSValueRef AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef attribute) const
+{
+ // FIXME: implement
+ return nullptr;
+}
+
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const
{
// FIXME: implement
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (159467 => 159468)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2013-11-19 00:17:56 UTC (rev 159467)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm 2013-11-19 00:32:44 UTC (rev 159468)
@@ -226,6 +226,15 @@
END_AX_OBJC_EXCEPTIONS
}
+void AccessibilityUIElement::getUIElementsWithAttribute(JSStringRef attribute, Vector<RefPtr<AccessibilityUIElement> >& elements) const
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ id value = [m_element accessibilityAttributeValue:[NSString stringWithJSStringRef:attribute]];
+ if ([value isKindOfClass:[NSArray class]])
+ convertNSArrayToVector(value, elements);
+ END_AX_OBJC_EXCEPTIONS
+}
+
void AccessibilityUIElement::getChildren(Vector<RefPtr<AccessibilityUIElement> >& elementVector)
{
BEGIN_AX_OBJC_EXCEPTIONS
@@ -442,6 +451,22 @@
return 0;
}
+JSValueRef AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef attribute) const
+{
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+ JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+
+ Vector<RefPtr<AccessibilityUIElement> > elements;
+ getUIElementsWithAttribute(attribute, elements);
+
+ size_t elementCount = elements.size();
+ auto valueElements = std::make_unique<JSValueRef[]>(elementCount);
+ for (size_t i = 0; i < elementCount; ++i)
+ valueElements[i] = JSObjectMake(context, elements[i]->wrapperClass(), elements[i].get());
+
+ return JSObjectMakeArray(context, elementCount, valueElements.get(), 0);
+}
+
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const
{
BEGIN_AX_OBJC_EXCEPTIONS