Bug 193803. Expose iframes correctly in accessibility apis, fix iframe events. r=kyle, sr=henry

This commit is contained in:
aaronl%netscape.com 2003-02-27 02:04:43 +00:00
Родитель 1cf695921f
Коммит 743f5bf616
4 изменённых файлов: 35 добавлений и 25 удалений

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

@ -558,14 +558,7 @@ NS_IMETHODIMP nsAccessible::GetAccId(PRInt32 *aAccId)
NS_IMETHODIMP nsAccessible::CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList) NS_IMETHODIMP nsAccessible::CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList)
{ {
if (aParent) { mParent = aParent;
PRUint32 role = 0;
aParent->GetAccRole(&role);
// prevent from invalid caching nsHTMLIFrameRootAccessible
if (role != ROLE_NOTHING) {
mParent = aParent;
}
}
if (aSiblingList) if (aSiblingList)
mSiblingList = aSiblingList; mSiblingList = aSiblingList;
mSiblingIndex = aSiblingIndex; mSiblingIndex = aSiblingIndex;

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

@ -835,8 +835,9 @@ void nsRootAccessible::FireDocLoadFinished()
if (mBusy != eBusyStateDone) { if (mBusy != eBusyStateDone) {
mBusy = eBusyStateDone; mBusy = eBusyStateDone;
#ifndef MOZ_ACCESSIBILITY_ATK #ifndef MOZ_ACCESSIBILITY_ATK
if (mListener) if (mListener) {
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, this, nsnull); mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, this, nsnull);
}
#endif #endif
} }
} }

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

@ -56,36 +56,42 @@ nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible*
/* attribute wstring accName; */ /* attribute wstring accName; */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAString& aAccName) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAString& aAccName)
{ {
return GetTitle(aAccName); nsresult rv = GetTitle(aAccName);
if (NS_FAILED(rv) || aAccName.IsEmpty())
rv = GetURL(aAccName);
return rv;
} }
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAString& aAccValue) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAString& aAccValue)
{ {
return GetURL(aAccValue); return NS_OK;
} }
/* nsIAccessible getAccFirstChild (); */ /* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **aChild)
{ {
return mRootAccessible->GetAccFirstChild(_retval); NS_IF_ADDREF(*aChild = mRootAccessible);
return NS_OK;
} }
/* nsIAccessible getAccLastChild (); */ /* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **aChild)
{ {
return mRootAccessible->GetAccLastChild(_retval); NS_IF_ADDREF(*aChild = mRootAccessible);
return NS_OK;
} }
/* long getAccChildCount (); */ /* long getAccChildCount (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *aNumChildren)
{ {
return mRootAccessible->GetAccChildCount(_retval); *aNumChildren = 1;
return NS_OK;
} }
/* unsigned long getAccRole (); */ /* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval) NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
{ {
*_retval = ROLE_PANE; *_retval = ROLE_CLIENT;
return NS_OK; return NS_OK;
} }
@ -352,13 +358,6 @@ nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
{ {
} }
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccRole(PRUint32 *_retval)
{
// prevent |this| from being cached by nsAccessible::CacheOptimizations
*_retval = ROLE_NOTHING;
return NS_OK;
}
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */ /* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
NS_IMETHODIMP nsHTMLIFrameRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener) NS_IMETHODIMP nsHTMLIFrameRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
{ {
@ -380,3 +379,18 @@ NS_IMETHODIMP nsHTMLIFrameRootAccessible::RemoveAccessibleEventListener()
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PANE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccName(nsAString& aAccName)
{
return NS_OK;
}
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccValue(nsAString& aAccValue)
{
return GetURL(aAccValue);
}

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

@ -97,6 +97,8 @@ class nsHTMLIFrameRootAccessible : public nsRootAccessible
virtual ~nsHTMLIFrameRootAccessible(); virtual ~nsHTMLIFrameRootAccessible();
NS_IMETHOD GetAccRole(PRUint32 *aAccRole); NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
NS_IMETHOD GetAccName(nsAString& aAccName);
NS_IMETHOD GetAccValue(nsAString& aAccValue);
// ----- nsIAccessibleEventReceiver ------------------- // ----- nsIAccessibleEventReceiver -------------------
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener); NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);