зеркало из https://github.com/mozilla/gecko-dev.git
Bug 395223 - positional description incorrect for headings, r=aaronlev, a=dsicore
This commit is contained in:
Родитель
86b19a26a8
Коммит
02c7dd244b
|
@ -67,6 +67,8 @@ void
|
|||
nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
|
||||
nsAString& aAttrValue)
|
||||
{
|
||||
aAttrValue.Truncate();
|
||||
|
||||
nsCAutoString attrName;
|
||||
aAttrName->ToUTF8String(attrName);
|
||||
aAttributes->GetStringProperty(attrName, aAttrValue);
|
||||
|
|
|
@ -2230,7 +2230,7 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
|
|||
// If 'level' attribute doesn't make sense element then it isn't represented
|
||||
// via IAccessible::attributes and groupLevel of groupPosition method is 0.
|
||||
// Elements that expose 'level' attribute only (like html headings elements)
|
||||
// don't support this method and all arguements are equealed 0.
|
||||
// don't support this method and all arguements are equalled 0.
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aGroupLevel);
|
||||
NS_ENSURE_ARG_POINTER(aSimilarItemsInGroup);
|
||||
|
|
|
@ -333,14 +333,21 @@ nsAccessibleWrap::get_accDescription(VARIANT varChild,
|
|||
|
||||
nsAutoString description;
|
||||
|
||||
// Try nsIAccessible::groupPosition to make a positional description string.
|
||||
PRInt32 groupLevel;
|
||||
PRInt32 similarItemsInGroup;
|
||||
PRInt32 positionInGroup;
|
||||
// Try to get group attributes to make a positional description string. We
|
||||
// can't use nsIAccessible::groupPosition because the method isn't supposed
|
||||
// to work with elements exposing 'level' attribute only (like HTML headings).
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = xpAccessible->GetAttributes(getter_AddRefs(attributes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!attributes)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 groupLevel = 0;
|
||||
PRInt32 itemsInGroup = 0;
|
||||
PRInt32 positionInGroup = 0;
|
||||
nsAccUtils::GetAccGroupAttrs(attributes, &groupLevel, &positionInGroup,
|
||||
&itemsInGroup);
|
||||
|
||||
nsresult rv = xpAccessible->GroupPosition(&groupLevel, &similarItemsInGroup,
|
||||
&positionInGroup);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (positionInGroup > 0) {
|
||||
if (groupLevel > 0) {
|
||||
// XXX: How do we calculate the number of children? Now we append
|
||||
|
@ -378,24 +385,27 @@ nsAccessibleWrap::get_accDescription(VARIANT varChild,
|
|||
if (numChildren) {
|
||||
nsTextFormatter::ssprintf(description,
|
||||
NS_LITERAL_STRING("L%d, %d of %d with %d").get(),
|
||||
groupLevel, positionInGroup,
|
||||
similarItemsInGroup + 1, numChildren);
|
||||
groupLevel, positionInGroup, itemsInGroup,
|
||||
numChildren);
|
||||
} else {
|
||||
nsTextFormatter::ssprintf(description,
|
||||
NS_LITERAL_STRING("L%d, %d of %d").get(),
|
||||
groupLevel, positionInGroup,
|
||||
similarItemsInGroup + 1);
|
||||
groupLevel, positionInGroup, itemsInGroup);
|
||||
}
|
||||
} else { // Position has no level
|
||||
nsTextFormatter::ssprintf(description,
|
||||
NS_LITERAL_STRING("%d of %d").get(),
|
||||
positionInGroup, similarItemsInGroup + 1);
|
||||
positionInGroup, itemsInGroup);
|
||||
}
|
||||
} else if (groupLevel > 0) {
|
||||
nsTextFormatter::ssprintf(description, NS_LITERAL_STRING("L%d").get(),
|
||||
groupLevel);
|
||||
}
|
||||
|
||||
if (!description.IsEmpty()) {
|
||||
*pszDescription = ::SysAllocString(description.get());
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
xpAccessible->GetDescription(description);
|
||||
if (!description.IsEmpty()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче