Skip to content
Permalink
Browse files
AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject…
… name and description

https://bugs.webkit.org/show_bug.cgi?id=157822

Reviewed by Chris Fleizach.

Source/WebCore:

Remove the old code which was overriding WebCore Accessibility and always use
AccessibilityText.

If the AccessibilityText's textSource is HelpText or SummaryText, it should be exposed
as the AtkObject description. If the textSource is TitleTagText and there is no other
text alternative, the value should also be exposed in this fashion. Note that AtkObject's
description property is equivalent to AXAPI's AXHelp property.

If the AccessibilityText's textSource is anything other than the above, the first
non-empty value should be exposed as the AtkObject name. Depending on the source of
the name content, AtkObject's name property can be the equivalent of AXAPI's AXTitle.
However, most of the time, AtkObject's name property is equivalent to AXAPI's
AXDescription property.

By making these changes, what WebKit exposes for ATK is now extremely similar to what
WebKit exposes on the Mac (modulo the property names) and also with what is defined in
the HTML Accessibility and Accessible Name and Description Computation API mappings specs.

Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because
asking for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject
description in GNU/Linux. But as indicated above, what ATK calls a "description" is what
the Mac calls "help."

Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal
with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187
has been opened for that task.) In the meantime, the existing tests have been given platform
checks to ask for the right property on each platform. This was done in such a way as to not
require other (non-ATK) platforms change their current expectations files.

* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetName):
(webkitAccessibleGetDescription):

Tools:

Fix AccessibilityUIElement::helpText() so that it returns an empty string rather than
nullptr upon failure.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::helpText):

LayoutTests:

Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because asking
for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject description in
GNU/Linux. But what the Mac calls a "description" is what ATK calls a "name." What ATK calls a
"description" is what the Mac calls "help."

Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal with
with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187 has
been opened for that task.) In the meantime, the existing tests have been given platform checks
to ask for the right property on each platform. This was done in such a way as to not require
other (non-ATK) platforms change their current expectations files.

In addition to the above, three previously-failing tests were corrected and are now passing.

* accessibility/alt-tag-on-image-with-nonimage-role.html:
* accessibility/aria-help.html:
* accessibility/aria-label.html:
* accessibility/aria-labeled-with-hidden-node.html:
* accessibility/aria-labelledby-on-input.html:
* accessibility/aria-labelledby-overrides-aria-labeledby.html:
* accessibility/aria-labelledby-overrides-label.html:
* accessibility/aria-labelledby-stay-within.html:
* accessibility/aria-labelledby-with-descendants.html:
* accessibility/aria-namefrom-author.html:
* accessibility/aria-option-role.html:
* accessibility/canvas-description-and-role.html:
* accessibility/empty-image-with-title.html:
* accessibility/fieldset-element.html:
* accessibility/focusable-div.html:
* accessibility/gtk/no-notification-for-unrendered-iframe-children-expected.txt:
* accessibility/gtk/no-notification-for-unrendered-iframe-children.html:
* accessibility/gtk/title-and-alt-expected.txt:
* accessibility/gtk/title-and-alt.html:
* accessibility/help-text.html:
* accessibility/img-alt-tag-only-whitespace-expected.txt:
* accessibility/img-alt-tag-only-whitespace.html:
* accessibility/img-aria-button-alt-tag.html:
* accessibility/img-fallsback-to-title.html:
* accessibility/input-image-alt.html:
* accessibility/loading-iframe-sends-notification.html:
* accessibility/media-element.html:
* accessibility/radio-button-title-label.html:
* accessibility/self-referencing-aria-labelledby.html:
* accessibility/svg-bounds.html:
* platform/gtk/TestExpectations:
* platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Added.
* platform/gtk/accessibility/aria-help-expected.txt:
* platform/gtk/accessibility/aria-hidden-negates-no-visibility-expected.txt: Added.
* platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Added.
* platform/gtk/accessibility/aria-namefrom-author-expected.txt: Added.
* platform/gtk/accessibility/aria-option-role-expected.txt: Added.
* platform/gtk/accessibility/aria-switch-text-expected.txt:
* platform/gtk/accessibility/canvas-description-and-role-expected.txt: Added.
* platform/gtk/accessibility/empty-image-with-title-expected.txt: Added.
* platform/gtk/accessibility/fieldset-element-expected.txt: Added.
* platform/gtk/accessibility/focusable-div-expected.txt: Added.
* platform/gtk/accessibility/help-text-expected.txt: Added.
* platform/gtk/accessibility/image-link-expected.txt:
* platform/gtk/accessibility/image-map1-expected.txt:
* platform/gtk/accessibility/image-map2-expected.txt:
* platform/gtk/accessibility/image-with-alt-and-map-expected.txt:
* platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.
* platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Added.
* platform/gtk/accessibility/img-fallsback-to-title-expected.txt:
* platform/gtk/accessibility/input-image-alt-expected.txt: Added.
* platform/gtk/accessibility/media-element-expected.txt:
* platform/gtk/accessibility/radio-button-title-label-expected.txt:
* platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Added.
* platform/gtk/accessibility/svg-bounds-expected.txt: Added.


Canonical link: https://commits.webkit.org/175953@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
joanmarie committed May 18, 2016
1 parent f996d02 commit 1716c6c6e421e9caf1abdc66459e732ab0770217
Showing 65 changed files with 739 additions and 191 deletions.
@@ -1,3 +1,84 @@
2016-05-18 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] Use WebCore Accessibility's AccessibilityText for AtkObject name and description
https://bugs.webkit.org/show_bug.cgi?id=157822

Reviewed by Chris Fleizach.

Now that the exposure is correct, the Layout Tests needed to be adjusted accordingly because asking
for the "AXDescription" gives you the AXDescription on the Mac and the AtkObject description in
GNU/Linux. But what the Mac calls a "description" is what ATK calls a "name." What ATK calls a
"description" is what the Mac calls "help."

Ultimately our Layout Tests and/or our platform TestRunner API should be modified to deal with
with these differences more gracefully. (Bug https://bugs.webkit.org/show_bug.cgi?id=157187 has
been opened for that task.) In the meantime, the existing tests have been given platform checks
to ask for the right property on each platform. This was done in such a way as to not require
other (non-ATK) platforms change their current expectations files.

In addition to the above, three previously-failing tests were corrected and are now passing.

* accessibility/alt-tag-on-image-with-nonimage-role.html:
* accessibility/aria-help.html:
* accessibility/aria-label.html:
* accessibility/aria-labeled-with-hidden-node.html:
* accessibility/aria-labelledby-on-input.html:
* accessibility/aria-labelledby-overrides-aria-labeledby.html:
* accessibility/aria-labelledby-overrides-label.html:
* accessibility/aria-labelledby-stay-within.html:
* accessibility/aria-labelledby-with-descendants.html:
* accessibility/aria-namefrom-author.html:
* accessibility/aria-option-role.html:
* accessibility/canvas-description-and-role.html:
* accessibility/empty-image-with-title.html:
* accessibility/fieldset-element.html:
* accessibility/focusable-div.html:
* accessibility/gtk/no-notification-for-unrendered-iframe-children-expected.txt:
* accessibility/gtk/no-notification-for-unrendered-iframe-children.html:
* accessibility/gtk/title-and-alt-expected.txt:
* accessibility/gtk/title-and-alt.html:
* accessibility/help-text.html:
* accessibility/img-alt-tag-only-whitespace-expected.txt:
* accessibility/img-alt-tag-only-whitespace.html:
* accessibility/img-aria-button-alt-tag.html:
* accessibility/img-fallsback-to-title.html:
* accessibility/input-image-alt.html:
* accessibility/loading-iframe-sends-notification.html:
* accessibility/media-element.html:
* accessibility/radio-button-title-label.html:
* accessibility/self-referencing-aria-labelledby.html:
* accessibility/svg-bounds.html:
* platform/gtk/TestExpectations:
* platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Added.
* platform/gtk/accessibility/aria-help-expected.txt:
* platform/gtk/accessibility/aria-hidden-negates-no-visibility-expected.txt: Added.
* platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Added.
* platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Added.
* platform/gtk/accessibility/aria-namefrom-author-expected.txt: Added.
* platform/gtk/accessibility/aria-option-role-expected.txt: Added.
* platform/gtk/accessibility/aria-switch-text-expected.txt:
* platform/gtk/accessibility/canvas-description-and-role-expected.txt: Added.
* platform/gtk/accessibility/empty-image-with-title-expected.txt: Added.
* platform/gtk/accessibility/fieldset-element-expected.txt: Added.
* platform/gtk/accessibility/focusable-div-expected.txt: Added.
* platform/gtk/accessibility/help-text-expected.txt: Added.
* platform/gtk/accessibility/image-link-expected.txt:
* platform/gtk/accessibility/image-map1-expected.txt:
* platform/gtk/accessibility/image-map2-expected.txt:
* platform/gtk/accessibility/image-with-alt-and-map-expected.txt:
* platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Added.
* platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Added.
* platform/gtk/accessibility/img-fallsback-to-title-expected.txt:
* platform/gtk/accessibility/input-image-alt-expected.txt: Added.
* platform/gtk/accessibility/media-element-expected.txt:
* platform/gtk/accessibility/radio-button-title-label-expected.txt:
* platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Added.
* platform/gtk/accessibility/svg-bounds-expected.txt: Added.

