bug 1270916 - use accessible->IndexInParent() in DocAccessibleChildBase::ShowEvent() r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 10 Nov 2016 23:53:45 -0500
changeset 322983 43708cd293faa60fc2855a437602cb82d8bb9715
parent 322982 1b22ff1fe4a66ea222ea4d8217f07c0f84d75911
child 322984 387d3acae9e99bdc140a65fd367ecbaa6238f3a3
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersdavidb
bugs1270916
milestone53.0a1
bug 1270916 - use accessible->IndexInParent() in DocAccessibleChildBase::ShowEvent() r=davidb Since we will fire events in the correct order we can use the index of the event target at the time the event is fired. This protects from weird cases where the target is inserted, and then children before the target are removed.
accessible/ipc/DocAccessibleChildBase.cpp
--- a/accessible/ipc/DocAccessibleChildBase.cpp
+++ b/accessible/ipc/DocAccessibleChildBase.cpp
@@ -80,17 +80,17 @@ DocAccessibleChildBase::SerializeTree(Ac
   }
 }
 
 void
 DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent)
 {
   Accessible* parent = aShowEvent->Parent();
   uint64_t parentID = parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
-  uint32_t idxInParent = aShowEvent->InsertionIndex();
+  uint32_t idxInParent = aShowEvent->GetAccessible()->IndexInParent();
   nsTArray<AccessibleData> shownTree;
   ShowEventData data(parentID, idxInParent, shownTree);
   SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
   SendShowEvent(data, aShowEvent->IsFromUserInput());
 }
 
 } // namespace a11y
 } // namespace mozilla