Fix for bug 375534 - groupPosition problems, r=aaronlev

This commit is contained in:
surkov.alexander@gmail.com 2007-04-07 02:07:24 -07:00
parent 058295d910
commit 08a2fd7455
25 changed files with 233 additions and 194 deletions

View File

@ -66,11 +66,11 @@ void
nsAccessibilityUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 *aLevel,
PRInt32 *aPosInSet,
PRInt32 *aSizeSet)
PRInt32 *aSetSize)
{
*aLevel = 0;
*aPosInSet = 0;
*aSizeSet = 0;
*aSetSize = 0;
nsAutoString value;
PRInt32 error = NS_OK;
@ -82,26 +82,40 @@ nsAccessibilityUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
*aLevel = level;
}
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
if (!value.IsEmpty()) {
PRInt32 posInSet = value.ToInteger(&error);
if (NS_SUCCEEDED(error))
*aPosInSet = posInSet;
}
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
if (!value.IsEmpty()) {
PRInt32 sizeSet = value.ToInteger(&error);
if (NS_SUCCEEDED(error))
*aSizeSet = sizeSet;
*aSetSize = sizeSet;
}
}
PRBool
nsAccessibilityUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
{
nsAutoString value;
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
if (!value.IsEmpty()) {
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
return !value.IsEmpty();
}
return PR_FALSE;
}
void
nsAccessibilityUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 aLevel,
PRInt32 aPosInSet,
PRInt32 aSizeSet)
PRInt32 aSetSize)
{
nsAutoString value;
@ -110,13 +124,13 @@ nsAccessibilityUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
SetAccAttr(aAttributes, nsAccessibilityAtoms::level, value);
}
if (aSizeSet && aPosInSet) {
if (aSetSize && aPosInSet) {
value.Truncate();
value.AppendInt(aPosInSet);
SetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
value.Truncate();
value.AppendInt(aSizeSet);
value.AppendInt(aSetSize);
SetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
}
}

View File

