зеркало из https://github.com/mozilla/pjs.git
Bug 301391. Allow child accessible values to be included in parents concatenated name, where appropriate. r=timeless, sr=bz, a=bsmedberg
This commit is contained in:
Родитель
ecff502016
Коммит
07ae9289a7
|
@ -1182,18 +1182,30 @@ nsresult nsAccessible::AppendStringWithSpaces(nsAString *aFlatString, const nsAS
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsAccessible::AppendNameFromAccessibleFor(nsIContent *aContent, nsAString *aFlatString)
|
||||
nsresult nsAccessible::AppendNameFromAccessibleFor(nsIContent *aContent,
|
||||
nsAString *aFlatString,
|
||||
PRBool aFromValue)
|
||||
{
|
||||
nsAutoString textEquivalent;
|
||||
nsAutoString textEquivalent, value;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(aContent));
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInWeakShell(domNode, mWeakShell, getter_AddRefs(accessible));
|
||||
if (domNode == mDOMNode) {
|
||||
accessible = this;
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
accService->GetAccessibleInWeakShell(domNode, mWeakShell, getter_AddRefs(accessible));
|
||||
}
|
||||
if (accessible) {
|
||||
accessible->GetName(textEquivalent);
|
||||
if (aFromValue) {
|
||||
accessible->GetFinalValue(textEquivalent);
|
||||
}
|
||||
else {
|
||||
accessible->GetName(textEquivalent);
|
||||
}
|
||||
}
|
||||
|
||||
textEquivalent.CompressWhitespace();
|
||||
|
@ -1255,7 +1267,14 @@ nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsA
|
|||
nsAutoString textEquivalent;
|
||||
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
||||
if (aContent->IsContentOfType(nsIContent::eXUL)) {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext, textEquivalent);
|
||||
if (aContent->Tag() == nsAccessibilityAtoms::label) {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
|
||||
textEquivalent);
|
||||
}
|
||||
else {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext,
|
||||
textEquivalent);
|
||||
}
|
||||
textEquivalent.CompressWhitespace();
|
||||
return AppendStringWithSpaces(aFlatString, textEquivalent);
|
||||
}
|
||||
|
@ -1287,6 +1306,9 @@ nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsA
|
|||
aFlatString->AppendLiteral("\r\n");
|
||||
return NS_OK;
|
||||
}
|
||||
else if (tag != nsAccessibilityAtoms::a && tag != nsAccessibilityAtoms::area) {
|
||||
AppendNameFromAccessibleFor(aContent, aFlatString, PR_TRUE /* use value */);
|
||||
}
|
||||
|
||||
textEquivalent.CompressWhitespace();
|
||||
return AppendStringWithSpaces(aFlatString, textEquivalent);
|
||||
|
@ -1682,7 +1704,7 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
|
|||
{"checked", BOOL_STATE, STATE_CHECKED }, END_ENTRY},
|
||||
{"grid", ROLE_TABLE, eNameLabelOrTitle, eNoValue, STATE_FOCUSABLE,
|
||||
{"readonly", BOOL_STATE, STATE_READONLY}, END_ENTRY},
|
||||
{"gridcell", ROLE_CELL, eNameOkFromChildren, eHasValueMinMax, eNoReqStates,
|
||||
{"gridcell", ROLE_CELL, eNameOkFromChildren, eNoValue, eNoReqStates,
|
||||
{"selected", BOOL_STATE, STATE_SELECTED | STATE_SELECTABLE},
|
||||
{"selected", "false", STATE_SELECTABLE},
|
||||
{"readonly", BOOL_STATE, STATE_READONLY},
|
||||
|
|
|
@ -166,7 +166,8 @@ protected:
|
|||
// For accessibles that are not lists of choices, the name of the subtree should be the
|
||||
// sum of names in the subtree
|
||||
nsresult AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
|
||||
nsresult AppendNameFromAccessibleFor(nsIContent *aContent, nsAString *aFlatString);
|
||||
nsresult AppendNameFromAccessibleFor(nsIContent *aContent, nsAString *aFlatString,
|
||||
PRBool aFromValue = PR_FALSE);
|
||||
nsresult AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
|
||||
nsresult AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче