Bug 147976 - Active Accessibility: progress meter get_accValue() sometimes returning value with 2 Progress meter <label> not getting picked up in get_accName(). r=kyle, sr=hewitt

This commit is contained in:
aaronl%netscape.com 2002-06-14 01:47:32 +00:00
Родитель adda8fb0bc
Коммит 7d692955f6
3 изменённых файлов: 10 добавлений и 9 удалений

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

@ -1489,20 +1489,21 @@ NS_IMETHODIMP nsAccessible::GetXULAccName(nsAString& _retval)
//
// This should keep search times down and still get the relevant
// labels.
nsAutoString controlID;
domElement->GetAttribute(NS_LITERAL_STRING("id"), controlID);
nsCOMPtr<nsIDOMNode> parent;
if (NS_SUCCEEDED(rv = mDOMNode->GetParentNode(getter_AddRefs(parent)))) {
if (!controlID.IsEmpty() && NS_SUCCEEDED(rv = mDOMNode->GetParentNode(getter_AddRefs(parent)))) {
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(parent));
NS_ASSERTION(xulElement, "No xulElement for parent DOM Node!");
if (xulElement) {
nsAutoString controlID;
nsCOMPtr<nsIDOMNodeList>labelList;
nsCOMPtr<nsIDOMNodeList> labelList;
if (NS_SUCCEEDED(rv = xulElement->GetElementsByAttribute(NS_LITERAL_STRING("control"), controlID, getter_AddRefs(labelList))))
{
PRUint32 length = 0;
if (NS_SUCCEEDED(rv = labelList->GetLength(&length)) && length > 0) {
for (PRUint32 i = 0; i < length; ++i) {
for (PRUint32 index = 0; index < length; ++index) {
nsCOMPtr<nsIDOMNode> child;
if (NS_SUCCEEDED(rv = labelList->Item(i, getter_AddRefs(child) ))) {
if (NS_SUCCEEDED(rv = labelList->Item(index, getter_AddRefs(child) ))) {
rv = AppendLabelText(child, label);
}
}

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

@ -42,7 +42,6 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIDOMXULDescriptionElement.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULLabelElement.h"
#include "nsIDOMXULMenuListElement.h"
@ -437,7 +436,7 @@ NS_IMETHODIMP nsXULGroupboxAccessible::GetAccName(nsAString& _retval)
*/
nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
nsFormControlAccessible(aNode, aShell)
{
}
@ -461,7 +460,8 @@ NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccValue(nsAString& _retval)
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No element for DOM node!");
element->GetAttribute(NS_LITERAL_STRING("value"), _retval);
_retval.Append(NS_LITERAL_STRING("%"));
if (!_retval.IsEmpty() && _retval.Last() != '%')
_retval.Append(NS_LITERAL_STRING("%"));
return NS_OK;
}

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

@ -95,7 +95,7 @@ public:
NS_IMETHOD GetAccName(nsAString& _retval);
};
class nsXULProgressMeterAccessible : public nsAccessible
class nsXULProgressMeterAccessible : public nsFormControlAccessible
{
public:
nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);