bug 474281 - accessible name of html table cells is incorrectly including descendants, r=aaronlev, r=surkov

--HG--
rename : accessible/tests/mochitest/test_nsHyperTextAcc_roles.html => accessible/tests/mochitest/test_role_nsHyperTextAcc.html
This commit is contained in:
Marco Zehe 2009-01-20 16:02:35 +01:00
parent 3da913760e
commit f7a7d7a499
12 changed files with 118 additions and 23 deletions

View File

@ -44,7 +44,7 @@
* @note - When adding a new role, be sure to also add it to nsRoleMap.h for
* each platform.
*/
[scriptable, uuid(8c0f68f8-164a-4078-a9ee-36a7d180f0e4)]
[scriptable, uuid(6793ca5c-c7cb-41db-9fb9-c16c0525f962)]
interface nsIAccessibleRole : nsISupports
{
/**
@ -230,8 +230,8 @@ interface nsIAccessibleRole : nsISupports
const unsigned long ROLE_ROW = 28;
/**
* Represents a cell within a table. Is is used for html:td,
* role="gridcell". Also, see ROLE_TABLE.
* Represents a cell within a table. It is used for html:td,
* xul:tree cell and xul:listcell. Also, see ROLE_TABLE.
*/
const unsigned long ROLE_CELL = 29;
@ -770,9 +770,16 @@ interface nsIAccessibleRole : nsISupports
const unsigned long ROLE_FLAT_EQUATION = 120;
/**
* It's not role actually. This contanst is important to help ensure
* Represents a cell within a grid. It is used for role="gridcell". Unlike
* ROLE_CELL, it allows the calculation of the accessible name from subtree.
* Also, see ROLE_TABLE.
*/
const unsigned long ROLE_GRID_CELL = 121;
/**
* It's not role actually. This constant is important to help ensure
* nsRoleMap's are synchronized.
*/
const unsigned long ROLE_LAST_ENTRY = 121;
const unsigned long ROLE_LAST_ENTRY = 122;
};

View File

@ -167,6 +167,7 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_LIST_ITEM, // nsIAccessibleRole::ROLE_RICH_OPTION 118
ATK_ROLE_LIST, // nsIAccessibleRole::ROLE_LISTBOX 119
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_FLAT_EQUATION 120
ATK_ROLE_TABLE_CELL, // nsIAccessibleRole::ROLE_GRID_CELL 121
kROLE_ATK_LAST_ENTRY // nsIAccessibleRole::ROLE_LAST_ENTRY
};

View File