@ -75,7 +75,12 @@ public:
static void GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 *aLevel,
PRInt32 *aPosInSet,
PRInt32 *aSizeSet);
PRInt32 *aSetSize);
/**
* Returns true if there are level, posinset and sizeset attributes.
*/
static PRBool HasAccGroupAttrs(nsIPersistentProperties *aAttributes);
/**
* Set group attributes ('level', 'setsize', 'posinset').
@ -83,7 +88,7 @@ public:
static void SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 aLevel,
PRInt32 aPosInSet,
PRInt32 aSizeSet);
PRInt32 aSetSize);
/**
* Set group attributes - 'level', 'setsize', 'posinset'.

View File

@ -2116,31 +2116,22 @@ NS_IMETHODIMP nsAccessible::GetFinalRole(PRUint32 *aRole)
return mDOMNode ? GetRole(aRole) : NS_ERROR_FAILURE; // Node already shut down
}
NS_IMETHODIMP nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
NS_IMETHODIMP
nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
{
*aAttributes = nsnull;
if (!mDOMNode) {
return NS_ERROR_FAILURE; // Node already shut down
}
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(element, NS_ERROR_UNEXPECTED);
NS_ENSURE_ARG_POINTER(aAttributes);
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
NS_ENSURE_TRUE(attributes, NS_ERROR_OUT_OF_MEMORY);
nsAutoString tagName;
nsAutoString oldValueUnused;
element->GetTagName(tagName);
if (!tagName.IsEmpty()) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("tag"), tagName, oldValueUnused);
}
nsresult rv = GetAttributesInternal(attributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content = GetRoleContent(mDOMNode);
if (content) {
nsAutoString id;
nsAutoString oldValueUnused;
if (content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, id)) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, oldValueUnused);
}
@ -2163,11 +2154,89 @@ NS_IMETHODIMP nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
}
}
if (!nsAccessibilityUtils::HasAccGroupAttrs(attributes)) {
// The role of an accessible can be pointed by ARIA attribute but ARIA
// posinset, level, setsize may be skipped. Therefore we calculate here
// these properties to map them into description.
PRUint32 role = Role(this);
if (role == nsIAccessibleRole::ROLE_LISTITEM ||
role == nsIAccessibleRole::ROLE_MENUITEM ||
role == nsIAccessibleRole::ROLE_RADIOBUTTON ||
role == nsIAccessibleRole::ROLE_PAGETAB ||
role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
nsCOMPtr<nsIAccessible> parent = GetParent();
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
PRInt32 positionInGroup = 0;
PRInt32 setSize = 0;
nsCOMPtr<nsIAccessible> sibling, nextSibling;
parent->GetFirstChild(getter_AddRefs(sibling));
NS_ENSURE_TRUE(sibling, NS_ERROR_FAILURE);
PRBool foundCurrent = PR_FALSE;
PRUint32 siblingRole;
while (sibling) {
sibling->GetFinalRole(&siblingRole);
if (siblingRole == role) {
++ setSize;
if (!foundCurrent) {
++ positionInGroup;
if (sibling == this)
foundCurrent = PR_TRUE;
}
}
sibling->GetNextSibling(getter_AddRefs(nextSibling));
sibling = nextSibling;
}
PRInt32 groupLevel = 0;
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
groupLevel = 1;
nsCOMPtr<nsIAccessible> nextParent;
while (parent) {
parent->GetFinalRole(&role);
if (role == nsIAccessibleRole::ROLE_OUTLINE)
break;
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
++ groupLevel;
parent->GetParent(getter_AddRefs(nextParent));
parent.swap(nextParent);
}
}
nsAccessibilityUtils::SetAccGroupAttrs(attributes, groupLevel,
positionInGroup,
setSize);
}
}
attributes.swap(*aAttributes);
return NS_OK;
}
nsresult
nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(element, NS_ERROR_UNEXPECTED);
nsAutoString tagName;
element->GetTagName(tagName);
if (!tagName.IsEmpty()) {
nsAutoString oldValueUnused;
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("tag"), tagName,
oldValueUnused);
}
return NS_OK;
}
NS_IMETHODIMP
nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
PRInt32 *aSimilarItemsInGroup,

View File

@ -166,6 +166,12 @@ public:
*/
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
/**
* Returns attributes for accessible without explicitly setted ARIA
* attributes.
*/
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
/**
* Maps ARIA state attributes to state of accessible. Note the given state
* argument should hold states for accessible before you pass it into this

View File

@ -139,13 +139,13 @@ nsHTMLRadioButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLRadioButtonAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsRadioButtonAccessible::GetAttributes(aAttributes);
nsresult rv = nsRadioButtonAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString nsURI;
@ -203,7 +203,7 @@ nsHTMLRadioButtonAccessible::GetAttributes(nsIPersistentProperties **aAttributes
}
nsAccessibilityUtils::
SetAccGroupAttrs(*aAttributes, 0, indexOf, count);
SetAccGroupAttrs(aAttributes, 0, indexOf, count);
return NS_OK;
}

View File

@ -63,7 +63,7 @@ public:
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
};
class nsHTMLButtonAccessible : public nsHyperTextAccessible

View File

@ -524,13 +524,13 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetName(nsAString& aName)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsHTMLSelectOptionAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsHyperTextAccessible::GetAttributes(aAttributes);
nsresult rv = nsHyperTextAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
@ -545,7 +545,7 @@ nsHTMLSelectOptionAccessible::GetAttributes(nsIPersistentProperties **aAttribute
PRUint32 indexOf = parentContent->IndexOf(content);
nsAccessibilityUtils::
SetAccGroupAttrs(*aAttributes, level, indexOf + 1, childCount);
SetAccGroupAttrs(aAttributes, level, indexOf + 1, childCount);
return NS_OK;
}

View File

@ -164,7 +164,7 @@ public:
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
nsIFrame* GetBoundsFrame();
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);

View File

@ -199,20 +199,22 @@ NS_IMETHODIMP nsHTMLTableAccessible::GetName(nsAString& aName)
return NS_OK;
}
NS_IMETHODIMP nsHTMLTableAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
if (!mDOMNode) {
return NS_ERROR_FAILURE; // Node already shut down
}
nsresult rv = nsAccessibleWrap::GetAttributes(aAttributes);
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isProbablyForLayout;
IsProbablyForLayout(&isProbablyForLayout);
if (isProbablyForLayout) {
nsAutoString oldValueUnused;
(*aAttributes)->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"), NS_LITERAL_STRING("true"), oldValueUnused);
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
NS_LITERAL_STRING("true"), oldValueUnused);
}
return NS_OK;

View File

@ -70,7 +70,7 @@ public:
NS_IMETHOD GetRole(PRUint32 *aResult);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetName(nsAString& aResult);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
#ifdef SHOW_LAYOUT_HEURISTIC
NS_IMETHOD GetDescription(nsAString& aDescription);
#endif

View File

@ -130,10 +130,9 @@ nsHTMLTextAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
*aAttributes = nsnull;
if (!mDOMNode) {
return NS_ERROR_FAILURE; // Node already shut down
}
@ -141,13 +140,9 @@ NS_IMETHODIMP nsHTMLTextAccessible::GetAttributes(nsIPersistentProperties **aAtt
PRUint32 role;
GetRole(&role);
if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
NS_ENSURE_TRUE(attributes, NS_ERROR_OUT_OF_MEMORY);
nsAutoString oldValueUnused;
attributes->SetStringProperty(NS_LITERAL_CSTRING("static"),
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("static"),
NS_LITERAL_STRING("true"), oldValueUnused);
attributes.swap(*aAttributes);
}
return NS_OK;

View File

@ -54,7 +54,7 @@ public:
NS_IMETHOD GetName(nsAString& _retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
NS_IMETHOD Shutdown() { mFrame = nsnull; return nsTextAccessibleWrap::Shutdown(); }
// nsPIAccessNode

View File

@ -811,37 +811,40 @@ NS_IMETHODIMP nsHyperTextAccessible::GetAttributeRange(PRInt32 aOffset, PRInt32
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHyperTextAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
if (!mDOMNode) {
return NS_ERROR_FAILURE; // Node already shut down
}
nsresult rv = nsAccessibleWrap::GetAttributes(aAttributes);
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
nsIAtom *tag = content->Tag();
nsAutoString headLevel;
PRInt32 headLevel = 0;
if (tag == nsAccessibilityAtoms::h1)
headLevel.AssignLiteral("1");
headLevel = 1;
else if (tag == nsAccessibilityAtoms::h2)
headLevel.AssignLiteral("2");
headLevel = 2;
else if (tag == nsAccessibilityAtoms::h3)
headLevel.AssignLiteral("3");
headLevel = 3;
else if (tag == nsAccessibilityAtoms::h4)
headLevel.AssignLiteral("4");
headLevel = 4;
else if (tag == nsAccessibilityAtoms::h5)
headLevel.AssignLiteral("5");
headLevel = 5;
else if (tag == nsAccessibilityAtoms::h6)
headLevel.AssignLiteral("6");
headLevel = 6;
if (!headLevel.IsEmpty()) {
nsAccessibilityUtils::SetAccAttr(*aAttributes,
if (headLevel) {
nsAutoString strHeadLevel;
strHeadLevel.AppendInt(headLevel);
nsAccessibilityUtils::SetAccAttr(aAttributes,
nsAccessibilityAtoms::level,
headLevel);
strHeadLevel);
}
return NS_OK;

View File

@ -76,7 +76,7 @@ public:
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
void CacheChildren();
protected:

View File

@ -328,14 +328,49 @@ nsAccessibleWrap::get_accDescription(VARIANT varChild,
if (NS_SUCCEEDED(rv)) {
if (positionInGroup != -1 && similarItemsInGroup != -1) {
if (groupLevel != -1) {
// XXX: How do we calculate the number of children?
// Normally we would append " with [numChildren]c" if we had that
// information. In the future we may need to use the ARIA owns property
// to calculate that if it's present.
nsTextFormatter::ssprintf(description,
NS_LITERAL_STRING("L%d, %d of %d").get(),
groupLevel, positionInGroup + 1,
similarItemsInGroup + 1);
// XXX: How do we calculate the number of children? Now we append
// " with [numChildren]c" for tree item. In the future we may need to
// use the ARIA owns property to calculate that if it's present.
PRInt32 numChildren = 0;
PRUint32 currentRole = 0;
rv = xpAccessible->GetFinalRole(&currentRole);
if (NS_SUCCEEDED(rv) &&
currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM) {
nsCOMPtr<nsIAccessible> child;
xpAccessible->GetFirstChild(getter_AddRefs(child));
while (child) {
child->GetFinalRole(&currentRole);
if (currentRole == nsIAccessibleRole::ROLE_GROUPING) {
nsCOMPtr<nsIAccessible> groupChild;
child->GetFirstChild(getter_AddRefs(groupChild));
while (groupChild) {
groupChild->GetFinalRole(&currentRole);
numChildren +=
(currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM);
nsCOMPtr<nsIAccessible> nextGroupChild;
groupChild->GetNextSibling(getter_AddRefs(nextGroupChild));
groupChild.swap(nextGroupChild);
}
break;
}
nsCOMPtr<nsIAccessible> nextChild;
child->GetNextSibling(getter_AddRefs(nextChild));
child.swap(nextChild);
}
}
if (numChildren) {
nsTextFormatter::ssprintf(description,
NS_LITERAL_STRING("L%d, %d of %d with %d").get(),
groupLevel, positionInGroup + 1,
similarItemsInGroup + 1, numChildren);
} else {
nsTextFormatter::ssprintf(description,
NS_LITERAL_STRING("L%d, %d of %d").get(),
groupLevel, positionInGroup + 1,
similarItemsInGroup + 1);
}
} else { // Position has no level
nsTextFormatter::ssprintf(description,
NS_LITERAL_STRING("%d of %d").get(),
@ -347,106 +382,16 @@ nsAccessibleWrap::get_accDescription(VARIANT varChild,
}
}
PRUint32 currentRole;
rv = xpAccessible->GetFinalRole(&currentRole);
if (NS_FAILED(rv) ||
(currentRole != nsIAccessibleRole::ROLE_LISTITEM &&
currentRole != nsIAccessibleRole::ROLE_MENUITEM &&
currentRole != nsIAccessibleRole::ROLE_RADIOBUTTON &&
currentRole != nsIAccessibleRole::ROLE_PAGETAB &&
currentRole != nsIAccessibleRole::ROLE_OUTLINEITEM)) {
xpAccessible->GetDescription(description);
if (!description.IsEmpty()) {
// Signal to screen readers that this description is speakable
// and is not a formatted positional information description
// Don't localize the "Description: " part of this string, it will be
// parsed out by assistive technologies.
description = NS_LITERAL_STRING("Description: ") + description;
}
*pszDescription = ::SysAllocString(description.get());
return S_OK;
xpAccessible->GetDescription(description);
if (!description.IsEmpty()) {
// Signal to screen readers that this description is speakable
// and is not a formatted positional information description
// Don't localize the "Description: " part of this string, it will be
// parsed out by assistive technologies.
description = NS_LITERAL_STRING("Description: ") + description;
}
// XXX: The role of an accessible can be pointed by ARIA attribute but
// ARIA posinset, level, setsize may be skipped. Therefore we calculate
// here these properties to map them into description. This should be
// handled in cross-platform code.
nsCOMPtr<nsIAccessible> parent;
xpAccessible->GetParent(getter_AddRefs(parent));
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
positionInGroup = 0;
similarItemsInGroup = 0;
nsCOMPtr<nsIAccessible> sibling, nextSibling;
parent->GetFirstChild(getter_AddRefs(sibling));
if (!sibling)
return E_FAIL;
PRBool foundCurrent = PR_FALSE;
PRUint32 siblingRole;
while (sibling) {
sibling->GetFinalRole(&siblingRole);
if (siblingRole == currentRole) {
++ similarItemsInGroup;
if (!foundCurrent) {
++ positionInGroup;
if (sibling == this)
foundCurrent = PR_TRUE;
}
}
sibling->GetNextSibling(getter_AddRefs(nextSibling));
sibling = nextSibling;
}
// 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.
if (currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM) {
groupLevel = 1;
nsCOMPtr<nsIAccessible> nextParent;
while (parent) {
parent->GetFinalRole(&currentRole);
if (currentRole != nsIAccessibleRole::ROLE_GROUPING)
break;
++ groupLevel;
parent->GetParent(getter_AddRefs(nextParent));
parent.swap(nextParent);
}
// Count the number of tree item children
PRInt32 numChildren = 0;
nsCOMPtr<nsIAccessible> groupSibling;
xpAccessible->GetNextSibling(getter_AddRefs(groupSibling));
if (groupSibling) {
groupSibling->GetFinalRole(&currentRole);
if (currentRole == nsIAccessibleRole::ROLE_GROUPING) {
// Accessible that groups child tree items
nsCOMPtr<nsIAccessible> child;
groupSibling->GetFirstChild(getter_AddRefs(child));
while (child) {
child->GetFinalRole(&currentRole);
numChildren += (currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM);
nsCOMPtr<nsIAccessible> nextChild;
child->GetNextSibling(getter_AddRefs(nextChild));
child.swap(nextChild);
}
}
}
// This must be a DHTML tree item -- XUL tree items impl GetDescription()
nsTextFormatter::ssprintf(description,
NS_LITERAL_STRING("L%d, %d of %d with %d").get(),
groupLevel, positionInGroup,
similarItemsInGroup, numChildren);
} else {
nsTextFormatter::ssprintf(description, NS_LITERAL_STRING("%d of %d").get(),
positionInGroup, similarItemsInGroup);
}
*pszDescription = ::SysAllocString(description.get());
*pszDescription = ::SysAllocString(description.get());
return S_OK;
}

View File

@ -241,12 +241,12 @@ nsXFormsAccessible::GetDescription(nsAString& aDescription)
return GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
}
NS_IMETHODIMP
nsXFormsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsXFormsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
nsresult rv = nsHyperTextAccessible::GetAttributes(aAttributes);
nsresult rv = nsHyperTextAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString name;
@ -254,8 +254,8 @@ nsXFormsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString unused;
return (*aAttributes)->SetStringProperty(NS_LITERAL_CSTRING("datatype"),
name, unused);
return aAttributes->SetStringProperty(NS_LITERAL_CSTRING("datatype"),
name, unused);
}
NS_IMETHODIMP

View File

@ -87,7 +87,7 @@ public:
// Appends ARIA 'datatype' property based on datatype of instance node that
// element is bound to.
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
// Denies accessible nodes in anonymous content of xforms element by
// always returning PR_FALSE value.

View File

@ -544,17 +544,17 @@ nsXULRadioButtonAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
NS_IMETHODIMP
nsXULRadioButtonAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsXULRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsFormControlAccessible::GetAttributes(aAttributes);
nsresult rv = nsFormControlAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccessibilityUtils::
SetAccAttrsForXULSelectControlItem(mDOMNode, *aAttributes);
SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -114,7 +114,7 @@ class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
public:
nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
};
class nsXULRadioGroupAccessible : public nsXULSelectableAccessible

View File

@ -438,20 +438,20 @@ NS_IMETHODIMP nsXULMenuitemAccessible::GetRole(PRUint32 *aRole)
return NS_OK;
}
NS_IMETHODIMP
nsXULMenuitemAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsXULMenuitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsAccessible::GetAttributes(aAttributes);
nsresult rv = nsAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
// XXX: we don't support xul:menuitem inside xul:menu element now until
// bug 372552 is fixed.
nsAccessibilityUtils::
SetAccAttrsForXULSelectControlItem(mDOMNode, *aAttributes);
SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -86,7 +86,7 @@ public:
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
};

View File

@ -129,17 +129,17 @@ nsXULTabAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK;
}
NS_IMETHODIMP
nsXULTabAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsXULTabAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsLeafAccessible::GetAttributes(aAttributes);
nsresult rv = nsLeafAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccessibilityUtils::
SetAccAttrsForXULSelectControlItem(mDOMNode, *aAttributes);
SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -55,7 +55,7 @@ public:
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
};
/**

View File

@ -681,13 +681,13 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
nsXULTreeitemAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsresult
nsXULTreeitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsresult rv = nsLeafAccessible::GetAttributes(aAttributes);
nsresult rv = nsLeafAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMXULTreeElement> tree(do_QueryInterface(mDOMNode));
@ -717,7 +717,7 @@ nsXULTreeitemAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
PRInt32 posInSet = mRow - startIndex + 1;
nsAccessibilityUtils::
SetAccGroupAttrs(*aAttributes, level + 1, posInSet, setSize);
SetAccGroupAttrs(aAttributes, level + 1, posInSet, setSize);
return NS_OK;
}

View File

@ -110,7 +110,7 @@ public:
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
NS_IMETHOD GetParent(nsIAccessible **_retval);
NS_IMETHOD GetNextSibling(nsIAccessible **_retval);