bug 1162621 - proxy Accessible::IndexOfEmbeddedChild r=davidb

This is a bit dirty, we should be able to implement this just in the main
process by looking at the role of the children.  However doing it this way is
simpler and allows us to share code with the non e10s case.
This commit is contained in:
Trevor Saunders 2015-05-07 12:59:17 -04:00
parent bf115e16cf
commit d4ef04f30a
6 changed files with 39 additions and 0 deletions

View File

@ -855,6 +855,13 @@ getIndexInParentCB(AtkObject* aAtkObj)
{
// We don't use Accessible::IndexInParent() because we don't include text
// leaf nodes as children in ATK.
if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
if (ProxyAccessible* parent = proxy->Parent())
return parent->IndexOfEmbeddedChild(proxy);
return -1;
}
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return -1;

View File

@ -1615,6 +1615,22 @@ DocAccessibleChild::RecvTakeFocus(const uint64_t& aID)
return true;
}
bool
DocAccessibleChild::RecvIndexOfEmbeddedChild(const uint64_t& aID,
const uint64_t& aChildID,
uint32_t* aChildIdx)
{
*aChildIdx = 0;
Accessible* parent = IdToAccessible(aID);
Accessible* child = IdToAccessible(aChildID);
if (!parent || !child)
return true;
*aChildIdx = parent->GetIndexOfEmbeddedChild(child);
return true;
}
bool
DocAccessibleChild::RecvChildAtPoint(const uint64_t& aID,
const int32_t& aX,

View File

@ -393,6 +393,10 @@ public:
virtual bool RecvTakeFocus(const uint64_t& aID) override;
virtual bool RecvIndexOfEmbeddedChild(const uint64_t& aID,
const uint64_t& aChildID,
uint32_t* aChildIdx) override final;
virtual bool RecvChildAtPoint(const uint64_t& aID,
const int32_t& aX,
const int32_t& aY,

View File

@ -211,6 +211,8 @@ child:
prio(high) sync Step(uint64_t aID) returns(double aStep);
prio(high) sync TakeFocus(uint64_t aID);
prio(high) sync IndexOfEmbeddedChild(uint64_t aID, uint64_t aChildID)
returns(uint32_t childIdx);
prio(high) sync ChildAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aWhich)
returns(uint64_t aChild, bool aOk);
prio(high) sync Bounds(uint64_t aID) returns(nsIntRect aRect);

View File

@ -903,6 +903,15 @@ ProxyAccessible::TakeFocus()
unused << mDoc->SendTakeFocus(mID);
}
ssize_t
ProxyAccessible::IndexOfEmbeddedChild(const ProxyAccessible* aChild)
{
uint64_t childID = aChild->mID;
uint32_t childIdx;
unused << mDoc->SendIndexOfEmbeddedChild(mID, childID, &childIdx);
return childIdx;
}
ProxyAccessible*
ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY,
Accessible::EWhichChildAtPoint aWhichChild)

View File

@ -47,6 +47,7 @@ public:
// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return mParent->mChildren.IndexOf(this); }
ssize_t IndexOfEmbeddedChild(const ProxyAccessible*);
bool MustPruneChildren() const;
void Shutdown();