bug 1270916 - remove EventTree::{Shown,Hidden}() r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Mon, 05 Sep 2016 16:09:28 -0400
changeset 322950 2c044a48a93897c9312bcd7ad7a32da1683df030
parent 322949 e89942576524b4a20209a9711633b94b61e15d1f
child 322951 9814186062bc3772323c0c45457a47725e3f33c2
push id30964
push usercbook@mozilla.com
push dateThu, 17 Nov 2016 13:34:58 +0000
treeherdermozilla-central@41fe2fa4ddab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1270916
milestone53.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 1270916 - remove EventTree::{Shown,Hidden}() r=davidb They are pretty useless wrappers, and in the future it will be useful to have access to the event object independent of the EventTree.
accessible/base/EventTree.cpp
accessible/base/EventTree.h
accessible/generic/Accessible.cpp
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -66,17 +66,18 @@ TreeMutation::AfterInsertion(Accessible*
   if (!mEventTree) {
     mEventTree = Controller()->QueueMutation(mParent);
     if (!mEventTree) {
       mEventTree = kNoEventTree;
     }
   }
 
   if (mEventTree != kNoEventTree) {
-    mEventTree->Shown(aChild);
+    RefPtr<AccShowEvent> ev = new AccShowEvent(aChild);
+    mEventTree->Mutated(ev);
     Controller()->QueueNameChange(aChild);
   }
 }
 
 void
 TreeMutation::BeforeRemoval(Accessible* aChild, bool aNoShutdown)
 {
   MOZ_ASSERT(aChild->Parent() == mParent);
@@ -88,17 +89,18 @@ TreeMutation::BeforeRemoval(Accessible* 
   if (!mEventTree) {
     mEventTree = Controller()->QueueMutation(mParent);
     if (!mEventTree) {
       mEventTree = kNoEventTree;
     }
   }
 
   if (mEventTree != kNoEventTree) {
-    mEventTree->Hidden(aChild, !aNoShutdown);
+    RefPtr<AccHideEvent> ev = new AccHideEvent(aChild, !aNoShutdown);
+    mEventTree->Mutated(ev);
     Controller()->QueueNameChange(aChild);
   }
 }
 
 void
 TreeMutation::Done()
 {
   MOZ_ASSERT(mParent->mStateFlags & Accessible::eKidsMutating);
--- a/accessible/base/EventTree.h
+++ b/accessible/base/EventTree.h
@@ -67,41 +67,44 @@ class EventTree final {
 public:
   EventTree() :
     mFirst(nullptr), mNext(nullptr), mContainer(nullptr), mFireReorder(false) { }
   explicit EventTree(Accessible* aContainer, bool aFireReorder) :
     mFirst(nullptr), mNext(nullptr), mContainer(aContainer),
     mFireReorder(aFireReorder) { }
   ~EventTree() { Clear(); }
 
-  void Shown(Accessible* aChild);
-
-  void Hidden(Accessible* aChild, bool aNeedsShutdown = true);
+  void Shown(Accessible* aTarget);
+  void Hidden(Accessible*, bool);
 
   /**
    * Return an event tree node for the given accessible.
    */
   const EventTree* Find(const Accessible* aContainer) const;
 
+  /**
+   * Add a mutation event to this event tree.
+   */
+  void Mutated(AccMutationEvent* aEv);
+
 #ifdef A11Y_LOG
   void Log(uint32_t aLevel = UINT32_MAX) const;
 #endif
 
 private:
   /**
    * Processes the event queue and fires events.
    */
   void Process(const RefPtr<DocAccessible>& aDeathGrip);
 
   /**
    * Return an event subtree for the given accessible.
    */
   EventTree* FindOrInsert(Accessible* aContainer);
 
-  void Mutated(AccMutationEvent* aEv);
   void Clear();
 
   UniquePtr<EventTree> mFirst;
   UniquePtr<EventTree> mNext;
 
   Accessible* mContainer;
   nsTArray<RefPtr<AccMutationEvent>> mDependentEvents;
   bool mFireReorder;
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2155,17 +2155,18 @@ Accessible::MoveChild(uint32_t aNewIndex
   MOZ_ASSERT(aChild->mParent == this, "A child from different subtree was given");
   MOZ_ASSERT(aChild->mIndexInParent != -1, "Unbound child was given");
   MOZ_ASSERT(static_cast<uint32_t>(aChild->mIndexInParent) != aNewIndex,
              "No move, same index");
   MOZ_ASSERT(aNewIndex <= mChildren.Length(), "Wrong new index was given");
 
   EventTree* eventTree = mDoc->Controller()->QueueMutation(this);
   if (eventTree) {
-    eventTree->Hidden(aChild, false);
+    RefPtr<AccHideEvent> event = new AccHideEvent(aChild, false);
+    eventTree->Mutated(event);
   }
 
   mEmbeddedObjCollector = nullptr;
   mChildren.RemoveElementAt(aChild->mIndexInParent);
 
   uint32_t startIdx = aNewIndex, endIdx = aChild->mIndexInParent;
 
   // If the child is moved after its current position.
@@ -2188,17 +2189,18 @@ Accessible::MoveChild(uint32_t aNewIndex
 
   for (uint32_t idx = startIdx; idx <= endIdx; idx++) {
     mChildren[idx]->mIndexInParent = idx;
     mChildren[idx]->mStateFlags |= eGroupInfoDirty;
     mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1;
   }
 
   if (eventTree) {
-    eventTree->Shown(aChild);
+    RefPtr<AccShowEvent> event = new AccShowEvent(aChild);
+    eventTree->Mutated(event);
     mDoc->Controller()->QueueNameChange(aChild);
   }
 }
 
 Accessible*
 Accessible::GetChildAt(uint32_t aIndex) const
 {
   Accessible* child = mChildren.SafeElementAt(aIndex, nullptr);