Bug 1262417 - bind a value change event with reorder event firing, r=yzen
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 19 Apr 2016 11:51:51 -0400
changeset 293914 b27efe1fcffe79b6b724698749238816837dc13a
parent 293913 75c314efec3ed7459e97afba357f8066a4137b93
child 293915 d5ed5fe137737f370d89aff9afb3d8eb2c749b48
push id30194
push usercbook@mozilla.com
push dateWed, 20 Apr 2016 09:50:56 +0000
treeherdermozilla-central@f05a1242fb29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1262417
milestone48.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 1262417 - bind a value change event with reorder event firing, r=yzen
accessible/base/EventTree.cpp
accessible/generic/DocAccessible.cpp
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -230,16 +230,17 @@ EventTree::Process()
       }
     }
   }
 
   // Fire reorder event at last.
   if (mFireReorder) {
     MOZ_ASSERT(mContainer);
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_REORDER, mContainer);
+    mContainer->Document()->MaybeNotifyOfValueChange(mContainer);
   }
 
   mDependentEvents.Clear();
 }
 
 EventTree*
 EventTree::FindOrInsert(Accessible* aContainer)
 {
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1851,18 +1851,16 @@ DocAccessible::FireEventsOnInsertion(Acc
     do {
       if (ancestor->IsAlert()) {
         FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
         break;
       }
     }
     while ((ancestor = ancestor->Parent()));
   }
-
-  MaybeNotifyOfValueChange(aContainer);
 }
 
 void
 DocAccessible::UpdateTreeOnRemoval(Accessible* aContainer, nsIContent* aChildNode)
 {
   // If child node is not accessible then look for its accessible children.
   Accessible* child = GetAccessible(aChildNode);
 #ifdef A11Y_LOG
@@ -1874,40 +1872,33 @@ DocAccessible::UpdateTreeOnRemoval(Acces
       logging::Address("child", child);
     else
       logging::MsgEntry("child accessible: null");
 
     logging::MsgEnd();
   }
 #endif
 
-  uint32_t updateFlags = eNoAccessible;
   TreeMutation mt(aContainer);
-
   if (child) {
     mt.BeforeRemoval(child);
-    updateFlags |= UpdateTreeInternal(child, false);
+    UpdateTreeInternal(child, false);
   }
   else {
     TreeWalker walker(aContainer, aChildNode, TreeWalker::eWalkCache);
     Accessible* child = walker.Next();
     if (child) {
       do {
         mt.BeforeRemoval(child);
-        updateFlags |= UpdateTreeInternal(child, false);
+        UpdateTreeInternal(child, false);
       }
       while ((child = walker.Next()));
     }
   }
   mt.Done();
-
-  // Content insertion/removal is not cause of accessible tree change.
-  if (updateFlags != eNoAccessible) {
-    MaybeNotifyOfValueChange(aContainer);
-  }
 }
 
 uint32_t
 DocAccessible::UpdateTreeInternal(Accessible* aChild, bool aIsInsert)
 {
   uint32_t updateFlags = eAccessible;
 
   // If a focused node has been shown then it could mean its frame was recreated
@@ -2167,19 +2158,17 @@ DocAccessible::MoveChild(Accessible* aCh
   // If the child was taken from from an ARIA owns element.
   if (aChild->IsRelocated()) {
     nsTArray<RefPtr<Accessible> >* children = mARIAOwnsHash.Get(curParent);
     children->RemoveElement(aChild);
   }
 
   if (curParent == aNewParent) {
     MOZ_ASSERT(aChild->IndexInParent() != aIdxInParent, "No move case");
-
     curParent->MoveChild(aIdxInParent, aChild);
-    MaybeNotifyOfValueChange(curParent);
 
 #ifdef A11Y_LOG
     logging::TreeInfo("move child: parent tree after",
                       logging::eVerbose, curParent);
 #endif
     return true;
   }
 
@@ -2187,30 +2176,26 @@ DocAccessible::MoveChild(Accessible* aCh
     return false;
   }
 
   TreeMutation rmut(curParent);
   rmut.BeforeRemoval(aChild, TreeMutation::kNoShutdown);
   curParent->RemoveChild(aChild);
   rmut.Done();
 
-  MaybeNotifyOfValueChange(curParent);
-
   // No insertion point for the child.
   if (aIdxInParent == -1) {
     return true;
   }
 
   TreeMutation imut(aNewParent);
   aNewParent->InsertChildAt(aIdxInParent, aChild);
   imut.AfterInsertion(aChild);
   imut.Done();
 
-  MaybeNotifyOfValueChange(aNewParent);
-
 #ifdef A11Y_LOG
   logging::TreeInfo("move child: old parent tree after",
                     logging::eVerbose, curParent);
   logging::TreeInfo("move child: new parent tree after",
                     logging::eVerbose, aNewParent);
 #endif
 
   return true;