2016-05-17 Saam barati <sbarati@apple.com>

LayoutTest inspector/debugger/tail-recursion.html failing on WK2 debug
@@ -24,10 +24,15 @@
shouldBe("text.stringValue", "'AXValue: TEST1'");

var group = accessibilityController.accessibleElementById("group");
shouldBe("group.description", "'AXDescription: TEST2'");

var button = accessibilityController.accessibleElementById("button");
shouldBe("button.description", "'AXDescription: TEST3'");

if (accessibilityController.platformName == "atk") {
shouldBe("group.title", "'AXTitle: TEST2'");
shouldBe("button.title", "'AXTitle: TEST3'");
} else {
shouldBe("group.description", "'AXDescription: TEST2'");
shouldBe("button.description", "'AXDescription: TEST3'");
}
}

</script>
@@ -20,7 +20,10 @@

document.getElementById("button").focus();
var button = accessibilityController.focusedElement;
shouldBe("button.helpText", "'AXHelp: click here'");
if (accessibilityController.platformName == "atk")
shouldBe("button.description", "'AXDescription: click here'");
else
shouldBe("button.helpText", "'AXHelp: click here'");
}

</script>
@@ -18,11 +18,18 @@
var body = document.getElementById("body");
body.focus();
var obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
var succeeded = obj.description == "AXDescription: aria label";
var succeeded;
if (accessibilityController.platformName == "atk")
succeeded = obj.title == "AXTitle: aria label";
else
succeeded = obj.description == "AXDescription: aria label";
shouldBe("succeeded", "true");

obj = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(1);
succeeded = obj.description == "AXDescription: aria link";
if (accessibilityController.platformName == "atk")
succeeded = obj.title == "AXTitle: aria link";
else
succeeded = obj.description == "AXDescription: aria link";
shouldBe("succeeded", "true");
}

@@ -17,7 +17,10 @@

if (window.accessibilityController) {
var button = accessibilityController.accessibleElementById("button");
shouldBe("button.description", "'AXDescription: TITLE'");
if (accessibilityController.platformName == "atk")
shouldBe("button.title", "'AXTitle: TITLE'");
else
shouldBe("button.description", "'AXDescription: TITLE'");
}
</script>

@@ -14,7 +14,10 @@
var labeledItem = document.getElementById("time");
labeledItem.focus();
var result = document.getElementById("result");
result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
if (accessibilityController.platformName == "atk")
result.innerText = "\nThe accessibility title is \"" + accessibilityController.focusedElement.title + "\"";
else
result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
}
</script>
</body>
@@ -23,10 +23,13 @@
description("This tests that aria-labelledby overrides aria-labeledby correctly.");

if (window.accessibilityController) {
var linkDescription = accessibilityController.accessibleElementById("link").description;

shouldBe("linkDescription", "'AXDescription: Y Z'");

if (accessibilityController.platformName == "atk") {
var linkTitle = accessibilityController.accessibleElementById("link").title;
shouldBe("linkTitle", "'AXTitle: Y Z'");
} else {
var linkDescription = accessibilityController.accessibleElementById("link").description;
shouldBe("linkDescription", "'AXDescription: Y Z'");
}
// Hide superfluous text.
document.getElementById("test").style.display = "none";
}
@@ -22,7 +22,10 @@
text.focus();
text = accessibilityController.focusedElement;

