bug 1243077 - simplify GetRoleCB some r=davidb

We can replace the code  dealing with Accessibles and proxies differently with
a call to AccessibleOrProxy::Role()
This commit is contained in:
Trevor Saunders 2016-01-22 06:06:05 -05:00
parent 3533020369
commit 2756d3cc25

View File

@ -650,22 +650,17 @@ getRoleCB(AtkObject *aAtkObj)
if (aAtkObj->role != ATK_ROLE_INVALID)
return aAtkObj->role;
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
a11y::role role;
if (!accWrap) {
ProxyAccessible* proxy = GetProxy(aAtkObj);
if (!proxy)
AccessibleOrProxy acc = GetInternalObj(aAtkObj);
if (acc.IsNull()) {
return ATK_ROLE_INVALID;
}
role = proxy->Role();
} else {
#ifdef DEBUG
if (AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj)) {
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support Text interface when it should");
#endif
role = accWrap->Role();
}
#endif
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, nameRule) \
@ -673,7 +668,7 @@ getRoleCB(AtkObject *aAtkObj)
aAtkObj->role = atkRole; \
break;
switch (role) {
switch (acc.Role()) {
#include "RoleMap.h"
default:
MOZ_CRASH("Unknown role.");