Bug 394896. Implement ARIA autocomplete. r=david.bolter, a=dsicore

This commit is contained in:
aaronleventhal%moonset.net 2007-09-18 21:48:04 +00:00
Родитель d0a61678f0
Коммит d5757e19d9
2 изменённых файлов: 27 добавлений и 10 удалений

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

@ -78,7 +78,9 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"combobox", nsIAccessibleRole::ROLE_COMBOBOX, eNameLabelOrTitle, eHasValueMinMax, nsIAccessibleStates::STATE_COLLAPSED,
{"combobox", nsIAccessibleRole::ROLE_COMBOBOX, eNameLabelOrTitle, eHasValueMinMax,
nsIAccessibleStates::STATE_COLLAPSED | nsIAccessibleStates::STATE_HASPOPUP,
// Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aaa:autocomplete
{"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
{"expanded", kBoolState, nsIAccessibleStates::STATE_EXPANDED}, kEndEntry},
@ -172,6 +174,9 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
{"tabpanel", nsIAccessibleRole::ROLE_PROPERTYPAGE, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"textbox", nsIAccessibleRole::ROLE_ENTRY, eNameLabelOrTitle, eNoValue, kNoReqStates,
// Manually map EXT_STATE_SINGLE_LINE and EXT_STATE_MULTI_LINE FROM aaa:multiline
// Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aaa:autocomplete
{"autocomplete", "list", nsIAccessibleStates::STATE_HASPOPUP},
{"autocomplete", "both", nsIAccessibleStates::STATE_HASPOPUP},
{"secret", kBoolState, nsIAccessibleStates::STATE_PROTECTED},
{"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},

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

@ -2337,17 +2337,29 @@ nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
}
}
// XXX We can remove this hack once we support RDF-based role & state maps
if (mRoleMapEntry && (mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY ||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PASSWORD_TEXT)) {
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
PRUint32 role;
GetFinalRole(&role);
if (role == nsIAccessibleRole::ROLE_ENTRY ||
role == nsIAccessibleRole::ROLE_PASSWORD_TEXT ||
role == nsIAccessibleRole::ROLE_COMBOBOX) {
nsIContent *content = frame->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
if (content->AttrValueIs(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::multiline,
nsAccessibilityAtoms::_true, eCaseMatters)) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
nsAutoString autocomplete;
if (content->GetAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::autocomplete, autocomplete) &&
(autocomplete.EqualsIgnoreCase("inline") ||
autocomplete.EqualsIgnoreCase("list") ||
autocomplete.EqualsIgnoreCase("both"))) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION;
}
else {
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
// XXX We can remove this hack once we support RDF-based role & state maps
if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY) {
if (content->AttrValueIs(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::multiline,
nsAccessibilityAtoms::_true, eCaseMatters)) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
}
else {
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
}
}
}
}