bug 1162621 - proxy Accessible::IndexOfEmbeddedChild r=davidb
☠☠ backed out by 053b96e48e3c ☠ ☠
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 07 May 2015 12:59:17 -0400
changeset 274412 01c40642909358267bddfab8a210a791f029520f
parent 274411 4ff5e8facd3751b864104efa120a918643553bf4
child 274413 82bbc0b0d516c7d69d931121443513537fcee8e5
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1162621
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
accessible/atk/AccessibleWrap.cpp
accessible/ipc/DocAccessibleChild.cpp
accessible/ipc/DocAccessibleChild.h
accessible/ipc/PDocAccessible.ipdl
accessible/ipc/ProxyAccessible.cpp
accessible/ipc/ProxyAccessible.h
--- a/accessible/atk/AccessibleWrap.cpp
+++ b/accessible/atk/AccessibleWrap.cpp
@@ -850,16 +850,23 @@ refChildCB(AtkObject *aAtkObj, gint aChi
   return childAtkObj;
 }
 
 gint
 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;
     }
 
     Accessible* parent = accWrap->Parent();
     if (!parent)
         return -1; // No parent
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -1611,16 +1611,32 @@ DocAccessibleChild::RecvTakeFocus(const 
   if (acc) {
     acc->TakeFocus();
   }
 
   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,
                                      const int32_t& aY,
                                      const uint32_t& aWhich,
                                      uint64_t* aChild,
                                      bool* aOk)
 {
   *aChild = 0;
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -388,16 +388,20 @@ public:
   virtual bool RecvMaxValue(const uint64_t& aID,
                             double* aValue) override;
 
   virtual bool RecvStep(const uint64_t& aID,
                         double* aStep) override;
 
   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,
                                 const uint32_t& aWhich,
                                 uint64_t* aChild,
                                 bool* aOk) override;
 
   virtual bool RecvBounds(const uint64_t& aID, nsIntRect* aRect) override;
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -206,16 +206,18 @@ child:
 
   prio(high) sync CurValue(uint64_t aID) returns(double aValue);
   prio(high) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal);
   prio(high) sync MinValue(uint64_t aID) returns(double aValue);
   prio(high) sync MaxValue(uint64_t aID) returns(double aValue);
   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);
 
   prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
   prio(high) sync DocType(uint64_t aID) returns(nsString aType);
   prio(high) sync URL(uint64_t aID) returns(nsString aURL);
   prio(high) sync MimeType(uint64_t aID) returns(nsString aMime);
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -898,16 +898,25 @@ ProxyAccessible::Step()
 }
 
 void
 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)
 {
   uint64_t childID = 0;
   bool ok = false;
   unused << mDoc->SendChildAtPoint(mID, aX, aY,
                                    static_cast<uint32_t>(aWhichChild),
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -42,16 +42,17 @@ public:
   void AddChildAt(uint32_t aIdx, ProxyAccessible* aChild)
   { mChildren.InsertElementAt(aIdx, aChild); }
 
   uint32_t ChildrenCount() const { return mChildren.Length(); }
   ProxyAccessible* ChildAt(uint32_t aIdx) const { return mChildren[aIdx]; }
 
   // 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();
 
   void SetChildDoc(DocAccessibleParent*);
 
   /**
    * Remove The given child.