bug 1262233 - stop implementing ProxyAccessible::IndexOfEmbeddedChild() with a sync message r=lsocks
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Mon, 04 Apr 2016 18:16:21 -0400
changeset 317709 546156845ae568136691c32f21d411190eacde6a
parent 317708 0efc1ab6080b7aa38f90050bc050790236e5c752
child 317710 02cbaad80b65e2317f4b800fe472f80649ba7612
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsocks
bugs1262233
milestone48.0a1
bug 1262233 - stop implementing ProxyAccessible::IndexOfEmbeddedChild() with a sync message r=lsocks
accessible/ipc/DocAccessibleChild.cpp
accessible/ipc/DocAccessibleChild.h
accessible/ipc/PDocAccessible.ipdl
accessible/ipc/ProxyAccessible.cpp
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -1841,32 +1841,16 @@ 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::RecvEmbeddedChildAt(const uint64_t& aID,
                                         const uint32_t& aIdx,
                                         uint64_t* aChildID)
 {
   *aChildID = 0;
 
   Accessible* acc = IdToAccessible(aID);
   if (!acc)
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -449,20 +449,16 @@ 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 RecvEmbeddedChildAt(const uint64_t& aID, const uint32_t& aIdx,
                                    uint64_t* aChildID) override final;
 
   virtual bool RecvFocusedChild(const uint64_t& aID,
                                 uint64_t* aChild,
                                 bool* aOk) override;
 
   virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -232,18 +232,16 @@ 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);
 
   async TakeFocus(uint64_t aID);
-  prio(high) sync IndexOfEmbeddedChild(uint64_t aID, uint64_t aChildID)
-    returns(uint32_t childIdx);
   prio(high) sync EmbeddedChildAt(uint64_t aID, uint32_t aChildIdx)
     returns(uint64_t aChild);
   prio(high) sync FocusedChild(uint64_t aID)
     returns(uint64_t aChild, bool aOk);
 
   prio(high) sync Language(uint64_t aID) returns(nsString aLocale);
   prio(high) sync DocType(uint64_t aID) returns(nsString aType);
   prio(high) sync Title(uint64_t aID) returns(nsString aTitle);
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -1043,20 +1043,28 @@ ProxyAccessible::EmbeddedChildCount() co
   }
 
   return count;
 }
 
 int32_t
 ProxyAccessible::IndexOfEmbeddedChild(const ProxyAccessible* aChild)
 {
-  uint64_t childID = aChild->mID;
-  uint32_t childIdx;
-  Unused << mDoc->SendIndexOfEmbeddedChild(mID, childID, &childIdx);
-  return childIdx;
+  size_t index = 0, kids = mChildren.Length();
+  for (size_t i = 0; i < kids; i++) {
+    if (mChildren[i]->IsEmbeddedObject()) {
+      if (mChildren[i] == aChild) {
+        return index;
+      }
+
+      index++;
+    }
+  }
+
+  return -1;
 }
 
 ProxyAccessible*
 ProxyAccessible::EmbeddedChildAt(size_t aChildIdx)
 {
   // For an outer doc the only child is a document, which is of course an
   // embedded child.  Further asking the child process for the id of the child
   // document won't work because the id of the child doc will be 0, which we