Bug 298572. No name for xul:label and xul:description static text objects. Patch thanks to Peter Parente (parente@cs.unc.edu), r=aaronlev, sr=tor, a=mkaply

This commit is contained in:
aaronleventhal%moonset.net 2005-07-12 21:24:07 +00:00
parent df7e5a8624
commit 6d8381dbd3

View File

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityAtoms.h"
#include "nsIDOMXULDescriptionElement.h"
#include "nsXULTextAccessible.h"
@ -56,10 +57,13 @@ NS_IMETHODIMP nsXULTextAccessible::GetName(nsAString& aName)
if (!content) {
return NS_ERROR_FAILURE; // Node shut down
}
if (content->Tag() == nsAccessibilityAtoms::label) {
return content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
nsresult rv = content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
// if the value doesn't exist, flatten the inner content as the name (for descriptions)
return AppendFlatStringFromSubtree(content, &aName);
}
return nsTextAccessibleWrap::GetName(aName);
// otherwise, use the value attribute as the name (for labels)
return NS_OK;
}
NS_IMETHODIMP nsXULTextAccessible::GetState(PRUint32 *_retval)