Bug 589145 - dexpcom accessible event classes, r=davidb, sr=neil, a=davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 25 Aug 2010 11:08:28 +0900
changeset 51377 4d7a1cae44c44dfc3c731f34593fbf3632e47e68
parent 51376 99bebf5ca9b4ecff4ff308b1205ff1d12fde1de8
child 51378 9c5898c4570d4f010ce655a1d2313f2f0af280b4
push id15295
push usersurkov.alexander@gmail.com
push dateWed, 25 Aug 2010 02:09:45 +0000
treeherdermozilla-central@55f009ed5368 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb, neil, davidb
bugs589145
milestone2.0b5pre
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 589145 - dexpcom accessible event classes, r=davidb, sr=neil, a=davidb
accessible/build/Makefile.in
accessible/public/nsIAccessibleEvent.idl
accessible/src/Makefile.in
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/atk/nsAccessibleWrap.h
accessible/src/base/AccEvent.cpp
accessible/src/base/AccEvent.h
accessible/src/base/Makefile.in
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccDocManager.h
accessible/src/base/nsAccEvent.cpp
accessible/src/base/nsAccEvent.h
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsCaretAccessible.cpp
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
accessible/src/base/nsEventShell.cpp
accessible/src/base/nsEventShell.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/mac/nsAccessibleWrap.h
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/msaa/nsAccessNodeWrap.cpp
accessible/src/msaa/nsAccessNodeWrap.h
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsAccessibleWrap.h
accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
accessible/src/msaa/nsHyperTextAccessibleWrap.h
accessible/src/other/nsAccessibleWrap.h
accessible/src/xpcom/Makefile.in
accessible/src/xpcom/nsAccEvent.cpp
accessible/src/xpcom/nsAccEvent.h
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.cpp
--- a/accessible/build/Makefile.in
+++ b/accessible/build/Makefile.in
@@ -54,16 +54,17 @@ LIBXUL_LIBRARY	= 1
 
 CPPSRCS		= nsAccessibilityFactory.cpp
 
 LOCAL_INCLUDES	= -I$(srcdir)/../src
 
 SHARED_LIBRARY_LIBS = \
 	../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
 	../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
+	../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
 	../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
 	$(NULL)
 
 ifdef MOZ_XUL
 SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
 endif
 
 ifndef DISABLE_XFORMS_HOOKS
--- a/accessible/public/nsIAccessibleEvent.idl
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -54,17 +54,17 @@ interface nsIDOMNode;
  * the event and its target. To listen to in-process accessibility invents,
  * make your object an nsIObserver, and listen for accessible-event by 
  * using code something like this:
  *   nsCOMPtr<nsIObserverService> observerService = 
  *     do_GetService("@mozilla.org/observer-service;1", &rv);
  *   if (NS_SUCCEEDED(rv)) 
  *     rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
  */
