bug 1255009 - make AccShowEvent store the insertion index of the new child r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Wed, 23 Mar 2016 16:44:50 -0400
changeset 290700 201cab594d2a38a457745ffd293994441e02113f
parent 290699 720933fc00b99d6ec11d8be54b710cdf493f18eb
child 290701 f1cf3b00918f9b08d28f675f49198681855599cd
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1255009
milestone48.0a1
bug 1255009 - make AccShowEvent store the insertion index of the new child r=davidb
accessible/base/AccEvent.cpp
accessible/base/AccEvent.h
accessible/ipc/DocAccessibleChild.cpp
--- a/accessible/base/AccEvent.cpp
+++ b/accessible/base/AccEvent.cpp
@@ -116,16 +116,19 @@ AccHideEvent::
 ////////////////////////////////////////////////////////////////////////////////
 // AccShowEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccShowEvent::
   AccShowEvent(Accessible* aTarget) :
   AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget)
 {
+  int32_t idx = aTarget->IndexInParent();
+  MOZ_ASSERT(idx >= 0);
+  mInsertionIndex = idx;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccTextSelChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccTextSelChangeEvent::AccTextSelChangeEvent(HyperTextAccessible* aTarget,
--- a/accessible/base/AccEvent.h
+++ b/accessible/base/AccEvent.h
@@ -282,16 +282,21 @@ public:
   explicit AccShowEvent(Accessible* aTarget);
 
   // Event
   static const EventGroup kEventGroup = eShowEvent;
   virtual unsigned int GetEventGroups() const override
   {
     return AccMutationEvent::GetEventGroups() | (1U << eShowEvent);
   }
+
+  uint32_t InsertionIndex() const { return mInsertionIndex; }
+
+private:
+  uint32_t mInsertionIndex;
 };
 
 
 /**
  * Class for reorder accessible event. Takes care about
  */
 class AccReorderEvent : public AccEvent
 {
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -138,17 +138,17 @@ DocAccessibleChild::IdToTableAccessible(
   return (acc && acc->IsTable()) ? acc->AsTable() : nullptr;
 }
 
 void
 DocAccessibleChild::ShowEvent(AccShowEvent* aShowEvent)
 {
   Accessible* parent = aShowEvent->Parent();
   uint64_t parentID = parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
-  uint32_t idxInParent = aShowEvent->GetAccessible()->IndexInParent();
+  uint32_t idxInParent = aShowEvent->InsertionIndex();
   nsTArray<AccessibleData> shownTree;
   ShowEventData data(parentID, idxInParent, shownTree);
   SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
   SendShowEvent(data);
 }
 
 bool
 DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState)