bug 1195471 - make getChildCountCB work with proxies r=davidb

This commit is contained in:
Trevor Saunders 2015-08-17 15:33:38 -04:00
parent 88fa41bffd
commit dcf750da4b
6 changed files with 40 additions and 3 deletions

View File

@ -822,12 +822,20 @@ getParentCB(AtkObject *aAtkObj)
gint
getChildCountCB(AtkObject *aAtkObj)
{
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
return 0;
if (AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj)) {
if (nsAccUtils::MustPrune(accWrap)) {
return 0;
}
return static_cast<gint>(accWrap->EmbeddedChildCount());
}
ProxyAccessible* proxy = GetProxy(aAtkObj);
if (proxy && !proxy->MustPruneChildren()) {
return proxy->EmbeddedChildCount();
}
return 0;
}
AtkObject *

View File

@ -1727,6 +1727,22 @@ DocAccessibleChild::RecvTakeFocus(const uint64_t& aID)
return true;
}
bool
DocAccessibleChild::RecvEmbeddedChildCount(const uint64_t& aID,
uint32_t* aCount)
{
*aCount = 0;
Accessible* acc = IdToAccessible(aID);
if (!acc) {
return true;
}
*aCount = acc->EmbeddedChildCount();
return true;
}
bool
DocAccessibleChild::RecvIndexOfEmbeddedChild(const uint64_t& aID,
const uint64_t& aChildID,

View File

@ -434,6 +434,9 @@ public:
virtual bool RecvTakeFocus(const uint64_t& aID) override;
virtual bool RecvEmbeddedChildCount(const uint64_t& aID, uint32_t* aCount)
override final;
virtual bool RecvIndexOfEmbeddedChild(const uint64_t& aID,
const uint64_t& aChildID,
uint32_t* aChildIdx) override final;

View File

@ -226,6 +226,7 @@ child:
prio(high) sync Step(uint64_t aID) returns(double aStep);
prio(high) sync TakeFocus(uint64_t aID);
prio(high) sync EmbeddedChildCount(uint64_t aID) returns(uint32_t aCount);
prio(high) sync IndexOfEmbeddedChild(uint64_t aID, uint64_t aChildID)
returns(uint32_t childIdx);
prio(high) sync EmbeddedChildAt(uint64_t aID, uint32_t aChildIdx)

View File

@ -979,6 +979,14 @@ ProxyAccessible::TakeFocus()
unused << mDoc->SendTakeFocus(mID);
}
uint32_t
ProxyAccessible::EmbeddedChildCount() const
{
uint32_t count;
unused << mDoc->SendEmbeddedChildCount(mID, &count);
return count;
}
int32_t
ProxyAccessible::IndexOfEmbeddedChild(const ProxyAccessible* aChild)
{

View File

@ -49,6 +49,7 @@ public:
// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return Parent()->mChildren.IndexOf(this); }
uint32_t EmbeddedChildCount() const;
int32_t IndexOfEmbeddedChild(const ProxyAccessible*);
ProxyAccessible* EmbeddedChildAt(size_t aChildIdx);
bool MustPruneChildren() const;