Bug 372131 - nsLinkableAccessible/nsTextAccessible shouldn't be inherited from nsHyperTextAccessbile, r=davidb

This commit is contained in:
Alexander Surkov 2009-10-27 08:58:36 +08:00
Родитель aaeca79739
Коммит b47512d0ee
8 изменённых файлов: 22 добавлений и 28 удалений

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

@ -109,14 +109,14 @@ nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
nsLinkableAccessible:: nsLinkableAccessible::
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) : nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
nsHyperTextAccessibleWrap(aNode, aShell), nsAccessibleWrap(aNode, aShell),
mActionContent(nsnull), mActionContent(nsnull),
mIsLink(PR_FALSE), mIsLink(PR_FALSE),
mIsOnclick(PR_FALSE) mIsOnclick(PR_FALSE)
{ {
} }
NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsHyperTextAccessibleWrap) NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsAccessibleWrap)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsLinkableAccessible. nsIAccessible // nsLinkableAccessible. nsIAccessible
@ -128,14 +128,13 @@ nsLinkableAccessible::TakeFocus()
if (actionAcc) if (actionAcc)
return actionAcc->TakeFocus(); return actionAcc->TakeFocus();
return nsHyperTextAccessibleWrap::TakeFocus(); return nsAccessibleWrap::TakeFocus();
} }
nsresult nsresult
nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState) nsLinkableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{ {
nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState, nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv); NS_ENSURE_A11Y_SUCCESS(rv, rv);
if (mIsLink) { if (mIsLink) {
@ -153,7 +152,7 @@ nsLinkableAccessible::GetValue(nsAString& aValue)
{ {
aValue.Truncate(); aValue.Truncate();
nsHyperTextAccessible::GetValue(aValue); nsAccessible::GetValue(aValue);
if (!aValue.IsEmpty()) if (!aValue.IsEmpty())
return NS_OK; return NS_OK;
@ -206,7 +205,7 @@ nsLinkableAccessible::DoAction(PRUint8 aIndex)
if (actionAcc) if (actionAcc)
return actionAcc->DoAction(aIndex); return actionAcc->DoAction(aIndex);
return nsHyperTextAccessibleWrap::DoAction(aIndex); return nsAccessibleWrap::DoAction(aIndex);
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -250,14 +249,14 @@ nsresult
nsLinkableAccessible::Init() nsLinkableAccessible::Init()
{ {
CacheActionContent(); CacheActionContent();
return nsHyperTextAccessibleWrap::Init(); return nsAccessibleWrap::Init();
} }
nsresult nsresult
nsLinkableAccessible::Shutdown() nsLinkableAccessible::Shutdown()
{ {
mActionContent = nsnull; mActionContent = nsnull;
return nsHyperTextAccessibleWrap::Shutdown(); return nsAccessibleWrap::Shutdown();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

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

@ -75,11 +75,12 @@ public:
}; };
/** /**
* A type of accessible for DOM nodes containing an href="" attribute. * Used for text or image accessible nodes contained by link accessibles or
* It knows how to report the state of the link ( traveled or not ) * accessibles for nodes with registered click event handler. It knows how to
* and can activate ( click ) the link programmatically. * report the state of the host link (traveled or not) and can activate (click)
*/ * the host accessible programmatically.
class nsLinkableAccessible : public nsHyperTextAccessibleWrap */
class nsLinkableAccessible : public nsAccessibleWrap
{ {
public: public:
enum { eAction_Jump = 0 }; enum { eAction_Jump = 0 };
@ -96,7 +97,7 @@ public:
NS_IMETHOD TakeFocus(); NS_IMETHOD TakeFocus();
NS_IMETHOD GetKeyboardShortcut(nsAString& _retval); NS_IMETHOD GetKeyboardShortcut(nsAString& _retval);
// nsIHyperLinkAccessible // nsIAccessibleHyperLink
NS_IMETHOD GetURI(PRInt32 i, nsIURI **aURI); NS_IMETHOD GetURI(PRInt32 i, nsIURI **aURI);
// nsAccessNode // nsAccessNode

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

@ -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 * We are text
*/ */

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

@ -49,8 +49,6 @@
class nsTextAccessible : public nsLinkableAccessible class nsTextAccessible : public nsLinkableAccessible
{ {
public: public:
NS_DECL_ISUPPORTS_INHERITED
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell); nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
// nsIAccessible // nsIAccessible

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

@ -57,6 +57,8 @@ nsTextAccessibleWrap(aDomNode, aShell)
{ {
} }
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextAccessible, nsTextAccessible)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLTextAccessible::GetName(nsAString& aName) nsHTMLTextAccessible::GetName(nsAString& aName)
{ {

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

@ -50,7 +50,10 @@ class nsHTMLTextAccessible : public nsTextAccessibleWrap
{ {
public: public:
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell); nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible // nsIAccessible
NS_IMETHOD GetName(nsAString& aName); NS_IMETHOD GetName(nsAString& aName);

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

@ -44,6 +44,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageAccessibleWrap,
nsHTMLImageAccessible) nsHTMLImageAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap, IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap,
nsHyperTextAccessibleWrap, nsAccessibleWrap,
CAccessibleImage); CAccessibleImage);

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

@ -41,11 +41,8 @@
#define _nsXULTextAccessible_H_ #define _nsXULTextAccessible_H_
#include "nsBaseWidgetAccessible.h" #include "nsBaseWidgetAccessible.h"
#include "nsTextAccessibleWrap.h"
#include "nsHyperTextAccessibleWrap.h" #include "nsHyperTextAccessibleWrap.h"
class nsIWeakReference;
class nsXULTextAccessible : public nsHyperTextAccessibleWrap class nsXULTextAccessible : public nsHyperTextAccessibleWrap
{ {