-[scriptable, uuid(c68b4386-dca7-4b88-8988-7a95ce7be92f)]
+[scriptable, uuid(fd1378c5-c606-4a5e-a321-8e7fc107e5cf)]
 interface nsIAccessibleEvent : nsISupports
 {
   /**
    * An object has been created.
    */
   const unsigned long EVENT_SHOW = 0x0001;
 
   /**
@@ -471,17 +471,17 @@ interface nsIAccessibleEvent : nsISuppor
    * May return null if accessible for event has been shut down
    */
   readonly attribute nsIDOMNode DOMNode;
 
   /**
    * Returns true if the event was caused by explicit user input,
    * as opposed to purely originating from a timer or mouse movement
    */
-  attribute boolean isFromUserInput;
+  readonly attribute boolean isFromUserInput;
 };
 
 
 [scriptable, uuid(9addd25d-8fa1-415e-94ec-6038f220d3e4)]
 interface nsIAccessibleStateChangeEvent : nsISupports
 {
   /**
    * Returns the state of accessible (see constants declared
--- a/accessible/src/Makefile.in
+++ b/accessible/src/Makefile.in
@@ -57,16 +57,17 @@ endif
 endif
 endif
 
 DIRS += $(PLATFORM_DIR)
 
 DIRS += \
   base \
   html \
+  xpcom \
   $(null)
 
 ifdef MOZ_XUL
 DIRS +=   xul
 endif
 
 ifndef DISABLE_XFORMS_HOOKS
 DIRS +=   xforms
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -1045,26 +1045,26 @@ nsAccessibleWrap *GetAccessibleWrap(AtkO
 
     if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
         return nsnull;
 
     return tmpAccWrap;
 }
 
 nsresult
-nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
     nsresult rv = nsAccessible::HandleAccEvent(aEvent);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return FirePlatformEvent(aEvent);
 }
 
 nsresult
-nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
 {
     nsAccessible *accessible = aEvent->GetAccessible();
     NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
 
     PRUint32 type = aEvent->GetEventType();
 
     AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
 
@@ -1092,20 +1092,20 @@ nsAccessibleWrap::FirePlatformEvent(nsAc
 
     case nsIAccessibleEvent::EVENT_FOCUS:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
         nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
         if (rootAccWrap && rootAccWrap->mActivated) {
             atk_focus_tracker_notify(atkObj);
             // Fire state change event for focus
-            nsRefPtr<nsAccEvent> stateChangeEvent =
-              new nsAccStateChangeEvent(accessible,
-                                        nsIAccessibleStates::STATE_FOCUSED,
-                                        PR_FALSE, PR_TRUE);
+            nsRefPtr<AccEvent> stateChangeEvent =
+              new AccStateChangeEvent(accessible,
+                                      nsIAccessibleStates::STATE_FOCUSED,
+                                      PR_FALSE, PR_TRUE);
             return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
         }
       } break;
 
     case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
         nsCOMPtr<nsIAccessibleValue> value(do_QueryObject(accessible));
@@ -1125,17 +1125,17 @@ nsAccessibleWrap::FirePlatformEvent(nsAc
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
         g_signal_emit_by_name(atkObj, "text_selection_changed");
         break;
 
     case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
 
-        nsAccCaretMoveEvent *caretMoveEvent = downcast_accEvent(aEvent);
+        AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
         NS_ASSERTION(caretMoveEvent, "Event needs event data");
         if (!caretMoveEvent)
             break;
 
         PRInt32 caretOffset = caretMoveEvent->GetCaretOffset();
 
         MAI_LOG_DEBUG(("\n\nCaret postion: %d", caretOffset));
         g_signal_emit_by_name(atkObj,
@@ -1154,34 +1154,34 @@ nsAccessibleWrap::FirePlatformEvent(nsAc
     case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
         g_signal_emit_by_name(atkObj, "model_changed");
         break;
 
     case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
-        nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
         NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
 
         PRInt32 rowIndex = tableEvent->GetIndex();
         PRInt32 numRows = tableEvent->GetCount();
 
         g_signal_emit_by_name(atkObj,
                               "row_inserted",
                               // After which the rows are inserted
                               rowIndex,
                               // The number of the inserted
                               numRows);
      } break;
 
    case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
      {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
-        nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
         NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
 
         PRInt32 rowIndex = tableEvent->GetIndex();
         PRInt32 numRows = tableEvent->GetCount();
 
         g_signal_emit_by_name(atkObj,
                               "row_deleted",
                               // After which the rows are deleted
@@ -1195,34 +1195,34 @@ nsAccessibleWrap::FirePlatformEvent(nsAc
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
         g_signal_emit_by_name(atkObj, "row_reordered");
         break;
       }
 
     case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
-        nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
         NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
 
         PRInt32 colIndex = tableEvent->GetIndex();
         PRInt32 numCols = tableEvent->GetCount();
 
         g_signal_emit_by_name(atkObj,
                               "column_inserted",
                               // After which the columns are inserted
                               colIndex,
                               // The number of the inserted
                               numCols);
       } break;
 
     case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
       {
         MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
-        nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
         NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
 
         PRInt32 colIndex = tableEvent->GetIndex();
         PRInt32 numCols = tableEvent->GetCount();
 
         g_signal_emit_by_name(atkObj,
                               "column_deleted",
                               // After which the columns are deleted
@@ -1315,22 +1315,22 @@ nsAccessibleWrap::FirePlatformEvent(nsAc
         atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
         break;
     }
 
     return NS_OK;
 }
 
 nsresult
-nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
+nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
                                           AtkObject *aObject)
 {
     MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
 
-    nsAccStateChangeEvent *event = downcast_accEvent(aEvent);
+    AccStateChangeEvent* event = downcast_accEvent(aEvent);
     NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
 
     PRUint32 state = event->GetState();
     PRBool isExtra = event->IsExtraState();
     PRBool isEnabled = event->IsStateEnabled();
 
     PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(state);
     if (stateIndex >= 0) {
@@ -1351,22 +1351,22 @@ nsAccessibleWrap::FireAtkStateChangeEven
                                            isEnabled);
         }
     }
 
     return NS_OK;
 }
 
 nsresult
-nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
+nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
                                           AtkObject *aObject)
 {
     MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
 
-    nsAccTextChangeEvent *event = downcast_accEvent(aEvent);
+    AccTextChangeEvent* event = downcast_accEvent(aEvent);
     NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
 
     PRInt32 start = event->GetStartOffset();
     PRUint32 length = event->GetLength();
     PRBool isInserted = event->IsTextInserted();
 
     PRBool isFromUserInput = aEvent->IsFromUserInput();
 
@@ -1374,17 +1374,17 @@ nsAccessibleWrap::FireAtkTextChangedEven
                                     isFromUserInput ? "" : kNonUserInputEvent, NULL);
     g_signal_emit_by_name(aObject, signal_name, start, length);
     g_free (signal_name);
 
     return NS_OK;
 }
 
 nsresult
-nsAccessibleWrap::FireAtkShowHideEvent(nsAccEvent *aEvent,
+nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
                                        AtkObject *aObject, PRBool aIsAdded)
 {
     if (aIsAdded)
         MAI_LOG_DEBUG(("\n\nReceived: Show event\n"));
     else
         MAI_LOG_DEBUG(("\n\nReceived: Hide event\n"));
 
     PRInt32 indexInParent = getIndexInParentCB(aObject);
--- a/accessible/src/atk/nsAccessibleWrap.h
+++ b/accessible/src/atk/nsAccessibleWrap.h
@@ -95,17 +95,17 @@ public:
 #ifdef MAI_LOGGING
     virtual void DumpnsAccessibleWrapInfo(int aDepth) {}
     static PRInt32 mAccWrapCreated;
     static PRInt32 mAccWrapDeleted;
 #endif
 
     // return the atk object for this nsAccessibleWrap
     NS_IMETHOD GetNativeInterface(void **aOutAccessible);
-    virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
+    virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
     AtkObject * GetAtkObject(void);
     static AtkObject * GetAtkObject(nsIAccessible * acc);
 
     PRBool IsValidObject();
     
     // get/set the MaiHyperlink object for this nsAccessibleWrap
     MaiHyperlink* GetMaiHyperlink(PRBool aCreate = PR_TRUE);
@@ -113,21 +113,21 @@ public:
 
     static const char * ReturnString(nsAString &aString) {
       static nsCString returnedString;
       returnedString = NS_ConvertUTF16toUTF8(aString);
       return returnedString.get();
     }
 
 protected:
-    virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
+    virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
-    nsresult FireAtkStateChangeEvent(nsAccEvent *aEvent, AtkObject *aObject);
-    nsresult FireAtkTextChangedEvent(nsAccEvent *aEvent, AtkObject *aObject);
-    nsresult FireAtkShowHideEvent(nsAccEvent *aEvent, AtkObject *aObject,
+    nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
+    nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
+    nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
                                   PRBool aIsAdded);
 
     AtkObject *mAtkObject;
 
 private:
     PRUint16 CreateMaiInterfaces(void);
 };
 
rename from accessible/src/base/nsAccEvent.cpp
rename to accessible/src/base/AccEvent.cpp
--- a/accessible/src/base/nsAccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -15,189 +15,138 @@
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 2003
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *   Original Author: Aaron Leventhal (aaronl@netscape.com)
+ *   Aaron Leventhal <aaronl@netscape.com> <original author>
+ *   Alexander Surkov <surkov.alexander@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsAccEvent.h"
+#include "AccEvent.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsApplicationAccessibleWrap.h"
 #include "nsDocAccessible.h"
 #include "nsIAccessibleText.h"
 #ifdef MOZ_XUL
 #include "nsXULTreeAccessible.h"
 #endif
+#include "nsAccEvent.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIEventStateManager.h"
 #include "nsIServiceManager.h"
 #ifdef MOZ_XUL
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent
+// AccEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent. nsISupports
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccEvent)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEvent)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEvent)
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
-  cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+// AccEvent constructors
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIAccessibleEvent)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccEvent)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEvent)
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent. Constructors
-
-nsAccEvent::nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
-                       PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
-                       EEventRule aEventRule) :
+AccEvent::AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
+                   PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
+                   EEventRule aEventRule) :
   mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
   mAccessible(aAccessible)
 {
   CaptureIsFromUserInput(aIsFromUserInput);
 }
 
-nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
-                       PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
-                       EEventRule aEventRule) :
+AccEvent::AccEvent(PRUint32 aEventType, nsINode* aNode,
+                   PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
+                   EEventRule aEventRule) :
   mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
   mNode(aNode)
 {
   CaptureIsFromUserInput(aIsFromUserInput);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent: nsIAccessibleEvent
-
-NS_IMETHODIMP
-nsAccEvent::GetIsFromUserInput(PRBool *aIsFromUserInput)
-{
-  *aIsFromUserInput = mIsFromUserInput;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::SetIsFromUserInput(PRBool aIsFromUserInput)
-{
-  mIsFromUserInput = aIsFromUserInput;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetEventType(PRUint32 *aEventType)
-{
-  *aEventType = mEventType;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetAccessible(nsIAccessible **aAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
-
-  NS_IF_ADDREF(*aAccessible = GetAccessible());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetDOMNode(nsIDOMNode **aDOMNode)
-{
-  NS_ENSURE_ARG_POINTER(aDOMNode);
-  *aDOMNode = nsnull;
-
-  if (!mNode)
-    mNode = GetNode();
-
-  if (mNode)
-    CallQueryInterface(mNode, aDOMNode);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aDocAccessible);
-
-  NS_IF_ADDREF(*aDocAccessible = GetDocAccessible());
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent: public methods
+// AccEvent public methods
 
 nsAccessible *
-nsAccEvent::GetAccessible()
+AccEvent::GetAccessible()
 {
   if (!mAccessible)
     mAccessible = GetAccessibleForNode();
 
   return mAccessible;
 }
 
 nsINode*
-nsAccEvent::GetNode()
+AccEvent::GetNode()
 {
   if (!mNode && mAccessible)
     mNode = mAccessible->GetNode();
 
   return mNode;
 }
 
 nsDocAccessible*
-nsAccEvent::GetDocAccessible()
+AccEvent::GetDocAccessible()
 {
   nsINode *node = GetNode();
   if (node)
     return GetAccService()->GetDocAccessible(node->GetOwnerDoc());
 
   return nsnull;
 }
 
+already_AddRefed<nsAccEvent>
+AccEvent::CreateXPCOMObject()
+{
+  nsAccEvent* event = new nsAccEvent(this);
+  NS_IF_ADDREF(event);
+  return event;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent: protected methods
+// AccEvent cycle collection
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(AccEvent)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AccEvent)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AccEvent)
+  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
+  cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
+
+////////////////////////////////////////////////////////////////////////////////
+// AccEvent protected methods
 
 nsAccessible *
-nsAccEvent::GetAccessibleForNode() const
+AccEvent::GetAccessibleForNode() const
 {
   if (!mNode)
     return nsnull;
 
   nsAccessible *accessible = GetAccService()->GetAccessible(mNode);
 
 #ifdef MOZ_XUL
   // hack for xul tree table. We need a better way for firing delayed event
@@ -222,17 +171,17 @@ nsAccEvent::GetAccessibleForNode() const
     }
   }
 #endif
 
   return accessible;
 }
 
 void
-nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
+AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
 {
   nsINode *targetNode = GetNode();
 
 #ifdef DEBUG
   if (!targetNode) {
     // XXX: remove this hack during reorganization of 506907. Meanwhile we
     // want to get rid an assertion for application accessible events which
     // don't have DOM node (see bug 506206).
@@ -264,252 +213,190 @@ nsAccEvent::CaptureIsFromUserInput(EIsFr
     return;
   }
 
   mIsFromUserInput = esm->IsHandlingUserInputExternal();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccReorderEvent
+// AccReorderEvent
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsAccReorderEvent, nsAccEvent)
-
-nsAccReorderEvent::nsAccReorderEvent(nsAccessible *aAccTarget,
-                                     PRBool aIsAsynch,
-                                     PRBool aIsUnconditional,
-                                     nsINode *aReasonNode) :
-  nsAccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
-             aIsAsynch, eAutoDetect, nsAccEvent::eCoalesceFromSameSubtree),
+AccReorderEvent::
+  AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
+                  PRBool aIsUnconditional, nsINode* aReasonNode) :
+  AccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
+           aIsAsynch, eAutoDetect, AccEvent::eCoalesceFromSameSubtree),
   mUnconditionalEvent(aIsUnconditional), mReasonNode(aReasonNode)
 {
 }
 
 PRBool
-nsAccReorderEvent::IsUnconditionalEvent()
+AccReorderEvent::IsUnconditionalEvent()
 {
   return mUnconditionalEvent;
 }
 
 PRBool
-nsAccReorderEvent::HasAccessibleInReasonSubtree()
+AccReorderEvent::HasAccessibleInReasonSubtree()
 {
   if (!mReasonNode)
     return PR_FALSE;
 
   nsAccessible *accessible = GetAccService()->GetAccessible(mReasonNode);
   return accessible || nsAccUtils::HasAccessibleChildren(mReasonNode);
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccStateChangeEvent
+// AccStateChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
-                             nsIAccessibleStateChangeEvent)
-
 // Note: we pass in eAllowDupes to the base class because we don't currently
 // support correct state change coalescence (XXX Bug 569356). Also we need to
 // decide how to coalesce events created via accessible (instead of node).
-nsAccStateChangeEvent::
-  nsAccStateChangeEvent(nsAccessible *aAccessible,
-                        PRUint32 aState, PRBool aIsExtraState,
-                        PRBool aIsEnabled, PRBool aIsAsynch,
-                        EIsFromUserInput aIsFromUserInput):
-  nsAccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
-             aIsFromUserInput, eAllowDupes),
+AccStateChangeEvent::
+  AccStateChangeEvent(nsAccessible* aAccessible,
+                      PRUint32 aState, PRBool aIsExtraState,
+                      PRBool aIsEnabled, PRBool aIsAsynch,
+                      EIsFromUserInput aIsFromUserInput):
+  AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
+           aIsFromUserInput, eAllowDupes),
   mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
 {
 }
 
-nsAccStateChangeEvent::
-  nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
-                        PRBool aIsEnabled):
-  nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
+AccStateChangeEvent::
+  AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
+                      PRBool aIsEnabled):
+  AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
   mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
 {
 }
 
-nsAccStateChangeEvent::
-  nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState) :
-  nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
+AccStateChangeEvent::
+  AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState) :
+  AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
   mState(aState), mIsExtraState(aIsExtraState)
 {
   // Use GetAccessibleForNode() because we do not want to store an accessible
   // since it leads to problems with delayed events in the case when
   // an accessible gets reorder event before delayed event is processed.
   nsAccessible *accessible = GetAccessibleForNode();
   if (accessible) {
     PRUint32 state = 0, extraState = 0;
     accessible->GetState(&state, mIsExtraState ? &extraState : nsnull);
     mIsEnabled = ((mIsExtraState ? extraState : state) & mState) != 0;
   } else {
     mIsEnabled = PR_FALSE;
   }
 }
 
-NS_IMETHODIMP
-nsAccStateChangeEvent::GetState(PRUint32 *aState)
+already_AddRefed<nsAccEvent>
+AccStateChangeEvent::CreateXPCOMObject()
 {
-  NS_ENSURE_ARG_POINTER(aState);
-  *aState = mState;
-  return NS_OK;
+  nsAccEvent* event = new nsAccStateChangeEvent(this);
+  NS_IF_ADDREF(event);
+  return event;
 }
 
-NS_IMETHODIMP
-nsAccStateChangeEvent::IsExtraState(PRBool *aIsExtraState)
-{
-  NS_ENSURE_ARG_POINTER(aIsExtraState);
-  *aIsExtraState = mIsExtraState;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccStateChangeEvent::IsEnabled(PRBool *aIsEnabled)
-{
-  NS_ENSURE_ARG_POINTER(aIsEnabled);
-  *aIsEnabled = mIsEnabled;
-  return NS_OK;
-}
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccTextChangeEvent
+// AccTextChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
-                             nsIAccessibleTextChangeEvent)
-
 // Note: we pass in eAllowDupes to the base class because we don't support text
 // events coalescence. We fire delayed text change events in nsDocAccessible but
 // we continue to base the event off the accessible object rather than just the
 // node. This means we won't try to create an accessible based on the node when
 // we are ready to fire the event and so we will no longer assert at that point
 // if the node was removed from the document. Either way, the AT won't work with
 // a defunct accessible so the behaviour should be equivalent.
 // XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
-nsAccTextChangeEvent::
-  nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
-                       nsAString& aModifiedText, PRBool aIsInserted,
-                       PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
-  : nsAccEvent(aIsInserted ?
-               static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
-               static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
-               aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
+AccTextChangeEvent::
+  AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
+                     nsAString& aModifiedText, PRBool aIsInserted,
+                     PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
+  : AccEvent(aIsInserted ?
+             static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
+             static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
+             aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
   , mStart(aStart)
   , mIsInserted(aIsInserted)
   , mModifiedText(aModifiedText)
 {
 }
 
-NS_IMETHODIMP
-nsAccTextChangeEvent::GetStart(PRInt32 *aStart)
-{
-  NS_ENSURE_ARG_POINTER(aStart);
-  *aStart = mStart;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTextChangeEvent::GetLength(PRUint32 *aLength)
+already_AddRefed<nsAccEvent>
+AccTextChangeEvent::CreateXPCOMObject()
 {
-  NS_ENSURE_ARG_POINTER(aLength);
-  *aLength = GetLength();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTextChangeEvent::IsInserted(PRBool *aIsInserted)
-{
-  NS_ENSURE_ARG_POINTER(aIsInserted);
-  *aIsInserted = mIsInserted;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
-{
-  aModifiedText = mModifiedText;
-  return NS_OK;
+  nsAccEvent* event = new nsAccTextChangeEvent(this);
+  NS_IF_ADDREF(event);
+  return event;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccHideEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccHideEvent::
   AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
                PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
-  nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
-             aIsFromUserInput, eCoalesceFromSameSubtree)
+  AccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
+           aIsFromUserInput, eCoalesceFromSameSubtree)
 {
   mNode = aTargetNode;
   mParent = mAccessible->GetCachedParent();
   mNextSibling = mAccessible->GetCachedNextSibling();
   mPrevSibling = mAccessible->GetCachedPrevSibling();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccCaretMoveEvent
+// AccCaretMoveEvent
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
-                             nsIAccessibleCaretMoveEvent)
-
-nsAccCaretMoveEvent::
-  nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset) :
-  nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
+AccCaretMoveEvent::
+  AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset) :
+  AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
   mCaretOffset(aCaretOffset)
 {
 }
 
-nsAccCaretMoveEvent::
-  nsAccCaretMoveEvent(nsINode *aNode) :
-  nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
+AccCaretMoveEvent::
+  AccCaretMoveEvent(nsINode* aNode) :
+  AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
   mCaretOffset(-1)
 {
 }
 
-NS_IMETHODIMP
-nsAccCaretMoveEvent::GetCaretOffset(PRInt32* aCaretOffset)
+already_AddRefed<nsAccEvent>
+AccCaretMoveEvent::CreateXPCOMObject()
 {
-  NS_ENSURE_ARG_POINTER(aCaretOffset);
+  nsAccEvent* event = new nsAccCaretMoveEvent(this);
+  NS_IF_ADDREF(event);
+  return event;
+}
 
-  *aCaretOffset = mCaretOffset;
-  return NS_OK;
-}
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsAccTableChangeEvent
+// AccTableChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
-                             nsIAccessibleTableChangeEvent)
-
-nsAccTableChangeEvent::
-  nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
-                        PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols, PRBool aIsAsynch):
-  nsAccEvent(aEventType, aAccessible, aIsAsynch), 
+AccTableChangeEvent::
+  AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
+                      PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
+                      PRBool aIsAsynch) :
+  AccEvent(aEventType, aAccessible, aIsAsynch),
   mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
 {
 }
 
-NS_IMETHODIMP
-nsAccTableChangeEvent::GetRowOrColIndex(PRInt32* aRowOrColIndex)
+already_AddRefed<nsAccEvent>
+AccTableChangeEvent::CreateXPCOMObject()
 {
-  NS_ENSURE_ARG_POINTER(aRowOrColIndex);
-
-  *aRowOrColIndex = mRowOrColIndex;
-  return NS_OK;
+  nsAccEvent* event = new nsAccTableChangeEvent(this);
+  NS_IF_ADDREF(event);
+  return event;
 }
 
-NS_IMETHODIMP
-nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
-{
-  NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
-
-  *aNumRowsOrCols = mNumRowsOrCols;
-  return NS_OK;
-}
-
rename from accessible/src/base/nsAccEvent.h
rename to accessible/src/base/AccEvent.h
--- a/accessible/src/base/nsAccEvent.h
+++ b/accessible/src/base/AccEvent.h
@@ -33,40 +33,39 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef _nsAccEvent_H_
-#define _nsAccEvent_H_
-
-#include "nsIAccessibleEvent.h"
+#ifndef _AccEvent_H_
+#define _AccEvent_H_
 
 #include "nsAccessible.h"
 
+class nsAccEvent;
 class nsDocAccessible;
 
 // Constants used to point whether the event is from user input.
 enum EIsFromUserInput
 {
   // eNoUserInput: event is not from user input
   eNoUserInput = 0,
   // eFromUserInput: event is from user input
   eFromUserInput = 1,
   // eAutoDetect: the value should be obtained from event state manager
   eAutoDetect = -1
 };
 
 /**
  * Generic accessible event.
  */
-class nsAccEvent: public nsIAccessibleEvent
+class AccEvent
 {
 public:
 
   // Rule for accessible events.
   // The rule will be applied when flushing pending events.
   enum EEventRule {
      // eAllowDupes : More than one event of the same type is allowed.
      //    This event will always be emitted.
@@ -85,100 +84,106 @@ public:
      //    will be emitted.
      eRemoveDupes,
 
      // eDoNotEmit : This event is confirmed as a duplicate, do not emit it.
      eDoNotEmit
   };
 
   // Initialize with an nsIAccessible
-  nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
-             PRBool aIsAsynch = PR_FALSE,
-             EIsFromUserInput aIsFromUserInput = eAutoDetect,
-             EEventRule aEventRule = eRemoveDupes);
+  AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
+           PRBool aIsAsynch = PR_FALSE,
+           EIsFromUserInput aIsFromUserInput = eAutoDetect,
+           EEventRule aEventRule = eRemoveDupes);
   // Initialize with an nsIDOMNode
-  nsAccEvent(PRUint32 aEventType, nsINode *aNode, PRBool aIsAsynch = PR_FALSE,
-             EIsFromUserInput aIsFromUserInput = eAutoDetect,
-             EEventRule aEventRule = eRemoveDupes);
-  virtual ~nsAccEvent() {}
+  AccEvent(PRUint32 aEventType, nsINode* aNode, PRBool aIsAsynch = PR_FALSE,
+           EIsFromUserInput aIsFromUserInput = eAutoDetect,
+           EEventRule aEventRule = eRemoveDupes);
+  virtual ~AccEvent() {}
 
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(nsAccEvent)
-
-  NS_DECL_NSIACCESSIBLEEVENT
-
-  // nsAccEvent
+  // AccEvent
   PRUint32 GetEventType() const { return mEventType; }
   EEventRule GetEventRule() const { return mEventRule; }
   PRBool IsAsync() const { return mIsAsync; }
   PRBool IsFromUserInput() const { return mIsFromUserInput; }
 
   nsAccessible *GetAccessible();
   nsDocAccessible* GetDocAccessible();
   nsINode* GetNode();
 
+  /**
+   * Create and return an XPCOM object for accessible event object.
+   */
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
+
+  /**
+   * Down casting.
+   */
   enum EventGroup {
     eGenericEvent,
     eReorderEvent,
     eStateChangeEvent,
     eTextChangeEvent,
     eHideEvent,
     eCaretMoveEvent,
     eTableChangeEvent
   };
 
   static const EventGroup kEventGroup = eGenericEvent;
   virtual unsigned int GetEventGroups() const
   {
     return 1U << eGenericEvent;
   }
 
+  /**
+   * Reference counting and cycle collection.
+   */
+  NS_INLINE_DECL_REFCOUNTING(AccEvent)
+  NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
+
 protected:
   /**
    * Get an accessible from event target node.
    */
   nsAccessible *GetAccessibleForNode() const;
 
   /**
    * Determine whether the event is from user input by event state manager if
    * it's not pointed explicetly.
    */
   void CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput);
 
   PRBool mIsFromUserInput;
-
   PRUint32 mEventType;
   EEventRule mEventRule;
   PRPackedBool mIsAsync;
   nsRefPtr<nsAccessible> mAccessible;
   nsCOMPtr<nsINode> mNode;
 
   friend class nsAccEventQueue;
 };
 
 
 /**
  * Accessible reorder event.
  */
-class nsAccReorderEvent : public nsAccEvent
+class AccReorderEvent : public AccEvent
 {
 public:
-  nsAccReorderEvent(nsAccessible *aAccTarget, PRBool aIsAsynch,
-                    PRBool aIsUnconditional, nsINode *aReasonNode);
+  AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
+                  PRBool aIsUnconditional, nsINode* aReasonNode);
 
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsAccEvent
+  // AccEvent
   static const EventGroup kEventGroup = eReorderEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eReorderEvent);
+    return AccEvent::GetEventGroups() | (1U << eReorderEvent);
   }
 
-  // nsAccReorderEvent
+  // AccReorderEvent
   /**
    * Return true if event is unconditional, i.e. must be fired.
    */
   PRBool IsUnconditionalEvent();
 
   /**
    * Return true if changed DOM node has accessible in its tree.
    */
@@ -188,188 +193,182 @@ private:
   PRBool mUnconditionalEvent;
   nsCOMPtr<nsINode> mReasonNode;
 };
 
 
 /**
  * Accessible state change event.
  */
-class nsAccStateChangeEvent: public nsAccEvent,
-                             public nsIAccessibleStateChangeEvent
+class AccStateChangeEvent: public AccEvent
 {
 public:
-  nsAccStateChangeEvent(nsAccessible *aAccessible,
-                        PRUint32 aState, PRBool aIsExtraState,
-                        PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
-                        EIsFromUserInput aIsFromUserInput = eAutoDetect);
+  AccStateChangeEvent(nsAccessible* aAccessible,
+                      PRUint32 aState, PRBool aIsExtraState,
+                      PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
+                      EIsFromUserInput aIsFromUserInput = eAutoDetect);
 
-  nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
-                        PRBool aIsEnabled);
-
-  nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState);
+  AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
+                      PRBool aIsEnabled);
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
+  AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState);
 
-  // nsAccEvent
+  // AccEvent
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
+
   static const EventGroup kEventGroup = eStateChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eStateChangeEvent);
+    return AccEvent::GetEventGroups() | (1U << eStateChangeEvent);
   }
 
-  // nsAccStateChangeEvent
+  // AccStateChangeEvent
   PRUint32 GetState() const { return mState; }
   PRBool IsExtraState() const { return mIsExtraState; }
   PRBool IsStateEnabled() const { return mIsEnabled; }
 
 private:
   PRUint32 mState;
   PRBool mIsExtraState;
   PRBool mIsEnabled;
 };
 
 
 /**
  * Accessible text change event.
  */
-class nsAccTextChangeEvent: public nsAccEvent,
-                            public nsIAccessibleTextChangeEvent
+class AccTextChangeEvent: public AccEvent
 {
 public:
-  nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
-                       nsAString& aModifiedText,
-                       PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
-                       EIsFromUserInput aIsFromUserInput = eAutoDetect);
+  AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
+                     nsAString& aModifiedText,
+                     PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
+                     EIsFromUserInput aIsFromUserInput = eAutoDetect);
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
+  // AccEvent
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
 
-  // nsAccEvent
   static const EventGroup kEventGroup = eTextChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eTextChangeEvent);
+    return AccEvent::GetEventGroups() | (1U << eTextChangeEvent);
   }
 
-  // nsAccTextChangeEvent
+  // AccTextChangeEvent
   PRInt32 GetStartOffset() const { return mStart; }
   PRUint32 GetLength() const { return mModifiedText.Length(); }
   PRBool IsTextInserted() const { return mIsInserted; }
+  void GetModifiedText(nsAString& aModifiedText)
+    { aModifiedText = mModifiedText; }
 
 private:
   PRInt32 mStart;
   PRBool mIsInserted;
   nsString mModifiedText;
 
   friend class nsAccEventQueue;
 };
 
 
 /**
  * Accessible hide events.
  */
-class AccHideEvent : public nsAccEvent
+class AccHideEvent : public AccEvent
 {
 public:
   AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
                PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput);
 
-  // nsAccEvent
+  // Event
   static const EventGroup kEventGroup = eHideEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eHideEvent);
+    return AccEvent::GetEventGroups() | (1U << eHideEvent);
   }
 
 protected:
   nsRefPtr<nsAccessible> mParent;
   nsRefPtr<nsAccessible> mNextSibling;
   nsRefPtr<nsAccessible> mPrevSibling;
-  nsRefPtr<nsAccTextChangeEvent> mTextChangeEvent;
+  nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
 
   friend class nsAccEventQueue;
 };
 
 
 /**
  * Accessible caret move event.
  */
-class nsAccCaretMoveEvent: public nsAccEvent,
-                           public nsIAccessibleCaretMoveEvent
+class AccCaretMoveEvent: public AccEvent
 {
 public:
-  nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset);
-  nsAccCaretMoveEvent(nsINode *aNode);
+  AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset);
+  AccCaretMoveEvent(nsINode* aNode);
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLECARETMOVEEVENT
+  // AccEvent
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
 
-  // nsAccEvent
   static const EventGroup kEventGroup = eCaretMoveEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
+    return AccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
   }
 
-  // nsAccCaretMoveEvent
+  // AccCaretMoveEvent
   PRInt32 GetCaretOffset() const { return mCaretOffset; }
 
 private:
   PRInt32 mCaretOffset;
 };
 
 
 /**
  * Accessible table change event.
  */
-class nsAccTableChangeEvent : public nsAccEvent,
-                              public nsIAccessibleTableChangeEvent
+class AccTableChangeEvent : public AccEvent
 {
 public:
-  nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
-                        PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
-                        PRBool aIsAsynch);
+  AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
+                      PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
+                      PRBool aIsAsynch);
 
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
+  // AccEvent
+  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
 
-  // nsAccEvent
   static const EventGroup kEventGroup = eTableChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
-    return nsAccEvent::GetEventGroups() | (1U << eTableChangeEvent);
+    return AccEvent::GetEventGroups() | (1U << eTableChangeEvent);
   }
 
-  // nsAccTableChangeEvent
+  // AccTableChangeEvent
   PRUint32 GetIndex() const { return mRowOrColIndex; }
   PRUint32 GetCount() const { return mNumRowsOrCols; }
 
 private:
   PRUint32 mRowOrColIndex;   // the start row/column after which the rows are inserted/deleted.
   PRUint32 mNumRowsOrCols;   // the number of inserted/deleted rows/columns
 };
 
 
 /**
  * Downcast the generic accessible event object to derived type.
  */
 class downcast_accEvent
 {
 public:
-  downcast_accEvent(nsAccEvent *e) : mRawPtr(e) { }
+  downcast_accEvent(AccEvent* e) : mRawPtr(e) { }
 
   template<class Destination>
   operator Destination*() {
     if (!mRawPtr)
       return nsnull;
 
     return mRawPtr->GetEventGroups() & (1U << Destination::kEventGroup) ?
       static_cast<Destination*>(mRawPtr) : nsnull;
   }
 
 private:
-  nsAccEvent *mRawPtr;
+  AccEvent* mRawPtr;
 };
 
 #endif
 
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -44,22 +44,22 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_base_s
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   AccCollector.cpp \
+  AccEvent.cpp \
   AccGroupInfo.cpp \
   AccIterator.cpp \
   filters.cpp \
   nsAccDocManager.cpp \
   nsAccessNode.cpp \
-  nsAccEvent.cpp \
   nsARIAGridAccessible.cpp \
   nsARIAMap.cpp \
   nsDocAccessible.cpp \
   nsOuterDocAccessible.cpp \
   nsAccessibilityAtoms.cpp \
   nsCoreUtils.cpp \
   nsAccUtils.cpp \
   nsRelUtils.cpp \
@@ -86,16 +86,17 @@ EXPORTS = \
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
   -I$(srcdir) \
+  -I$(srcdir)/../xpcom \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
 
 ifndef DISABLE_XFORMS_HOOKS
 LOCAL_INCLUDES += -I$(srcdir)/../xforms
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -230,26 +230,26 @@ nsAccDocManager::OnStateChange(nsIWebPro
   PRUint32 loadType;
   docShell->GetLoadType(&loadType);
   if (loadType == LOAD_RELOAD_NORMAL ||
       loadType == LOAD_RELOAD_BYPASS_CACHE ||
       loadType == LOAD_RELOAD_BYPASS_PROXY ||
       loadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE) {
 
     // Fire reload event.
-    nsRefPtr<nsAccEvent> reloadEvent =
-      new nsAccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
+    nsRefPtr<AccEvent> reloadEvent =
+      new AccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
     nsEventShell::FireEvent(reloadEvent);
   }
 
   // Fire state busy change event. Use delayed event since we don't care
   // actually if event isn't delivered when the document goes away like a shot.
-  nsRefPtr<nsAccEvent> stateEvent =
-    new nsAccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
-                              PR_FALSE, PR_TRUE);
+  nsRefPtr<AccEvent> stateEvent =
+    new AccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
+                            PR_FALSE, PR_TRUE);
   docAcc->FireDelayedAccessibleEvent(stateEvent);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccDocManager::OnProgressChange(nsIWebProgress *aWebProgress,
                                   nsIRequest *aRequest,
@@ -373,24 +373,24 @@ nsAccDocManager::HandleDOMDocumentLoad(n
       docAcc->InvalidateCacheSubtree(nsnull,
                                      nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE);
     }
     return;
   }
 
   // Fire complete/load stopped if the load event type is given.
   if (aLoadEventType) {
-    nsRefPtr<nsAccEvent> loadEvent = new nsAccEvent(aLoadEventType, aDocument);
+    nsRefPtr<AccEvent> loadEvent = new AccEvent(aLoadEventType, aDocument);
     docAcc->FireDelayedAccessibleEvent(loadEvent);
   }
 
   // Fire busy state change event.
-  nsRefPtr<nsAccEvent> stateEvent =
-    new nsAccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
-                              PR_FALSE, PR_FALSE);
+  nsRefPtr<AccEvent> stateEvent =
+    new AccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
+                            PR_FALSE, PR_FALSE);
   docAcc->FireDelayedAccessibleEvent(stateEvent);
 }
 
 PRBool
 nsAccDocManager::IsEventTargetDocument(nsIDocument *aDocument) const
 {
   nsCOMPtr<nsISupports> container = aDocument->GetContainer();
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
--- a/accessible/src/base/nsAccDocManager.h
+++ b/accessible/src/base/nsAccDocManager.h
@@ -381,17 +381,17 @@ private:
   PRUint32 type = aEvent->GetEventType();                                      \
   if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED) {               \
     strEventType.AssignLiteral("load stopped");                                \
   } else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE) {       \
     strEventType.AssignLiteral("load complete");                               \
   } else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD) {              \
       strEventType.AssignLiteral("reload");                                    \
   } else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) {                 \
-    nsAccStateChangeEvent *event = downcast_accEvent(aEvent);                  \
+    AccStateChangeEvent* event = downcast_accEvent(aEvent);                    \
     if (event->GetState() == nsIAccessibleStates::STATE_BUSY) {                \
       strEventType.AssignLiteral("busy ");                                     \
       if (event->IsStateEnabled())                                             \
         strEventType.AppendLiteral("true");                                    \
       else                                                                     \
         strEventType.AppendLiteral("false");                                   \
     }                                                                          \
   }
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -43,16 +43,17 @@
 
 #include "AccGroupInfo.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 
+#include "nsAccEvent.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsRelUtils.h"
 #include "nsTextEquivUtils.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentXBL.h"
