bug 1164976 - Make DocAccessibleParent::GetAccessible return itself when appropriate r=davidb

This commit is contained in:
Trevor Saunders 2015-05-13 11:57:14 -04:00
parent 51d2c1b7ac
commit f48235cf49
2 changed files with 11 additions and 17 deletions

View File

@ -23,14 +23,7 @@ DocAccessibleParent::RecvShowEvent(const ShowEventData& aData)
return false;
}
ProxyAccessible* parent = nullptr;
if (aData.ID()) {
ProxyEntry* e = mAccessibles.GetEntry(aData.ID());
if (e)
parent = e->mProxy;
} else {
parent = this;
}
ProxyAccessible* parent = GetAccessible(aData.ID());
// XXX This should really never happen, but sometimes we fail to fire the
// required show events.
@ -123,18 +116,13 @@ DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID)
bool
DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
{
if (!aID) {
ProxyEvent(this, aEventType);
return true;
}
ProxyEntry* e = mAccessibles.GetEntry(aID);
if (!e) {
ProxyAccessible* proxy = GetAccessible(aID);
if (!proxy) {
NS_ERROR("no proxy for event!");
return true;
}
ProxyEvent(e->mProxy, aEventType);
ProxyEvent(proxy, aEventType);
return true;
}

View File

@ -94,12 +94,18 @@ public:
/**
* Return the accessible for given id.
*/
ProxyAccessible* GetAccessible(uintptr_t aID) const
ProxyAccessible* GetAccessible(uintptr_t aID)
{
if (!aID)
return this;
ProxyEntry* e = mAccessibles.GetEntry(aID);
return e ? e->mProxy : nullptr;
}
const ProxyAccessible* GetAccessible(uintptr_t aID) const
{ return const_cast<DocAccessibleParent*>(this)->GetAccessible(aID); }
private:
class ProxyEntry : public PLDHashEntryHdr