Bug 524665 - use empty CacheChildren for leaf accessibles instead of implicit GetFirstChild and etc, r=davidb

This commit is contained in:
Alexander Surkov 2009-10-28 18:42:36 +08:00
Родитель ec0c996b5e
Коммит 4b7cf36d00
6 изменённых файлов: 60 добавлений и 118 удалений

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

@ -54,9 +54,9 @@
#include "nsIServiceManager.h"
#include "nsIURI.h"
//-------------
////////////////////////////////////////////////////////////////////////////////
// nsLeafAccessible
//-------------
////////////////////////////////////////////////////////////////////////////////
nsLeafAccessible::nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessibleWrap(aNode, aShell)
@ -65,34 +65,6 @@ nsAccessibleWrap(aNode, aShell)
NS_IMPL_ISUPPORTS_INHERITED0(nsLeafAccessible, nsAccessible)
/* nsIAccessible getFirstChild (); */
NS_IMETHODIMP nsLeafAccessible::GetFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* nsIAccessible getLastChild (); */
NS_IMETHODIMP nsLeafAccessible::GetLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsLeafAccessible::GetChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
// nsAccessible::GetAllowsAnonChildAccessibles()
PRBool
nsLeafAccessible::GetAllowsAnonChildAccessibles()
{
return PR_FALSE;
}
// nsAccessible::GetChildAtPoint()
nsresult
nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
@ -104,8 +76,18 @@ nsLeafAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
return NS_OK;
}
// nsAccessible::CacheChildren()
void
nsLeafAccessible::CacheChildren()
{
// No children for leaf accessible.
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
}
////////////////////////////////////////////////////////////////////////////////
// nsLinkableAccessible
////////////////////////////////////////////////////////////////////////////////
nsLinkableAccessible::
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :

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

@ -62,16 +62,15 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
NS_IMETHOD GetChildCount(PRInt32 *_retval);
// nsAccessible
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
nsIAccessible **aChild);
virtual PRBool GetAllowsAnonChildAccessibles();
protected:
// nsAccessible
virtual void CacheChildren();
};
/**

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

@ -38,21 +38,18 @@
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsTextAccessible.h"
// ------------
// Text Accessibles
// ------------
////////////////////////////////////////////////////////////////////////////////
// nsTextAccessible
////////////////////////////////////////////////////////////////////////////////
nsTextAccessible::nsTextAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsLinkableAccessible(aDOMNode, aShell)
{
nsTextAccessible::
nsTextAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
nsLinkableAccessible(aDOMNode, aShell)
{
}
/**
* We are text
*/
nsresult
nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
{
@ -60,33 +57,6 @@ nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
nsresult
nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
{
@ -96,3 +66,9 @@ nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32
return frame->GetRenderedText(&aText, nsnull, nsnull, aStartOffset, aLength);
}
void
nsTextAccessible::CacheChildren()
{
// No children for text accessible.
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
}

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

@ -41,25 +41,23 @@
#include "nsBaseWidgetAccessible.h"
/**
* Text nodes have no children, but since double inheritance
* no-worky we have to re-impl the LeafAccessiblity blocks
* this way.
*/
/**
* Generic class used for text nodes.
*/
class nsTextAccessible : public nsLinkableAccessible
{
public:
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
NS_IMETHOD GetChildCount(PRInt32 *_retval);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
PRUint32 aLength);
protected:
// nsAccessible
virtual void CacheChildren();
};

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

@ -47,12 +47,13 @@
////////////////////////////////////////////////////////////////////////////////
// nsHTMLAreaAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLAreaAccessible::
nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aParent,
nsIWeakReference* aShell):
nsHTMLLinkAccessible(aDomNode, aShell)
{
{
}
////////////////////////////////////////////////////////////////////////////////
@ -89,33 +90,6 @@ nsHTMLAreaAccessible::GetDescription(nsAString& aDescription)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaAccessible::GetFirstChild(nsIAccessible **aChild)
{
NS_ENSURE_ARG_POINTER(aChild);
*aChild = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaAccessible::GetLastChild(nsIAccessible **aChild)
{
NS_ENSURE_ARG_POINTER(aChild);
*aChild = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaAccessible::GetChildCount(PRInt32 *aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
PRInt32 *width, PRInt32 *height)
@ -161,7 +135,9 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
return NS_OK;
}
// nsAccessible::GetChildAtPoint()
////////////////////////////////////////////////////////////////////////////////
// nsAccessible public implementation
nsresult
nsHTMLAreaAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
@ -171,3 +147,13 @@ nsHTMLAreaAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
NS_ADDREF(*aChild = this);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessible protected implementation
void
nsHTMLAreaAccessible::CacheChildren()
{
// No children for aria accessible.
mAccChildCount = IsDefunct() ? eChildCountUninitialized : 0;
}

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

@ -41,9 +41,9 @@
#include "nsHTMLLinkAccessible.h"
/* Accessible for image map areas - must be child of image
/**
* Accessible for image map areas - must be child of image.
*/
class nsHTMLAreaAccessible : public nsHTMLLinkAccessible
{
@ -54,10 +54,6 @@ public:
// nsIAccessible
NS_IMETHOD GetDescription(nsAString& aDescription);
NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
NS_IMETHOD GetChildCount(PRInt32 *_retval);
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
// nsAccessible
@ -65,6 +61,11 @@ public:
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
nsIAccessible **aChild);
protected:
// nsAccessible
virtual void CacheChildren();
};
#endif