From 6975411a43cc03188e96017577c6ad7127ba9262 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Thu, 22 Oct 2009 12:45:52 +0800 Subject: [PATCH] Bug 523565 - nsHTMLLabelAccessible shouldn't be text accessible, r=davidb --- accessible/src/html/nsHTMLTextAccessible.cpp | 62 ++++++++------------ accessible/src/html/nsHTMLTextAccessible.h | 8 +-- 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/accessible/src/html/nsHTMLTextAccessible.cpp b/accessible/src/html/nsHTMLTextAccessible.cpp index 9d025a2308a..09c013d1ed5 100644 --- a/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/accessible/src/html/nsHTMLTextAccessible.cpp @@ -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