@@ -1235,25 +1236,38 @@ nsAccessible::GetXULName(nsAString& aLab
     }
     parent = parent->GetParent();
   }
 
   return nsTextEquivUtils::GetNameFromSubtree(this, aLabel);
 }
 
 nsresult
-nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
+nsAccessible::HandleAccEvent(AccEvent* aEvent)
 {
   NS_ENSURE_ARG_POINTER(aEvent);
 
   nsCOMPtr<nsIObserverService> obsService =
     mozilla::services::GetObserverService();
   NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
 
-  return obsService->NotifyObservers(aEvent, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
+  nsCOMPtr<nsISimpleEnumerator> observers;
+  obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC,
+                                 getter_AddRefs(observers));
+
+  NS_ENSURE_STATE(observers);
+
+  PRBool hasObservers = PR_FALSE;
+  observers->HasMoreElements(&hasObservers);
+  if (hasObservers) {
+    nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
+    return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
+  }
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::GetRole(PRUint32 *aRole)
 {
   NS_ENSURE_ARG_POINTER(aRole);
   *aRole = nsIAccessibleRole::ROLE_NOTHING;
 
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -50,17 +50,17 @@
 
 #include "nsStringGlue.h"
 #include "nsTArray.h"
 #include "nsRefPtrHashtable.h"
 
 class AccGroupInfo;
 class EmbeddedObjCollector;
 class nsAccessible;
-class nsAccEvent;
+class AccEvent;
 struct nsRoleMapEntry;
 
 struct nsRect;
 class nsIContent;
 class nsIFrame;
 class nsIAtom;
 class nsIView;
 
@@ -298,17 +298,17 @@ public:
 
   //////////////////////////////////////////////////////////////////////////////
   // Miscellaneous methods
 
   /**
    * Handle accessible event, i.e. process it, notifies observers and fires
    * platform specific event.
    */
-  virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 
   /**
    * Return true if there are accessible children in anonymous content
    */
   virtual PRBool GetAllowsAnonChildAccessibles();
 
   /**
    * Returns text of accessible if accessible has text role otherwise empty
@@ -449,17 +449,17 @@ protected:
   /**
    * Fires platform accessible event. It's notification method only. It does
    * change nothing on Gecko side. Don't use it until you're sure what you do
    * (see example in XUL tree accessible), use nsEventShell::FireEvent()
    * instead. MUST be overridden in wrap classes.
    *
    * @param aEvent  the accessible event to fire.
    */
-  virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) = 0;
+  virtual nsresult FirePlatformEvent(AccEvent* aEvent) = 0;
 
   // Data Members
   nsRefPtr<nsAccessible> mParent;
   nsTArray<nsRefPtr<nsAccessible> > mChildren;
   PRInt32 mIndexInParent;
 
   enum ChildrenFlags {
     eChildrenUninitialized = 0x00,
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -259,18 +259,17 @@ nsCaretAccessible::NormalSelectionChange
     textAcc->GetSelectionCount(&selectionCount);   // Don't swallow similar events when selecting text
     if (!selectionCount) {
       return NS_OK;  // Swallow duplicate caret event
     }
   }
   mLastCaretOffset = caretOffset;
   mLastTextAccessible.swap(textAcc);
 
-  nsRefPtr<nsAccEvent> event =
-    new nsAccCaretMoveEvent(textNode);
+  nsRefPtr<AccEvent> event = new AccCaretMoveEvent(textNode);
   NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
   return mRootAccessible->FireDelayedAccessibleEvent(event);
 }
 
 nsresult
 nsCaretAccessible::SpellcheckSelectionChanged(nsIDOMDocument *aDoc,
                                               nsISelection *aSel)
@@ -280,19 +279,19 @@ nsCaretAccessible::SpellcheckSelectionCh
   // the same accessible for newly appended range of the selection (for every
   // misspelled word). If spellchecking is disabled (for example,
   // @spellcheck="false" on html:body) then we won't fire any event.
 
   nsRefPtr<nsHyperTextAccessible> textAcc =
     nsAccUtils::GetTextAccessibleFromSelection(aSel);
   NS_ENSURE_STATE(textAcc);
 
-  nsRefPtr<nsAccEvent> event =
-    new nsAccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
-                   textAcc, nsnull);
+  nsRefPtr<AccEvent> event =
+    new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
+                 textAcc, nsnull);
 
   nsEventShell::FireEvent(event);
   return NS_OK;
 }
 
 nsIntRect
 nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
 {
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -606,18 +606,18 @@ nsDocAccessible::Init()
   mEventQueue = new nsAccEventQueue(this);
   if (!mEventQueue)
     return PR_FALSE;
 
   AddEventListeners();
 
   // Fire reorder event to notify new accessible document has been created and
   // attached to the tree.
-  nsRefPtr<nsAccEvent> reorderEvent =
-    new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
+  nsRefPtr<AccEvent> reorderEvent =
+    new AccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
   if (!reorderEvent)
     return PR_FALSE;
 
   FireDelayedAccessibleEvent(reorderEvent);
   return PR_TRUE;
 }
 
 void
@@ -873,21 +873,21 @@ void nsDocAccessible::ScrollPositionDidC
 // nsIObserver
 
 NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic,
                                        const PRUnichar *aData)
 {
   if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {    
     // State editable will now be set, readonly is now clear
     // Normally we only fire delayed events created from the node, not an
-    // accessible object. See the nsAccStateChangeEvent constructor for details
+    // accessible object. See the AccStateChangeEvent constructor for details
     // about this exceptional case.
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
-                                PR_TRUE, PR_TRUE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
+                              PR_TRUE, PR_TRUE);
     FireDelayedAccessibleEvent(event);
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDocumentObserver
@@ -967,27 +967,27 @@ nsDocAccessible::AttributeChangedImpl(ns
 
     // Note. Checking the XUL or HTML namespace would not seem to gain us
     // anything, because disabled attribute really is going to mean the same
     // thing in any namespace.
 
     // Note. We use the attribute instead of the disabled state bit because
     // ARIA's aria-disabled does not affect the disabled state bit.
 
-    nsRefPtr<nsAccEvent> enabledChangeEvent =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::EXT_STATE_ENABLED,
-                                PR_TRUE);
+    nsRefPtr<AccEvent> enabledChangeEvent =
+      new AccStateChangeEvent(aContent,
+                              nsIAccessibleStates::EXT_STATE_ENABLED,
+                              PR_TRUE);
 
     FireDelayedAccessibleEvent(enabledChangeEvent);
 
-    nsRefPtr<nsAccEvent> sensitiveChangeEvent =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::EXT_STATE_SENSITIVE,
-                                PR_TRUE);
+    nsRefPtr<AccEvent> sensitiveChangeEvent =
+      new AccStateChangeEvent(aContent,
+                              nsIAccessibleStates::EXT_STATE_SENSITIVE,
+                              PR_TRUE);
 
     FireDelayedAccessibleEvent(sensitiveChangeEvent);
     return;
   }
 
   // Check for namespaced ARIA attribute
   if (aNameSpaceID == kNameSpaceID_None) {
     // Check for hyphenated aria-foo property?
@@ -1028,63 +1028,61 @@ nsDocAccessible::AttributeChangedImpl(ns
     // whatever gets event_focus, which is done in
     // nsRootAccessible::FireAccessibleFocusEvent()
     // So right here we make sure only to deal with multi selects
     if (multiSelect) {
       // Need to find the right event to use here, SELECTION_WITHIN would
       // seem right but we had started using it for something else
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
                                  multiSelect->GetNode(),
-                                 nsAccEvent::eAllowDupes);
+                                 AccEvent::eAllowDupes);
 
       static nsIContent::AttrValuesArray strings[] =
         {&nsAccessibilityAtoms::_empty, &nsAccessibilityAtoms::_false, nsnull};
       if (aContent->FindAttrValueIn(kNameSpaceID_None, aAttribute,
                                     strings, eCaseMatters) >= 0) {
         FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_REMOVE,
                                    aContent);
         return;
       }
 
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_ADD,
                                  aContent);
     }
   }
 
   if (aAttribute == nsAccessibilityAtoms::contenteditable) {
-    nsRefPtr<nsAccEvent> editableChangeEvent =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::EXT_STATE_EDITABLE,
-                                PR_TRUE);
+    nsRefPtr<AccEvent> editableChangeEvent =
+      new AccStateChangeEvent(aContent,
+                              nsIAccessibleStates::EXT_STATE_EDITABLE,
+                              PR_TRUE);
     FireDelayedAccessibleEvent(editableChangeEvent);
     return;
   }
 }
 
 // nsDocAccessible protected member
 void
 nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
 {
   // Note: For universal/global ARIA states and properties we don't care if
   // there is an ARIA role present or not.
 
   if (aAttribute == nsAccessibilityAtoms::aria_required) {
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::STATE_REQUIRED,
-                                PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_REQUIRED,
+                              PR_FALSE);
     FireDelayedAccessibleEvent(event);
     return;
   }
 
   if (aAttribute == nsAccessibilityAtoms::aria_invalid) {
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::STATE_INVALID,
-                                PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
+                              PR_FALSE);
     FireDelayedAccessibleEvent(event);
     return;
   }
 
   if (aAttribute == nsAccessibilityAtoms::aria_activedescendant) {
     // The activedescendant universal property redirects accessible focus events
     // to the element with the id that activedescendant points to
     nsCOMPtr<nsINode> focusedNode = GetCurrentFocus();
@@ -1102,20 +1100,19 @@ nsDocAccessible::ARIAAttributeChanged(ns
   if (aAttribute == nsAccessibilityAtoms::aria_grabbed ||
       aAttribute == nsAccessibilityAtoms::aria_dropeffect) {
     FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
                                aContent);
   }
 
   // We treat aria-expanded as a global ARIA state for historical reasons
   if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::STATE_EXPANDED,
-                                PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_EXPANDED,
+                              PR_FALSE);
     FireDelayedAccessibleEvent(event);
     return;
   }
 
   if (!aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) {
     // We don't care about these other ARIA attribute changes unless there is
     // an ARIA role set for the element
     // XXX: we should check the role map to see if the changed property is
@@ -1124,46 +1121,44 @@ nsDocAccessible::ARIAAttributeChanged(ns
   }
 
   // The following ARIA attributes only take affect when dynamic content role is present
   if (aAttribute == nsAccessibilityAtoms::aria_checked ||
       aAttribute == nsAccessibilityAtoms::aria_pressed) {
     const PRUint32 kState = (aAttribute == nsAccessibilityAtoms::aria_checked) ?
                             nsIAccessibleStates::STATE_CHECKED : 
                             nsIAccessibleStates::STATE_PRESSED;
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(aContent, kState, PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(aContent, kState, PR_FALSE);
     FireDelayedAccessibleEvent(event);
     if (aContent == gLastFocusedNode) {
       // State changes for MIXED state currently only supported for focused item, because
       // otherwise we would need access to the old attribute value in this listener.
       // This is because we don't know if the previous value of aria-checked or aria-pressed was "mixed"
       // without caching that info.
       nsAccessible *accessible = event->GetAccessible();
       if (accessible) {
         PRBool wasMixed = (gLastFocusedAccessiblesState & nsIAccessibleStates::STATE_MIXED) != 0;
         PRBool isMixed  =
           (nsAccUtils::State(accessible) & nsIAccessibleStates::STATE_MIXED) != 0;
         if (wasMixed != isMixed) {
-          nsRefPtr<nsAccEvent> event =
-            new nsAccStateChangeEvent(aContent,
-                                      nsIAccessibleStates::STATE_MIXED,
-                                      PR_FALSE, isMixed);
+          nsRefPtr<AccEvent> event =
+            new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_MIXED,
+                                    PR_FALSE, isMixed);
           FireDelayedAccessibleEvent(event);
         }
       }
     }
     return;
   }
 
   if (aAttribute == nsAccessibilityAtoms::aria_readonly) {
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(aContent,
-                                nsIAccessibleStates::STATE_READONLY,
-                                PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_READONLY,
+                              PR_FALSE);
     FireDelayedAccessibleEvent(event);
     return;
   }
 
   // Fire value change event whenever aria-valuetext is changed, or
   // when aria-valuenow is changed and aria-valuetext is empty
   if (aAttribute == nsAccessibilityAtoms::aria_valuetext ||      
       (aAttribute == nsAccessibilityAtoms::aria_valuenow &&
@@ -1272,17 +1267,17 @@ nsDocAccessible::ParentChainChanged(nsIC
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible
 
 #ifdef DEBUG_ACCDOCMGR
 nsresult
-nsDocAccessible::HandleAccEvent(nsAccEvent *aAccEvent)
+nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
 {
   NS_LOG_ACCDOCLOAD_HANDLEEVENT(aAccEvent)
 
   return nsHyperTextAccessible::HandleAccEvent(aAccEvent);
 
 }
 #endif
 
@@ -1295,19 +1290,19 @@ nsDocAccessible::HandleAccEvent(nsAccEve
 
 void
 nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
 {
   if (nsAccUtils::Role(aAccessible) != nsIAccessibleRole::ROLE_ENTRY)
     return;
 
   // Dependent value change event for text changes in textfields
-  nsRefPtr<nsAccEvent> valueChangeEvent =
-    new nsAccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
-                   PR_FALSE, eAutoDetect, nsAccEvent::eRemoveDupes);
+  nsRefPtr<AccEvent> valueChangeEvent =
+    new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
+                 PR_FALSE, eAutoDetect, AccEvent::eRemoveDupes);
   FireDelayedAccessibleEvent(valueChangeEvent);
 }
 
 void
 nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
                                             CharacterDataChangeInfo* aInfo,
                                             PRBool aIsInserted)
 {
@@ -1350,27 +1345,27 @@ nsDocAccessible::FireTextChangeEventForT
   rv = accessible->AppendTextTo(text, textOffset, contentLength);
   if (NS_FAILED(rv))
     return;
 
   if (text.IsEmpty())
     return;
 
   // Normally we only fire delayed events created from the node, not an
-  // accessible object. See the nsAccTextChangeEvent constructor for details
+  // accessible object. See the AccTextChangeEvent constructor for details
   // about this exceptional case.
-  nsRefPtr<nsAccEvent> event =
-    new nsAccTextChangeEvent(textAccessible, offset + textOffset, text,
-                             aIsInserted, PR_FALSE);
+  nsRefPtr<AccEvent> event =
+    new AccTextChangeEvent(textAccessible, offset + textOffset, text,
+                           aIsInserted, PR_FALSE);
   FireDelayedAccessibleEvent(event);
 
   FireValueChangeForTextFields(textAccessible);
 }
 
-already_AddRefed<nsAccEvent>
+already_AddRefed<AccEvent>
 nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
                                               nsIContent *aChangeNode,
                                               nsAccessible *aChangeChild,
                                               PRBool aIsInserting,
                                               PRBool aIsAsynch,
                                               EIsFromUserInput aIsFromUserInput)
 {
   nsRefPtr<nsHyperTextAccessible> textAccessible =
@@ -1427,53 +1422,53 @@ nsDocAccessible::CreateTextChangeEventFo
 
       nextChild->AppendTextTo(text, 0, PR_UINT32_MAX);
     }
   }
 
   if (text.IsEmpty())
     return nsnull;
 
-  nsAccEvent *event =
-    new nsAccTextChangeEvent(aContainerAccessible, offset, text,
-                             aIsInserting, aIsAsynch, aIsFromUserInput);
+  AccEvent* event = new AccTextChangeEvent(aContainerAccessible, offset, text,
+                                           aIsInserting, aIsAsynch,
+                                           aIsFromUserInput);
   NS_IF_ADDREF(event);
 
   return event;
 }
 
 // nsDocAccessible public member
 nsresult
 nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
-                                            nsAccEvent::EEventRule aAllowDupes,
+                                            AccEvent::EEventRule aAllowDupes,
                                             PRBool aIsAsynch,
                                             EIsFromUserInput aIsFromUserInput)
 {
-  nsRefPtr<nsAccEvent> event =
-    new nsAccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
+  nsRefPtr<AccEvent> event =
+    new AccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
   NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
   return FireDelayedAccessibleEvent(event);
 }
 
 // nsDocAccessible public member
 nsresult
-nsDocAccessible::FireDelayedAccessibleEvent(nsAccEvent *aEvent)
+nsDocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
 {
   NS_ENSURE_ARG(aEvent);
   NS_LOG_ACCDOCLOAD_FIREEVENT(aEvent)
 
   if (mEventQueue)
     mEventQueue->Push(aEvent);
 
   return NS_OK;
 }
 
 void
-nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
+nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent)
 {  
   nsAccessible *accessible = aEvent->GetAccessible();
   nsINode *node = aEvent->GetNode();
 
   PRUint32 eventType = aEvent->GetEventType();
   EIsFromUserInput isFromUserInput =
     aEvent->IsFromUserInput() ? eFromUserInput : eNoUserInput;
 
@@ -1530,17 +1525,17 @@ nsDocAccessible::ProcessPendingEvent(nsA
 
     // Also fire text changes if the node being created could affect the text in an nsIAccessibleText parent.
     // When a node is being made visible or is inserted, the text in an ancestor hyper text will gain characters
     // At this point we now have the frame and accessible for this node if there is one. That is why we
     // wait to fire this here, instead of in InvalidateCacheSubtree(), where we wouldn't be able to calculate
     // the offset, length and text for the text change.
     if (node && node != mDocument) {
       nsCOMPtr<nsIContent> content(do_QueryInterface(node));
-      nsRefPtr<nsAccEvent> textChangeEvent =
+      nsRefPtr<AccEvent> textChangeEvent =
         CreateTextChangeEventForNode(containerAccessible, content, accessible,
                                      PR_TRUE, PR_TRUE, isFromUserInput);
       if (textChangeEvent) {
         // XXX Queue them up and merge the text change events
         // XXX We need a way to ignore SplitNode and JoinNode() when they
         // do not affect the text within the hypertext
         nsEventShell::FireEvent(textChangeEvent);
       }
@@ -1564,18 +1559,18 @@ nsDocAccessible::ProcessPendingEvent(nsA
 #endif
 #ifdef DEBUG_CARET
         // Test caret line # -- fire an EVENT_ALERT on the focused node so we can watch the
         // line-number object attribute on it
         nsAccessible *focusedAcc =
           GetAccService()->GetAccessible(gLastFocusedNode);
         nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, focusedAcc);
 #endif
-        nsRefPtr<nsAccEvent> caretMoveEvent =
-          new nsAccCaretMoveEvent(accessible, caretOffset);
+        nsRefPtr<AccEvent> caretMoveEvent =
+          new AccCaretMoveEvent(accessible, caretOffset);
         if (!caretMoveEvent)
           return;
 
         nsEventShell::FireEvent(caretMoveEvent);
 
         PRInt32 selectionCount;
         accessibleText->GetSelectionCount(&selectionCount);
         if (selectionCount) {  // There's a selection so fire selection change as well
@@ -1583,17 +1578,17 @@ nsDocAccessible::ProcessPendingEvent(nsA
                                   accessible, PR_TRUE);
         }
       } 
     }
     else if (eventType == nsIAccessibleEvent::EVENT_REORDER) {
       // Fire reorder event if it's unconditional (see InvalidateCacheSubtree
       // method) or if changed node (that is the reason of this reorder event)
       // is accessible or has accessible children.
-      nsAccReorderEvent *reorderEvent = downcast_accEvent(aEvent);
+      AccReorderEvent* reorderEvent = downcast_accEvent(aEvent);
       if (reorderEvent->IsUnconditionalEvent() ||
           reorderEvent->HasAccessibleInReasonSubtree()) {
         nsEventShell::FireEvent(aEvent);
       }
     }
     else {
       nsEventShell::FireEvent(aEvent);
 
@@ -1852,34 +1847,34 @@ nsDocAccessible::InvalidateCacheSubtree(
     // Fire EVENT_SHOW, EVENT_MENUPOPUP_START for newly visible content.
 
     // Fire after a short timer, because we want to make sure the view has been
     // updated to make this accessible content visible. If we don't wait,
     // the assistive technology may receive the event and then retrieve
     // nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
 
     FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SHOW, childNode,
-                               nsAccEvent::eCoalesceFromSameSubtree,
+                               AccEvent::eCoalesceFromSameSubtree,
                                isAsynch);
 
     // Check to see change occurred in an ARIA menu, and fire
     // an EVENT_MENUPOPUP_START if it did.
     nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
     if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
-                                 childNode, nsAccEvent::eRemoveDupes,
+                                 childNode, AccEvent::eRemoveDupes,
                                  isAsynch);
     }
 
     // Check to see if change occurred inside an alert, and fire an EVENT_ALERT if it did
     nsIContent *ancestor = aChild;
     while (PR_TRUE) {
       if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
         FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor,
-                                   nsAccEvent::eRemoveDupes, isAsynch);
+                                   AccEvent::eRemoveDupes, isAsynch);
         break;
       }
       ancestor = ancestor->GetParent();
       if (!ancestor)
         break;
 
       roleMapEntry = nsAccUtils::GetRoleMapEntry(ancestor);
     }
@@ -1897,20 +1892,19 @@ nsDocAccessible::InvalidateCacheSubtree(
   // changed node (because its frame might not be constructed yet). In this case
   // we fire a conditional reorder event, so that we will later check whether
   // the changed node is accessible or has accessible children.
   // Filtering/coalescing of these events happens during the queue flush.
 
   PRBool isUnconditionalEvent = childAccessible ||
     aChild && nsAccUtils::HasAccessibleChildren(childNode);
 
-  nsRefPtr<nsAccEvent> reorderEvent =
-    new nsAccReorderEvent(containerAccessible, isAsynch,
-                          isUnconditionalEvent,
-                          aChild ? aChild : nsnull);
+  nsRefPtr<AccEvent> reorderEvent =
+    new AccReorderEvent(containerAccessible, isAsynch, isUnconditionalEvent,
+                        aChild ? aChild : nsnull);
   NS_ENSURE_TRUE(reorderEvent,);
 
   FireDelayedAccessibleEvent(reorderEvent);
 }
 
 nsresult
 nsDocAccessible::FireShowHideEvents(nsINode *aNode,
                                     PRBool aAvoidOnThisNode,
@@ -1930,28 +1924,28 @@ nsDocAccessible::FireShowHideEvents(nsIN
       // Allow creation of new accessibles for show events
       accessible = GetAccService()->GetAccessible(aNode);
     }
   }
 
   if (accessible) {
     // Found an accessible, so fire the show/hide on it and don't look further
     // into this subtree.
-    nsRefPtr<nsAccEvent> event;
+    nsRefPtr<AccEvent> event;
     if (aDelayedOrNormal == eDelayedEvent &&
         aEventType == nsIAccessibleEvent::EVENT_HIDE) {
       // Use AccHideEvent for delayed hide events to coalesce text change events
       // caused by these hide events.
       event = new AccHideEvent(accessible, accessible->GetNode(),
                                aIsAsyncChange, aIsFromUserInput);
 
     } else {
-      event = new nsAccEvent(aEventType, accessible, aIsAsyncChange,
-                             aIsFromUserInput,
-                             nsAccEvent::eCoalesceFromSameSubtree);
+      event = new AccEvent(aEventType, accessible, aIsAsyncChange,
+                           aIsFromUserInput,
+                           AccEvent::eCoalesceFromSameSubtree);
     }
     NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
     if (aDelayedOrNormal == eDelayedEvent)
       return FireDelayedAccessibleEvent(event);
 
     nsEventShell::FireEvent(event);
     return NS_OK;
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -112,17 +112,17 @@ public:
   // nsAccessible
   virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
 
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
 #ifdef DEBUG_ACCDOCMGR
-  virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 #endif
 
   // nsIAccessibleText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsDocAccessible
 
   /**
@@ -146,26 +146,26 @@ public:
    *
    * @param aEventType   [in] the nsIAccessibleEvent event type
    * @param aDOMNode     [in] DOM node the accesible event should be fired for
    * @param aAllowDupes  [in] rule to process an event (see EEventRule constants)
    * @param aIsAsynch    [in] set to PR_TRUE if this is not being called from
    *                      code synchronous with a DOM event
    */
   nsresult FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
-                                      nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes,
+                                      AccEvent::EEventRule aAllowDupes = AccEvent::eRemoveDupes,
                                       PRBool aIsAsynch = PR_FALSE,
                                       EIsFromUserInput aIsFromUserInput = eAutoDetect);
 
   /**
    * Fire accessible event after timeout.
    *
    * @param aEvent  [in] the event to fire
    */
-  nsresult FireDelayedAccessibleEvent(nsAccEvent *aEvent);
+  nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
 
   /**
    * Find the accessible object in the accessibility cache that corresponds to
    * the given node or the first ancestor of it that has an accessible object
    * associated with it. Clear that accessible object's parent's cache of
    * accessible children and remove the accessible object and any descendants
    * from the accessible cache. Fires proper events. New accessible objects will
    * be created and cached again on demand.
@@ -202,17 +202,17 @@ public:
    * Remove the given accessible from document cache.
    */
   void RemoveAccessNodeFromCache(nsAccessible *aAccessible);
 
   /**
    * Process the event when the queue of pending events is untwisted. Fire
    * accessible events as result of the processing.
    */
-  void ProcessPendingEvent(nsAccEvent* aEvent);
+  void ProcessPendingEvent(AccEvent* aEvent);
 
 protected:
 
     virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
     virtual nsresult AddEventListeners();
     virtual nsresult RemoveEventListeners();
     void AddScrollListener();
     void RemoveScrollListener();
@@ -271,17 +271,17 @@ protected:
    *                                 removed, or shown/hidden
    * @param  aAccessible           [in] the accessible for that node, or nsnull
    *                                 if none exists
    * @param  aIsInserting          [in] is aChangeNode being created or shown
    *                                 (vs. removed or hidden)
    * @param  aIsAsync              [in] whether casual change is async
    * @param  aIsFromUserInput      [in] the event is known to be from user input
    */
