Commit bd43f07d authored by cfleizach@apple.com's avatar cfleizach@apple.com
Browse files

ARIA: support a way to create a static text object

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

Reviewed by David Kilzer.

WebCore: 

Test: accessibility/aria-text-role.html

* accessibility/AccessibilityObject.cpp:
(WebCore::createARIARoleMap):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValue):
(WebCore::AccessibilityRenderObject::isDescendantOfBarrenParent):
(WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::text):
* accessibility/AccessibilityRenderObject.h:

LayoutTests: 

* accessibility/aria-text-role-expected.txt: Added.
* accessibility/aria-text-role.html: Added.
* platform/gtk/Skipped:
* platform/win/Skipped:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0067edb7
2009-12-01 Chris Fleizach <cfleizach@apple.com>
Reviewed by David Kilzer.
ARIA: support a way to create a static text object
https://bugs.webkit.org/show_bug.cgi?id=32030
* accessibility/aria-text-role-expected.txt: Added.
* accessibility/aria-text-role.html: Added.
* platform/gtk/Skipped:
* platform/win/Skipped:
2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>
 
Reviewed by Simon Fraser.
hello world this is a test more test
This tests that you can set an ARIA text role and that it will not have children through hit testing
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS textrole.role is 'AXRole: AXStaticText'
PASS textrole.stringValue is 'AXValue: all at once'
PASS textrole.elementAtPoint(x, y).isEqual(textrole) 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>
var successfullyParsed = false;
</script>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="textrole" tabindex=0 role="text" aria-label="all at once">
<b>hello world</b>
<i>this is a test</i>
<a href="#">more test</a>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that you can set an ARIA text role and that it will not have children through hit testing");
if (window.accessibilityController) {
document.getElementById("textrole").focus();
var textrole = accessibilityController.focusedElement;
shouldBe("textrole.role", "'AXRole: AXStaticText'");
shouldBe("textrole.stringValue", "'AXValue: all at once'");
// now check the hit-testing
var x = textrole.clickPointX;
var y = textrole.clickPointY;
shouldBe("textrole.elementAtPoint(x, y).isEqual(textrole)", "true");
}
successfullyParsed = true;
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -54,6 +54,7 @@ accessibility/aria-labelledby-stay-within.html
accessibility/aria-link-supports-press.html
accessibility/aria-readonly.html
accessibility/aria-tab-roles.html
accessibility/aria-text-role.html
accessibility/aria-used-on-image-maps.html
accessibility/button-press-action.html
accessibility/canvas.html
......
......@@ -372,6 +372,7 @@ accessibility/aria-readonly.html
accessibility/aria-roles.html
accessibility/aria-tables.html
accessibility/aria-tab-roles.html
accessibility/aria-text-role.html
accessibility/aria-used-on-image-maps.html
accessibility/button-press-action.html
accessibility/canvas.html
......
2009-12-01 Chris Fleizach <cfleizach@apple.com>
Reviewed by David Kilzer.
ARIA: support a way to create a static text object
https://bugs.webkit.org/show_bug.cgi?id=32030
Test: accessibility/aria-text-role.html
* accessibility/AccessibilityObject.cpp:
(WebCore::createARIARoleMap):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValue):
(WebCore::AccessibilityRenderObject::isDescendantOfBarrenParent):
(WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::text):
* accessibility/AccessibilityRenderObject.h:
2009-12-01 Oliver Hunt <oliver@apple.com>
 
Reviewed by Maciej Stachowiak.
......@@ -905,6 +905,7 @@ static ARIARoleMap* createARIARoleMap()
{ "tab", TabRole },
{ "tablist", TabListRole },
{ "tabpanel", TabPanelRole },
{ "text", StaticTextRole },
{ "textbox", TextAreaRole },
{ "timer", ApplicationTimerRole },
{ "toolbar", ToolbarRole },
......
......@@ -860,6 +860,9 @@ String AccessibilityRenderObject::stringValue() const
if (!m_renderer || isPasswordField())
return String();
if (ariaRoleAttribute() == StaticTextRole)
return text();
if (m_renderer->isText())
return textUnderElement();
......@@ -1357,6 +1360,16 @@ bool AccessibilityRenderObject::ariaIsHidden() const
return false;
}
bool AccessibilityRenderObject::isDescendantOfBarrenParent() const
{
for (AccessibilityObject* object = parentObject(); object; object = object->parentObject()) {
if (!object->canHaveChildren())
return true;
}
return false;
}
bool AccessibilityRenderObject::accessibilityIsIgnored() const
{
// Is the platform interested in this object?
......@@ -1377,6 +1390,10 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
if (isPresentationalChildOfAriaRole())
return true;
// If this element is within a parent that cannot have children, it should not be exposed.
if (isDescendantOfBarrenParent())
return true;
if (roleValue() == IgnoredRole)
return true;
......@@ -1489,6 +1506,10 @@ int AccessibilityRenderObject::layoutCount() const
String AccessibilityRenderObject::text() const
{
// If this is a user defined static text, use the accessible name computation.
if (ariaRoleAttribute() == StaticTextRole)
return accessibilityDescription();
if (!isTextControl() || isPasswordField())
return String();
......
......@@ -256,6 +256,7 @@ private:
void ariaListboxSelectedChildren(AccessibilityChildrenVector&);
void ariaListboxVisibleChildren(AccessibilityChildrenVector&);
bool ariaIsHidden() const;
bool isDescendantOfBarrenParent() const;
bool hasTextAlternative() const;
String positionalDescriptionForMSAA() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment