Commit 56f6bf20 authored by mario@webkit.org's avatar mario@webkit.org

2011-03-30 Mario Sanchez Prada <msanchez@igalia.com>

        Reviewed by Chris Fleizach.

        AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
        https://bugs.webkit.org/show_bug.cgi?id=47636

        Added new layout test to check that roles are correct in GTK.

        * platform/gtk/accessibility/aria-roles-unignored-expected.txt: Added.
        * platform/gtk/accessibility/aria-roles-unignored.html: Added.
2011-03-30  Mario Sanchez Prada  <msanchez@igalia.com>

        Reviewed by Chris Fleizach.

        AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
        https://bugs.webkit.org/show_bug.cgi?id=47636

        Define new roles in WebCore and map them to ATK accordingly.

        Test: platform/gtk/accessibility/aria-roles-unignored.html

        * accessibility/AccessibilityObject.h: Added new roles to
        represent paragraphs, labels, forms and div sections.
        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
        Return ParagraphRole, LabelRole, FormRole and DivRole when needed
        for the GTK platform only.
        * accessibility/gtk/AccessibilityObjectAtk.cpp:
        (WebCore::AccessibilityObject::allowsTextRanges): Consider the new
        roles now that those kind of nodes won't return true to isGroup().
        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
        (atkRole): Map new WebCore roles to ATK Roles.
        (webkit_accessible_get_role): Remove code to define roles for
        paragraphs, labels, forms and divs based on node's tag name.

        Update mappings for the Mac platform.

        * accessibility/mac/AccessibilityObjectWrapper.mm:
        (createAccessibilityRoleMap): Add explicit mappings from the new
        roles introduced to NSAccessibilityGroupRole.
2011-03-30  Mario Sanchez Prada  <msanchez@igalia.com>

        Reviewed by Chris Fleizach.

        AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
        https://bugs.webkit.org/show_bug.cgi?id=47636

        Duplicate new internal WebCore roles in the Chromium port.

        * public/WebAccessibilityRole.h: Update enumeration
        WebAccessibilityRole to reflect newly added roles in WebCore.
        * src/AssertMatchingEnums.cpp: Added new assertions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 676a9edb
2011-03-30 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Chris Fleizach.
AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
https://bugs.webkit.org/show_bug.cgi?id=47636
Added new layout test to check that roles are correct in GTK.
* platform/gtk/accessibility/aria-roles-unignored-expected.txt: Added.
* platform/gtk/accessibility/aria-roles-unignored.html: Added.
2011-03-30 Jessie Berlin <jberlin@apple.com>
[Leopard Intel Release Tests] fast/text/justify-ideograph-leading-expansion.html failing
......
Simple paragraph
A paragraph pretending to be a table
A label Who said label? It's a heading!
A form with a button Click me!
Just a button Click me!
Just some text inside a div
This div is contains a textbox (an entry)
This tests that ARIA roles are not ignored for 'p','label', 'form' and 'div' elements
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS element.role is 'AXRole: paragraph'
PASS element.role is 'AXRole: table'
PASS element.role is 'AXRole: label'
PASS element.role is 'AXRole: heading'
PASS element.role is 'AXRole: form'
PASS element.role is 'AXRole: push button'
PASS element.role is 'AXRole: panel'
PASS element.role is 'AXRole: entry'
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">
<p>Simple paragraph</p>
<p role="grid">A paragraph pretending to be a table</p>
<label>A label</label>
<label role="heading">Who said label? It's a heading!</label>
<form>A form with a button <button name="button" value="Button">Click me!</button></form>
<form role="button">Just a button <button name="button" value="Button">Click me!</button></form>
<div>Just some text inside a div</form>
<div role="textbox">This div is contains a textbox (an entry)</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that ARIA roles are not ignored for 'p','label', 'form' and 'div' elements");
if (window.layoutController) {
layoutTestController.dumpAsText();
}
if (window.accessibilityController) {
document.getElementById("body").focus();
var webArea = accessibilityController.focusedElement;
// Paragraphs
var element = webArea.childAtIndex(0);
shouldBe("element.role", "'AXRole: paragraph'");
element = webArea.childAtIndex(1);
shouldBe("element.role", "'AXRole: table'");
// Labels are exposed as inside a panel
var labelsPanel = webArea.childAtIndex(2);
element = labelsPanel.childAtIndex(0);
shouldBe("element.role", "'AXRole: label'");
element = labelsPanel.childAtIndex(1);
shouldBe("element.role", "'AXRole: heading'");
// Forms
element = webArea.childAtIndex(3);
shouldBe("element.role", "'AXRole: form'");
element = webArea.childAtIndex(4);
shouldBe("element.role", "'AXRole: push button'");
// Divs
element = webArea.childAtIndex(5);
shouldBe("element.role", "'AXRole: panel'");
element = webArea.childAtIndex(6);
shouldBe("element.role", "'AXRole: entry'");
}
successfullyParsed = true;
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2011-03-30 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Chris Fleizach.
AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
https://bugs.webkit.org/show_bug.cgi?id=47636
Define new roles in WebCore and map them to ATK accordingly.
Test: platform/gtk/accessibility/aria-roles-unignored.html
* accessibility/AccessibilityObject.h: Added new roles to
represent paragraphs, labels, forms and div sections.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
Return ParagraphRole, LabelRole, FormRole and DivRole when needed
for the GTK platform only.
* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::allowsTextRanges): Consider the new
roles now that those kind of nodes won't return true to isGroup().
* accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(atkRole): Map new WebCore roles to ATK Roles.
(webkit_accessible_get_role): Remove code to define roles for
paragraphs, labels, forms and divs based on node's tag name.
Update mappings for the Mac platform.
* accessibility/mac/AccessibilityObjectWrapper.mm:
(createAccessibilityRoleMap): Add explicit mappings from the new
roles introduced to NSAccessibilityGroupRole.
2011-03-30 Yury Semikhatsky <yurys@chromium.org>
Unreviewed. Build fix for Efl and Qt Win.
......@@ -171,6 +171,10 @@ enum AccessibilityRole {
ListItemRole,
MenuListPopupRole,
MenuListOptionRole,
ParagraphRole,
LabelRole,
DivRole,
FormRole,
// ARIA Grouping roles
LandmarkApplicationRole,
......
......@@ -3087,9 +3087,24 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
#if PLATFORM(GTK)
if (m_renderer->isHR())
return SplitterRole;
if (node && node->hasTagName(pTag))
return ParagraphRole;
if (node && node->hasTagName(labelTag))
return LabelRole;
if (node && node->hasTagName(divTag))
return DivRole;
if (node && node->hasTagName(formTag))
return FormRole;
#else
if (node && node->hasTagName(labelTag))
return GroupRole;
#endif
if (m_renderer->isBlockFlow() || (node && node->hasTagName(labelTag)))
if (m_renderer->isBlockFlow())
return GroupRole;
// If the element does not have role, but it has ARIA attributes, accessibility should fallback to exposing it as a group.
......
......@@ -98,7 +98,13 @@ void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper)
bool AccessibilityObject::allowsTextRanges() const
{
return isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem();
// Check type for the AccessibilityObject.
if (isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem())
return true;
// Check roles as the last fallback mechanism.
AccessibilityRole role = roleValue();
return role == ParagraphRole || role == LabelRole || role == DivRole || role == FormRole;
}
unsigned AccessibilityObject::getLengthForTextRange() const
......
......@@ -476,6 +476,14 @@ static AtkRole atkRole(AccessibilityRole role)
case ListItemRole:
case ListBoxOptionRole:
return ATK_ROLE_LIST_ITEM;
case ParagraphRole:
return ATK_ROLE_PARAGRAPH;
case LabelRole:
return ATK_ROLE_LABEL;
case DivRole:
return ATK_ROLE_SECTION;
case FormRole:
return ATK_ROLE_FORM;
default:
return ATK_ROLE_UNKNOWN;
}
......@@ -483,31 +491,16 @@ static AtkRole atkRole(AccessibilityRole role)
static AtkRole webkit_accessible_get_role(AtkObject* object)
{
AccessibilityObject* axObject = core(object);
AccessibilityObject* coreObject = core(object);
if (!axObject)
if (!coreObject)
return ATK_ROLE_UNKNOWN;
// WebCore does not know about paragraph role, label role, or section role
if (axObject->isAccessibilityRenderObject()) {
Node* node = static_cast<AccessibilityRenderObject*>(axObject)->renderer()->node();
if (node) {
if (node->hasTagName(HTMLNames::pTag))
return ATK_ROLE_PARAGRAPH;
if (node->hasTagName(HTMLNames::labelTag))
return ATK_ROLE_LABEL;
if (node->hasTagName(HTMLNames::divTag))
return ATK_ROLE_SECTION;
if (node->hasTagName(HTMLNames::formTag))
return ATK_ROLE_FORM;
}
}
// Note: Why doesn't WebCore have a password field for this
if (axObject->isPasswordField())
if (coreObject->isPasswordField())
return ATK_ROLE_PASSWORD_TEXT;
return atkRole(axObject->roleValue());
return atkRole(coreObject->roleValue());
}
static bool selectionBelongsToObject(AccessibilityObject* coreObject, VisibleSelection& selection)
......
......@@ -1287,7 +1287,11 @@ static const AccessibilityRoleMap& createAccessibilityRoleMap()
{ TabPanelRole, NSAccessibilityGroupRole },
{ TreeRole, NSAccessibilityOutlineRole },
{ TreeItemRole, NSAccessibilityRowRole },
{ ListItemRole, NSAccessibilityGroupRole }
{ ListItemRole, NSAccessibilityGroupRole },
{ ParagraphRole, NSAccessibilityGroupRole },
{ LabelRole, NSAccessibilityGroupRole },
{ DivRole, NSAccessibilityGroupRole },
{ FormRole, NSAccessibilityGroupRole }
};
AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
......
2011-03-30 Mario Sanchez Prada <msanchez@igalia.com>
Reviewed by Chris Fleizach.
AX: GTK: ARIA role is not respected on <p> <label> <div> and <form>
https://bugs.webkit.org/show_bug.cgi?id=47636
Duplicate new internal WebCore roles in the Chromium port.
* public/WebAccessibilityRole.h: Update enumeration
WebAccessibilityRole to reflect newly added roles in WebCore.
* src/AssertMatchingEnums.cpp: Added new assertions.
2011-03-30 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
......
......@@ -116,6 +116,11 @@ enum WebAccessibilityRole {
WebAccessibilityRoleMenuListPopup,
WebAccessibilityRoleMenuListOption,
WebAccessibilityRoleParagraph,
WebAccessibilityRoleLabel,
WebAccessibilityRoleDiv,
WebAccessibilityRoleForm,
WebAccessibilityRoleLandmarkApplication,
WebAccessibilityRoleLandmarkBanner,
WebAccessibilityRoleLandmarkComplementary,
......
......@@ -173,6 +173,10 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleTreeItemRole, TreeItemRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDirectory, DirectoryRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleEditableText, EditableTextRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleListItem, ListItemRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleParagraph, ParagraphRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLabel, LabelRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDiv, DivRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleForm, FormRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkApplication, LandmarkApplicationRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkBanner, LandmarkBannerRole);
COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleLandmarkComplementary, LandmarkComplementaryRole);
......
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