From 93993116dae1a940d773ae140c9c68f4ed6433ee Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 2 Sep 2016 20:50:56 -0400 Subject: [PATCH] bug 1270916 - allow keeping AccTreeMutation in a list r=davidb Soon we will use the list to track the order of the events. --- accessible/base/AccEvent.cpp | 18 +++++++++++++++++- accessible/base/AccEvent.h | 9 +++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/accessible/base/AccEvent.cpp b/accessible/base/AccEvent.cpp index d30a2bed507a..a27ceacb9f13 100644 --- a/accessible/base/AccEvent.cpp +++ b/accessible/base/AccEvent.cpp @@ -42,7 +42,23 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible, //////////////////////////////////////////////////////////////////////////////// // AccEvent cycle collection -NS_IMPL_CYCLE_COLLECTION(AccEvent, mAccessible) +NS_IMPL_CYCLE_COLLECTION_CLASS(AccEvent) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AccEvent) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mAccessible) + if (AccTreeMutationEvent* tmEvent = downcast_accEvent(tmp)) { + tmEvent->SetNextEvent(nullptr); + tmEvent->SetPrevEvent(nullptr); + } +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AccEvent) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAccessible) + if (AccTreeMutationEvent* tmEvent = downcast_accEvent(tmp)) { + CycleCollectionNoteChild(cb, tmEvent->NextEvent(), "mNext"); + CycleCollectionNoteChild(cb, tmEvent->PrevEvent(), "mPrevEvent"); + } +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release) diff --git a/accessible/base/AccEvent.h b/accessible/base/AccEvent.h index 790997697c15..bd5eafc06029 100644 --- a/accessible/base/AccEvent.h +++ b/accessible/base/AccEvent.h @@ -219,6 +219,15 @@ public: { return AccEvent::GetEventGroups() | (1U << eTreeMutationEvent); } + + void SetNextEvent(AccTreeMutationEvent* aNext) { mNextEvent = aNext; } + void SetPrevEvent(AccTreeMutationEvent* aPrev) { mPrevEvent = aPrev; } + AccTreeMutationEvent* NextEvent() const { return mNextEvent; } + AccTreeMutationEvent* PrevEvent() const { return mPrevEvent; } + +private: + RefPtr mNextEvent; + RefPtr mPrevEvent; }; /**