Bug 289313. Accessible DHTML tree views. Affects assistive technology use. r=timeless, sr=tor, a=mkaply

This commit is contained in:
aaronleventhal%moonset.net 2005-04-07 15:45:58 +00:00
Родитель b28ea79cd7
Коммит 42057efedb
5 изменённых файлов: 48 добавлений и 27 удалений

Просмотреть файл

@ -375,7 +375,7 @@ interface nsIAccessible : nsISupports
enum { ROLE_CHART = 26U }; // ATK_ROLE_IMAGE
enum { ROLE_DIALOG = 16U }; // ATK_ROLE_DIALOG
enum { ROLE_BORDER = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_GROUPING = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_GROUPING = 38U }; // ATK_ROLE_PANEL
enum { ROLE_SEPARATOR = 49U }; // ATK_ROLE_SEPARATOR
enum { ROLE_TOOLBAR = 62U }; // ATK_ROLE_TOOL_BAR
enum { ROLE_STATUSBAR = 53U }; // ATK_ROLE_STATUSBAR

Просмотреть файл

@ -1385,17 +1385,18 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
{"alert", ROLE_ALERT, eNameFromSubtree, eNoValue, eNoReqStates, END_ENTRY},
{"application", ROLE_APPLICATION, eNoName, eNoValue, eNoReqStates, END_ENTRY},
{"button", ROLE_PUSHBUTTON, eNameFromSubtree, eNoValue, eNoReqStates,
{"pressed", BOOL_STATE, STATE_PRESSED},
{"haspopup", BOOL_STATE, STATE_HASPOPUP}, END_ENTRY},
{"button-submit", ROLE_PUSHBUTTON, eNameFromSubtree, eNoValue, STATE_DEFAULT, END_ENTRY},
{"checkbox", ROLE_CHECKBUTTON, eNameFromSubtree, eNoValue, eNoReqStates,
{"checked", BOOL_STATE, STATE_CHECKED},
{"readonly", BOOL_STATE, STATE_READONLY},
{"required", BOOL_STATE, STATE_REQUIRED }, END_ENTRY},
{"readonly", BOOL_STATE, STATE_READONLY}, END_ENTRY},
{"checkbox-tristate", ROLE_CHECKBUTTON, eNameFromSubtree, eNoValue, eNoReqStates,
{"checked", BOOL_STATE, STATE_CHECKED},
{"checked", "mixed", STATE_MIXED},
{"readonly", BOOL_STATE, STATE_READONLY},
{"required", BOOL_STATE, STATE_REQUIRED }},
{"invalid", BOOL_STATE, STATE_INVALID},
{"required", BOOL_STATE, STATE_REQUIRED}},
{"columnheader", ROLE_COLUMNHEADER, eNameFromSubtree, eNoValue, STATE_SELECTABLE,
{"selected", BOOL_STATE, STATE_SELECTED},
{"readonly", BOOL_STATE, STATE_READONLY}, END_ENTRY},
@ -1418,26 +1419,25 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
{"menuitem-checkbox", ROLE_MENUITEM, eNameFromSubtree, eNoValue, eNoReqStates,
{"checked", BOOL_STATE, STATE_CHECKED}, END_ENTRY},
{"grid", ROLE_TABLE, eNameFromTitle, eNoValue, STATE_FOCUSABLE,
{"readonly", BOOL_STATE, STATE_READONLY},
{"multiselectable", BOOL_STATE, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE}, END_ENTRY},
{"gridcell", ROLE_CELL, eNameFromSubtree, eHasValue, STATE_SELECTABLE,
{"readonly", BOOL_STATE, STATE_READONLY}, END_ENTRY},
{"gridcell", ROLE_CELL, eNameFromSubtree, eHasValueMinMax, STATE_SELECTABLE,
{"selected", BOOL_STATE, STATE_SELECTED},
{"readonly", BOOL_STATE, STATE_READONLY},
{"invalid", BOOL_STATE, STATE_INVALID},
{"required", BOOL_STATE, STATE_REQUIRED}},
{"required", BOOL_STATE, STATE_REQUIRED}, END_ENTRY},
{"group", ROLE_GROUPING, eNameFromTitle, eNoValue, eNoReqStates, END_ENTRY},
{"link", ROLE_LINK, eNameFromTitle, eNoValue, STATE_LINKED, END_ENTRY},
{"option", ROLE_LISTITEM, eNameFromSubtree, eNoValue, STATE_SELECTABLE,
{"selected", BOOL_STATE, STATE_SELECTED}, END_ENTRY},
{"progressmeter", ROLE_PROGRESSBAR, eNameFromTitle, eHasValueMinMax, STATE_READONLY,
{"progressbar", ROLE_PROGRESSBAR, eNameFromTitle, eHasValueMinMax, STATE_READONLY,
{"valuenow", "unknown", STATE_MIXED}, END_ENTRY},
{"radio", ROLE_RADIOBUTTON, eNameFromSubtree, eNoValue, STATE_SELECTABLE, END_ENTRY},
{"radio", ROLE_RADIOBUTTON, eNameFromSubtree, eNoValue, eNoReqStates,
{"checked", BOOL_STATE, STATE_CHECKED}, END_ENTRY},
{"rowheader", ROLE_ROWHEADER, eNameFromSubtree, eNoValue, STATE_SELECTABLE,
{"selected", BOOL_STATE, STATE_SELECTED},
{"readonly", BOOL_STATE, STATE_READONLY}, END_ENTRY},
{"secret", ROLE_PASSWORD_TEXT, eNameFromTitle, eNoValue, STATE_PROTECTED,
{"invalid", BOOL_STATE, STATE_INVALID},
{"required", BOOL_STATE, STATE_REQUIRED}, END_ENTRY}, // XXX EXT_STATE_SINGLE_LINE
{"separator", ROLE_SEPARATOR, eNameFromTitle, eNoValue, eNoReqStates, END_ENTRY},
{"slider", ROLE_SLIDER, eNameFromTitle, eHasValueMinMax, eNoReqStates,
{"readonly", BOOL_STATE, STATE_READONLY},
{"invalid", BOOL_STATE, STATE_INVALID},
@ -1451,23 +1451,24 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
{"tab", ROLE_PAGETAB, eNameFromSubtree, eNoValue, eNoReqStates, END_ENTRY},
{"tablist", ROLE_PAGETABLIST, eNameFromSubtree, eNoValue, eNoReqStates, END_ENTRY},
{"tabpanel", ROLE_PROPERTYPAGE, eNameFromSubtree, eNoValue, eNoReqStates, END_ENTRY},
{"textarea", ROLE_TEXT, eNameFromTitle, eHasValue, eNoReqStates,
{"textarea", ROLE_TEXT, eNameFromTitle, eHasValueMinMax, eNoReqStates,
{"readonly", BOOL_STATE, STATE_READONLY},
{"invalid", BOOL_STATE, STATE_INVALID},
{"required", BOOL_STATE, STATE_REQUIRED}, END_ENTRY}, // XXX EXT_STATE_MULTI_LINE
{"textfield", ROLE_TEXT, eNameFromTitle, eHasValue, eNoReqStates, {"readonly", BOOL_STATE, STATE_READONLY},
{"textfield", ROLE_TEXT, eNameFromTitle, eHasValueMinMax, eNoReqStates,
{"readonly", BOOL_STATE, STATE_READONLY},
{"invalid", BOOL_STATE, STATE_INVALID},
{"required", BOOL_STATE, STATE_REQUIRED}, END_ENTRY}, // XXX EXT_STATE_SINGLE_LINE
{"toolbarbutton", ROLE_PUSHBUTTON, eNameFromSubtree, eNoValue, eNoReqStates,
{"pressed", BOOL_STATE, STATE_PRESSED}, END_ENTRY},
{"required", BOOL_STATE, STATE_REQUIRED},
{"haspopup", BOOL_STATE, STATE_HASPOPUP}, END_ENTRY}, // XXX EXT_STATE_SINGLE_LINE
{"toolbar", ROLE_TOOLBAR, eNoName, eNoValue, eNoReqStates, END_ENTRY},
{"tree", ROLE_OUTLINE, eNameFromTitle, eNoValue, eNoReqStates,
{"readonly", BOOL_STATE, STATE_READONLY},
{"multiselectable", BOOL_STATE, STATE_EXTSELECTABLE}, END_ENTRY},
{"multiselectable", BOOL_STATE, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE}, END_ENTRY},
{"treeitem", ROLE_OUTLINEITEM, eNameFromSubtree, eNoValue, STATE_SELECTABLE,
{"selected", BOOL_STATE, STATE_SELECTED},
{"collapsed", BOOL_STATE, STATE_COLLAPSED},
{"expanded", BOOL_STATE, STATE_EXPANDED},
{"checked", BOOL_STATE, STATE_CHECKED}},
{"expanded", "false", STATE_COLLAPSED},
{"checked", BOOL_STATE, STATE_CHECKED}, END_ENTRY},
{nsnull, ROLE_NOTHING, eNoName, eNoValue, eNoReqStates, END_ENTRY} // Last item
};
@ -1555,8 +1556,9 @@ NS_IMETHODIMP nsAccessible::GetFinalState(PRUint32 *aState)
finalState |= mRoleMapEntry->state;
if (MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap1) &&
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap2) &&
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap3)) {
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap4);
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap3) &&
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap4)) {
MappedAttrState(content, &finalState, &mRoleMapEntry->attributeMap5);
}
// Anything can be disabled/unavailable
MappedAttrState(content, &finalState, &gDisabledStateMap);

Просмотреть файл

@ -71,7 +71,6 @@ enum ENameRule {
enum EValueRule {
eNoValue,
eHasValue, // Supports value from waistate:valuenow attribute
eHasValueMinMax // Supports value, min and max from waistate:valuenow, valuemin and valuemax
};
@ -95,6 +94,7 @@ struct nsRoleMapEntry
nsStateMapEntry attributeMap2;
nsStateMapEntry attributeMap3;
nsStateMapEntry attributeMap4;
nsStateMapEntry attributeMap5;
};
class nsAccessible : public nsAccessNodeWrap,

Просмотреть файл

@ -882,7 +882,7 @@ NS_IMETHODIMP nsDocAccessible::AttrModified(nsIDOMEvent* aMutationEvent)
mutationEvent->GetAttrName(attrName);
PRUint32 eventType = 0;
if (attrName.EqualsLiteral("checked")) {
if (attrName.EqualsLiteral("checked") || attrName.EqualsLiteral("expanded")) {
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(targetNode));
if (targetContent->IsContentOfType(nsIContent::eXUL)) {
// XXX Should we remove XUL's CheckboxStateChanged event and just utilize this instead?

Просмотреть файл

@ -280,7 +280,8 @@ NS_IMETHODIMP nsAccessibleWrap::GetDescription(nsAString& aDescription)
nsresult rv = GetFinalRole(&currentRole);
if (NS_FAILED(rv) ||
(currentRole != ROLE_LISTITEM && currentRole != ROLE_MENUITEM &&
currentRole != ROLE_RADIOBUTTON && currentRole != ROLE_PAGETAB)) {
currentRole != ROLE_RADIOBUTTON && currentRole != ROLE_PAGETAB &&
currentRole != ROLE_OUTLINEITEM)) {
return rv;
}
@ -315,9 +316,27 @@ NS_IMETHODIMP nsAccessibleWrap::GetDescription(nsAString& aDescription)
// Don't localize the string "of" -- that's just the format of this string.
// The AT will parse the relevant numbers out and add its own localization.
nsTextFormatter::ssprintf(aDescription, NS_LITERAL_STRING("%d of %d").get(),
indexInParent, numSiblings);
if (currentRole == ROLE_OUTLINEITEM) {
PRUint32 level = 1;
nsCOMPtr<nsIAccessible> nextParent;
while (parent) {
parent->GetFinalRole(&currentRole);
if (currentRole != ROLE_GROUPING) {
break;
}
++level;
parent->GetParent(getter_AddRefs(nextParent));
parent.swap(nextParent);
}
// This must be a DHTML tree item -- XUL tree items impl GetDescription()
nsTextFormatter::ssprintf(aDescription, NS_LITERAL_STRING("L%d, %d of %d").get(),
level, indexInParent, numSiblings);
}
else {
nsTextFormatter::ssprintf(aDescription, NS_LITERAL_STRING("%d of %d").get(),
indexInParent, numSiblings);
}
return NS_OK;
}