Skip to content

Commit

Permalink
bug 1162621 - proxy Accessible::IndexOfEmbeddedChild r=davidb
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tbsaunde committed May 9, 2015
1 parent 7c747d8 commit 82cda4a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 0 deletions.
7 changes: 7 additions & 0 deletions accessible/atk/AccessibleWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions accessible/ipc/DocAccessibleChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,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,
Expand Down
4 changes: 4 additions & 0 deletions accessible/ipc/DocAccessibleChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ class DocAccessibleChild : public PDocAccessibleChild

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,
Expand Down
2 changes: 2 additions & 0 deletions accessible/ipc/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions accessible/ipc/ProxyAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,15 @@ ProxyAccessible::TakeFocus()
unused << mDoc->SendTakeFocus(mID);
}

int32_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)
Expand Down
1 change: 1 addition & 0 deletions accessible/ipc/ProxyAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ProxyAccessible

// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return mParent->mChildren.IndexOf(this); }
int32_t IndexOfEmbeddedChild(const ProxyAccessible*);
bool MustPruneChildren() const;

void Shutdown();
Expand Down

0 comments on commit 82cda4a

Please sign in to comment.