-  already_AddRefed<nsAccEvent>
+  already_AddRefed<AccEvent>
     CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
                                  nsIContent *aChangeNode,
                                  nsAccessible *aAccessible,
                                  PRBool aIsInserting,
                                  PRBool aIsAsynch,
                                  EIsFromUserInput aIsFromUserInput = eAutoDetect);
 
   /**
--- a/accessible/src/base/nsEventShell.cpp
+++ b/accessible/src/base/nsEventShell.cpp
@@ -42,17 +42,17 @@
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsEventShell
 ////////////////////////////////////////////////////////////////////////////////
 
 void
-nsEventShell::FireEvent(nsAccEvent *aEvent)
+nsEventShell::FireEvent(AccEvent* aEvent)
 {
   if (!aEvent)
     return;
 
   nsAccessible *accessible = aEvent->GetAccessible();
   NS_ENSURE_TRUE(accessible,);
 
   nsINode* node = aEvent->GetNode();
@@ -67,18 +67,18 @@ nsEventShell::FireEvent(nsAccEvent *aEve
 }
 
 void
 nsEventShell::FireEvent(PRUint32 aEventType, nsAccessible *aAccessible,
                         PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
 {
   NS_ENSURE_TRUE(aAccessible,);
 
-  nsRefPtr<nsAccEvent> event = new nsAccEvent(aEventType, aAccessible,
-                                              aIsAsynch, aIsFromUserInput);
+  nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
+                                          aIsAsynch, aIsFromUserInput);
 
   FireEvent(event);
 }
 
 void 
 nsEventShell::GetEventAttributes(nsINode *aNode,
                                  nsIPersistentProperties *aAttributes)
 {
@@ -118,37 +118,32 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccEven
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccEventQueue)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEventQueue)
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mDocument");
   cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mDocument.get()));
-
-  PRUint32 i, length = tmp->mEvents.Length();
-  for (i = 0; i < length; ++i) {
-    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvents[i]");
-    cb.NoteXPCOMChild(tmp->mEvents[i].get());
-  }
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_MEMBER(mEvents, AccEvent)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEventQueue)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mEvents)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccEventQueue)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEventQueue)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccEventQueue: public
 
 void
-nsAccEventQueue::Push(nsAccEvent *aEvent)
+nsAccEventQueue::Push(AccEvent* aEvent)
 {
   mEvents.AppendElement(aEvent);
 
   // Filter events.
   CoalesceEvents();
 
   // Associate text change with hide event if it wasn't stolen from hiding
   // siblings during coalescence.
@@ -198,25 +193,25 @@ nsAccEventQueue::WillRefresh(mozilla::Ti
 {
   // If the document accessible is now shut down, don't fire events in it
   // anymore.
   if (!mDocument)
     return;
 
   // Process only currently queued events. Newly appended events during events
   // flushing won't be processed.
-  nsTArray < nsRefPtr<nsAccEvent> > events;
+  nsTArray < nsRefPtr<AccEvent> > events;
   events.SwapElements(mEvents);
   PRUint32 length = events.Length();
   NS_ASSERTION(length, "How did we get here without events to fire?");
 
   for (PRUint32 index = 0; index < length; index ++) {
 
-    nsAccEvent *accEvent = events[index];
-    if (accEvent->mEventRule != nsAccEvent::eDoNotEmit) {
+    AccEvent* accEvent = events[index];
+    if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
       mDocument->ProcessPendingEvent(accEvent);
 
       AccHideEvent* hideEvent = downcast_accEvent(accEvent);
       if (hideEvent) {
         if (hideEvent->mTextChangeEvent)
           mDocument->ProcessPendingEvent(hideEvent->mTextChangeEvent);
       }
     }
@@ -235,28 +230,28 @@ nsAccEventQueue::WillRefresh(mozilla::Ti
   }
 }
 
 void
 nsAccEventQueue::CoalesceEvents()
 {
   PRUint32 numQueuedEvents = mEvents.Length();
   PRInt32 tail = numQueuedEvents - 1;
-  nsAccEvent* tailEvent = mEvents[tail];
+  AccEvent* tailEvent = mEvents[tail];
 
   // No node means this is application accessible (which can be a subject
   // of reorder events), we do not coalesce events for it currently.
   if (!tailEvent->mNode)
     return;
 
   switch(tailEvent->mEventRule) {
-    case nsAccEvent::eCoalesceFromSameSubtree:
+    case AccEvent::eCoalesceFromSameSubtree:
     {
       for (PRInt32 index = tail - 1; index >= 0; index--) {
-        nsAccEvent* thisEvent = mEvents[index];
+        AccEvent* thisEvent = mEvents[index];
 
         if (thisEvent->mEventType != tailEvent->mEventType)
           continue; // Different type
 
         // Skip event for application accessible since no coalescence for it
         // is supported. Ignore events from different documents since we don't
         // coalesce them.
         if (!thisEvent->mNode ||
@@ -275,17 +270,17 @@ nsAccEventQueue::CoalesceEvents()
         // Coalesce hide events for sibling targets.
         if (tailEvent->mEventType == nsIAccessibleEvent::EVENT_HIDE) {
           AccHideEvent* tailHideEvent = downcast_accEvent(tailEvent);
           AccHideEvent* thisHideEvent = downcast_accEvent(thisEvent);
           if (thisHideEvent->mParent == tailHideEvent->mParent) {
             tailEvent->mEventRule = thisEvent->mEventRule;
 
             // Coalesce text change events for hide events.
-            if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
+            if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
               CoalesceTextChangeEventsFor(tailHideEvent, thisHideEvent);
 
             return;
           }
         }
 
         // Ignore events unattached from DOM since we don't coalesce them.
         if (!thisEvent->mNode->IsInDoc())
@@ -297,28 +292,28 @@ nsAccEventQueue::CoalesceEvents()
           tailEvent->mEventRule = thisEvent->mEventRule;
           return;
         }
 
         // Specifies if this event target can be descendant of tail node.
         PRBool thisCanBeDescendantOfTail = PR_FALSE;
 
         // Coalesce depending on whether this event was coalesced or not.
-        if (thisEvent->mEventRule == nsAccEvent::eDoNotEmit) {
+        if (thisEvent->mEventRule == AccEvent::eDoNotEmit) {
           // If this event was coalesced then do not emit tail event iff tail
           // event has the same target or its target is contained by this event
           // target. Note, we don't need to check whether tail event target
           // contains this event target since this event was coalesced already.
 
           // As well we don't need to apply the calculated rule for siblings of
           // tail node because tail event rule was applied to possible tail
           // node siblings while this event was coalesced.
 
           if (thisEvent->mNode == tailEvent->mNode) {
-            thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
+            thisEvent->mEventRule = AccEvent::eDoNotEmit;
             return;
           }
 
         } else {
           // If this event wasn't coalesced already then try to coalesce it or
           // tail event. If this event is coalesced by tail event then continue
           // search through events other events that can be coalesced by tail
           // event.
@@ -326,21 +321,21 @@ nsAccEventQueue::CoalesceEvents()
           // If tail and this events have the same target then coalesce tail
           // event because more early event we should fire early and then stop
           // processing.
           if (thisEvent->mNode == tailEvent->mNode) {
             // Coalesce reorder events by special way since reorder events can
             // be conditional events (be or not be fired in the end).
             if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
               CoalesceReorderEventsFromSameSource(thisEvent, tailEvent);
-              if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
+              if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
                 continue;
             }
             else {
-              tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
+              tailEvent->mEventRule = AccEvent::eDoNotEmit;
             }
 
             return;
           }
 
           // This and tail events can be anywhere in the tree, make assumptions
           // for mutation events.
 
@@ -362,23 +357,23 @@ nsAccEventQueue::CoalesceEvents()
         // Note: more older hide event target (thisNode) can't contain recent
         // hide event target (tailNode), i.e. be ancestor of tailNode. Skip
         // this check for hide events.
         if (tailEvent->mEventType != nsIAccessibleEvent::EVENT_HIDE &&
             nsCoreUtils::IsAncestorOf(thisEvent->mNode, tailEvent->mNode)) {
 
           if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
             CoalesceReorderEventsFromSameTree(thisEvent, tailEvent);
-            if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
+            if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
               continue;
 
             return;
           }
 
-          tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
+          tailEvent->mEventRule = AccEvent::eDoNotEmit;
           return;
         }
 
 #ifdef DEBUG
         if (tailEvent->mEventType == nsIAccessibleEvent::EVENT_HIDE &&
             nsCoreUtils::IsAncestorOf(thisEvent->mNode, tailEvent->mNode)) {
           NS_NOTREACHED("More older hide event target is an ancestor of recent hide event target!");
         }
@@ -386,135 +381,135 @@ nsAccEventQueue::CoalesceEvents()
 
         // If this node is a descendant of tail node then coalesce this event,
         // check other events in the queue.
         if (thisCanBeDescendantOfTail &&
             nsCoreUtils::IsAncestorOf(tailEvent->mNode, thisEvent->mNode)) {
 
           if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
             CoalesceReorderEventsFromSameTree(tailEvent, thisEvent);
-            if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
+            if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
               continue;
 
             return;
           }
 
           // Do not emit thisEvent, also apply this result to sibling nodes of
           // thisNode.
-          thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
+          thisEvent->mEventRule = AccEvent::eDoNotEmit;
           ApplyToSiblings(0, index, thisEvent->mEventType,
-                          thisEvent->mNode, nsAccEvent::eDoNotEmit);
+                          thisEvent->mNode, AccEvent::eDoNotEmit);
           continue;
         }
 
 #ifdef DEBUG
         if (!thisCanBeDescendantOfTail &&
             nsCoreUtils::IsAncestorOf(tailEvent->mNode, thisEvent->mNode)) {
           NS_NOTREACHED("Older event target is a descendant of recent event target!");
         }
 #endif
 
       } // for (index)
 
     } break; // case eCoalesceFromSameSubtree
 
-    case nsAccEvent::eCoalesceFromSameDocument:
+    case AccEvent::eCoalesceFromSameDocument:
     {
       // Used for focus event, coalesce more older event since focus event
       // for accessible can be duplicated by event for its document, we are
       // interested in focus event for accessible.
       for (PRInt32 index = tail - 1; index >= 0; index--) {
-        nsAccEvent* thisEvent = mEvents[index];
+        AccEvent* thisEvent = mEvents[index];
         if (thisEvent->mEventType == tailEvent->mEventType &&
             thisEvent->mEventRule == tailEvent->mEventRule &&
             thisEvent->GetDocAccessible() == tailEvent->GetDocAccessible()) {
-          thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
+          thisEvent->mEventRule = AccEvent::eDoNotEmit;
           return;
         }
       }
     } break; // case eCoalesceFromSameDocument
 
-    case nsAccEvent::eRemoveDupes:
+    case AccEvent::eRemoveDupes:
     {
       // Check for repeat events, coalesce newly appended event by more older
       // event.
       for (PRInt32 index = tail - 1; index >= 0; index--) {
-        nsAccEvent* accEvent = mEvents[index];
+        AccEvent* accEvent = mEvents[index];
         if (accEvent->mEventType == tailEvent->mEventType &&
             accEvent->mEventRule == tailEvent->mEventRule &&
             accEvent->mNode == tailEvent->mNode) {
-          tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
+          tailEvent->mEventRule = AccEvent::eDoNotEmit;
           return;
         }
       }
     } break; // case eRemoveDupes
 
     default:
       break; // case eAllowDupes, eDoNotEmit
   } // switch
 }
 
 void
 nsAccEventQueue::ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
                                  PRUint32 aEventType, nsINode* aNode,
-                                 nsAccEvent::EEventRule aEventRule)
+                                 AccEvent::EEventRule aEventRule)
 {
   for (PRUint32 index = aStart; index < aEnd; index ++) {
-    nsAccEvent* accEvent = mEvents[index];
+    AccEvent* accEvent = mEvents[index];
     if (accEvent->mEventType == aEventType &&
-        accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
+        accEvent->mEventRule != AccEvent::eDoNotEmit &&
         accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) {
       accEvent->mEventRule = aEventRule;
     }
   }
 }
 
 void
-nsAccEventQueue::CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
-                                                     nsAccEvent *aAccEvent2)
+nsAccEventQueue::CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
+                                                     AccEvent* aAccEvent2)
 {
   // Do not emit event2 if event1 is unconditional.
-  nsAccReorderEvent *reorderEvent1 = downcast_accEvent(aAccEvent1);
+  AccReorderEvent* reorderEvent1 = downcast_accEvent(aAccEvent1);
   if (reorderEvent1->IsUnconditionalEvent()) {
-    aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
+    aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
     return;
   }
 
   // Do not emit event1 if event2 is unconditional.
-  nsAccReorderEvent *reorderEvent2 = downcast_accEvent(aAccEvent2);
+  AccReorderEvent* reorderEvent2 = downcast_accEvent(aAccEvent2);
   if (reorderEvent2->IsUnconditionalEvent()) {
-    aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
+    aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
     return;
   }
 
   // Do not emit event2 if event1 is valid, otherwise do not emit event1.
   if (reorderEvent1->HasAccessibleInReasonSubtree())
-    aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
+    aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
   else
-    aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
+    aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
 }
 
 void
-nsAccEventQueue::CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
-                                                   nsAccEvent *aDescendantAccEvent)
+nsAccEventQueue::CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
+                                                   AccEvent* aDescendantAccEvent)
 {
   // Do not emit descendant event if this event is unconditional.
-  nsAccReorderEvent *reorderEvent = downcast_accEvent(aAccEvent);
+  AccReorderEvent* reorderEvent = downcast_accEvent(aAccEvent);
   if (reorderEvent->IsUnconditionalEvent())
-    aDescendantAccEvent->mEventRule = nsAccEvent::eDoNotEmit;
+    aDescendantAccEvent->mEventRule = AccEvent::eDoNotEmit;
 }
 
 void
 nsAccEventQueue::CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
                                              AccHideEvent* aThisEvent)
 {
   // XXX: we need a way to ignore SplitNode and JoinNode() when they do not
   // affect the text within the hypertext.
 
-  nsAccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
+  AccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
   if (!textEvent)
     return;
 
   if (aThisEvent->mNextSibling == aTailEvent->mAccessible) {
     aTailEvent->mAccessible->AppendTextTo(textEvent->mModifiedText,
                                           0, PR_UINT32_MAX);
 
   } else if (aThisEvent->mPrevSibling == aTailEvent->mAccessible) {
@@ -552,12 +547,12 @@ nsAccEventQueue::CreateTextChangeEventFo
   PRInt32 offset = textAccessible->GetChildOffset(aEvent->mAccessible);
 
   nsAutoString text;
   aEvent->mAccessible->AppendTextTo(text, 0, PR_UINT32_MAX);
   if (text.IsEmpty())
     return;
 
   aEvent->mTextChangeEvent =
-    new nsAccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
-                             aEvent->mIsAsync,
-                             aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
+    new AccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
+                           aEvent->mIsAsync,
+                           aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
 }
--- a/accessible/src/base/nsEventShell.h
+++ b/accessible/src/base/nsEventShell.h
@@ -34,17 +34,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsEventShell_H_
 #define _nsEventShell_H_
 
-#include "nsAccEvent.h"
+#include "AccEvent.h"
 
 #include "a11yGeneric.h"
 
 #include "nsAutoPtr.h"
 
 #include "nsRefreshDriver.h"
 
 class nsIPersistentProperties;
@@ -54,17 +54,17 @@ class nsIPersistentProperties;
  */
 class nsEventShell
 {
 public:
 
   /**
    * Fire the accessible event.
    */
-  static void FireEvent(nsAccEvent *aEvent);
+  static void FireEvent(AccEvent* aEvent);
 
   /**
    * Fire accessible event of the given type for the given accessible.
    *
    * @param  aEventType   [in] the event type
    * @param  aAccessible  [in] the event target
    * @param  aIsAsync     [in, optional] specifies whether the origin change
    *                        this event is fired owing to is async.
@@ -100,17 +100,17 @@ public:
   ~nsAccEventQueue();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(nsAccEventQueue)
 
   /**
    * Push event to queue, coalesce it if necessary. Start pending processing.
    */
-  void Push(nsAccEvent *aEvent);
+  void Push(AccEvent* aEvent);
 
   /**
    * Shutdown the queue.
    */
   void Shutdown();
 
 private:
 
@@ -137,30 +137,30 @@ private:
    * @param aEnd             end index to be scanned (not included)
    * @param aEventType       target event type
    * @param aDOMNode         target are siblings of this node
    * @param aEventRule       the event rule to be applied
    *                         (should be eDoNotEmit or eAllowDupes)
    */
   void ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
                        PRUint32 aEventType, nsINode* aNode,
-                       nsAccEvent::EEventRule aEventRule);
+                       AccEvent::EEventRule aEventRule);
 
   /**
    * Do not emit one of two given reorder events fired for the same DOM node.
    */
