Bug 523565 - nsHTMLLabelAccessible shouldn't be text accessible, r=davidb

This commit is contained in:
Alexander Surkov 2009-10-22 12:45:52 +08:00
Родитель a96debc29c
Коммит e8ad80bf21
2 изменённых файлов: 25 добавлений и 45 удалений

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

@ -48,6 +48,10 @@
#include "nsISelectionController.h"
#include "nsComponentManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTextAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessibleWrap(aDomNode, aShell)
{
@ -112,6 +116,10 @@ nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLHRAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLHRAccessible::nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsLeafAccessible(aDomNode, aShell)
{
@ -162,13 +170,16 @@ nsHTMLBRAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
// A label is an element (not a leaf) and thus can support advanced interfaces.
// We need to skip over nsTextAccessible QI which prevents that
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsLinkableAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLabelAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLLabelAccessible::nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessible(aDomNode, aShell)
{
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
nsHTMLLabelAccessible::
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell) :
nsHyperTextAccessibleWrap(aDomNode, aShell)
{
}
nsresult
@ -184,37 +195,9 @@ nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
return NS_OK;
}
nsresult
nsHTMLLabelAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
return NS_OK;
}
NS_IMETHODIMP nsHTMLLabelAccessible::GetFirstChild(nsIAccessible **aFirstChild)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetFirstChild(aFirstChild);
}
/* readonly attribute nsIAccessible accFirstChild; */
NS_IMETHODIMP nsHTMLLabelAccessible::GetLastChild(nsIAccessible **aLastChild)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetLastChild(aLastChild);
}
/* readonly attribute long accChildCount; */
NS_IMETHODIMP nsHTMLLabelAccessible::GetChildCount(PRInt32 *aAccChildCount)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetChildCount(aAccChildCount);
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLIAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLLIAccessible::nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
const nsAString& aBulletText):
@ -290,8 +273,10 @@ void nsHTMLLIAccessible::CacheChildren()
}
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLListBulletAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLListBulletAccessible::
nsHTMLListBulletAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell,
const nsAString& aBulletText) :
@ -364,6 +349,7 @@ nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset
////////////////////////////////////////////////////////////////////////////////
// nsHTMLListAccessible
////////////////////////////////////////////////////////////////////////////////
nsresult
nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)

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

@ -80,22 +80,16 @@ public:
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLLabelAccessible : public nsTextAccessible
class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLListBulletAccessible : public nsLeafAccessible