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

View File

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