Bug 1187742 - Handle proxies in mozAccessible {isEnabled,title,value,help,isExpired} r=tbsaunde

This commit is contained in:
Lorien Hu 2015-08-04 14:56:17 -04:00
parent fb72a45a11
commit cdea941639
6 changed files with 49 additions and 6 deletions

View File

@ -167,6 +167,18 @@ DocAccessibleChild::RecvValue(const uint64_t& aID, nsString* aValue)
return true;
}
bool
DocAccessibleChild::RecvHelp(const uint64_t& aID, nsString* aHelp)
{
Accessible* acc = IdToAccessible(aID);
if (!acc) {
return true;
}
acc->Help(*aHelp);
return true;
}
bool
DocAccessibleChild::RecvDescription(const uint64_t& aID, nsString* aDesc)
{

View File

@ -70,6 +70,8 @@ public:
virtual bool RecvValue(const uint64_t& aID, nsString* aValue) override;
virtual bool RecvHelp(const uint64_t& aID, nsString* aHelp) override;
/*
* Get the description for the accessible with given id.
*/

View File

@ -75,6 +75,7 @@ child:
prio(high) sync State(uint64_t aID) returns(uint64_t states);
prio(high) sync Name(uint64_t aID) returns(nsString name);
prio(high) sync Value(uint64_t aID) returns(nsString value);
prio(high) sync Help(uint64_t aID) returns(nsString help);
prio(high) sync Description(uint64_t aID) returns(nsString desc);
prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
prio(high) sync RelationByType(uint64_t aID, uint32_t aRelationType)

View File

@ -95,6 +95,12 @@ ProxyAccessible::Value(nsString& aValue) const
unused << mDoc->SendValue(mID, &aValue);
}
void
ProxyAccessible::Help(nsString& aHelp) const
{
unused << mDoc->SendHelp(mID, &aHelp);
}
void
ProxyAccessible::Description(nsString& aDesc) const
{

View File

@ -89,6 +89,11 @@ public:
*/
void Value(nsString& aValue) const;
/*
* Set aHelp to the help string of the proxied accessible.
*/
void Help(nsString& aHelp) const;
/**
* Set aDesc to the description of the proxied accessible.
*/

View File

@ -1156,7 +1156,11 @@ struct RoleDescrComparator
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
nsAutoString title;
[self getGeckoAccessible]->Name(title);
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
accWrap->Name(title);
else if (ProxyAccessible* proxy = [self getProxyAccessible])
proxy->Name(title);
return nsCocoaUtils::ToNSString(title);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
@ -1167,7 +1171,11 @@ struct RoleDescrComparator
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
nsAutoString value;
[self getGeckoAccessible]->Value(value);
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
accWrap->Value(value);
else if (ProxyAccessible* proxy = [self getProxyAccessible])
proxy->Value(value);
return nsCocoaUtils::ToNSString(value);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
@ -1213,7 +1221,11 @@ struct RoleDescrComparator
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
nsAutoString helpText;
[self getGeckoAccessible]->Help(helpText);
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
accWrap->Help(helpText);
else if (ProxyAccessible* proxy = [self getProxyAccessible])
proxy->Help(helpText);
return nsCocoaUtils::ToNSString(helpText);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
@ -1259,8 +1271,13 @@ struct RoleDescrComparator
- (BOOL)isEnabled
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
return accWrap && ((accWrap->InteractiveState() & states::UNAVAILABLE) == 0);
if (AccessibleWrap* accWrap = [self getGeckoAccessible])
return ((accWrap->InteractiveState() & states::UNAVAILABLE) == 0);
if (ProxyAccessible* proxy = [self getProxyAccessible])
return ((proxy->State() & states::UNAVAILABLE) == 0);
return false;
}
// The root accessible calls this when the focused node was
@ -1338,7 +1355,7 @@ struct RoleDescrComparator
- (BOOL)isExpired
{
return ![self getGeckoAccessible];
return ![self getGeckoAccessible] && ![self getProxyAccessible];
}
#pragma mark -