-  void CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
-                                           nsAccEvent *aAccEvent2);
+  void CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
+                                           AccEvent* aAccEvent2);
 
   /**
    * Do not emit one of two given reorder events fired for DOM nodes in the case
    * when one DOM node is in parent chain of second one.
    */
-  void CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
-                                         nsAccEvent *aDescendantAccEvent);
+  void CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
+                                         AccEvent* aDescendantAccEvent);
 
   /**
    * Coalesce text change events caused by sibling hide events.
    */
   void CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
                                    AccHideEvent* aThisEvent);
 
   /**
@@ -181,12 +181,12 @@ private:
    * The document accessible reference owning this queue.
    */
   nsRefPtr<nsDocAccessible> mDocument;
 
   /**
    * Pending events array.  Don't make this an nsAutoTArray; we use
    * SwapElements() on it.
    */
-  nsTArray<nsRefPtr<nsAccEvent> > mEvents;
+  nsTArray<nsRefPtr<AccEvent> > mEvents;
 };
 
 #endif
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -398,32 +398,32 @@ nsRootAccessible::FireAccessibleFocusEve
       PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
       if (role != naturalRole) { // Must be a DHTML menuitem
         nsAccessible *menuBarAccessible =
           nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
                                           nsIAccessibleRole::ROLE_MENUBAR);
         if (menuBarAccessible) {
           mCurrentARIAMenubar = menuBarAccessible->GetNode();
           if (mCurrentARIAMenubar) {
-            nsRefPtr<nsAccEvent> menuStartEvent =
-              new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_START,
-                             menuBarAccessible, PR_FALSE, aIsFromUserInput,
-                             nsAccEvent::eAllowDupes);
+            nsRefPtr<AccEvent> menuStartEvent =
+              new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
+                           menuBarAccessible, PR_FALSE, aIsFromUserInput,
+                           AccEvent::eAllowDupes);
             if (menuStartEvent) {
               FireDelayedAccessibleEvent(menuStartEvent);
             }
           }
         }
       }
     }
   }
   else if (mCurrentARIAMenubar) {
-    nsRefPtr<nsAccEvent> menuEndEvent =
-      new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
-                     PR_FALSE, aIsFromUserInput, nsAccEvent::eAllowDupes);
+    nsRefPtr<AccEvent> menuEndEvent =
+      new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
+                   PR_FALSE, aIsFromUserInput, AccEvent::eAllowDupes);
     if (menuEndEvent) {
       FireDelayedAccessibleEvent(menuEndEvent);
     }
     mCurrentARIAMenubar = nsnull;
   }
 
   nsCOMPtr<nsIContent> focusContent = do_QueryInterface(finalFocusNode);
   nsIFrame *focusFrame = nsnull;
@@ -441,17 +441,17 @@ nsRootAccessible::FireAccessibleFocusEve
   gLastFocusedNode = finalFocusNode;
   NS_IF_ADDREF(gLastFocusedNode);
 
   gLastFocusedFrameType = (focusFrame && focusFrame->GetStyleVisibility()->IsVisible()) ? focusFrame->GetType() : 0;
 
   // Coalesce focus events from the same document, because DOM focus event might
   // be fired for the document node and then for the focused DOM element.
   FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
-                             finalFocusNode, nsAccEvent::eCoalesceFromSameDocument,
+                             finalFocusNode, AccEvent::eCoalesceFromSameDocument,
                              aIsAsynch, aIsFromUserInput);
 
   return PR_TRUE;
 }
 
 void
 nsRootAccessible::FireCurrentFocusEvent()
 {
@@ -544,36 +544,35 @@ nsRootAccessible::HandleEvent(nsIDOMEven
 
     // radiogroup in prefWindow is exposed as a list,
     // and panebutton is exposed as XULListitem in A11y.
     // nsXULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case,
     // so we need to check nsIAccessibleStates::STATE_SELECTED also.
     PRBool isEnabled = (state & (nsIAccessibleStates::STATE_CHECKED |
                         nsIAccessibleStates::STATE_SELECTED)) != 0;
 
-    nsRefPtr<nsAccEvent> accEvent =
-      new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
-                                PR_FALSE, isEnabled);
+    nsRefPtr<AccEvent> accEvent =
+      new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
+                              PR_FALSE, isEnabled);
     nsEventShell::FireEvent(accEvent);
 
     if (isEnabled)
       FireAccessibleFocusEvent(accessible, targetNode, aEvent);
 
     return NS_OK;
   }
 
   if (eventType.EqualsLiteral("CheckboxStateChange")) {
     PRUint32 state = nsAccUtils::State(accessible);
 
     PRBool isEnabled = !!(state & nsIAccessibleStates::STATE_CHECKED);
 
-    nsRefPtr<nsAccEvent> accEvent =
-      new nsAccStateChangeEvent(accessible,
-                                nsIAccessibleStates::STATE_CHECKED,
-                                PR_FALSE, isEnabled);
+    nsRefPtr<AccEvent> accEvent =
+      new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
+                              PR_FALSE, isEnabled);
 
     nsEventShell::FireEvent(accEvent);
     return NS_OK;
   }
 
   nsAccessible *treeItemAccessible = nsnull;
 #ifdef MOZ_XUL
   // If it's a tree element, need the currently selected item
@@ -595,19 +594,19 @@ nsRootAccessible::HandleEvent(nsIDOMEven
   }
 #endif
 
 #ifdef MOZ_XUL
   if (treeItemAccessible && eventType.EqualsLiteral("OpenStateChange")) {
     PRUint32 state = nsAccUtils::State(accessible); // collapsed/expanded changed
     PRBool isEnabled = (state & nsIAccessibleStates::STATE_EXPANDED) != 0;
 
-    nsRefPtr<nsAccEvent> accEvent =
-      new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
-                                PR_FALSE, isEnabled);
+    nsRefPtr<AccEvent> accEvent =
+      new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
+                              PR_FALSE, isEnabled);
     nsEventShell::FireEvent(accEvent);
     return NS_OK;
   }
 
   if (treeItemAccessible && eventType.EqualsLiteral("select")) {
     // If multiselect tree, we should fire selectionadd or selection removed
     if (gLastFocusedNode == targetNode) {
       nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel =
@@ -748,17 +747,17 @@ nsRootAccessible::HandleEvent(nsIDOMEven
   }
   else if (eventType.EqualsLiteral("DOMMenuBarInactive")) {  // Always asynch, always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
                             accessible, PR_TRUE, eFromUserInput);
     FireCurrentFocusEvent();
   }
   else if (eventType.EqualsLiteral("ValueChange")) {
     FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
-                               targetNode, nsAccEvent::eRemoveDupes);
+                               targetNode, AccEvent::eRemoveDupes);
   }
 #ifdef DEBUG
   else if (eventType.EqualsLiteral("mouseover")) {
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START,
                             accessible);
   }
 #endif
   return NS_OK;
@@ -882,20 +881,20 @@ nsRootAccessible::HandlePopupShownEvent(
   }
 
   if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
     // Fire expanded state change event for comboboxes and autocompeletes.
     nsAccessible *comboboxAcc = aAccessible->GetParent();
     PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
     if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
         comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
-      nsRefPtr<nsAccEvent> event =
-        new nsAccStateChangeEvent(comboboxAcc,
-                                  nsIAccessibleStates::STATE_EXPANDED,
-                                  PR_FALSE, PR_TRUE);
+      nsRefPtr<AccEvent> event =
+        new AccStateChangeEvent(comboboxAcc,
+                                nsIAccessibleStates::STATE_EXPANDED,
+                                PR_FALSE, PR_TRUE);
       NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
       nsEventShell::FireEvent(event);
       return NS_OK;
     }
   }
 
   return NS_OK;
@@ -924,20 +923,20 @@ nsRootAccessible::HandlePopupHidingEvent
   PRUint32 role = nsAccUtils::Role(aAccessible);
   if (role != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
     return NS_OK;
 
   nsAccessible *comboboxAcc = aAccessible->GetParent();
   PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
   if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
       comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
-    nsRefPtr<nsAccEvent> event =
-      new nsAccStateChangeEvent(comboboxAcc,
-                                nsIAccessibleStates::STATE_EXPANDED,
-                                PR_FALSE, PR_FALSE);
+    nsRefPtr<AccEvent> event =
+      new AccStateChangeEvent(comboboxAcc,
+                              nsIAccessibleStates::STATE_EXPANDED,
+                              PR_FALSE, PR_FALSE);
     NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
     nsEventShell::FireEvent(event);
     return NS_OK;
   }
 
   return NS_OK;
 }
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -758,35 +758,34 @@ nsHTMLSelectOptionAccessible::SelectionC
   if (!multiSelect)
     return;
 
   nsAccessible *option = GetAccService()->GetAccessible(aPossibleOptionNode);
   if (!option)
     return;
 
 
-  nsRefPtr<nsAccEvent> selWithinEvent =
-    new nsAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
+  nsRefPtr<AccEvent> selWithinEvent =
+    new AccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
 
   if (!selWithinEvent)
     return;
 
   option->GetDocAccessible()->FireDelayedAccessibleEvent(selWithinEvent);
 
   PRUint32 state = nsAccUtils::State(option);
   PRUint32 eventType;
   if (state & nsIAccessibleStates::STATE_SELECTED) {
     eventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
   }
   else {
     eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
   }
 
-  nsRefPtr<nsAccEvent> selAddRemoveEvent =
-    new nsAccEvent(eventType, option);
+  nsRefPtr<AccEvent> selAddRemoveEvent = new AccEvent(eventType, option);
 
   if (selAddRemoveEvent)
     option->GetDocAccessible()->FireDelayedAccessibleEvent(selAddRemoveEvent);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectOptionAccessible: private methods
 
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -73,17 +73,17 @@ class nsAccessibleWrap : public nsAccess
     virtual objc_class* GetNativeType ();
     
     // returns a pointer to the native window for this accessible tree.
     void GetNativeWindow (void **aOutNativeWindow);
     
     virtual void Shutdown ();
     virtual void InvalidateChildren();
 
-    virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
+    virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
     // ignored means that the accessible might still have children, but is not displayed
     // to the user. it also has no native accessible object represented for it.
     PRBool IsIgnored();
     
     PRInt32 GetUnignoredChildCount(PRBool aDeepCount);
     
     PRBool HasPopup () {
@@ -93,17 +93,17 @@ class nsAccessibleWrap : public nsAccess
     }
     
     // return this accessible's all children, adhering to "flat" accessibles by not returning their children.
     void GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray);
     virtual already_AddRefed<nsIAccessible> GetUnignoredParent();
     
   protected:
 
-    virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
+    virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
   /**
    * Return true if the parent doesn't have children to expose to AT.
    */
   PRBool AncestorIsFlat();
 
     // Wrapper around our native object.
     AccessibleWrapper *mNativeWrapper;
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -156,30 +156,30 @@ nsAccessibleWrap::Shutdown ()
     delete mNativeWrapper;
     mNativeWrapper = nsnull;
   }
   
   nsAccessible::Shutdown();
 }
 
 nsresult
-nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   nsresult rv = nsAccessible::HandleAccEvent(aEvent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return FirePlatformEvent(aEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 nsresult
-nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   PRUint32 eventType = aEvent->GetEventType();
 
   // ignore everything but focus-changed and value-changed events for now.
   if (eventType != nsIAccessibleEvent::EVENT_FOCUS &&
       eventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE)
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -65,17 +65,17 @@ HINSTANCE nsAccessNodeWrap::gmUserLib = 
 LPFNACCESSIBLEOBJECTFROMWINDOW nsAccessNodeWrap::gmAccessibleObjectFromWindow = nsnull;
 LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
 LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
 
 PRBool nsAccessNodeWrap::gIsEnumVariantSupportDisabled = 0;
 // Used to determine whether an IAccessible2 compatible screen reader is loaded.
 PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
 
-nsAccTextChangeEvent *nsAccessNodeWrap::gTextEvent = nsnull;
+AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
 
 // Pref to disallow CtrlTab preview functionality if JAWS or Window-Eyes are
 // running.
 #define CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF "browser.ctrlTab.disallowForScreenReaders"
 
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
--- a/accessible/src/msaa/nsAccessNodeWrap.h
+++ b/accessible/src/msaa/nsAccessNodeWrap.h
@@ -66,17 +66,17 @@
 #endif
 #ifdef MOZ_CRASHREPORTER
 #include "nsICrashReporter.h"
 #endif
 
 typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
 typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
 
-class nsAccTextChangeEvent;
+class AccTextChangeEvent;
 
 class nsAccessNodeWrap :  public nsAccessNode,
                           public nsIWinAccessNode,
                           public ISimpleDOMNode,
                           public IServiceProvider
 {
   public:
     NS_DECL_ISUPPORTS_INHERITED
@@ -182,17 +182,17 @@ protected:
      * loaded. Currently used for JAWS versions older than 8.0.2173.
      */
      static PRBool gIsIA2Disabled;
 
     /**
      * It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
      * implementation.
      */
-    static nsAccTextChangeEvent *gTextEvent;
+    static AccTextChangeEvent* gTextEvent;
 };
 
 /**
  * Converts nsresult to HRESULT.
  */
 HRESULT GetHRESULT(nsresult aResult);
 
 #endif
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -1577,26 +1577,26 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativ
   *aOutAccessible = static_cast<IAccessible*>(this);
   NS_ADDREF_THIS();
   return NS_OK;
 }
 
 // nsAccessible
 
 nsresult
-nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   nsresult rv = nsAccessible::HandleAccEvent(aEvent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return FirePlatformEvent(aEvent);
 }
 
 nsresult
-nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
+nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
 {
   PRUint32 eventType = aEvent->GetEventType();
 
   NS_ENSURE_TRUE(eventType > 0 &&
                  eventType < nsIAccessibleEvent::EVENT_LAST_ENTRY,
                  NS_ERROR_FAILURE);
 
   PRUint32 winLastEntry = gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY];
--- a/accessible/src/msaa/nsAccessibleWrap.h
+++ b/accessible/src/msaa/nsAccessibleWrap.h
@@ -302,17 +302,17 @@ public: // construction, destruction
   virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid,
                                            LCID lcid, WORD wFlags,
                                            DISPPARAMS *pDispParams,
                                            VARIANT *pVarResult,
                                            EXCEPINFO *pExcepInfo,
                                            UINT *puArgErr);
 
   // nsAccessible
-  virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
   // Helper methods
   static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
   static HWND GetHWNDFor(nsAccessible *aAccessible);
   static HRESULT ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
                                         BSTR *aIA2Attributes);
 
   /**
@@ -341,17 +341,17 @@ public: // construction, destruction
   /**
    * Drops the IEnumVariant current position so that navigation methods
    * Next() and Skip() doesn't work until Reset() method is called. The method
    * is used when children of the accessible are changed.
    */
   void UnattachIEnumVariant();
 
 protected:
-  virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
+  virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
   // mEnumVARIANTPosition not the current accessible's position, but a "cursor" of 
   // where we are in the current list of children, with respect to
   // nsIEnumVariant::Reset(), Skip() and Next().
   PRInt32 mEnumVARIANTPosition;
 
   /**
    * Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
@@ -46,17 +46,17 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHyperText
                              nsHyperTextAccessible)
 
 IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
                          nsAccessibleWrap,
                          CAccessibleHypertext,
                          CAccessibleEditableText);
 
 nsresult
-nsHyperTextAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
+nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   PRUint32 eventType = aEvent->GetEventType();
 
   if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
       eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
     nsAccessible *accessible = aEvent->GetAccessible();
     if (accessible) {
       nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(accessible));
@@ -95,11 +95,13 @@ nsHyperTextAccessibleWrap::GetModifiedTe
     return NS_OK;
 
   nsAccessible *targetAcc = gTextEvent->GetAccessible();
   if (targetAcc != this)
     return NS_OK;
 
   *aStartOffset = gTextEvent->GetStartOffset();
   *aEndOffset = *aStartOffset + gTextEvent->GetLength();
-  return gTextEvent->GetModifiedText(aText);
+  gTextEvent->GetModifiedText(aText);
+
+  return NS_OK;
 }
 
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/msaa/nsHyperTextAccessibleWrap.h
@@ -56,17 +56,17 @@ public:
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
 protected:
   virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
                                    PRUint32 *aStartOffset,
                                    PRUint32 *aEndOffset);
 };
 
 #endif
--- a/accessible/src/other/nsAccessibleWrap.h
+++ b/accessible/src/other/nsAccessibleWrap.h
@@ -48,14 +48,15 @@
 
 class nsAccessibleWrap : public nsAccessible
 {
 public: // construction, destruction
   nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
   virtual ~nsAccessibleWrap();
 
   protected:
-    virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) {
+    virtual nsresult FirePlatformEvent(AccEvent* aEvent)
+    {
       return NS_OK;
     }
 };
 
 #endif
new file mode 100644
--- /dev/null
+++ b/accessible/src/xpcom/Makefile.in
@@ -0,0 +1,61 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = accessibility
+LIBRARY_NAME = accessibility_xpcom_s
+LIBXUL_LIBRARY = 1
+
+CPPSRCS = \
+  nsAccEvent.cpp \
+  $(NULL)
+
+# we don't want the shared lib, but we want to force the creation of a static lib.
+FORCE_STATIC_LIB = 1
+
+include $(topsrcdir)/config/rules.mk
+
+LOCAL_INCLUDES = \
+  -I$(srcdir)/../base \
+  $(NULL)
new file mode 100644
--- /dev/null
+++ b/accessible/src/xpcom/nsAccEvent.cpp
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsAccEvent.h"
+#include "nsDocAccessible.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
+
+NS_IMETHODIMP
+nsAccEvent::GetIsFromUserInput(PRBool* aIsFromUserInput)
+{
+  *aIsFromUserInput = mEvent->IsFromUserInput();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccEvent::GetEventType(PRUint32* aEventType)
+{
+  *aEventType = mEvent->GetEventType();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
+{
+  NS_ENSURE_ARG_POINTER(aAccessible);
+  *aAccessible = nsnull;
+
+  NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
+{
+  NS_ENSURE_ARG_POINTER(aDOMNode);
+  *aDOMNode = nsnull;
+
+  nsINode* node = mEvent->GetNode();
+  if (node)
+    CallQueryInterface(node, aDOMNode);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
+{
+  NS_ENSURE_ARG_POINTER(aDocAccessible);
+
+  NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
+  return NS_OK;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccStateChangeEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
+                             nsIAccessibleStateChangeEvent)
+
+NS_IMETHODIMP
+nsAccStateChangeEvent::GetState(PRUint32* aState)
+{
+  NS_ENSURE_ARG_POINTER(aState);
+  *aState = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
+{
+  NS_ENSURE_ARG_POINTER(aIsExtraState);
+  *aIsExtraState = static_cast<AccStateChangeEvent*>(mEvent.get())->IsExtraState();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccStateChangeEvent::IsEnabled(PRBool* aIsEnabled)
+{
+  NS_ENSURE_ARG_POINTER(aIsEnabled);
+  *aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
+  return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccTextChangeEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
+                             nsIAccessibleTextChangeEvent)
+
+NS_IMETHODIMP
+nsAccTextChangeEvent::GetStart(PRInt32* aStart)
+{
+  NS_ENSURE_ARG_POINTER(aStart);
+  *aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccTextChangeEvent::GetLength(PRUint32* aLength)
+{
+  NS_ENSURE_ARG_POINTER(aLength);
+  *aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccTextChangeEvent::IsInserted(PRBool* aIsInserted)
+{
+  NS_ENSURE_ARG_POINTER(aIsInserted);
+  *aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
+{
+  static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
+  return NS_OK;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccCaretMoveEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
+                             nsIAccessibleCaretMoveEvent)
+
+NS_IMETHODIMP
+nsAccCaretMoveEvent::GetCaretOffset(PRInt32 *aCaretOffset)
+{
+  NS_ENSURE_ARG_POINTER(aCaretOffset);
+
+  *aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
+  return NS_OK;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccTableChangeEvent
+////////////////////////////////////////////////////////////////////////////////
+
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
+                             nsIAccessibleTableChangeEvent)
+
+NS_IMETHODIMP
+nsAccTableChangeEvent::GetRowOrColIndex(PRInt32 *aRowOrColIndex)
+{
+  NS_ENSURE_ARG_POINTER(aRowOrColIndex);
+
+  *aRowOrColIndex =
+    static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
+{
+  NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
+
+  *aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
+  return NS_OK;
+}
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/xpcom/nsAccEvent.h
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _nsAccEvent_H_
+#define _nsAccEvent_H_
+
+#include "nsIAccessibleEvent.h"
+
+#include "AccEvent.h"
+
+/**
+ * Generic accessible event.
+ */
+class nsAccEvent: public nsIAccessibleEvent
+{
+public:
+  nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
+  virtual ~nsAccEvent() { }
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIACCESSIBLEEVENT
+
+protected:
+  nsRefPtr<AccEvent> mEvent;
+
+private:
+  nsAccEvent();
+  nsAccEvent(const nsAccEvent&);
+  nsAccEvent& operator =(const nsAccEvent&);
+};
+
+
+/**
+ * Accessible state change event.
+ */
+class nsAccStateChangeEvent: public nsAccEvent,
+                             public nsIAccessibleStateChangeEvent
+{
+public:
+  nsAccStateChangeEvent(AccStateChangeEvent* aEvent) : nsAccEvent(aEvent) { }
+  virtual ~nsAccStateChangeEvent() { }
+
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
+
+private:
+  nsAccStateChangeEvent();
+  nsAccStateChangeEvent(const nsAccStateChangeEvent&);
+  nsAccStateChangeEvent& operator =(const nsAccStateChangeEvent&);
+};
+
+
+/**
+ * Accessible text change event.
+ */
+class nsAccTextChangeEvent: public nsAccEvent,
+                            public nsIAccessibleTextChangeEvent
+{
+public:
+  nsAccTextChangeEvent(AccTextChangeEvent* aEvent) : nsAccEvent(aEvent) { }
+  virtual ~nsAccTextChangeEvent() { }
+
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
+
+private:
+  nsAccTextChangeEvent();
+  nsAccTextChangeEvent(const nsAccTextChangeEvent&);
+  nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
+};
+
+
+/**
+ * Accessible caret move event.
+ */
+class nsAccCaretMoveEvent: public nsAccEvent,
+                           public nsIAccessibleCaretMoveEvent
+{
+public:
+  nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
+  virtual ~nsAccCaretMoveEvent() { }
+
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIACCESSIBLECARETMOVEEVENT
+
+private:
+  nsAccCaretMoveEvent();
+  nsAccCaretMoveEvent(const nsAccCaretMoveEvent&);
+  nsAccCaretMoveEvent& operator =(const nsAccCaretMoveEvent&);
+};
+
+
+/**
+ * Accessible table change event.
+ */
+class nsAccTableChangeEvent : public nsAccEvent,
+                              public nsIAccessibleTableChangeEvent
+{
+public:
+  nsAccTableChangeEvent(AccTableChangeEvent* aEvent) : nsAccEvent(aEvent) { }
+  virtual ~nsAccTableChangeEvent() { }
+
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
+
+private:
+  nsAccTableChangeEvent();
+  nsAccTableChangeEvent(const nsAccTableChangeEvent&);
+  nsAccTableChangeEvent& operator =(const nsAccTableChangeEvent&);
+};
+
+#endif
+
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -516,18 +516,18 @@ nsXULTreeAccessible::InvalidateCache(PRI
 
   // Fire destroy event for removed tree items and delete them from caches.
   for (PRInt32 rowIdx = aRow; rowIdx < aRow - aCount; rowIdx++) {
 
     void* key = reinterpret_cast<void*>(rowIdx);
     nsAccessible *accessible = mAccessibleCache.GetWeak(key);
 
     if (accessible) {
-      nsRefPtr<nsAccEvent> event =
-        new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
+      nsRefPtr<AccEvent> event =
+        new AccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
       nsEventShell::FireEvent(event);
 
       accessible->Shutdown();
 
       // Remove accessible from document cache and tree cache.
       nsDocAccessible *docAccessible = GetDocAccessible();
       if (docAccessible)
         docAccessible->RemoveAccessNodeFromCache(accessible);
@@ -617,29 +617,29 @@ void
 nsXULTreeAccessible::TreeViewChanged()
 {
   if (IsDefunct())
     return;
 
   // Fire only notification destroy/create events on accessible tree to lie to
   // AT because it should be expensive to fire destroy events for each tree item
   // in cache.
-  nsRefPtr<nsAccEvent> eventDestroy =
-    new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
+  nsRefPtr<AccEvent> eventDestroy =
+    new AccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
   if (!eventDestroy)
     return;
 
   FirePlatformEvent(eventDestroy);
 
   ClearCache(mAccessibleCache);
 
   mTree->GetView(getter_AddRefs(mTreeView));
 
-  nsRefPtr<nsAccEvent> eventCreate =
-    new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
+  nsRefPtr<AccEvent> eventCreate =
+    new AccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
   if (!eventCreate)
     return;
 
   FirePlatformEvent(eventCreate);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: protected implementation
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -1233,19 +1233,19 @@ nsXULTreeGridCellAccessible::CellInvalid
   nsAutoString textEquiv;
 
   PRInt16 type;
   mColumn->GetType(&type);
   if (type == nsITreeColumn::TYPE_CHECKBOX) {
     mTreeView->GetCellValue(mRow, mColumn, textEquiv);
     if (mCachedTextEquiv != textEquiv) {
       PRBool isEnabled = textEquiv.EqualsLiteral("true");
-      nsRefPtr<nsAccEvent> accEvent =
-        new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
-                                  PR_FALSE, isEnabled);
+      nsRefPtr<AccEvent> accEvent =
+        new AccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
+                                PR_FALSE, isEnabled);
       nsEventShell::FireEvent(accEvent);
 
       mCachedTextEquiv = textEquiv;
     }
 
     return;
   }