@ -170,7 +170,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
},
{
"gridcell",
nsIAccessibleRole::ROLE_CELL,
nsIAccessibleRole::ROLE_GRID_CELL,
eNoValue,
eNoAction,
kNoReqStates,

View File

@ -269,7 +269,8 @@ static const char kRoleNames[][20] = {
"listbox option", //ROLE_OPTION
"listbox rich option", //ROLE_RICH_OPTION
"listbox", //ROLE_LISTBOX
"flat equation" //ROLE_FLAT_EQUATION
"flat equation", //ROLE_FLAT_EQUATION
"gridcell" //ROLE_GRID_CELL
};
/**

View File

@ -73,7 +73,7 @@ PRUint32 nsNameUtils::gRoleToNameRulesMap[] =
eFromSubtree, // ROLE_ROWHEADER
eFromSubtree, // ROLE_COLUMN
eFromSubtree, // ROLE_ROW
eFromSubtree, // ROLE_CELL
eNoRule, // ROLE_CELL
eFromSubtree, // ROLE_LINK
eFromSubtree, // ROLE_HELPBALLOON
eNoRule, // ROLE_CHARACTER
@ -164,5 +164,6 @@ PRUint32 nsNameUtils::gRoleToNameRulesMap[] =
eFromSubtree, // ROLE_OPTION
eFromSubtree, // ROLE_RICH_OPTION
eNoRule, // ROLE_LISTBOX
eNoRule // ROLE_FLAT_EQUATION
eNoRule, // ROLE_FLAT_EQUATION
eFromSubtree // ROLE_GRID_CELL
};

View File

@ -163,5 +163,6 @@ static const NSString* AXRoles [] = {
NSAccessibilityRowRole, // ROLE_RICH_OPTION
NSAccessibilityListRole, // ROLE_LISTBOX
NSAccessibilityUnknownRole, // ROLE_FLAT_EQUATION
NSAccessibilityGroupRole, // ROLE_GRID_CELL
@"ROLE_LAST_ENTRY" // ROLE_LAST_ENTRY. bogus role that will never be shown (just marks the end of this array)!
};

View File

@ -437,6 +437,9 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
// nsIAccessibleRole::ROLE_FLAT_EQUATION
{ ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
// nsIAccessibleRole::ROLE_GRID_CELL
{ ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
// nsIAccessibleRole::ROLE_LAST_ENTRY
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
};

View File

@ -57,6 +57,7 @@ _TEST_FILES =\
nsIAccessible_selects.js \
nsIAccessible_states.js \
nsIAccessibleEditableText.js \
role.js \
test_aria_activedescendant.html \
test_aria_role_article.html \
test_aria_role_equation.html \
@ -69,7 +70,6 @@ _TEST_FILES =\
test_groupattrs.xul \
test_groupattrs.html \
$(warning test_table_indexes.html temporarily disabled) \
test_nsHyperTextAcc_roles.html \
test_nsIAccessible_actions.html \
$(warning test_nsIAccessible_actions.xul temporarily disabled) \
test_nsIAccessible_applicationAccessible.html \
@ -96,6 +96,8 @@ _TEST_FILES =\
$(warning test_nsIAccessibleTable_listboxes.xul temporarily disabled) \
test_nsIAccessNode_utils.html \
test_nsOuterDocAccessible.html \
test_role_nsHyperTextAcc.html \
test_role_table_cells.html \
test_textattrs.html \
test_textboxes.html \
test_textboxes.xul \

View File

@ -40,6 +40,7 @@ const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
// Roles
const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
@ -47,6 +48,7 @@ const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT;
const ROLE_ENTRY = nsIAccessibleRole.ROLE_ENTRY;
const ROLE_FLAT_EQUATION = nsIAccessibleRole.ROLE_FLAT_EQUATION;
const ROLE_FORM = nsIAccessibleRole.ROLE_FORM;
const ROLE_GRID_CELL = nsIAccessibleRole.ROLE_GRID_CELL;
const ROLE_HEADING = nsIAccessibleRole.ROLE_HEADING;
const ROLE_LABEL = nsIAccessibleRole.ROLE_LABEL;
const ROLE_LIST = nsIAccessibleRole.ROLE_LIST;

View File

@ -0,0 +1,12 @@
function testRole(aID, aRole)
{
var acc = getAccessible(aID);
if (!acc)
return;
try {
is(acc.finalRole, aRole, "Wrong role for " + aID + "!");
} catch(e) {
ok(false, "Error getting role for " + aID + "!");
}
}

View File

@ -14,21 +14,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=472326
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function testRole(aID, aRole)
{
var acc = getAccessible(aID);
if (!acc)
return;
try {
is(acc.role, aRole, "Wrong role for " + aID + "!");
} catch(e) {
ok(false, "Error getting role for " + aID + "!");
}
}
function doTests()
{
// Test html:form.

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=474281
-->
<head>
<title>Name calculation for table and grid cells</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_name.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function doTests()
{
// XXX For the below tests, remove the name tests once bug 468034 is
// fixed, and do the name tests in the new infrastructure.
// Test table cell name and role
testName("tc", null);
testRole("tc", ROLE_CELL);
// Test grid cell.
testName("gc", "This is a paragraph This is a link This is a list");
testRole("gc", ROLE_GRID_CELL);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=474281"
title="accessible name of html table cells is incorrectly including descendants">
Mozilla bug 474281</a>
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table>
<tr>
<td id="tc">
<p>This is a paragraph</p>
<a href="#">This is a link</a>
<ul>
<li>This is a list</li>
</ul>
</td>
</tr>
</table>
<table>
<tr>
<td id="gc" role="gridcell">
<p>This is a paragraph</p>
<a href="#">This is a link</a>
<ul>
<li>This is a list</li>
</ul>
</td>
</tr>
</table>
</body>
</html>