bug 1087485 - teach atk to get parents from proxies r=surkov

This commit is contained in:
Trevor Saunders 2014-09-23 08:00:15 -04:00
parent d5b8458420
commit 1f8554035f
2 changed files with 20 additions and 11 deletions

View File

@ -784,19 +784,21 @@ GetLocaleCB(AtkObject* aAtkObj)
AtkObject *
getParentCB(AtkObject *aAtkObj)
{
if (!aAtkObj->accessible_parent) {
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return nullptr;
if (aAtkObj->accessible_parent)
return aAtkObj->accessible_parent;
Accessible* accParent = accWrap->Parent();
if (!accParent)
return nullptr;
AtkObject* parent = AccessibleWrap::GetAtkObject(accParent);
if (parent)
atk_object_set_parent(aAtkObj, parent);
AtkObject* atkParent = nullptr;
if (AccessibleWrap* wrapper = GetAccessibleWrap(aAtkObj)) {
Accessible* parent = wrapper->Parent();
atkParent = parent ? AccessibleWrap::GetAtkObject(parent) : nullptr;
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
ProxyAccessible* parent = proxy->Parent();
atkParent = parent ? GetWrapperFor(parent) : nullptr;
}
if (atkParent)
atk_object_set_parent(aAtkObj, atkParent);
return aAtkObj->accessible_parent;
}
@ -984,6 +986,12 @@ GetProxy(AtkObject* aObj)
& ~IS_PROXY);
}
AtkObject*
GetWrapperFor(ProxyAccessible* aProxy)
{
return reinterpret_cast<AtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
}
static uint16_t
GetInterfacesForProxy(ProxyAccessible* aProxy)
{

View File

@ -36,6 +36,7 @@ GType mai_atk_object_get_type(void);
GType mai_util_get_type();
mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
extern int atkMajorVersion, atkMinorVersion;