From b47512d0eeb24f1884fac891b7828c3f31eb232e Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Tue, 27 Oct 2009 08:58:36 +0800 Subject: [PATCH] Bug 372131 - nsLinkableAccessible/nsTextAccessible shouldn't be inherited from nsHyperTextAccessbile, r=davidb --- accessible/src/base/nsBaseWidgetAccessible.cpp | 17 ++++++++--------- accessible/src/base/nsBaseWidgetAccessible.h | 13 +++++++------ accessible/src/base/nsTextAccessible.cpp | 6 ------ accessible/src/base/nsTextAccessible.h | 2 -- accessible/src/html/nsHTMLTextAccessible.cpp | 2 ++ accessible/src/html/nsHTMLTextAccessible.h | 5 ++++- .../src/msaa/nsHTMLImageAccessibleWrap.cpp | 2 +- accessible/src/xul/nsXULTextAccessible.h | 3 --- 8 files changed, 22 insertions(+), 28 deletions(-) diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index b30c492a843..90bc7971efd 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -109,14 +109,14 @@ nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, nsLinkableAccessible:: nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) : - nsHyperTextAccessibleWrap(aNode, aShell), + nsAccessibleWrap(aNode, aShell), mActionContent(nsnull), mIsLink(PR_FALSE), mIsOnclick(PR_FALSE) { } -NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsHyperTextAccessibleWrap) +NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsAccessibleWrap) //////////////////////////////////////////////////////////////////////////////// // nsLinkableAccessible. nsIAccessible @@ -128,14 +128,13 @@ nsLinkableAccessible::TakeFocus() if (actionAcc) return actionAcc->TakeFocus(); - return nsHyperTextAccessibleWrap::TakeFocus(); + return nsAccessibleWrap::TakeFocus(); } nsresult nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState) { - nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState, - aExtraState); + nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState); NS_ENSURE_A11Y_SUCCESS(rv, rv); if (mIsLink) { @@ -153,7 +152,7 @@ nsLinkableAccessible::GetValue(nsAString& aValue) { aValue.Truncate(); - nsHyperTextAccessible::GetValue(aValue); + nsAccessible::GetValue(aValue); if (!aValue.IsEmpty()) return NS_OK; @@ -206,7 +205,7 @@ nsLinkableAccessible::DoAction(PRUint8 aIndex) if (actionAcc) return actionAcc->DoAction(aIndex); - return nsHyperTextAccessibleWrap::DoAction(aIndex); + return nsAccessibleWrap::DoAction(aIndex); } NS_IMETHODIMP @@ -250,14 +249,14 @@ nsresult nsLinkableAccessible::Init() { CacheActionContent(); - return nsHyperTextAccessibleWrap::Init(); + return nsAccessibleWrap::Init(); } nsresult nsLinkableAccessible::Shutdown() { mActionContent = nsnull; - return nsHyperTextAccessibleWrap::Shutdown(); + return nsAccessibleWrap::Shutdown(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/base/nsBaseWidgetAccessible.h b/accessible/src/base/nsBaseWidgetAccessible.h index 0fa0532969a..ea5a53b6b9b 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.h +++ b/accessible/src/base/nsBaseWidgetAccessible.h @@ -75,11 +75,12 @@ public: }; /** - * A type of accessible for DOM nodes containing an href="" attribute. - * It knows how to report the state of the link ( traveled or not ) - * and can activate ( click ) the link programmatically. - */ -class nsLinkableAccessible : public nsHyperTextAccessibleWrap + * Used for text or image accessible nodes contained by link accessibles or + * accessibles for nodes with registered click event handler. It knows how to + * report the state of the host link (traveled or not) and can activate (click) + * the host accessible programmatically. + */ +class nsLinkableAccessible : public nsAccessibleWrap { public: enum { eAction_Jump = 0 }; @@ -96,7 +97,7 @@ public: NS_IMETHOD TakeFocus(); NS_IMETHOD GetKeyboardShortcut(nsAString& _retval); - // nsIHyperLinkAccessible + // nsIAccessibleHyperLink NS_IMETHOD GetURI(PRInt32 i, nsIURI **aURI); // nsAccessNode diff --git a/accessible/src/base/nsTextAccessible.cpp b/accessible/src/base/nsTextAccessible.cpp index e4b66a352bf..3822445b9ed 100644 --- a/accessible/src/base/nsTextAccessible.cpp +++ b/accessible/src/base/nsTextAccessible.cpp @@ -50,12 +50,6 @@ nsLinkableAccessible(aDOMNode, aShell) { } -// Make sure we don't support text or other irrelevant interfaces. -// We have nsLinkableAccessible in our inheritance chain as a convenience in order to -// get link actions and states on the text accessibles. Windows screen readers expect that. -NS_IMPL_ISUPPORTS_INHERITED2(nsTextAccessible, nsAccessNode, - nsAccessible, nsIAccessible) - /** * We are text */ diff --git a/accessible/src/base/nsTextAccessible.h b/accessible/src/base/nsTextAccessible.h index 883fa022ce6..7d741b45f20 100644 --- a/accessible/src/base/nsTextAccessible.h +++ b/accessible/src/base/nsTextAccessible.h @@ -49,8 +49,6 @@ class nsTextAccessible : public nsLinkableAccessible { public: - NS_DECL_ISUPPORTS_INHERITED - nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell); // nsIAccessible diff --git a/accessible/src/html/nsHTMLTextAccessible.cpp b/accessible/src/html/nsHTMLTextAccessible.cpp index 56d5f7785eb..b7c2c6dc855 100644 --- a/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/accessible/src/html/nsHTMLTextAccessible.cpp @@ -57,6 +57,8 @@ nsTextAccessibleWrap(aDomNode, aShell) { } +NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible) + NS_IMETHODIMP nsHTMLTextAccessible::GetName(nsAString& aName) { diff --git a/accessible/src/html/nsHTMLTextAccessible.h b/accessible/src/html/nsHTMLTextAccessible.h index 64ca71327f5..5fe7ee5d4d7 100644 --- a/accessible/src/html/nsHTMLTextAccessible.h +++ b/accessible/src/html/nsHTMLTextAccessible.h @@ -50,7 +50,10 @@ class nsHTMLTextAccessible : public nsTextAccessibleWrap { public: nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell); - + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + // nsIAccessible NS_IMETHOD GetName(nsAString& aName); diff --git a/accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp b/accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp index bb44e8261b9..3f9fffad5c0 100644 --- a/accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp +++ b/accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp @@ -44,6 +44,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageAccessibleWrap, nsHTMLImageAccessible) IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap, - nsHyperTextAccessibleWrap, + nsAccessibleWrap, CAccessibleImage); diff --git a/accessible/src/xul/nsXULTextAccessible.h b/accessible/src/xul/nsXULTextAccessible.h index d5d37d6f9da..197bcd5db5b 100644 --- a/accessible/src/xul/nsXULTextAccessible.h +++ b/accessible/src/xul/nsXULTextAccessible.h @@ -41,11 +41,8 @@ #define _nsXULTextAccessible_H_ #include "nsBaseWidgetAccessible.h" -#include "nsTextAccessibleWrap.h" #include "nsHyperTextAccessibleWrap.h" -class nsIWeakReference; - class nsXULTextAccessible : public nsHyperTextAccessibleWrap {