bug 1107337 - Teach refChildCB to deal with proxies r=lsocks, davidb

This commit is contained in:
Trevor Saunders 2015-06-08 13:09:23 -04:00
parent 2e34b54154
commit 4a9a25c9f1

View File

@ -11,6 +11,7 @@
#include "InterfaceInitFuncs.h" #include "InterfaceInitFuncs.h"
#include "nsAccUtils.h" #include "nsAccUtils.h"
#include "mozilla/a11y/PDocAccessible.h" #include "mozilla/a11y/PDocAccessible.h"
#include "OuterDocAccessible.h"
#include "ProxyAccessible.h" #include "ProxyAccessible.h"
#include "RootAccessible.h" #include "RootAccessible.h"
#include "nsMai.h" #include "nsMai.h"
@ -828,26 +829,45 @@ getChildCountCB(AtkObject *aAtkObj)
AtkObject * AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex) refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{ {
// aChildIndex should not be less than zero // aChildIndex should not be less than zero
if (aChildIndex < 0) { if (aChildIndex < 0) {
return nullptr;
}
AtkObject* childAtkObj = nullptr;
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (accWrap) {
if (nsAccUtils::MustPrune(accWrap)) {
return nullptr; return nullptr;
} }
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
return nullptr;
}
Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex); Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
if (!accChild) if (accChild) {
return nullptr; childAtkObj = AccessibleWrap::GetAtkObject(accChild);
} else {
OuterDocAccessible* docOwner = accWrap->AsOuterDoc();
if (docOwner) {
ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc();
if (proxyDoc)
childAtkObj = GetWrapperFor(proxyDoc);
}
}
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
if (proxy->MustPruneChildren())
return nullptr;
AtkObject* childAtkObj = AccessibleWrap::GetAtkObject(accChild); ProxyAccessible* child = proxy->EmbeddedChildAt(aChildIndex);
if (child)
childAtkObj = GetWrapperFor(child);
} else {
return nullptr;
}
NS_ASSERTION(childAtkObj, "Fail to get AtkObj"); NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
if (!childAtkObj) if (!childAtkObj)
return nullptr; return nullptr;
g_object_ref(childAtkObj);
g_object_ref(childAtkObj);
if (aAtkObj != childAtkObj->accessible_parent) if (aAtkObj != childAtkObj->accessible_parent)
atk_object_set_parent(childAtkObj, aAtkObj); atk_object_set_parent(childAtkObj, aAtkObj);