Bug 1289223: Make EventTree process all accessibility show events draft
authorMichael Li <michael.li11702@gmail.com>
Mon, 08 Aug 2016 15:02:57 -0400
changeset 398124 e35f07bea6e782e5bbccc4f197cc8e8bc9e2d97d
parent 398122 61f2c98adad89dff2aef3c9831a82af31db1ae9d
child 398170 8de62d054991f8518f965de7e04ec9102bdfaeea
child 398181 59ab92c9ef452811786eba024dc25cdba77eaab4
push id25454
push userbmo:mili@mozilla.com
push dateMon, 08 Aug 2016 19:07:10 +0000
bugs1289223
milestone51.0a1
Bug 1289223: Make EventTree process all accessibility show events MozReview-Commit-ID: CKiyHobOFKz
accessible/generic/DocAccessible-inl.h
accessible/generic/DocAccessible.cpp
accessible/generic/DocAccessible.h
--- a/accessible/generic/DocAccessible-inl.h
+++ b/accessible/generic/DocAccessible-inl.h
@@ -172,12 +172,24 @@ DocAccessible::CreateSubtree(Accessible*
   // account active item?
   if (focusedAcc) {
     FocusMgr()->DispatchFocusEvent(this, focusedAcc);
     SelectionMgr()->
       SetControlSelectionListener(focusedAcc->GetNode()->AsElement());
   }
 }
 
+inline void
+DocAccessible::ProcessChildShowEvents()
+{
+  TreeMutation mt(this);
+  uint32_t childCount = ChildCount();
+  for (uint32_t i = 0; i < childCount; i++) {
+    Accessible* child = GetChildAt(i);
+    mt.AfterInsertion(child);
+  }
+  mt.Done();
+}
+
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1457,22 +1457,17 @@ DocAccessible::DoInitialUpdate()
   // this reorder event is processed by parent document then events targeted to
   // this document may be fired prior to this reorder event. If this is
   // a problem then consider to keep event processing per tab document.
   if (!IsRoot()) {
     RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
     ParentDocument()->FireDelayedEvent(reorderEvent);
   }
 
-  uint32_t childCount = ChildCount();
-  for (uint32_t i = 0; i < childCount; i++) {
-    Accessible* child = GetChildAt(i);
-    RefPtr<AccShowEvent> event = new AccShowEvent(child);
-  FireDelayedEvent(event);
-  }
+  ProcessChildShowEvents();
 }
 
 void
 DocAccessible::ProcessLoad()
 {
   mLoadState |= eCompletelyLoaded;
 
 #ifdef A11Y_LOG
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -508,16 +508,22 @@ protected:
    *
    * While children are cached we may encounter the case there's no accessible
    * for referred content by related accessible. Store these related nodes to
    * invalidate their containers later.
    */
   void ProcessInvalidationList();
 
   /**
+   * Put children into EventTree to process show events.
+   *
+   */
+  void ProcessChildShowEvents();
+
+  /**
    * Update the accessible tree for content removal.
    */
   void UpdateTreeOnRemoval(Accessible* aContainer, nsIContent* aChildNode);
 
   /**
    * Validates all aria-owns connections and updates the tree accordingly.
    */
   void ValidateARIAOwned();