debug("text.description is " + text.description);
if (accessibilityController.platformName == "atk")
debug("text.title is " + text.title);
else
debug("text.description is " + text.description);

// There should be no title UI element.
shouldBe("text.titleUIElement() != null && text.titleUIElement().isValid", "false");
@@ -32,11 +32,16 @@
var labeledItem = document.getElementById("rep");
labeledItem.focus();
var result = document.getElementById("result");
if ( accessibilityController.focusedElement.description == "AXDescription: Reply Item Five" ) {
var resultValue;
if (accessibilityController.platformName == "atk")
resultValue = accessibilityController.focusedElement.title;
else
resultValue = accessibilityController.focusedElement.description;
if (resultValue.endsWith("Reply Item Five")) {
result.innerText = "Passed";
}
else {
result.innerText = "Failed. Result ==" + accessibilityController.focusedElement.description + "==";
result.innerText = "Failed. Result ==" + resultValue + "==";
}
}
</script>
@@ -49,7 +49,10 @@
if (window.accessibilityController) {
for (var k = 1; k < 8; k++) {
var test = accessibilityController.accessibleElementById("test" + k);
debug("test " + k + ": aria-labelledby description: " + test.description);
if (accessibilityController.platformName == "atk")
debug("test " + k + ": aria-labelledby description: " + test.title);
else
debug("test " + k + ": aria-labelledby description: " + test.description);
debug("test " + k + ": expected description: " + document.getElementById("test" + k).getAttribute("data-label") + "\n");
}
document.getElementById("content").style.visibility = "hidden";
@@ -67,7 +67,10 @@
document.getElementById("button").setAttribute("aria-labelledby", labelledby);

if (window.accessibilityController) {
debug("Button description: " + accessibilityController.accessibleElementById("button").description);
if (accessibilityController.platformName == "atk")
debug("Button title: " + accessibilityController.accessibleElementById("button").title);
else
debug("Button description: " + accessibilityController.accessibleElementById("button").description);
document.getElementById("content").style.visibility = "hidden";
}

@@ -29,7 +29,10 @@
debug("firstChild.title is " + firstChild.title);

debug("secondChild.role is " + secondChild.role);
debug("secondChild.description is " + secondChild.description);
if (accessibilityController.platformName == "atk")
debug("secondChild.title is " + secondChild.title);
else
debug("secondChild.description is " + secondChild.description);

shouldBe("firstChild.childrenCount", "0");
shouldBe("secondChild.childrenCount", "0");
@@ -21,11 +21,17 @@
shouldBe("axContainer.childrenCount", "2");

var axCanvas1 = axContainer.childAtIndex(0);
debug('Canvas 1 description: ' + axCanvas1.description);
if (accessibilityController.platformName == "atk")
debug('Canvas 1 title: ' + axCanvas1.title);
else
debug('Canvas 1 description: ' + axCanvas1.description);
debug('Canvas 1 role: ' + axCanvas1.role);

var axCanvas2 = axContainer.childAtIndex(1);
debug('Canvas 2 description: ' + axCanvas2.description);
if (accessibilityController.platformName == "atk")
debug('Canvas 2 title: ' + axCanvas2.title);
else
debug('Canvas 2 description: ' + axCanvas2.description);
debug('Canvas 2 role: ' + axCanvas2.role);
}

@@ -17,7 +17,10 @@

var image1 = accessibilityController.accessibleElementById("image1");
debug("image1.role is " + image1.role);
debug("image1.description is " + image1.description);
if (accessibilityController.platformName == "atk")
debug("image1.title is " + image1.title);
else
debug("image1.description is " + image1.description);
}

</script>
@@ -78,7 +78,10 @@
// fieldset tests.
fieldsetTestCount = document.getElementsByClassName("fieldsetTest").length;
for (var i = 0; i < fieldsetTestCount; ++i) {
fieldsetDescription = accessibilityController.accessibleElementById("f" + i).description;
if (accessibilityController.platformName == "atk")
fieldsetDescription = accessibilityController.accessibleElementById("f" + i).title;
else
fieldsetDescription = accessibilityController.accessibleElementById("f" + i).description;
debug(fieldsetDescription);
}

@@ -50,7 +50,10 @@
div3.focus();
shouldBe("document.activeElement == div3", "true");
window.axDiv3 = accessibilityController.focusedElement;
shouldBe("lastChar(axDiv3.description)", "\"D\"");
if (accessibilityController.platformName == "atk")
shouldBe("lastChar(axDiv3.title)", "\"D\"");
else
shouldBe("lastChar(axDiv3.description)", "\"D\"");

var div4 = document.getElementById('div4');
div4.focus();
@@ -4,8 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE



AXChildrenAdded on AXDescription: inner body
AXChildrenAdded on AXDescription: inner body
AXChildrenAdded on AXTitle: inner body
AXChildrenAdded on AXTitle: inner body
PASS successfullyParsed is true

TEST COMPLETE
@@ -21,7 +21,7 @@

accessibilityController.addNotificationListener(function(element, notification) {
if (notification == "AXChildrenAdded" && element.role == "AXRole: AXGroup")
debug(notification + " on " + element.description);
debug(notification + " on " + element.title);
});
}

@@ -1,16 +1,16 @@

Functional label:
Functional label:
This tests the exposure of alt and title information.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS image.title is 'AXTitle: Image alt attr'
PASS image.description is 'AXDescription: Image title attr'
PASS link.title is 'AXTitle: '
PASS link.title is 'AXTitle: Functional label'
PASS link.description is 'AXDescription: Link title attr'
PASS entry.title is 'AXTitle: '
PASS entry.description is 'AXDescription: Entry title attr'
PASS entry.title is 'AXTitle: Entry title attr'
PASS entry.description is 'AXDescription: '
PASS button.title is 'AXTitle: Submit'
PASS button.description is 'AXDescription: Submit button title attr'
PASS successfullyParsed is true
@@ -23,12 +23,12 @@
shouldBe("image.description", "'AXDescription: Image title attr'");

var link = accessibilityController.accessibleElementById("link");
shouldBe("link.title", "'AXTitle: Functional label.'");
shouldBe("link.title", "'AXTitle: Functional label'");
shouldBe("link.description", "'AXDescription: Link title attr'");

var entry = accessibilityController.accessibleElementById("entry");
shouldBe("entry.title", "'AXTitle: '");
shouldBe("entry.description", "'AXDescription: Entry title attr'");
shouldBe("entry.title", "'AXTitle: Entry title attr'");
shouldBe("entry.description", "'AXDescription: '");

var button = accessibilityController.accessibleElementById("button");
shouldBe("button.title", "'AXTitle: Submit'");
@@ -65,7 +65,11 @@ <h1 class="ex" title="bar" data-expected="bar"><a class="ex" href="#" data-expec
var ax = accessibilityController.accessibleElementById(id);
if (!ax)
continue;
var output = ax.helpText.replace("AXHelp: ", "");
var output;
if (accessibilityController.platformName == "atk")
output = ax.description.replace("AXDescription: ", "");
else
output = ax.helpText.replace("AXHelp: ", "");
var result = document.getElementById("console");
if (expectation === output)
result.textContent += "PASS: Help text for <" + tag +"> is \"" + output + "\"\n";
@@ -1,4 +1,4 @@
CONSOLE MESSAGE: line 26: Image description: AXDescription: Image
CONSOLE MESSAGE: line 27: Image description: AXDescription: Image



@@ -23,7 +23,10 @@
document.getElementById("images").focus();
var imagesGroup = accessibilityController.focusedElement;
shouldBe("imagesGroup.childrenCount", "1");
console.log("Image description: " + imagesGroup.childAtIndex(0).description);
if (accessibilityController.platformName != "atk")
console.log("Image description: " + imagesGroup.childAtIndex(0).description);
else
console.log("Image title: " + imagesGroup.childAtIndex(0).title);
}

</script>

0 comments on commit 1716c6c

Please sign in to comment.