https://bugs.webkit.org/show_bug.cgi?id=145991
Reviewed by Daniel Bates.
Source/WebCore:
Make some minor modifications to support notification handling in WKTR.
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityClickPoint]):
(-[WebAccessibilityObjectWrapper description]):
(-[WebAccessibilityObjectWrapper accessibilitySetPostedNotificationCallback:withContext:]): Deleted.
(-[WebAccessibilityObjectWrapper accessibilityPostedNotification:]): Deleted.
Tools:
Add support for WKTR iOS accessibility.
Utilize the notification handling mechanisms that Mac already uses.
Rename iphone* DRT methods to either use existing methods that are similar, or rename to more generic names.
* DumpRenderTree/AccessibilityUIElement.cpp:
(stringForSelectionCallback):
(getIdentifierCallback):
(getTraitsCallback):
(getElementTextPositionCallback):
(getElementTextLengthCallback):
(AccessibilityUIElement::getJSClass):
(getIPhoneLabelCallback): Deleted.
(getIPhoneHintCallback): Deleted.
(getIPhoneValueCallback): Deleted.
(getIPhoneIdentifierCallback): Deleted.
(getIPhoneTraitsCallback): Deleted.
(getIPhoneIsElementCallback): Deleted.
(getIPhoneElementTextPositionCallback): Deleted.
(getIPhoneElementTextLengthCallback): Deleted.
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::identifier):
(AccessibilityUIElement::traits):
(AccessibilityUIElement::elementTextPosition):
(AccessibilityUIElement::elementTextLength):
(AccessibilityUIElement::description):
(AccessibilityUIElement::orientation):
(AccessibilityUIElement::stringValue):
(AccessibilityUIElement::language):
(AccessibilityUIElement::helpText):
(AccessibilityUIElement::intValue):
(AccessibilityUIElement::isSelected):
(AccessibilityUIElement::isExpanded):
(AccessibilityUIElement::documentURI):
(AccessibilityUIElement::addNotificationListener):
(AccessibilityUIElement::removeNotificationListener):
(AccessibilityUIElement::isFocusable):
(AccessibilityUIElement::isIgnored):
(AccessibilityUIElement::hasPopup):
(AccessibilityUIElement::iphoneLabel): Deleted.
(AccessibilityUIElement::iphoneHint): Deleted.
(AccessibilityUIElement::iphoneValue): Deleted.
(AccessibilityUIElement::iphoneIdentifier): Deleted.
(AccessibilityUIElement::iphoneTraits): Deleted.
(AccessibilityUIElement::iphoneIsElement): Deleted.
(AccessibilityUIElement::iphoneElementTextPosition): Deleted.
(AccessibilityUIElement::iphoneElementTextLength): Deleted.
(_accessibilityNotificationCallback): Deleted.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::isValid):
(WTR::AccessibilityUIElement::identifier):
(WTR::AccessibilityUIElement::traits):
(WTR::AccessibilityUIElement::elementTextPosition):
(WTR::AccessibilityUIElement::elementTextLength):
(WTR::AccessibilityUIElement::stringForSelection):
(WTR::AccessibilityUIElement::elementsForRange):
(WTR::AccessibilityUIElement::increaseTextSelection):
(WTR::AccessibilityUIElement::decreaseTextSelection):
(WTR::AccessibilityUIElement::linkedElement):
(WTR::AccessibilityUIElement::headerElementAtIndex):
(WTR::AccessibilityUIElement::assistiveTechnologySimulatedFocus):
(WTR::AccessibilityUIElement::characterAtOffset):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityControllerIOS.mm:
(WTR::findAccessibleObjectById):
(WTR::AccessibilityController::accessibleElementById):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(+[NSString stringWithJSStringRef:]):
(-[NSString createJSStringRef]):
(WTR::convertNSArrayToVector):
(WTR::concatenateAttributeAndValue):
(WTR::AccessibilityUIElement::AccessibilityUIElement):
(WTR::AccessibilityUIElement::isEqual):
(WTR::AccessibilityUIElement::headerElementAtIndex):
(WTR::AccessibilityUIElement::linkedElement):
(WTR::AccessibilityUIElement::getLinkedUIElements):
(WTR::AccessibilityUIElement::elementAtPoint):
(WTR::convertElementsToObjectArray):
(WTR::AccessibilityUIElement::elementsForRange):
(WTR::AccessibilityUIElement::indexOfChild):
(WTR::AccessibilityUIElement::stringAttributeValue):
(WTR::AccessibilityUIElement::description):
(WTR::AccessibilityUIElement::orientation):
(WTR::AccessibilityUIElement::stringValue):
(WTR::AccessibilityUIElement::language):
(WTR::AccessibilityUIElement::helpText):
(WTR::AccessibilityUIElement::x):
(WTR::AccessibilityUIElement::clickPointX):
(WTR::AccessibilityUIElement::clickPointY):
(WTR::AccessibilityUIElement::intValue):
(WTR::AccessibilityUIElement::minValue):
(WTR::AccessibilityUIElement::maxValue):
(WTR::AccessibilityUIElement::valueDescription):
(WTR::AccessibilityUIElement::isSelected):
(WTR::AccessibilityUIElement::isSelectedOptionActive):
(WTR::AccessibilityUIElement::stringForRange):
(WTR::AccessibilityUIElement::attributedStringForRange):
(WTR::AccessibilityUIElement::attributesOfHeader):
(WTR::AccessibilityUIElement::traits):
(WTR::AccessibilityUIElement::identifier):
(WTR::AccessibilityUIElement::rowCount):
(WTR::AccessibilityUIElement::rowIndexRange):
(WTR::AccessibilityUIElement::columnIndexRange):
(WTR::AccessibilityUIElement::cellForColumnAndRow):
(WTR::AccessibilityUIElement::horizontalScrollbar):
(WTR::AccessibilityUIElement::documentURI):
(WTR::AccessibilityUIElement::assistiveTechnologySimulatedFocus):
(WTR::AccessibilityUIElement::increaseTextSelection):
(WTR::AccessibilityUIElement::decreaseTextSelection):
(WTR::AccessibilityUIElement::stringForSelection):
(WTR::AccessibilityUIElement::elementTextPosition):
(WTR::AccessibilityUIElement::elementTextLength):
(WTR::AccessibilityUIElement::url):
(WTR::AccessibilityUIElement::addNotificationListener):
(WTR::AccessibilityUIElement::removeNotificationListener):
(WTR::AccessibilityUIElement::isFocusable):
(WTR::AccessibilityUIElement::isIgnored):
(WTR::AccessibilityUIElement::hasPopup):
(WTR::AccessibilityUIElement::mathPrescriptsDescription):
(WTR::_CGPathEnumerationIteration):
(WTR::AccessibilityUIElement::pathDescription):
(WTR::AccessibilityUIElement::supportedActions):
LayoutTests:
Alter tests so that it addresses:
1) Utilize the new AX methods which created new expectations.
2) There were some expectations checked in with failures that are now fixed.
3) Remove failing test expectations from TestExpectations.
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/ios-simulator/accessibility: Replaced with LayoutTests/platform/ios-simulator/accessibility.
* platform/ios-simulator/accessibility/accessibility-crash-in-axcontainer-expected.txt:
* platform/ios-simulator/accessibility/accessibility-crash-in-axcontainer.html:
* platform/ios-simulator/accessibility/accessibility-hint-expected.txt:
* platform/ios-simulator/accessibility/accessibility-hint.html:
* platform/ios-simulator/accessibility/aria-label-with-internal-text-expected.txt:
* platform/ios-simulator/accessibility/aria-label-with-internal-text.html:
* platform/ios-simulator/accessibility/disabled-states-expected.txt:
* platform/ios-simulator/accessibility/disabled-states.html:
* platform/ios-simulator/accessibility/dom-focus-fires-on-correct-element-expected.txt:
* platform/ios-simulator/accessibility/dom-focus-fires-on-correct-element.html:
* platform/ios-simulator/accessibility/file-upload-button-expected.txt:
* platform/ios-simulator/accessibility/file-upload-button.html:
* platform/ios-simulator/accessibility/focus-change-notifications.html:
* platform/ios-simulator/accessibility/identifier-expected.txt:
* platform/ios-simulator/accessibility/identifier.html:
* platform/ios-simulator/accessibility/internal-link-expected.txt:
* platform/ios-simulator/accessibility/internal-link.html:
* platform/ios-simulator/accessibility/landmark-type-expected.txt:
* platform/ios-simulator/accessibility/landmark-type.html:
* platform/ios-simulator/accessibility/link-with-images-text-expected.txt:
* platform/ios-simulator/accessibility/link-with-images-text.html:
* platform/ios-simulator/accessibility/link-with-only-image-expected.txt:
* platform/ios-simulator/accessibility/link-with-only-image.html:
* platform/ios-simulator/accessibility/math-expected.txt:
* platform/ios-simulator/accessibility/math.html:
* platform/ios-simulator/accessibility/mixed-checkboxes-expected.txt:
* platform/ios-simulator/accessibility/mixed-checkboxes.html:
* platform/ios-simulator/accessibility/no-child-link-header.html:
* platform/ios-simulator/accessibility/non-contiguous-link-expected.txt:
* platform/ios-simulator/accessibility/non-contiguous-link.html:
* platform/ios-simulator/accessibility/password-value-expected.txt:
* platform/ios-simulator/accessibility/password-value.html:
* platform/ios-simulator/accessibility/placeholder-value-expected.txt:
* platform/ios-simulator/accessibility/placeholder-value.html:
* platform/ios-simulator/accessibility/popup-button-value-label-expected.txt:
* platform/ios-simulator/accessibility/popup-button-value-label.html:
* platform/ios-simulator/accessibility/progressbar-expected.txt:
* platform/ios-simulator/accessibility/progressbar.html:
* platform/ios-simulator/accessibility/radio-button-expected.txt:
* platform/ios-simulator/accessibility/radio-button.html:
* platform/ios-simulator/accessibility/secure-text-field.html:
* platform/ios-simulator/accessibility/selected-buttons-expected.txt:
* platform/ios-simulator/accessibility/svg-group-element-with-title-expected.txt:
* platform/ios-simulator/accessibility/svg-group-element-with-title.html:
* platform/ios-simulator/accessibility/tab-role-expected.txt:
* platform/ios-simulator/accessibility/tab-role.html:
* platform/ios-simulator/accessibility/tables-lists-expected.txt:
* platform/ios-simulator/accessibility/tables-lists.html:
* platform/ios-simulator/accessibility/text-marker-list-item-expected.txt:
* platform/ios-simulator/accessibility/text-marker-list-item.html:
* platform/ios-simulator/accessibility/text-marker-validation.html:
* platform/ios-simulator/accessibility/text-role-expected.txt:
* platform/ios-simulator/accessibility/text-role.html:
* platform/ios-simulator/accessibility/textfield-in-axvalue-expected.txt:
* platform/ios-simulator/accessibility/textfield-in-axvalue.html:
* platform/ios-simulator/accessibility/toggle-button.html:
* platform/ios-simulator/accessibility/url-test.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185609
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-06-15 Chris Fleizach <cfleizach@apple.com>
+
+ AX: iOS accessibility tests are not running because we need WKTR support
+ https://bugs.webkit.org/show_bug.cgi?id=145991
+
+ Reviewed by Daniel Bates.
+
+ Alter tests so that it addresses:
+ 1) Utilize the new AX methods which created new expectations.
+ 2) There were some expectations checked in with failures that are now fixed.
+ 3) Remove failing test expectations from TestExpectations.
+
+ * platform/ios-simulator-wk1/TestExpectations:
+ * platform/ios-simulator-wk2/TestExpectations:
+ * platform/ios-simulator/TestExpectations:
+ * platform/ios-simulator/accessibility: Replaced with LayoutTests/platform/ios-simulator/accessibility.
+ * platform/ios-simulator/accessibility/accessibility-crash-in-axcontainer-expected.txt:
+ * platform/ios-simulator/accessibility/accessibility-crash-in-axcontainer.html:
+ * platform/ios-simulator/accessibility/accessibility-hint-expected.txt:
+ * platform/ios-simulator/accessibility/accessibility-hint.html:
+ * platform/ios-simulator/accessibility/aria-label-with-internal-text-expected.txt:
+ * platform/ios-simulator/accessibility/aria-label-with-internal-text.html:
+ * platform/ios-simulator/accessibility/disabled-states-expected.txt:
+ * platform/ios-simulator/accessibility/disabled-states.html:
+ * platform/ios-simulator/accessibility/dom-focus-fires-on-correct-element-expected.txt:
+ * platform/ios-simulator/accessibility/dom-focus-fires-on-correct-element.html:
+ * platform/ios-simulator/accessibility/file-upload-button-expected.txt:
+ * platform/ios-simulator/accessibility/file-upload-button.html:
+ * platform/ios-simulator/accessibility/focus-change-notifications.html:
+ * platform/ios-simulator/accessibility/identifier-expected.txt:
+ * platform/ios-simulator/accessibility/identifier.html:
+ * platform/ios-simulator/accessibility/internal-link-expected.txt:
+ * platform/ios-simulator/accessibility/internal-link.html:
+ * platform/ios-simulator/accessibility/landmark-type-expected.txt:
+ * platform/ios-simulator/accessibility/landmark-type.html:
+ * platform/ios-simulator/accessibility/link-with-images-text-expected.txt:
+ * platform/ios-simulator/accessibility/link-with-images-text.html:
+ * platform/ios-simulator/accessibility/link-with-only-image-expected.txt:
+ * platform/ios-simulator/accessibility/link-with-only-image.html:
+ * platform/ios-simulator/accessibility/math-expected.txt:
+ * platform/ios-simulator/accessibility/math.html:
+ * platform/ios-simulator/accessibility/mixed-checkboxes-expected.txt:
+ * platform/ios-simulator/accessibility/mixed-checkboxes.html:
+ * platform/ios-simulator/accessibility/no-child-link-header.html:
+ * platform/ios-simulator/accessibility/non-contiguous-link-expected.txt:
+ * platform/ios-simulator/accessibility/non-contiguous-link.html:
+ * platform/ios-simulator/accessibility/password-value-expected.txt:
+ * platform/ios-simulator/accessibility/password-value.html:
+ * platform/ios-simulator/accessibility/placeholder-value-expected.txt:
+ * platform/ios-simulator/accessibility/placeholder-value.html:
+ * platform/ios-simulator/accessibility/popup-button-value-label-expected.txt:
+ * platform/ios-simulator/accessibility/popup-button-value-label.html:
+ * platform/ios-simulator/accessibility/progressbar-expected.txt:
+ * platform/ios-simulator/accessibility/progressbar.html:
+ * platform/ios-simulator/accessibility/radio-button-expected.txt:
+ * platform/ios-simulator/accessibility/radio-button.html:
+ * platform/ios-simulator/accessibility/secure-text-field.html:
+ * platform/ios-simulator/accessibility/selected-buttons-expected.txt:
+ * platform/ios-simulator/accessibility/svg-group-element-with-title-expected.txt:
+ * platform/ios-simulator/accessibility/svg-group-element-with-title.html:
+ * platform/ios-simulator/accessibility/tab-role-expected.txt:
+ * platform/ios-simulator/accessibility/tab-role.html:
+ * platform/ios-simulator/accessibility/tables-lists-expected.txt:
+ * platform/ios-simulator/accessibility/tables-lists.html:
+ * platform/ios-simulator/accessibility/text-marker-list-item-expected.txt:
+ * platform/ios-simulator/accessibility/text-marker-list-item.html:
+ * platform/ios-simulator/accessibility/text-marker-validation.html:
+ * platform/ios-simulator/accessibility/text-role-expected.txt:
+ * platform/ios-simulator/accessibility/text-role.html:
+ * platform/ios-simulator/accessibility/textfield-in-axvalue-expected.txt:
+ * platform/ios-simulator/accessibility/textfield-in-axvalue.html:
+ * platform/ios-simulator/accessibility/toggle-button.html:
+ * platform/ios-simulator/accessibility/url-test.html:
+
2015-06-16 Brent Fulgham <bfulgham@apple.com>
CSS Scroll Snap - support snapping to nested elements
inspector-protocol/debugger/regress-133182.html [ Failure ]
inspector-protocol/dom/getAccessibilityPropertiesForNode.html [ Failure ]
inspector-protocol/page/javascriptDialogEvents.html [ Failure ]
-platform/ios-simulator/accessibility/disabled-states.html [ Failure ]
platform/ios-simulator/ios/fast/text/underline-scaling.html [ Failure ]
svg/custom/linking-uri-01-b.svg [ Failure ]
compositing/backgrounds/background-image-with-negative-zindex.html [ ImageOnlyFailure ]
fast/history/history-length.html [ Crash ]
storage/websql/alter-to-info-table.html [ Crash ]
-webkit.org/b/145432 media/video-transformed-by-javascript.html [ Failure ]
\ No newline at end of file
+webkit.org/b/145432 media/video-transformed-by-javascript.html [ Failure ]
platform/ios-simulator/ios/fast/coordinates/mouse-event.html
# iOS-specific tests that time out or fail in WebKitTestRunner due to missing DRT-specific functionality:
-platform/ios-simulator/accessibility
-platform/ios-simulator/ios/accessibility
platform/ios-simulator/ios/fast/coordinates/touch-event-zoomed.html
platform/ios-simulator/ios/fast/coordinates/touch-event.html
platform/ios-simulator/ios/fast/events/touch/input-touch-target.html
storage/websql/sql-error-codes.html [ Failure ]
# iOS-specific tests that fail:
-platform/ios-simulator/accessibility/text-marker-list-item.html [ Failure ]
platform/ios-simulator/ios/compositing/overlap-page-scale.html [ Failure ]
platform/ios-simulator/ios/fast/fixed/absolute-over-fixed.html [ Failure ]
platform/ios-simulator/ios/fast/fixed/fixed-in-transform.html [ Failure ]
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS link.iphoneLabel is 'AXLabel: yellow'
-FAIL link.parentElement().iphoneLabel should be AXLabel: . Threw exception TypeError: undefined is not an object (evaluating 'link.parentElement().iphoneLabel')
+PASS link.description is 'AXLabel: yellow'
+PASS link.parentElement() == null || link.parentElement().isValid is true
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body id="body">
+<div id="container" role="group">
+
<img src="resources/cake.png" usemap="#map" id="backImg" alt="" width="225" height="206">
-<map name="map" aria-labelledby="papercolor">
+<map id="link" name="map" aria-labelledby="papercolor">
<area shape="rect" tabindex="0" alt="yellow" href="#" coords="19,28,46,52" id="yellow">
<area shape="rect" tabindex="0" alt="orange" href="#" coords="58,28,85,52" id="orange">
</map>
+</div>
<p id="description"></p>
<div id="console"></div>
if (window.accessibilityController) {
- document.getElementById("body").focus();
- var link = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
- shouldBe("link.iphoneLabel", "'AXLabel: yellow'");
+ var link = accessibilityController.accessibleElementById("container").childAtIndex(0);
+ shouldBe("link.description", "'AXLabel: yellow'");
document.getElementById("backImg").parentNode.removeChild(document.getElementById("backImg"));
// Should not crash here when asking for parentElement (even though it was removed).
- shouldBe("link.parentElement().iphoneLabel", "'AXLabel: '");
+ shouldBeTrue("link.parentElement() == null || link.parentElement().isValid");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS link.iphoneHint is 'AXHint: This is a hint'
+PASS link.helpText is 'AXHint: This is a hint'
PASS successfullyParsed is true
TEST COMPLETE
document.getElementById("link").focus();
var link = accessibilityController.focusedElement;
- shouldBe("link.iphoneHint", "'AXHint: This is a hint'");
+ shouldBe("link.helpText", "'AXHint: This is a hint'");
}
successfullyParsed = true;
Button 1 should expose alternative text only.
-PASS button1.iphoneLabel is 'AXLabel: PLAY'
+PASS button1.description is 'AXLabel: PLAY'
Button 2 should expose internal text only.
-PASS button2.iphoneLabel is 'AXLabel: 1'
+PASS button2.description is 'AXLabel: 1'
Text 1 should rely on the stringValue() in the label field.
-PASS text1.iphoneLabel is 'AXLabel: text1'
+PASS text1.description is 'AXLabel: text1'
Link1 should combine the title field and the aria-label field.
-FAIL link1.iphoneLabel should be AXLabel: link1, link1-title. Was AXLabel: link1.
+FAIL link1.description should be AXLabel: link1, link1-title. Was AXLabel: link1.
PASS successfullyParsed is true
TEST COMPLETE
var button1 = accessibilityController.accessibleElementById("button1");
debug("Button 1 should expose alternative text only.");
- shouldBe("button1.iphoneLabel", "'AXLabel: PLAY'");
+ shouldBe("button1.description", "'AXLabel: PLAY'");
var button2 = accessibilityController.accessibleElementById("button2");
debug("Button 2 should expose internal text only.");
- shouldBe("button2.iphoneLabel", "'AXLabel: 1'");
+ shouldBe("button2.description", "'AXLabel: 1'");
var text1 = accessibilityController.accessibleElementById("text1");
debug("Text 1 should rely on the stringValue() in the label field.");
- shouldBe("text1.iphoneLabel", "'AXLabel: text1'");
+ shouldBe("text1.description", "'AXLabel: text1'");
var link1 = accessibilityController.accessibleElementById("link1");
debug("Link1 should combine the title field and the aria-label field.");
- shouldBe("link1.iphoneLabel", "'AXLabel: link1, link1-title'");
+ shouldBe("link1.description", "'AXLabel: link1, link1-title'");
}
successfullyParsed = true;
-CONSOLE MESSAGE: line 26: TypeError: HTMLParagraphElement is not a function (evaluating 'description("This test thats disabled and aria-disabled change the traits returned.")')
button 1
button 2
button 3
+This test thats disabled and aria-disabled change the traits returned.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS btn1.traits != btn2.traits is true
+PASS btn2.traits == btn3.traits is true
+PASS select1.traits != select2.traits is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
-<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
-<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../resources/js-test-pre.js"></script>
<script>
var successfullyParsed = false;
-if (window.testRunner)
- testRunner.dumpAsText();
</script>
</head>
<body>
document.getElementById("button2").focus();
var btn2 = accessibilityController.focusedElement;
- shouldBe("btn1.iphoneTraits != btn2.iphoneTraits", "true");
+ shouldBe("btn1.traits != btn2.traits", "true");
document.getElementById("button3").focus();
var btn3 = accessibilityController.focusedElement;
- shouldBe("btn2.iphoneTraits == btn3.iphoneTraits", "true");
+ shouldBe("btn2.traits == btn3.traits", "true");
document.getElementById("select1").focus();
var select1 = accessibilityController.focusedElement;
document.getElementById("select2").focus();
var select2 = accessibilityController.focusedElement;
- shouldBe("select1.iphoneTraits != select2.iphoneTraits", "true");
+ shouldBe("select1.traits != select2.traits", "true");
}
successfullyParsed = true;
</script>
-<script src="../../../fast/js/resources/js-test-post.js"></script>
+<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS textInsideLink.iphoneLabel is 'AXLabel: link1'
+PASS textInsideLink.description is 'AXLabel: link1'
PASS accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideLink) is true
-PASS textInsideHeading.iphoneLabel is 'AXLabel: heading1'
+PASS textInsideHeading.description is 'AXLabel: heading1'
PASS accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideHeading) is true
PASS successfullyParsed is true
var body = accessibilityController.rootElement;
// Get access to the text inside the link.
- var textInsideLink = body.childAtIndex(0).childAtIndex(0).childAtIndex(0);
- shouldBe("textInsideLink.iphoneLabel", "'AXLabel: link1'");
+ var textInsideLink = accessibilityController.accessibleElementById("link1").childAtIndex(0);
+ shouldBe("textInsideLink.description", "'AXLabel: link1'");
// Simulate VoiceOver focus onto the element.
textInsideLink.assistiveTechnologySimulatedFocus();
// Repeat for text inside link inside heading.
// Get access to the text inside the link.
- var textInsideHeading = body.childAtIndex(1).childAtIndex(0);
- shouldBe("textInsideHeading.iphoneLabel", "'AXLabel: heading1'");
+ var textInsideHeading = accessibilityController.accessibleElementById("heading1").childAtIndex(0);
+ shouldBe("textInsideHeading.description", "'AXLabel: heading1'");
// Simulate VoiceOver focus onto the element.
textInsideHeading.assistiveTechnologySimulatedFocus();
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS button1.iphoneLabel is 'AXLabel: Choose File'
-PASS button1.iphoneValue is 'AXValue: no file selected'
+PASS button1.description is 'AXLabel: Choose File'
+PASS button1.stringValue is 'AXValue: no file selected'
PASS successfullyParsed is true
TEST COMPLETE
if (window.accessibilityController) {
var button1 = accessibilityController.accessibleElementById("file-input");
- shouldBe("button1.iphoneLabel", "'AXLabel: Choose File'");
- shouldBe("button1.iphoneValue", "'AXValue: no file selected'");
+ shouldBe("button1.description", "'AXLabel: Choose File'");
+ shouldBe("button1.stringValue", "'AXValue: no file selected'");
}
successfullyParsed = true;
var focusChangeCount = 0;
var rootElement = 0;
- function focusCallback(notification) {
+ function focusCallback(notification) {
if (notification == "AXFocusChanged") {
focusChangeCount++;
if (window.accessibilityController) {
// Make sure AX gets turned on.
- rootElement = accessibilityController.rootElement;
+ rootElement = accessibilityController.rootElement.childAtIndex(0);
window.testRunner.waitUntilDone();
var addedNotification = rootElement.addNotificationListener(focusCallback);
+ if (!addedNotification) {
+ rootElement = accessibilityController.rootElement;
+ addedNotification = rootElement.addNotificationListener(focusCallback);
+ }
+
shouldBe("addedNotification", "true");
// Switch focus from h1.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS button1.iphoneIdentifier is 'AXIdentifier: button1'
+PASS button1.identifier is 'AXIdentifier: button1'
PASS successfullyParsed is true
TEST COMPLETE
// Make sure a checkbox with a label DOES NOT have the same center point as the frame
document.getElementById("button1").focus();
var button1 = accessibilityController.focusedElement;
- shouldBe("button1.iphoneIdentifier", "'AXIdentifier: button1'");
+ shouldBe("button1.identifier", "'AXIdentifier: button1'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS link.linkedElement().iphoneLabel is 'AXLabel: Linked Element'
+PASS link.linkedElement().description is 'AXLabel: Linked Element'
PASS successfullyParsed is true
TEST COMPLETE
document.getElementById("name").focus();
var link = accessibilityController.focusedElement;
- shouldBe("link.linkedElement().iphoneLabel", "'AXLabel: Linked Element'");
+ shouldBe("link.linkedElement().description", "'AXLabel: Linked Element'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS main.iphoneLabel is 'AXLabel: main'
-PASS banner.iphoneLabel is 'AXLabel: banner'
+PASS main.description is 'AXLabel: main'
+PASS banner.description is 'AXLabel: banner'
PASS successfullyParsed is true
TEST COMPLETE
if (window.accessibilityController) {
var main = accessibilityController.accessibleElementById("main");
- shouldBe("main.iphoneLabel", "'AXLabel: main'");
+ shouldBe("main.description", "'AXLabel: main'");
var banner = accessibilityController.accessibleElementById("banner");
- shouldBe("banner.iphoneLabel", "'AXLabel: banner'");
+ shouldBe("banner.description", "'AXLabel: banner'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS obj.iphoneIsElement is true
-FAIL obj.iphoneLabel should be AXLabel: iPhoneFrom $99. Was AXLabel: iPhone From $99.
+PASS obj.isIgnored is false
+PASS obj.description is 'AXLabel: iPhone From $99'
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body>
-<a href="store.html">
+<a href="store.html" id="link">
<span>
<img src="image.gif" width=100 height=100 alt="">
<strong>iPhone</strong>From $99</span>
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
- shouldBe("obj.iphoneIsElement", "true");
- shouldBe("obj.iphoneLabel", "'AXLabel: iPhoneFrom $99'");
+ var obj = accessibilityController.accessibleElementById("link");
+ shouldBe("obj.isIgnored", "false");
+ shouldBe("obj.description", "'AXLabel: iPhone From $99'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS obj.iphoneIsElement is true
-PASS obj.iphoneLabel is 'AXLabel: Hello World'
+FAIL obj.isIgnored should be false. Was true.
+PASS obj.description is 'AXLabel: Hello World'
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body>
-<a href="store.html">
+<a href="store.html" id="link">
<img src="image.gif" width=100 height=100 alt="Hello World">
</a>
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0).childAtIndex(0);
- shouldBe("obj.iphoneIsElement", "true");
- shouldBe("obj.iphoneLabel", "'AXLabel: Hello World'");
+ var obj = accessibilityController.accessibleElementById("link");
+ shouldBeFalse("obj.isIgnored");
+ shouldBe("obj.description", "'AXLabel: Hello World'");
}
successfullyParsed = true;
PASS group.childrenCount is 5
-PASS group.childAtIndex(0).iphoneLabel is 'AXLabel: Raman scattering study of the'
-PASS group.childAtIndex(1).iphoneLabel is 'AXLabel: F e sub 1 minus x, end subscript. C o sub x, S b sub 2, math'
-PASS group.childAtIndex(2).iphoneLabel is 'AXLabel: and'
-PASS group.childAtIndex(3).iphoneLabel is 'AXLabel: open, 0 less than or equal to x less than or equal to 1, close, math'
-PASS group.childAtIndex(4).iphoneLabel is 'AXLabel: single crystals.'
-PASS group.childAtIndex(0).iphoneIsElement is true
-PASS group.childAtIndex(1).iphoneIsElement is true
-PASS group.childAtIndex(2).iphoneIsElement is true
-PASS group.childAtIndex(3).iphoneIsElement is true
-PASS group.childAtIndex(4).iphoneIsElement is true
+PASS group.childAtIndex(0).description is 'AXLabel: Raman scattering study of the'
+PASS group.childAtIndex(1).description is 'AXLabel: F e sub 1 minus x, end subscript. C o sub x, S b sub 2, math'
+PASS group.childAtIndex(2).description is 'AXLabel: and'
+PASS group.childAtIndex(3).description is 'AXLabel: open, 0 less than or equal to x less than or equal to 1, close, math'
+PASS group.childAtIndex(4).description is 'AXLabel: single crystals.'
+PASS group.childAtIndex(0).isIgnored is false
+PASS group.childAtIndex(1).isIgnored is false
+PASS group.childAtIndex(2).isIgnored is false
+PASS group.childAtIndex(3).isIgnored is false
+PASS group.childAtIndex(4).isIgnored is false
PASS successfullyParsed is true
TEST COMPLETE
document.getElementById("group").focus();
var group = accessibilityController.focusedElement;
shouldBe("group.childrenCount", "5");
- shouldBe("group.childAtIndex(0).iphoneLabel", "'AXLabel: Raman scattering study of the'");
- shouldBe("group.childAtIndex(1).iphoneLabel", "'AXLabel: F e sub 1 minus x, end subscript. C o sub x, S b sub 2, math'");
- shouldBe("group.childAtIndex(2).iphoneLabel", "'AXLabel: and'");
- shouldBe("group.childAtIndex(3).iphoneLabel", "'AXLabel: open, 0 less than or equal to x less than or equal to 1, close, math'");
- shouldBe("group.childAtIndex(4).iphoneLabel", "'AXLabel: single crystals.'");
+ shouldBe("group.childAtIndex(0).description", "'AXLabel: Raman scattering study of the'");
+ shouldBe("group.childAtIndex(1).description", "'AXLabel: F e sub 1 minus x, end subscript. C o sub x, S b sub 2, math'");
+ shouldBe("group.childAtIndex(2).description", "'AXLabel: and'");
+ shouldBe("group.childAtIndex(3).description", "'AXLabel: open, 0 less than or equal to x less than or equal to 1, close, math'");
+ shouldBe("group.childAtIndex(4).description", "'AXLabel: single crystals.'");
- shouldBeTrue("group.childAtIndex(0).iphoneIsElement");
- shouldBeTrue("group.childAtIndex(1).iphoneIsElement");
- shouldBeTrue("group.childAtIndex(2).iphoneIsElement");
- shouldBeTrue("group.childAtIndex(3).iphoneIsElement");
- shouldBeTrue("group.childAtIndex(4).iphoneIsElement");
+ shouldBeFalse("group.childAtIndex(0).isIgnored");
+ shouldBeFalse("group.childAtIndex(1).isIgnored");
+ shouldBeFalse("group.childAtIndex(2).isIgnored");
+ shouldBeFalse("group.childAtIndex(3).isIgnored");
+ shouldBeFalse("group.childAtIndex(4).isIgnored");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS accessibilityController.focusedElement.iphoneValue is 'AXValue: 0'
-PASS accessibilityController.focusedElement.iphoneValue is 'AXValue: 1'
-PASS accessibilityController.focusedElement.iphoneValue is 'AXValue: 2'
-PASS accessibilityController.focusedElement.iphoneValue is 'AXValue: 1'
-PASS accessibilityController.focusedElement.iphoneValue is 'AXValue: 0'
+PASS accessibilityController.focusedElement.stringValue is 'AXValue: 0'
+PASS accessibilityController.focusedElement.stringValue is 'AXValue: 1'
+PASS accessibilityController.focusedElement.stringValue is 'AXValue: 2'
+PASS accessibilityController.focusedElement.stringValue is 'AXValue: 1'
+PASS accessibilityController.focusedElement.stringValue is 'AXValue: 0'
PASS successfullyParsed is true
TEST COMPLETE
if (window.accessibilityController) {
document.getElementById("check1").focus();
- shouldBe("accessibilityController.focusedElement.iphoneValue", "'AXValue: 0'");
+ shouldBe("accessibilityController.focusedElement.stringValue", "'AXValue: 0'");
document.getElementById("check2").focus();
- shouldBe("accessibilityController.focusedElement.iphoneValue", "'AXValue: 1'");
+ shouldBe("accessibilityController.focusedElement.stringValue", "'AXValue: 1'");
document.getElementById("check3").focus();
- shouldBe("accessibilityController.focusedElement.iphoneValue", "'AXValue: 2'");
+ shouldBe("accessibilityController.focusedElement.stringValue", "'AXValue: 2'");
document.getElementById("check4").focus();
- shouldBe("accessibilityController.focusedElement.iphoneValue", "'AXValue: 1'");
+ shouldBe("accessibilityController.focusedElement.stringValue", "'AXValue: 1'");
document.getElementById("check5").focus();
- shouldBe("accessibilityController.focusedElement.iphoneValue", "'AXValue: 0'");
+ shouldBe("accessibilityController.focusedElement.stringValue", "'AXValue: 0'");
}
successfullyParsed = true;
</head>
<body>
-<a href="#" title="LINK"><img alt="" src="empty.png" width=100 height=100></a>
+<a id="link" href="#" title="LINK"><img alt="" src="empty.png" width=100 height=100></a>
-<div role="heading" aria-label="HEADING" style='border:1px solid black; width:100px; height:100px;'></div>
+<div id="heading" role="heading" aria-label="HEADING" style='border:1px solid black; width:100px; height:100px;'></div>
<script>
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
- var succeeded = obj.iphoneIsElement && obj.iphoneLabel == "AXLabel: LINK";
+ var obj = accessibilityController.accessibleElementById("link");
+ var succeeded = !obj.isIgnored && obj.description == "AXLabel: LINK";
// shouldBe("succeeded", "true");
var failed = false;
failed = true;
}
- obj = accessibilityController.rootElement.childAtIndex(1);
- succeeded = obj.iphoneIsElement && obj.iphoneLabel == "AXLabel: HEADING";
+ obj = accessibilityController.accessibleElementById("heading");
+ succeeded = !obj.isIgnored && obj.description == "AXLabel: HEADING";
// shouldBe("succeeded", "true");
if (!succeeded) {
-ALERT: Tests passed
This is a link that would normally appear as multiple elements.
+This test makes sure that only one element is returned for the link object, instead of many elements that are all links.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS obj.description is 'AXLabel: This is a link that would normally appear as multiple elements'
+PASS obj.isIgnored is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</head>
<body>
-<a href="#">This is a link that <b>would</b> normally appear <b>as multiple</b> elements</a>.
+<a id="link" href="#">This is a link that <b>would</b> normally appear <b>as multiple</b> elements</a>.
+
+<p id="description"></p>
+<div id="console"></div>
<script>
- //description("This test makes sure that only one element is returned for the link object, instead of many elements that are all links.");
+ description("This test makes sure that only one element is returned for the link object, instead of many elements that are all links.");
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
- var succeeded = obj.iphoneLabel == "AXLabel: This is a link that would normally appear as multiple elements";
- // shouldBe("succeeded", "true");
- var failed = false;
- if (!succeeded) {
- failed = true;
- }
-
- succeeded = obj.iphoneIsElement;
- // shouldBe("succeeded", "true");
-
- if (!succeeded) {
- failed = true;
- }
-
- if (failed)
- alert("Tests failed");
- else
- alert("Tests passed");
-
+ var obj = accessibilityController.accessibleElementById("link");
+ shouldBe("obj.description", "'AXLabel: This is a link that would normally appear as multiple elements'");
+ shouldBeFalse("obj.isIgnored");
}
successfullyParsed = true;
</script>
+<script src="../../../resources/js-test-post.js"></script>
</body>
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS pass.iphoneValue.length is password.length + axValue.length
-PASS pass.iphoneValue == password is false
+PASS pass.stringValue.length is password.length + axValue.length
+PASS pass.stringValue == password is false
PASS successfullyParsed is true
TEST COMPLETE
var pass = accessibilityController.focusedElement;
var axValue = "AXValue: ";
- shouldBe("pass.iphoneValue.length", "password.length + axValue.length");
- shouldBeFalse("pass.iphoneValue == password");
+ shouldBe("pass.stringValue.length", "password.length + axValue.length");
+ shouldBeFalse("pass.stringValue == password");
}
successfullyParsed = true;
PASS pass.stringAttributeValue('AXPlaceholderValue') is 'place'
-PASS pass.iphoneValue is 'AXValue: val'
+PASS pass.stringValue is 'AXValue: val'
PASS successfullyParsed is true
TEST COMPLETE
var pass = accessibilityController.focusedElement;
shouldBe("pass.stringAttributeValue('AXPlaceholderValue')", "'place'");
- shouldBe("pass.iphoneValue", "'AXValue: val'");
+ shouldBe("pass.stringValue", "'AXValue: val'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS pass.iphoneValue is 'AXValue: item 1'
-PASS pass.iphoneLabel is 'AXLabel: '
-PASS pass.iphoneValue is 'AXValue: item 2'
-PASS pass.iphoneLabel is 'AXLabel: Popup'
+PASS pass.stringValue is 'AXValue: item 1'
+PASS pass.description is 'AXLabel: '
+PASS pass.stringValue is 'AXValue: item 2'
+PASS pass.description is 'AXLabel: Popup'
PASS successfullyParsed is true
TEST COMPLETE
document.getElementById("pop").focus();
var pass = accessibilityController.focusedElement;
- shouldBe("pass.iphoneValue", "'AXValue: item 1'");
- shouldBe("pass.iphoneLabel", "'AXLabel: '");
+ shouldBe("pass.stringValue", "'AXValue: item 1'");
+ shouldBe("pass.description", "'AXLabel: '");
// Check the second popup button.
document.getElementById("pop2").focus();
pass = accessibilityController.focusedElement;
- shouldBe("pass.iphoneValue", "'AXValue: item 2'");
- shouldBe("pass.iphoneLabel", "'AXLabel: Popup'");
+ shouldBe("pass.stringValue", "'AXValue: item 2'");
+ shouldBe("pass.description", "'AXLabel: Popup'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS button1.iphoneLabel is 'AXLabel: Popularity'
-PASS button1.iphoneValue is 'AXValue: 5.00'
-PASS button1.iphoneIsElement is true
+PASS button1.description is 'AXLabel: Popularity'
+PASS button1.stringValue is 'AXValue: 5.00'
+PASS button1.isIgnored is false
PASS button1.minValue is 1
PASS button1.maxValue is 12
PASS successfullyParsed is true
if (window.accessibilityController) {
var button1 = accessibilityController.accessibleElementById("progressbar");
- shouldBe("button1.iphoneLabel", "'AXLabel: Popularity'");
- shouldBe("button1.iphoneValue", "'AXValue: 5.00'");
- shouldBeTrue("button1.iphoneIsElement");
+ shouldBe("button1.description", "'AXLabel: Popularity'");
+ shouldBe("button1.stringValue", "'AXValue: 5.00'");
+ shouldBeFalse("button1.isIgnored");
shouldBe("button1.minValue", "1");
shouldBe("button1.maxValue", "12");
}
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS checkbox.iphoneTraits != radio1.iphoneTraits is true
-PASS radio1.iphoneValue is 'AXValue: 1'
-PASS radio2.iphoneValue is 'AXValue: 0'
-PASS radio3.iphoneValue is 'AXValue: 0'
+PASS checkbox.traits != radio1.traits is true
+PASS radio1.stringValue is 'AXValue: 1'
+PASS radio2.stringValue is 'AXValue: 0'
+PASS radio3.stringValue is 'AXValue: 0'
PASS radio1.rowIndexRange() is '{0, 3}'
PASS radio2.rowIndexRange() is '{1, 3}'
PASS radio3.rowIndexRange() is '{2, 3}'
var radio3 = accessibilityController.focusedElement;
// Verify checkbox and radio have different traits.
- shouldBeTrue("checkbox.iphoneTraits != radio1.iphoneTraits");
+ shouldBeTrue("checkbox.traits != radio1.traits");
// Verify the value of the checked radio item is correct.
- shouldBe("radio1.iphoneValue", "'AXValue: 1'");
- shouldBe("radio2.iphoneValue", "'AXValue: 0'");
- shouldBe("radio3.iphoneValue", "'AXValue: 0'");
+ shouldBe("radio1.stringValue", "'AXValue: 1'");
+ shouldBe("radio2.stringValue", "'AXValue: 0'");
+ shouldBe("radio3.stringValue", "'AXValue: 0'");
// Verify the radio buttons are part of a group.
shouldBe("radio1.rowIndexRange()", "'{0, 3}'");
if (window.accessibilityController) {
- var passfield = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
- var textfield = accessibilityController.rootElement.childAtIndex(0).childAtIndex(1);
- var succeeded = passfield.iphoneTraits != textfield.iphoneTraits;
+ var passfield = accessibilityController.accessibleElementById("pass");
+ var textfield = accessibilityController.accessibleElementById("text");
+ var succeeded = passfield.traits != textfield.traits;
// shouldBe("succeeded", "true");
var failed = false;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-FAIL button1.isSelected should be true. Was false.
+PASS button1.isSelected is true
PASS button2.isSelected is false
-FAIL tab1.isSelected should be true. Was false.
+PASS tab1.isSelected is true
PASS tab2.isSelected is false
PASS successfullyParsed is true
Verify that the SVG group is returned as an accessible element.
-PASS group1.iphoneLabel is 'AXLabel: SVG TITLE 1'
-PASS group1.iphoneIsElement is true
+PASS group1.description is 'AXLabel: SVG TITLE 1'
+PASS group1.isIgnored is false
Verify that you can hit-test to the SVG group.
PASS hitTestElement.isEqual(group1) is true
debug("Verify that the SVG group is returned as an accessible element.");
var group1 = accessibilityController.accessibleElementById("group1");
- shouldBe("group1.iphoneLabel", "'AXLabel: SVG TITLE 1'");
- shouldBeTrue("group1.iphoneIsElement");
+ shouldBe("group1.description", "'AXLabel: SVG TITLE 1'");
+ shouldBeFalse("group1.isIgnored");
debug("\nVerify that you can hit-test to the SVG group.");
var hitTestElement = accessibilityController.elementAtPoint(group1.clickPointX, group1.clickPointY);
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS tab.iphoneLabel is 'AXLabel: tab1'
-PASS button.iphoneTraits != tab.iphoneTraits is true
-PASS tab.iphoneTraits != 0 is true
-FAIL tab.isSelected should be true. Was false.
+PASS tab.description is 'AXLabel: tab1'
+PASS button.traits != tab.traits is true
+PASS tab.traits != 0 is true
+PASS tab.isSelected is true
PASS successfullyParsed is true
TEST COMPLETE
document.getElementById("fakeButton").focus();
var tab = accessibilityController.focusedElement;
- shouldBe("tab.iphoneLabel", "'AXLabel: tab1'");
+ shouldBe("tab.description", "'AXLabel: tab1'");
// Now make sure it has the same traits as a button.
document.getElementById("realButton").focus();
var button = accessibilityController.focusedElement;
- shouldBeTrue("button.iphoneTraits != tab.iphoneTraits");
- shouldBeTrue("tab.iphoneTraits != 0");
+ shouldBeTrue("button.traits != tab.traits");
+ shouldBeTrue("tab.traits != 0");
shouldBeTrue("tab.isSelected");
}
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS listItem.iphoneTraits != initialItem.iphoneTraits is true
-PASS listItem.iphoneTraits != tableItem.iphoneTraits is true
-FAIL listItem.iphoneTraits != landmarkItem.iphoneTraits should be true. Threw exception TypeError: undefined is not an object (evaluating 'landmarkItem.iphoneTraits')
-PASS tableItem.iphoneTraits != initialItem.iphoneTraits is true
-FAIL tableItem.iphoneTraits != landmarkItem.iphoneTraits should be true. Threw exception TypeError: undefined is not an object (evaluating 'landmarkItem.iphoneTraits')
-FAIL landmarkItem.iphoneTraits != initialItem.iphoneTraits should be true. Threw exception TypeError: undefined is not an object (evaluating 'landmarkItem.iphoneTraits')
+PASS listItem.traits != initialItem.traits is true
+PASS listItem.traits != tableItem.traits is true
+PASS listItem.traits != landmarkItem.traits is true
+PASS tableItem.traits != initialItem.traits is true
+PASS tableItem.traits != landmarkItem.traits is true
+PASS landmarkItem.traits != initialItem.traits is true
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body id="body">
+<div id="content" role="group">
+
item 1
<ol>
<b>landmark 1</b>
</div>
+</div>
+
<p id="description"></p>
<div id="console"></div>
if (window.accessibilityController) {
- var root = accessibilityController.rootElement;
+ var root = accessibilityController.accessibleElementById("content");
var initialItem = root.childAtIndex(0).childAtIndex(0);
var listItem = root.childAtIndex(1).childAtIndex(0).childAtIndex(0);
var tableItem = root.childAtIndex(2).childAtIndex(0);
- var landmarkItem = root.childAtIndex(5).childAtIndex(0).childAtIndex(0);
+ var landmarkItem = root.childAtIndex(3).childAtIndex(0);
- shouldBe("listItem.iphoneTraits != initialItem.iphoneTraits", "true");
- shouldBe("listItem.iphoneTraits != tableItem.iphoneTraits", "true");
- shouldBe("listItem.iphoneTraits != landmarkItem.iphoneTraits", "true");
+ shouldBe("listItem.traits != initialItem.traits", "true");
+ shouldBe("listItem.traits != tableItem.traits", "true");
+ shouldBe("listItem.traits != landmarkItem.traits", "true");
- shouldBe("tableItem.iphoneTraits != initialItem.iphoneTraits", "true");
- shouldBe("tableItem.iphoneTraits != landmarkItem.iphoneTraits", "true");
+ shouldBe("tableItem.traits != initialItem.traits", "true");
+ shouldBe("tableItem.traits != landmarkItem.traits", "true");
- shouldBe("landmarkItem.iphoneTraits != initialItem.iphoneTraits", "true");
+ shouldBe("landmarkItem.traits != initialItem.traits", "true");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS text is '1. item 1'
+FAIL text should be 1. item 1. Was 1. .
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body id="body">
-<ol>
+<ol id="list">
<li>item 1</li>
</ol>
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement;
+ var obj = accessibilityController.accessibleElementById("list");
var text = obj.stringForRange(0, 6);
shouldBe("text", "'1. item 1'");
}
</head>
<body>
-<div>element 1</div>
-<div>element 2</div>
-<div>element 3</div>
-<div>element 4</div>
+<div id="element1">element 1</div>
+<div id="element2">element 2</div>
+<div id="element3">element 3</div>
+<div id="element4">element 4</div>
<p id="description"></p>
<div id="console"></div>
if (window.accessibilityController) {
- var obj = accessibilityController.rootElement.childAtIndex(2);
+ var obj = accessibilityController.accessibleElementById("element3");
- var textPos = obj.iphoneElementTextPosition;
- var textLen = obj.iphoneElementTextLength;
+ var textPos = obj.elementTextPosition;
+ var textLen = obj.elementTextLength;
var succeeded = textPos == 20 && textLen == 9;
shouldBe("succeeded", "true");
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS textrole.iphoneLabel is 'AXLabel: all at once'
+PASS textrole.description is 'AXLabel: all at once'
PASS successfullyParsed is true
TEST COMPLETE
if (window.accessibilityController) {
- document.getElementById("textrole").focus();
- var textrole = accessibilityController.rootElement.childAtIndex(0);
- shouldBe("textrole.iphoneLabel", "'AXLabel: all at once'");
+ var textrole = accessibilityController.accessibleElementById("textrole");
+ shouldBe("textrole.description", "'AXLabel: all at once'");
}
successfullyParsed = true;
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS textfield.iphoneLabel is 'AXLabel: Search'
-PASS textfield.iphoneValue is 'AXValue: hello'
-PASS h1.iphoneLabel is 'AXLabel: H1 Test'
-PASS h1.iphoneValue is 'AXValue: 1'
-PASS button.iphoneLabel is 'AXLabel: Button Title'
-PASS button.iphoneValue is 'AXValue: '
+PASS textfield.description is 'AXLabel: Search'
+PASS textfield.stringValue is 'AXValue: hello'
+PASS h1.description is 'AXLabel: H1 Test'
+PASS h1.stringValue is 'AXValue: 1'
+PASS button.description is 'AXLabel: Button Title'
+PASS button.stringValue is 'AXValue: '
PASS successfullyParsed is true
TEST COMPLETE
if (window.accessibilityController) {
- var textfield = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
- shouldBe("textfield.iphoneLabel", "'AXLabel: Search'");
- shouldBe("textfield.iphoneValue", "'AXValue: hello'");
+ var textfield = accessibilityController.accessibleElementById("textfield");
+ shouldBe("textfield.description", "'AXLabel: Search'");
+ shouldBe("textfield.stringValue", "'AXValue: hello'");
- var h1 = accessibilityController.rootElement.childAtIndex(1);
- shouldBe("h1.iphoneLabel", "'AXLabel: H1 Test'");
+ var h1 = accessibilityController.accessibleElementById("h1");
+ shouldBe("h1.description", "'AXLabel: H1 Test'");
// Should be 1 for the heading level.
- shouldBe("h1.iphoneValue", "'AXValue: 1'");
+ shouldBe("h1.stringValue", "'AXValue: 1'");
- var button = accessibilityController.rootElement.childAtIndex(2).childAtIndex(0);
- shouldBe("button.iphoneLabel", "'AXLabel: Button Title'");
- shouldBe("button.iphoneValue", "'AXValue: '");
+ var button = accessibilityController.accessibleElementById("button");
+ shouldBe("button.description", "'AXLabel: Button Title'");
+ shouldBe("button.stringValue", "'AXValue: '");
}
successfullyParsed = true;
if (window.accessibilityController) {
var button1 = accessibilityController.accessibleElementById("button1");
- debug("Button1 : " + button1.iphoneLabel);
- debug("Button1 : " + button1.iphoneValue);
+ debug("Button1 : " + button1.description);
+ debug("Button1 : " + button1.stringValue);
var button2 = accessibilityController.accessibleElementById("button2");
- debug("Button2 : " + button2.iphoneLabel);
- debug("Button2 : " + button2.iphoneValue);
+ debug("Button2 : " + button2.description);
+ debug("Button2 : " + button2.stringValue);
}
successfullyParsed = true;
</head>
<body id="body">
-<input type="image" src="url-test1.html"><BR>
-<a href="#url-test2.html">test</a><BR>
-<img src="url-test3.png" width=100 height=100 alt="test"><BR>
+<input id="element1" type="image" src="url-test1.html"><BR>
+<a id="element2" href="#url-test2.html">test</a><BR>
+<img id="element3" src="url-test3.png" width=100 height=100 alt="test"><BR>
<p id="description"></p>
if (window.accessibilityController) {
- var element = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+ var element = accessibilityController.accessibleElementById("element1");
shouldBe("element.url.indexOf('url-test1.html') != -1", "true");
- element = accessibilityController.rootElement.childAtIndex(0).childAtIndex(1);
+ element = accessibilityController.accessibleElementById("element2");
shouldBe("element.url.indexOf('url-test2.html') != -1", "true");
- element = accessibilityController.rootElement.childAtIndex(0).childAtIndex(2);
+ element = accessibilityController.accessibleElementById("element3");
shouldBe("element.url.indexOf('url-test3.png') != -1", "true");
}
+2015-06-15 Chris Fleizach <cfleizach@apple.com>
+
+ AX: iOS accessibility tests are not running because we need WKTR support
+ https://bugs.webkit.org/show_bug.cgi?id=145991
+
+ Reviewed by Daniel Bates.
+
+ Make some minor modifications to support notification handling in WKTR.
+
+ * accessibility/ios/AXObjectCacheIOS.mm:
+ (WebCore::AXObjectCache::postPlatformNotification):
+ (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityClickPoint]):
+ (-[WebAccessibilityObjectWrapper description]):
+ (-[WebAccessibilityObjectWrapper accessibilitySetPostedNotificationCallback:withContext:]): Deleted.
+ (-[WebAccessibilityObjectWrapper accessibilityPostedNotification:]): Deleted.
+
2015-06-16 Mark Lam <mark.lam@apple.com>
Use NakedPtr<Exception>& to return exception results.
}
// Used by DRT to know when notifications are posted.
- [obj->wrapper() accessibilityPostedNotification:notificationString];
+ if (notificationString)
+ [obj->wrapper() accessibilityPostedNotification:notificationString];
}
void AXObjectCache::postTextStateChangePlatformNotification(AccessibilityObject* object, const AXTextStateChangeIntent&, const VisibleSelection&)
return m_object->clickPoint();
}
-// These are used by DRT so that it can know when notifications are sent.
-// Since they are static, only one callback can be installed at a time (that's all DRT should need).
-typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
-static AXPostedNotificationCallback AXNotificationCallback = nullptr;
-static void* AXPostedNotificationContext = nullptr;
-
-- (void)accessibilitySetPostedNotificationCallback:(AXPostedNotificationCallback)function withContext:(void*)context
-{
- AXNotificationCallback = function;
- AXPostedNotificationContext = context;
-}
-
-- (void)accessibilityPostedNotification:(NSString *)notificationName
-{
- if (AXNotificationCallback && notificationName)
- AXNotificationCallback(self, notificationName, AXPostedNotificationContext);
-}
-
#ifndef NDEBUG
- (NSString *)description
{
+2015-06-15 Chris Fleizach <cfleizach@apple.com>
+
+ AX: iOS accessibility tests are not running because we need WKTR support
+ https://bugs.webkit.org/show_bug.cgi?id=145991
+
+ Reviewed by Daniel Bates.
+
+ Add support for WKTR iOS accessibility.
+ Utilize the notification handling mechanisms that Mac already uses.
+ Rename iphone* DRT methods to either use existing methods that are similar, or rename to more generic names.
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (stringForSelectionCallback):
+ (getIdentifierCallback):
+ (getTraitsCallback):
+ (getElementTextPositionCallback):
+ (getElementTextLengthCallback):
+ (AccessibilityUIElement::getJSClass):
+ (getIPhoneLabelCallback): Deleted.
+ (getIPhoneHintCallback): Deleted.
+ (getIPhoneValueCallback): Deleted.
+ (getIPhoneIdentifierCallback): Deleted.
+ (getIPhoneTraitsCallback): Deleted.
+ (getIPhoneIsElementCallback): Deleted.
+ (getIPhoneElementTextPositionCallback): Deleted.
+ (getIPhoneElementTextLengthCallback): Deleted.
+ * DumpRenderTree/AccessibilityUIElement.h:
+ * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+ (AccessibilityUIElement::identifier):
+ (AccessibilityUIElement::traits):
+ (AccessibilityUIElement::elementTextPosition):
+ (AccessibilityUIElement::elementTextLength):
+ (AccessibilityUIElement::description):
+ (AccessibilityUIElement::orientation):
+ (AccessibilityUIElement::stringValue):
+ (AccessibilityUIElement::language):
+ (AccessibilityUIElement::helpText):
+ (AccessibilityUIElement::intValue):
+ (AccessibilityUIElement::isSelected):
+ (AccessibilityUIElement::isExpanded):
+ (AccessibilityUIElement::documentURI):
+ (AccessibilityUIElement::addNotificationListener):
+ (AccessibilityUIElement::removeNotificationListener):
+ (AccessibilityUIElement::isFocusable):
+ (AccessibilityUIElement::isIgnored):
+ (AccessibilityUIElement::hasPopup):
+ (AccessibilityUIElement::iphoneLabel): Deleted.
+ (AccessibilityUIElement::iphoneHint): Deleted.
+ (AccessibilityUIElement::iphoneValue): Deleted.
+ (AccessibilityUIElement::iphoneIdentifier): Deleted.
+ (AccessibilityUIElement::iphoneTraits): Deleted.
+ (AccessibilityUIElement::iphoneIsElement): Deleted.
+ (AccessibilityUIElement::iphoneElementTextPosition): Deleted.
+ (AccessibilityUIElement::iphoneElementTextLength): Deleted.
+ (_accessibilityNotificationCallback): Deleted.
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+ (WTR::AccessibilityUIElement::isValid):
+ (WTR::AccessibilityUIElement::identifier):
+ (WTR::AccessibilityUIElement::traits):
+ (WTR::AccessibilityUIElement::elementTextPosition):
+ (WTR::AccessibilityUIElement::elementTextLength):
+ (WTR::AccessibilityUIElement::stringForSelection):
+ (WTR::AccessibilityUIElement::elementsForRange):
+ (WTR::AccessibilityUIElement::increaseTextSelection):
+ (WTR::AccessibilityUIElement::decreaseTextSelection):
+ (WTR::AccessibilityUIElement::linkedElement):
+ (WTR::AccessibilityUIElement::headerElementAtIndex):
+ (WTR::AccessibilityUIElement::assistiveTechnologySimulatedFocus):
+ (WTR::AccessibilityUIElement::characterAtOffset):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityControllerIOS.mm:
+ (WTR::findAccessibleObjectById):
+ (WTR::AccessibilityController::accessibleElementById):
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (+[NSString stringWithJSStringRef:]):
+ (-[NSString createJSStringRef]):
+ (WTR::convertNSArrayToVector):
+ (WTR::concatenateAttributeAndValue):
+ (WTR::AccessibilityUIElement::AccessibilityUIElement):
+ (WTR::AccessibilityUIElement::isEqual):
+ (WTR::AccessibilityUIElement::headerElementAtIndex):
+ (WTR::AccessibilityUIElement::linkedElement):
+ (WTR::AccessibilityUIElement::getLinkedUIElements):
+ (WTR::AccessibilityUIElement::elementAtPoint):
+ (WTR::convertElementsToObjectArray):
+ (WTR::AccessibilityUIElement::elementsForRange):
+ (WTR::AccessibilityUIElement::indexOfChild):
+ (WTR::AccessibilityUIElement::stringAttributeValue):
+ (WTR::AccessibilityUIElement::description):
+ (WTR::AccessibilityUIElement::orientation):
+ (WTR::AccessibilityUIElement::stringValue):
+ (WTR::AccessibilityUIElement::language):
+ (WTR::AccessibilityUIElement::helpText):
+ (WTR::AccessibilityUIElement::x):
+ (WTR::AccessibilityUIElement::clickPointX):
+ (WTR::AccessibilityUIElement::clickPointY):
+ (WTR::AccessibilityUIElement::intValue):
+ (WTR::AccessibilityUIElement::minValue):
+ (WTR::AccessibilityUIElement::maxValue):
+ (WTR::AccessibilityUIElement::valueDescription):
+ (WTR::AccessibilityUIElement::isSelected):
+ (WTR::AccessibilityUIElement::isSelectedOptionActive):
+ (WTR::AccessibilityUIElement::stringForRange):
+ (WTR::AccessibilityUIElement::attributedStringForRange):
+ (WTR::AccessibilityUIElement::attributesOfHeader):
+ (WTR::AccessibilityUIElement::traits):
+ (WTR::AccessibilityUIElement::identifier):
+ (WTR::AccessibilityUIElement::rowCount):
+ (WTR::AccessibilityUIElement::rowIndexRange):
+ (WTR::AccessibilityUIElement::columnIndexRange):
+ (WTR::AccessibilityUIElement::cellForColumnAndRow):
+ (WTR::AccessibilityUIElement::horizontalScrollbar):
+ (WTR::AccessibilityUIElement::documentURI):
+ (WTR::AccessibilityUIElement::assistiveTechnologySimulatedFocus):
+ (WTR::AccessibilityUIElement::increaseTextSelection):
+ (WTR::AccessibilityUIElement::decreaseTextSelection):
+ (WTR::AccessibilityUIElement::stringForSelection):
+ (WTR::AccessibilityUIElement::elementTextPosition):
+ (WTR::AccessibilityUIElement::elementTextLength):
+ (WTR::AccessibilityUIElement::url):
+ (WTR::AccessibilityUIElement::addNotificationListener):
+ (WTR::AccessibilityUIElement::removeNotificationListener):
+ (WTR::AccessibilityUIElement::isFocusable):
+ (WTR::AccessibilityUIElement::isIgnored):
+ (WTR::AccessibilityUIElement::hasPopup):
+ (WTR::AccessibilityUIElement::mathPrescriptsDescription):
+ (WTR::_CGPathEnumerationIteration):
+ (WTR::AccessibilityUIElement::pathDescription):
+ (WTR::AccessibilityUIElement::supportedActions):
+
2015-06-16 Mark Lam <mark.lam@apple.com>
Use NakedPtr<Exception>& to return exception results.
return JSValueMakeString(context, labelString.get());
}
-static JSValueRef getIPhoneLabelCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+static JSValueRef getIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
- JSRetainPtr<JSStringRef> labelString(Adopt, toAXElement(thisObject)->iphoneLabel());
- return JSValueMakeString(context, labelString.get());
-}
-
-static JSValueRef getIPhoneHintCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
-{
- JSRetainPtr<JSStringRef> hintString(Adopt, toAXElement(thisObject)->iphoneHint());
- return JSValueMakeString(context, hintString.get());
-}
-
-static JSValueRef getIPhoneValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
-{
- JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneValue());
- return JSValueMakeString(context, valueString.get());
-}
-
-static JSValueRef getIPhoneIdentifierCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
-{
- JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneIdentifier());
+ JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->identifier());
return JSValueMakeString(context, valueString.get());
}
-static JSValueRef getIPhoneTraitsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+static JSValueRef getTraitsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
- JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->iphoneTraits());
+ JSRetainPtr<JSStringRef> valueString(Adopt, toAXElement(thisObject)->traits());
return JSValueMakeString(context, valueString.get());
}
-static JSValueRef getIPhoneIsElementCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
-{
- return JSValueMakeBoolean(context, toAXElement(thisObject)->iphoneIsElement());
-}
-
-static JSValueRef getIPhoneElementTextPositionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+static JSValueRef getElementTextPositionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
- return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextPosition());
+ return JSValueMakeNumber(context, toAXElement(thisObject)->elementTextPosition());
}
-static JSValueRef getIPhoneElementTextLengthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+static JSValueRef getElementTextLengthCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
- return JSValueMakeNumber(context, toAXElement(thisObject)->iphoneElementTextLength());
+ return JSValueMakeNumber(context, toAXElement(thisObject)->elementTextLength());
}
#endif // PLATFORM(IOS)
{ "startTextMarker", startTextMarkerCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "endTextMarker", endTextMarkerCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
#if PLATFORM(IOS)
- { "iphoneLabel", getIPhoneLabelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneHint", getIPhoneHintCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneValue", getIPhoneValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneIdentifier", getIPhoneIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneTraits", getIPhoneTraitsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneIsElement", getIPhoneIsElementCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneElementTextPosition", getIPhoneElementTextPositionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
- { "iphoneElementTextLength", getIPhoneElementTextLengthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "identifier", getIdentifierCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "traits", getTraitsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "elementTextPosition", getElementTextPositionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "elementTextLength", getElementTextLengthCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "stringForSelection", stringForSelectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
#endif // PLATFORM(IOS)
#if PLATFORM(MAC) && !PLATFORM(IOS)
void removeNotificationListener();
#if PLATFORM(IOS)
- JSStringRef iphoneLabel();
- JSStringRef iphoneValue();
- JSStringRef iphoneTraits();
- JSStringRef iphoneHint();
- JSStringRef iphoneIdentifier();
- bool iphoneIsElement();
- int iphoneElementTextPosition();
- int iphoneElementTextLength();
+ JSStringRef traits();
+ JSStringRef identifier();
+ int elementTextPosition();
+ int elementTextLength();
AccessibilityUIElement headerElementAtIndex(unsigned);
// This will simulate the accessibilityDidBecomeFocused API in UIKit.
void assistiveTechnologySimulatedFocus();
static JSClassRef getJSClass();
PlatformUIElement m_element;
-#if PLATFORM(IOS)
- JSObjectRef m_notificationFunctionCallback;
-#elif PLATFORM(MAC)
+#if PLATFORM(COCOA)
// A retained, platform specific object used to help manage notifications for this object.
NotificationHandler m_notificationHandler;
#endif
#import "AccessibilityUIElement.h"
#import "AccessibilityCommonMac.h"
+#import "AccessibilityNotificationHandler.h"
#import <Foundation/Foundation.h>
#import <JavaScriptCore/JSRetainPtr.h>
#import <JavaScriptCore/JSStringRef.h>
- (CGFloat)_accessibilityMaxValue;
- (void)_accessibilitySetValue:(NSString *)value;
- (void)_accessibilityActivate;
+- (UIAccessibilityTraits)_axSelectedTrait;
@end
@interface NSObject (WebAccessibilityObjectWrapperPrivate)
#pragma mark iPhone Attributes
-JSStringRef AccessibilityUIElement::iphoneLabel()
-{
- return concatenateAttributeAndValue(@"AXLabel", [m_element accessibilityLabel]);
-}
-
-JSStringRef AccessibilityUIElement::iphoneHint()
-{
- return concatenateAttributeAndValue(@"AXHint", [m_element accessibilityHint]);
-}
-
-JSStringRef AccessibilityUIElement::iphoneValue()
-{
- return concatenateAttributeAndValue(@"AXValue", [m_element accessibilityValue]);
-}
-
-JSStringRef AccessibilityUIElement::iphoneIdentifier()
+JSStringRef AccessibilityUIElement::identifier()
{
return concatenateAttributeAndValue(@"AXIdentifier", [m_element accessibilityIdentifier]);
}
-JSStringRef AccessibilityUIElement::iphoneTraits()
+JSStringRef AccessibilityUIElement::traits()
{
return concatenateAttributeAndValue(@"AXTraits", [NSString stringWithFormat:@"%qu", [m_element accessibilityTraits]]);
}
-bool AccessibilityUIElement::iphoneIsElement()
-{
- return [m_element isAccessibilityElement];
-}
-
-int AccessibilityUIElement::iphoneElementTextPosition()
+int AccessibilityUIElement::elementTextPosition()
{
NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue];
return range.location;
}
-int AccessibilityUIElement::iphoneElementTextLength()
+int AccessibilityUIElement::elementTextLength()
{
NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue];
return range.length;
JSStringRef AccessibilityUIElement::description()
{
- return JSStringCreateWithCharacters(0, 0);
-}
+ return concatenateAttributeAndValue(@"AXLabel", [m_element accessibilityLabel]);
+}
JSStringRef AccessibilityUIElement::orientation() const
{
JSStringRef AccessibilityUIElement::stringValue()
{
- return JSStringCreateWithCharacters(0, 0);
+ return concatenateAttributeAndValue(@"AXValue", [m_element accessibilityValue]);
}
JSStringRef AccessibilityUIElement::language()
JSStringRef AccessibilityUIElement::helpText() const
{
- return JSStringCreateWithCharacters(0, 0);
+ return concatenateAttributeAndValue(@"AXHint", [m_element accessibilityHint]);
}
double AccessibilityUIElement::intValue() const
bool AccessibilityUIElement::isSelected() const
{
UIAccessibilityTraits traits = [m_element accessibilityTraits];
- return (traits & UIAccessibilityTraitSelected);
+ bool result = (traits & [m_element _axSelectedTrait]) == [m_element _axSelectedTrait];
+ return result;
}
bool AccessibilityUIElement::isExpanded() const
return JSStringCreateWithCharacters(0, 0);
}
-static void _accessibilityNotificationCallback(id element, NSString* notification, void* context)
-{
- if (!context)
- return;
-
- JSObjectRef functionCallback = static_cast<JSObjectRef>(context);
-
- JSRetainPtr<JSStringRef> jsNotification(Adopt, [notification createJSStringRef]);
- JSValueRef argument = JSValueMakeString([mainFrame globalContext], jsNotification.get());
- JSObjectCallAsFunction([mainFrame globalContext], functionCallback, NULL, 1, &argument, NULL);
-}
-
bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback)
{
if (!functionCallback)
return false;
- m_notificationFunctionCallback = functionCallback;
- [platformUIElement() accessibilitySetPostedNotificationCallback:_accessibilityNotificationCallback withContext:reinterpret_cast<void*>(m_notificationFunctionCallback)];
- return true;
+ // iOS programmers should not be adding more than one notification listener per element.
+ // Other platforms may be different.
+ if (m_notificationHandler)
+ return false;
+ m_notificationHandler = [[AccessibilityNotificationHandler alloc] init];
+ [m_notificationHandler setPlatformElement:platformUIElement()];
+ [m_notificationHandler setCallback:functionCallback];
+ [m_notificationHandler startObserving];
+
+ return true;
}
void AccessibilityUIElement::removeNotificationListener()
{
- m_notificationFunctionCallback = 0;
- [platformUIElement() accessibilitySetPostedNotificationCallback:nil withContext:nil];
+ // iOS programmers should not be trying to remove a listener that's already removed.
+ ASSERT(m_notificationHandler);
+
+ [m_notificationHandler stopObserving];
+ [m_notificationHandler release];
+ m_notificationHandler = nil;
}
bool AccessibilityUIElement::isFocusable() const
bool AccessibilityUIElement::isIgnored() const
{
- // FIXME: implement
- return false;
+ return ![m_element isAccessibilityElement];
}
bool AccessibilityUIElement::hasPopup() const
return m_element;
}
+// iOS specific methods
+#if !PLATFORM(IOS)
+JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier() { return nullptr; }
+JSRetainPtr<JSStringRef> AccessibilityUIElement::traits() { return nullptr; }
+int AccessibilityUIElement::elementTextPosition() { return 0; }
+int AccessibilityUIElement::elementTextLength() { return 0; }
+JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForSelection() { return nullptr; }
+JSValueRef AccessibilityUIElement::elementsForRange(unsigned, unsigned) { return nullptr; }
+void AccessibilityUIElement::increaseTextSelection() { }
+void AccessibilityUIElement::decreaseTextSelection() { }
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedElement() { return nullptr; }
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::headerElementAtIndex(unsigned) { return nullptr; }
+void AccessibilityUIElement::assistiveTechnologySimulatedFocus() { return; }
+#endif
+
// Unsupported methods on various platforms. As they're implemented on other platforms this list should be modified.
#if (!PLATFORM(GTK) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
JSRetainPtr<JSStringRef> AccessibilityUIElement::characterAtOffset(int) { return 0; }
// Make sure you call remove, because you can't rely on objects being deallocated in a timely fashion.
bool removeNotificationListener();
+ JSRetainPtr<JSStringRef> identifier();
+ JSRetainPtr<JSStringRef> traits();
+ int elementTextPosition();
+ int elementTextLength();
+ JSRetainPtr<JSStringRef> stringForSelection();
+ JSValueRef elementsForRange(unsigned location, unsigned length);
+ void increaseTextSelection();
+ void decreaseTextSelection();
+ PassRefPtr<AccessibilityUIElement> linkedElement();
+ PassRefPtr<AccessibilityUIElement> headerElementAtIndex(unsigned index);
+ void assistiveTechnologySimulatedFocus();
+
private:
AccessibilityUIElement(PlatformUIElement);
AccessibilityUIElement(const AccessibilityUIElement&);
readonly attribute DOMString mathPrescriptsDescription;
readonly attribute DOMString pathDescription;
-
+
+ // iOS specific accessibility methods.
+ readonly attribute DOMString identifier;
+ readonly attribute DOMString traits;
+ readonly attribute int elementTextPosition;
+ readonly attribute int elementTextLength;
+ readonly attribute DOMString stringForSelection;
+ object elementsForRange(unsigned long location, unsigned long length);
+ void increaseTextSelection();
+ void decreaseTextSelection();
+ AccessibilityUIElement linkedElement();
+ AccessibilityUIElement headerElementAtIndex(unsigned long index);
+ // This will simulate the accessibilityDidBecomeFocused API in UIKit.
+ void assistiveTechnologySimulatedFocus();
+
// Notification support.
boolean addNotificationListener(object callbackFunction);
boolean removeNotificationListener();
static id findAccessibleObjectById(id obj, NSString *idAttribute)
{
- return 0;
+ id objIdAttribute = [obj accessibilityIdentifier];
+ if ([objIdAttribute isKindOfClass:[NSString class]] && [objIdAttribute isEqualToString:idAttribute])
+ return obj;
+
+ NSUInteger childrenCount = [obj accessibilityElementCount];
+ for (NSUInteger i = 0; i < childrenCount; ++i) {
+ id result = findAccessibleObjectById([obj accessibilityElementAtIndex:i], idAttribute);
+ if (result)
+ return result;
+ }
+
+ return nil;
}
PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef idAttribute)
#import "AccessibilityUIElement.h"
#import "InjectedBundle.h"
#import "InjectedBundlePage.h"
+#import <Foundation/Foundation.h>
+#import <JavaScriptCore/JSRetainPtr.h>
+#import <JavaScriptCore/JSStringRef.h>
+#import <JavaScriptCore/JSStringRefCF.h>
#import <UIKit/UIKit.h>
+#import <WebCore/TextGranularity.h>
+#import <WebKit/WKBundleFrame.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Vector.h>
+
+typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
+
+@interface NSObject (UIAccessibilityHidden)
+- (id)accessibilityHitTest:(CGPoint)point;
+- (id)accessibilityLinkedElement;
+- (NSRange)accessibilityColumnRange;
+- (NSRange)accessibilityRowRange;
+- (id)accessibilityElementForRow:(NSInteger)row andColumn:(NSInteger)column;
+- (NSURL *)accessibilityURL;
+- (NSArray *)accessibilityHeaderElements;
+- (NSString *)accessibilityPlaceholderValue;
+- (NSString *)stringForRange:(NSRange)range;
+- (NSArray *)elementsForRange:(NSRange)range;
+- (NSString *)selectionRangeString;
+- (CGPoint)accessibilityClickPoint;
+- (void)accessibilityModifySelection:(WebCore::TextGranularity)granularity increase:(BOOL)increase;
+- (void)accessibilitySetPostedNotificationCallback:(AXPostedNotificationCallback)function withContext:(void*)context;
+- (CGFloat)_accessibilityMinValue;
+- (CGFloat)_accessibilityMaxValue;
+- (void)_accessibilitySetValue:(NSString *)value;
+- (void)_accessibilityActivate;
+- (UIAccessibilityTraits)_axSelectedTrait;
+@end
+
+@interface NSObject (WebAccessibilityObjectWrapperPrivate)
+- (CGPathRef)_accessibilityPath;
+@end
+
+@implementation NSString (JSStringRefAdditions)
+
++ (NSString *)stringWithJSStringRef:(JSStringRef)jsStringRef
+{
+ if (!jsStringRef)
+ return nil;
+
+ CFStringRef cfString = JSStringCopyCFString(kCFAllocatorDefault, jsStringRef);
+ return [(NSString *)cfString autorelease];
+}
+
+- (JSStringRef)createJSStringRef
+{
+ return JSStringCreateWithCFString((CFStringRef)self);
+}
+
+@end
namespace WTR {
+static void convertNSArrayToVector(NSArray* array, Vector<RefPtr<AccessibilityUIElement> >& elementVector)
+{
+ NSUInteger count = [array count];
+ for (NSUInteger i = 0; i < count; ++i)
+ elementVector.append(AccessibilityUIElement::create([array objectAtIndex:i]));
+}
+
+static JSStringRef concatenateAttributeAndValue(NSString* attribute, NSString* value)
+{
+ Vector<UniChar> buffer([attribute length]);
+ [attribute getCharacters:buffer.data()];
+ buffer.append(':');
+ buffer.append(' ');
+
+ Vector<UniChar> valueBuffer([value length]);
+ [value getCharacters:valueBuffer.data()];
+ buffer.appendVector(valueBuffer);
+
+ return JSStringCreateWithCharacters(buffer.data(), buffer.size());
+}
+
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
: m_element(element)
{
return platformUIElement() == otherElement->platformUIElement();
}
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::headerElementAtIndex(unsigned index)
+{
+ NSArray *headers = [m_element accessibilityHeaderElements];
+ if (index < [headers count])
+ return AccessibilityUIElement::create([headers objectAtIndex:index]);
+
+ return nullptr;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedElement()
+{
+ id linkedElement = [m_element accessibilityLinkedElement];
+ if (linkedElement)
+ return AccessibilityUIElement::create(linkedElement);
+
+ return nullptr;
+}
+
void AccessibilityUIElement::getLinkedUIElements(Vector<RefPtr<AccessibilityUIElement> >& elementVector)
{
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::elementAtPoint(int x, int y)
{
- return 0;
+ id element = [m_element accessibilityHitTest:CGPointMake(x, y)];
+ if (!element)
+ return nil;
+
+ return AccessibilityUIElement::create(element);
+}
+
+static JSValueRef convertElementsToObjectArray(JSContextRef context, Vector<RefPtr<AccessibilityUIElement>>& elements)
+{
+ JSValueRef arrayResult = JSObjectMakeArray(context, 0, nullptr, nullptr);
+ JSObjectRef arrayObj = JSValueToObject(context, arrayResult, nullptr);
+ size_t elementCount = elements.size();
+ for (size_t i = 0; i < elementCount; ++i)
+ JSObjectSetPropertyAtIndex(context, arrayObj, i, JSObjectMake(context, elements[i]->wrapperClass(), elements[i].get()), nullptr);
+
+ return arrayResult;
+}
+
+JSValueRef AccessibilityUIElement::elementsForRange(unsigned location, unsigned length)
+{
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+
+ NSArray *elementsForRange = [m_element elementsForRange:NSMakeRange(location, length)];
+ Vector<RefPtr<AccessibilityUIElement>> elements;
+ convertNSArrayToVector(elementsForRange, elements);
+ return convertElementsToObjectArray(context, elements);
}
unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element)
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
{
+ if (JSStringIsEqualToUTF8CString(attribute, "AXPlaceholderValue"))
+ return [[m_element accessibilityPlaceholderValue] createJSStringRef];
+
return JSStringCreateWithCharacters(0, 0);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::description()
{
- return JSStringCreateWithCharacters(0, 0);
+ return concatenateAttributeAndValue(@"AXLabel", [m_element accessibilityLabel]);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::orientation() const
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringValue()
{
- return JSStringCreateWithCharacters(0, 0);
+ return concatenateAttributeAndValue(@"AXValue", [m_element accessibilityValue]);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::language()
JSRetainPtr<JSStringRef> AccessibilityUIElement::helpText() const
{
- return JSStringCreateWithCharacters(0, 0);
+ return concatenateAttributeAndValue(@"AXHint", [m_element accessibilityHint]);
}
double AccessibilityUIElement::x()
double AccessibilityUIElement::clickPointX()
{
- return 0;
+ return [m_element accessibilityClickPoint].x;
}
double AccessibilityUIElement::clickPointY()
{
- return 0;
+ return [m_element accessibilityClickPoint].y;
}
double AccessibilityUIElement::intValue() const
double AccessibilityUIElement::minValue()
{
- return 0;
+ return [m_element _accessibilityMinValue];
}
double AccessibilityUIElement::maxValue()
{
- return 0;
+ return [m_element _accessibilityMaxValue];
}
+
JSRetainPtr<JSStringRef> AccessibilityUIElement::valueDescription()
{
return JSStringCreateWithCharacters(0, 0);
bool AccessibilityUIElement::isSelected() const
{
UIAccessibilityTraits traits = [m_element accessibilityTraits];
- return (traits & UIAccessibilityTraitSelected);
+ return (traits & [m_element _axSelectedTrait]) == [m_element _axSelectedTrait];
}
bool AccessibilityUIElement::isSelectedOptionActive() const
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned location, unsigned length)
{
- return JSStringCreateWithCharacters(0, 0);
+ NSString *stringForRange = [m_element stringForRange:NSMakeRange(location, length)];
+ if (!stringForRange)
+ return nullptr;
+
+ return [stringForRange createJSStringRef];
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
return JSStringCreateWithCharacters(0, 0);
}
+JSRetainPtr<JSStringRef> AccessibilityUIElement::traits()
+{
+ return concatenateAttributeAndValue(@"AXTraits", [NSString stringWithFormat:@"%qu", [m_element accessibilityTraits]]);
+}
+
+JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier()
+{
+ return concatenateAttributeAndValue(@"AXIdentifier", [m_element accessibilityIdentifier]);
+}
+
int AccessibilityUIElement::rowCount()
{
return -1;
JSRetainPtr<JSStringRef> AccessibilityUIElement::rowIndexRange()
{
- return JSStringCreateWithCharacters(0, 0);
+ NSRange range = [m_element accessibilityRowRange];
+ NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", (unsigned long)range.location, (unsigned long)range.length];
+ return [rangeDescription createJSStringRef];
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::columnIndexRange()
{
- return JSStringCreateWithCharacters(0, 0);
+ NSRange range = [m_element accessibilityColumnRange];
+ NSMutableString* rangeDescription = [NSMutableString stringWithFormat:@"{%lu, %lu}", (unsigned long)range.location, (unsigned long)range.length];
+ return [rangeDescription createJSStringRef];
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::cellForColumnAndRow(unsigned col, unsigned row)
{
- return 0;
+ return AccessibilityUIElement::create([m_element accessibilityElementForRow:row andColumn:col]);
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::horizontalScrollbar() const
return JSStringCreateWithCharacters(0, 0);
}
+void AccessibilityUIElement::assistiveTechnologySimulatedFocus()
+{
+ [m_element accessibilityElementDidBecomeFocused];
+}
+
+void AccessibilityUIElement::increaseTextSelection()
+{
+ [m_element accessibilityModifySelection:WebCore::CharacterGranularity increase:YES];
+}
+
+void AccessibilityUIElement::decreaseTextSelection()
+{
+ [m_element accessibilityModifySelection:WebCore::CharacterGranularity increase:NO];
+}
+
+JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForSelection()
+{
+ NSString *stringForRange = [m_element selectionRangeString];
+ if (!stringForRange)
+ return nullptr;
+
+ return [stringForRange createJSStringRef];
+}
+
+int AccessibilityUIElement::elementTextPosition()
+{
+ NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue];
+ return range.location;
+}
+
+int AccessibilityUIElement::elementTextLength()
+{
+ NSRange range = [[m_element valueForKey:@"elementTextRange"] rangeValue];
+ return range.length;
+}
+
JSRetainPtr<JSStringRef> AccessibilityUIElement::url()
{
- return JSStringCreateWithCharacters(0, 0);
+ NSURL *url = [m_element accessibilityURL];
+ return [[url absoluteString] createJSStringRef];
}
bool AccessibilityUIElement::addNotificationListener(JSValueRef functionCallback)
{
- return false;
+ if (!functionCallback)
+ return false;
+
+ // iOS programmers should not be adding more than one notification listener per element.
+ // Other platforms may be different.
+ if (m_notificationHandler)
+ return false;
+ m_notificationHandler = [[AccessibilityNotificationHandler alloc] init];
+ [m_notificationHandler setPlatformElement:platformUIElement()];
+ [m_notificationHandler setCallback:functionCallback];
+ [m_notificationHandler startObserving];
+
+ return true;
}
bool AccessibilityUIElement::removeNotificationListener()
{
- return false;
+ // iOS programmers should not be trying to remove a listener that's already removed.
+ ASSERT(m_notificationHandler);
+
+ [m_notificationHandler stopObserving];
+ [m_notificationHandler release];
+ m_notificationHandler = nil;
+
+ return true;
}
bool AccessibilityUIElement::isFocusable() const
bool AccessibilityUIElement::isIgnored() const
{
- return false;
+ bool isAccessibilityElement = [m_element isAccessibilityElement];
+ return !isAccessibilityElement;
}
bool AccessibilityUIElement::hasPopup() const
return 0;
}
+static void _CGPathEnumerationIteration(void *info, const CGPathElement *element)
+{
+ NSMutableString *result = (NSMutableString *)info;
+ switch (element->type) {
+ case kCGPathElementMoveToPoint:
+ [result appendString:@"\tMove to point\n"];
+ break;
+ case kCGPathElementAddLineToPoint:
+ [result appendString:@"\tLine to\n"];
+ break;
+ case kCGPathElementAddQuadCurveToPoint:
+ [result appendString:@"\tQuad curve to\n"];
+ break;
+ case kCGPathElementAddCurveToPoint:
+ [result appendString:@"\tCurve to\n"];
+ break;
+ case kCGPathElementCloseSubpath:
+ [result appendString:@"\tClose\n"];
+ break;
+ }
+}
+
JSRetainPtr<JSStringRef> AccessibilityUIElement::pathDescription() const
{
- return 0;
+ NSMutableString *result = [NSMutableString stringWithString:@"\nStart Path\n"];
+ CGPathRef pathRef = [m_element _accessibilityPath];
+
+ CGPathApply(pathRef, result, _CGPathEnumerationIteration);
+
+ return [result createJSStringRef];
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const