bug 833164 - code gen xpcom accessible events r=surkov ted
authorTrevor Saunders <trev.saunders@gmail.com>
Sat, 19 Jan 2013 10:38:01 -0500
changeset 124929 a4e388a97ff3e6a0b15cf2155ca2963fdc5a217d
parent 124928 80be1feda16c38a8a32d6f88bc50e504edaa9983
child 124930 1c16fe5ae5aeb430651b4a13f56d5fa00bb048d5
push idunknown
push userunknown
push dateunknown
reviewerssurkov
bugs833164
milestone22.0a1
bug 833164 - code gen xpcom accessible events r=surkov ted
accessible/public/moz.build
accessible/public/nsIAccessibleCaretMoveEvent.idl
accessible/public/nsIAccessibleEvent.idl
accessible/public/nsIAccessibleHideEvent.idl
accessible/public/nsIAccessibleStateChangeEvent.idl
accessible/public/nsIAccessibleTableChangeEvent.idl
accessible/public/nsIAccessibleTextChangeEvent.idl
accessible/public/nsIAccessibleVirtualCursorChangeEvent.idl
accessible/src/base/AccEvent.cpp
accessible/src/base/AccEvent.h
accessible/src/base/nsAccUtils.h
accessible/src/generic/Accessible.cpp
accessible/src/jsat/EventManager.jsm
accessible/src/jsat/Utils.jsm
accessible/src/xpcom/AccEventGen.py
accessible/src/xpcom/AccEvents.conf
accessible/src/xpcom/Makefile.in
accessible/src/xpcom/nsAccEvent.cpp
accessible/src/xpcom/nsAccEvent.h
accessible/tests/mochitest/events.js
accessible/tests/mochitest/events/test_docload.xul
accessible/tests/mochitest/events/test_statechange.html
--- a/accessible/public/moz.build
+++ b/accessible/public/moz.build
@@ -7,17 +7,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
     DIRS += ['msaa', 'ia2']
 
 XPIDL_SOURCES += [
     'nsIAccessible.idl',
     'nsIAccessibleApplication.idl',
     'nsIAccessibleCursorable.idl',
     'nsIAccessibleDocument.idl',
     'nsIAccessibleEditableText.idl',
+    'nsIAccessibleCaretMoveEvent.idl',
     'nsIAccessibleEvent.idl',
+    'nsIAccessibleHideEvent.idl',
+    'nsIAccessibleStateChangeEvent.idl',
+    'nsIAccessibleTableChangeEvent.idl',
+    'nsIAccessibleTextChangeEvent.idl',
+    'nsIAccessibleVirtualCursorChangeEvent.idl',
     'nsIAccessibleHyperLink.idl',
     'nsIAccessibleHyperText.idl',
     'nsIAccessibleImage.idl',
     'nsIAccessiblePivot.idl',
     'nsIAccessibleProvider.idl',
     'nsIAccessibleRelation.idl',
     'nsIAccessibleRetrieval.idl',
     'nsIAccessibleRole.idl',
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleCaretMoveEvent.idl
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+/**
+ * Fired when the caret changes position in text.
+ */
+[scriptable, builtinclass, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
+interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
+{
+  /**
+   * Return caret offset.
+   */
+  readonly attribute long caretOffset;
+};
--- a/accessible/public/nsIAccessibleEvent.idl
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -20,17 +20,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(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
+[scriptable, builtinclass, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
 interface nsIAccessibleEvent : nsISupports
 {
   /**
    * An object has been created.
    */
   const unsigned long EVENT_SHOW = 0x0001;
 
   /**
@@ -443,125 +443,8 @@ interface nsIAccessibleEvent : nsISuppor
   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
    */
   readonly attribute boolean isFromUserInput;
 };
-
-
-[scriptable, uuid(9addd25d-8fa1-415e-94ec-6038f220d3e4)]
-interface nsIAccessibleStateChangeEvent : nsISupports
-{
-  /**
-   * Returns the state of accessible (see constants declared
-   * in nsIAccessibleStates).
-   */
-  readonly attribute unsigned long state;
-
-  /**
-   * Returns true if the state is extra state.
-   */
-  boolean isExtraState();
-
-  /**
-   * Returns true if the state is turned on.
-   */
-  boolean isEnabled();
-};
-
-
-[scriptable, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
-interface nsIAccessibleTextChangeEvent : nsISupports
-{
-  /**
-   * Returns offset of changed text in accessible.
-   */
-  readonly attribute long start;
-
-  /**
-   * Returns length of changed text.
-   */
-  readonly attribute unsigned long length;
-
-  /**
-   * Returns true if text was inserted, otherwise false.
-   */
-  boolean isInserted();
-
-  /**
-   * The inserted or removed text
-   */
-  readonly attribute DOMString modifiedText;
-};
-
-[scriptable, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
-interface nsIAccessibleHideEvent: nsISupports
-{
-  /**
-   * Return an accessible that was a parent of the target.
-   */
-  readonly attribute nsIAccessible targetParent;
-
-  /**
-   * Return an accessible that was a next sibling of the target
-   */
-  readonly attribute nsIAccessible targetNextSibling;
-
-  /**
-   * Return an accessible that was a parent of the target
-   */
-  readonly attribute nsIAccessible targetPrevSibling;
-};
-
-[scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
-interface nsIAccessibleCaretMoveEvent: nsISupports
-{
-  /**
-   * Return caret offset.
-   */
-  readonly attribute long caretOffset;
-};
-
-[scriptable, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
-interface nsIAccessibleTableChangeEvent: nsISupports
-{
-  /**
-   * Return the row or column index.
-   */
-  readonly attribute long rowOrColIndex;
-
-  /**
-   * Return the number of rows or cols
-   */
-  readonly attribute long numRowsOrCols;
-};
-
-
-/*
- * An interface for virtual cursor changed events.
- * Passes previous cursor position and text offsets.
- */
-[scriptable, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
-interface nsIAccessibleVirtualCursorChangeEvent : nsISupports
-{
-  /**
-   * Previous object pointed at by virtual cursor. null if none.
-   */
-  readonly attribute nsIAccessible oldAccessible;
-
-  /**
-   * Previous start offset of pivot. -1 if none.
-   */
-  readonly attribute long oldStartOffset;
-
-  /**
-   * Previous end offset of pivot. -1 if none.
-   */
-  readonly attribute long oldEndOffset;
-
-  /**
-   * Reason for virtual cursor move.
-   */
-  readonly attribute short reason;
-};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleHideEvent.idl
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+/**
+ * Fired when a accessible and its subtree are removed from the tree.
+ */
+[scriptable, builtinclass, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
+interface nsIAccessibleHideEvent: nsIAccessibleEvent
+{
+  /**
+   * Return an accessible that was a parent of the target.
+   */
+  readonly attribute nsIAccessible targetParent;
+
+  /**
+   * Return an accessible that was a next sibling of the target
+   */
+  readonly attribute nsIAccessible targetNextSibling;
+
+  /**
+   * Return an accessible that was a parent of the target
+   */
+  readonly attribute nsIAccessible targetPrevSibling;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleStateChangeEvent.idl
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+/**
+ * Fired when a state of an accessible changes.
+ */
+[scriptable, builtinclass, uuid(0d2d77c5-7b16-4a15-8b20-c484ceb5ac0d)]
+interface nsIAccessibleStateChangeEvent : nsIAccessibleEvent
+{
+  /**
+   * Returns the state of accessible (see constants declared
+   * in nsIAccessibleStates).
+   */
+  readonly attribute unsigned long state;
+
+  /**
+   * Returns true if the state is extra state.
+   */
+  readonly attribute boolean isExtraState;
+
+  /**
+   * Returns true if the state is turned on.
+   */
+  readonly attribute boolean isEnabled;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleTableChangeEvent.idl
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+[scriptable, builtinclass, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
+interface nsIAccessibleTableChangeEvent: nsIAccessibleEvent
+{
+  /**
+   * Return the row or column index.
+   */
+  readonly attribute long rowOrColIndex;
+
+  /**
+   * Return the number of rows or cols
+   */
+  readonly attribute long RowsOrColsCount;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleTextChangeEvent.idl
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+/**
+ * Fired when an accessible's text changes.
+ */
+[scriptable, builtinclass, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
+interface nsIAccessibleTextChangeEvent : nsIAccessibleEvent
+{
+  /**
+   * Returns offset of changed text in accessible.
+   */
+  readonly attribute long start;
+
+  /**
+   * Returns length of changed text.
+   */
+  readonly attribute unsigned long length;
+
+  /**
+   * Returns true if text was inserted, otherwise false.
+   */
+  readonly attribute boolean isInserted;
+
+  /**
+   * The inserted or removed text
+   */
+  readonly attribute DOMString modifiedText;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleVirtualCursorChangeEvent.idl
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIAccessibleEvent.idl"
+
+/*
+ * An interface for virtual cursor changed events.
+ * Passes previous cursor position and text offsets.
+ */
+[scriptable, builtinclass, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
+interface nsIAccessibleVirtualCursorChangeEvent : nsIAccessibleEvent
+{
+  /**
+   * Previous object pointed at by virtual cursor. null if none.
+   */
+  readonly attribute nsIAccessible oldAccessible;
+
+  /**
+   * Previous start offset of pivot. -1 if none.
+   */
+  readonly attribute long oldStartOffset;
+
+  /**
+   * Previous end offset of pivot. -1 if none.
+   */
+  readonly attribute long oldEndOffset;
+
+  /**
+   * Reason for virtual cursor move.
+   */
+  readonly attribute short reason;
+};
--- a/accessible/src/base/AccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -6,25 +6,26 @@
 
 #include "AccEvent.h"
 
 #include "ApplicationAccessibleWrap.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "DocAccessible.h"
 #include "nsIAccessibleText.h"
-#include "nsAccEvent.h"
+#include "xpcAccEvents.h"
 #include "States.h"
 
 #include "nsEventStateManager.h"
 #include "nsIServiceManager.h"
 #ifdef MOZ_XUL
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #endif
 
+using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccEvent constructors
@@ -35,47 +36,24 @@ AccEvent::AccEvent(uint32_t aEventType, 
 {
   if (aIsFromUserInput == eAutoDetect)
     mIsFromUserInput = nsEventStateManager::IsHandlingUserInput();
   else
     mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// AccEvent public methods
-
-already_AddRefed<nsAccEvent>
-AccEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccEvent(this);
-  NS_IF_ADDREF(event);
-  return event;
-}
-
-////////////////////////////////////////////////////////////////////////////////
 // AccEvent cycle collection
 
 NS_IMPL_CYCLE_COLLECTION_1(AccEvent, mAccessible)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
 
 ////////////////////////////////////////////////////////////////////////////////
-// AccStateChangeEvent
-////////////////////////////////////////////////////////////////////////////////
-
-already_AddRefed<nsAccEvent>
-AccStateChangeEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccStateChangeEvent(this);
-  NS_IF_ADDREF(event);
-  return event;
-}
-
-
 ////////////////////////////////////////////////////////////////////////////////
 // AccTextChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 // Note: we pass in eAllowDupes to the base class because we don't support text
 // events coalescence. We fire delayed text change events in DocAccessible 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
@@ -95,24 +73,16 @@ AccTextChangeEvent::
   , mModifiedText(aModifiedText)
 {
   // XXX We should use IsFromUserInput here, but that isn't always correct
   // when the text change isn't related to content insertion or removal.
    mIsFromUserInput = mAccessible->State() &
     (states::FOCUSED | states::EDITABLE);
 }
 
-already_AddRefed<nsAccEvent>
-AccTextChangeEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccTextChangeEvent(this);
-  NS_IF_ADDREF(event);
-  return event;
-}
-
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccReorderEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 uint32_t
 AccReorderEvent::IsShowHideEventTarget(const Accessible* aTarget) const
 {
@@ -137,50 +107,29 @@ AccReorderEvent::IsShowHideEventTarget(c
 AccHideEvent::
   AccHideEvent(Accessible* aTarget, nsINode* aTargetNode) :
   AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
 {
   mNextSibling = mAccessible->NextSibling();
   mPrevSibling = mAccessible->PrevSibling();
 }
 
-already_AddRefed<nsAccEvent>
-AccHideEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccHideEvent(this);
-  NS_ADDREF(event);
-  return event;
-}
-
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccShowEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccShowEvent::
   AccShowEvent(Accessible* aTarget, nsINode* aTargetNode) :
   AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget, aTargetNode)
 {
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// AccCaretMoveEvent
-////////////////////////////////////////////////////////////////////////////////
-
-already_AddRefed<nsAccEvent>
-AccCaretMoveEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccCaretMoveEvent(this);
-  NS_IF_ADDREF(event);
-  return event;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
 // AccSelChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccSelChangeEvent::
   AccSelChangeEvent(Accessible* aWidget, Accessible* aItem,
                     SelChangeType aSelChangeType) :
     AccEvent(0, aItem, eAutoDetect, eCoalesceSelectionChange),
     mWidget(aWidget), mItem(aItem), mSelChangeType(aSelChangeType),
@@ -204,39 +153,84 @@ AccSelChangeEvent::
 AccTableChangeEvent::
   AccTableChangeEvent(Accessible* aAccessible, uint32_t aEventType,
                       int32_t aRowOrColIndex, int32_t aNumRowsOrCols) :
   AccEvent(aEventType, aAccessible),
   mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
 {
 }
 
-already_AddRefed<nsAccEvent>
-AccTableChangeEvent::CreateXPCOMObject()
-{
-  nsAccEvent* event = new nsAccTableChangeEvent(this);
-  NS_IF_ADDREF(event);
-  return event;
-}
-
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccVCChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccVCChangeEvent::
   AccVCChangeEvent(Accessible* aAccessible,
                    nsIAccessible* aOldAccessible,
                    int32_t aOldStart, int32_t aOldEnd,
                    int16_t aReason) :
     AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible),
     mOldAccessible(aOldAccessible), mOldStart(aOldStart), mOldEnd(aOldEnd),
     mReason(aReason)
 {
 }
 
-already_AddRefed<nsAccEvent>
-AccVCChangeEvent::CreateXPCOMObject()
+already_AddRefed<nsIAccessibleEvent>
+a11y::MakeXPCEvent(AccEvent* aEvent)
 {
-  nsAccEvent* event = new nsAccVirtualCursorChangeEvent(this);
-  NS_ADDREF(event);
-  return event;
-}
+  DocAccessible* doc = aEvent->GetDocAccessible();
+  Accessible* acc = aEvent->GetAccessible();
+  nsINode* node = acc->GetNode();
+  nsIDOMNode* domNode = node ? node->AsDOMNode() : nullptr;
+  bool fromUser = aEvent->IsFromUserInput();
+  uint32_t type = aEvent->GetEventType();
+  uint32_t eventGroup = aEvent->GetEventGroups();
+  nsCOMPtr<nsIAccessibleEvent> xpEvent;
+
+  if (eventGroup & (1 << AccEvent::eStateChangeEvent)) {
+    AccStateChangeEvent* sc = downcast_accEvent(aEvent);
+    bool extra = false;
+    uint32_t state = nsAccUtils::To32States(sc->GetState(), &extra);
+    xpEvent = new xpcAccStateChangeEvent(type, acc, doc, domNode, fromUser,
+                                         state, extra, sc->IsStateEnabled());
+    return xpEvent.forget();
+  }
+
+  if (eventGroup & (1 << AccEvent::eTextChangeEvent)) {
+    AccTextChangeEvent* tc = downcast_accEvent(aEvent);
+    nsString text;
+    tc->GetModifiedText(text);
+    xpEvent = new xpcAccTextChangeEvent(type, acc, doc, domNode, fromUser,
+                                        tc->GetStartOffset(), tc->GetLength(),
+                                        tc->IsTextInserted(), text);
+    return xpEvent.forget();
+  }
+
+  if (eventGroup & (1 << AccEvent::eHideEvent)) {
+    AccHideEvent* hideEvent = downcast_accEvent(aEvent);
+    xpEvent = new xpcAccHideEvent(type, acc, doc, domNode, fromUser,
+                                  hideEvent->TargetParent(),
+                                  hideEvent->TargetNextSibling(),
+                                  hideEvent->TargetPrevSibling());
+    return xpEvent.forget();
+  }
+
+  if (eventGroup & (1 << AccEvent::eCaretMoveEvent)) {
+    AccCaretMoveEvent* cm = downcast_accEvent(aEvent);
+    xpEvent = new xpcAccCaretMoveEvent(type, acc, doc, domNode, fromUser,
+                                       cm->GetCaretOffset());
+    return xpEvent.forget();
+  }
+
+  if (eventGroup & (1 << AccEvent::eVirtualCursorChangeEvent)) {
+    AccVCChangeEvent* vcc = downcast_accEvent(aEvent);
+    xpEvent = new xpcAccVirtualCursorChangeEvent(type, acc, doc, domNode, fromUser,
+                                                 vcc->OldAccessible(),
+                                                 vcc->OldStartOffset(),
+                                                 vcc->OldEndOffset(),
+                                                 vcc->Reason());
+    return xpEvent.forget();
+  }
+
+  xpEvent = new xpcAccEvent(type, acc, doc, domNode, fromUser);
+  return xpEvent.forget();
+  }
--- a/accessible/src/base/AccEvent.h
+++ b/accessible/src/base/AccEvent.h
@@ -10,18 +10,16 @@
 
 #include "mozilla/a11y/Accessible.h"
 
 namespace mozilla {
 namespace a11y {
 
 class DocAccessible;
 
-class nsAccEvent;
-
 // 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
@@ -79,21 +77,16 @@ public:
   uint32_t GetEventType() const { return mEventType; }
   EEventRule GetEventRule() const { return mEventRule; }
   bool IsFromUserInput() const { return mIsFromUserInput; }
 
   Accessible* GetAccessible() const { return mAccessible; }
   DocAccessible* GetDocAccessible() const { return mAccessible->Document(); }
 
   /**
-   * Create and return an XPCOM object for accessible event object.
-   */
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
-  /**
    * Down casting.
    */
   enum EventGroup {
     eGenericEvent,
     eStateChangeEvent,
     eTextChangeEvent,
     eMutationEvent,
     eReorderEvent,
@@ -142,18 +135,16 @@ public:
              mState(aState), mIsEnabled(aIsEnabled) { }
 
   AccStateChangeEvent(Accessible* aAccessible, uint64_t aState) :
     AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
              eAutoDetect, eCoalesceStateChange), mState(aState)
     { mIsEnabled = (mAccessible->State() & mState) != 0; }
 
   // AccEvent
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eStateChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccEvent::GetEventGroups() | (1U << eStateChangeEvent);
   }
 
   // AccStateChangeEvent
   uint64_t GetState() const { return mState; }
@@ -173,18 +164,16 @@ private:
 class AccTextChangeEvent: public AccEvent
 {
 public:
   AccTextChangeEvent(Accessible* aAccessible, int32_t aStart,
                      const nsAString& aModifiedText, bool aIsInserted,
                      EIsFromUserInput aIsFromUserInput = eAutoDetect);
 
   // AccEvent
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eTextChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccEvent::GetEventGroups() | (1U << eTextChangeEvent);
   }
 
   // AccTextChangeEvent
   int32_t GetStartOffset() const { return mStart; }
@@ -243,18 +232,16 @@ protected:
  * Accessible hide event.
  */
 class AccHideEvent: public AccMutationEvent
 {
 public:
   AccHideEvent(Accessible* aTarget, nsINode* aTargetNode);
 
   // Event
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eHideEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccMutationEvent::GetEventGroups() | (1U << eHideEvent);
   }
 
   // AccHideEvent
   Accessible* TargetParent() const { return mParent; }
@@ -344,18 +331,16 @@ class AccCaretMoveEvent: public AccEvent
 {
 public:
   AccCaretMoveEvent(Accessible* aAccessible) :
     AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
     mCaretOffset(-1) { }
   virtual ~AccCaretMoveEvent() { }
 
   // AccEvent
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eCaretMoveEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
   }
 
   // AccCaretMoveEvent
   int32_t GetCaretOffset() const { return mCaretOffset; }
@@ -409,18 +394,16 @@ private:
  */
 class AccTableChangeEvent : public AccEvent
 {
 public:
   AccTableChangeEvent(Accessible* aAccessible, uint32_t aEventType,
                       int32_t aRowOrColIndex, int32_t aNumRowsOrCols);
 
   // AccEvent
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eTableChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccEvent::GetEventGroups() | (1U << eTableChangeEvent);
   }
 
   // AccTableChangeEvent
   uint32_t GetIndex() const { return mRowOrColIndex; }
@@ -440,18 +423,16 @@ public:
   AccVCChangeEvent(Accessible* aAccessible,
                    nsIAccessible* aOldAccessible,
                    int32_t aOldStart, int32_t aOldEnd,
                    int16_t aReason);
 
   virtual ~AccVCChangeEvent() { }
 
   // AccEvent
-  virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
-
   static const EventGroup kEventGroup = eVirtualCursorChangeEvent;
   virtual unsigned int GetEventGroups() const
   {
     return AccEvent::GetEventGroups() | (1U << eVirtualCursorChangeEvent);
   }
 
   // AccTableChangeEvent
   nsIAccessible* OldAccessible() const { return mOldAccessible; }
@@ -482,13 +463,19 @@ public:
     return mRawPtr->GetEventGroups() & (1U << Destination::kEventGroup) ?
       static_cast<Destination*>(mRawPtr) : nullptr;
   }
 
 private:
   AccEvent* mRawPtr;
 };
 
+/**
+ * Return a new xpcom accessible event for the given internal one.
+ */
+already_AddRefed<nsIAccessibleEvent>
+MakeXPCEvent(AccEvent* aEvent);
+
 } // namespace a11y
 } // namespace mozilla
 
 #endif
 
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -263,16 +263,23 @@ public:
   static inline void To32States(uint64_t aState64,
                                 uint32_t* aState1, uint32_t* aState2)
   {
     *aState1 = aState64 & 0x7fffffff;
     if (aState2)
       *aState2 = static_cast<uint32_t>(aState64 >> 31);
   }
 
+  static uint32_t To32States(uint64_t aState, bool* aIsExtra)
+  {
+    uint32_t extraState = aState >> 31;
+    *aIsExtra = !!extraState;
+    return aState | extraState;
+  }
+
   /**
    * Return true if the given accessible can't have children. Used when exposing
    * to platform accessibility APIs, should the children be pruned off?
    */
   static bool MustPrune(Accessible* aAccessible);
 };
 
 } // namespace a11y
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -6,17 +6,16 @@
 #include "Accessible-inl.h"
 
 #include "nsIXBLAccessible.h"
 
 #include "AccCollector.h"
 #include "AccGroupInfo.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
-#include "nsAccEvent.h"
 #include "nsAccessibleRelation.h"
 #include "nsAccessibilityService.h"
 #include "nsIAccessibleRelation.h"
 #include "nsEventShell.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "RootAccessible.h"
@@ -1156,31 +1155,30 @@ Accessible::GetXULName(nsString& aName)
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
 
 nsresult
 Accessible::HandleAccEvent(AccEvent* aEvent)
 {
   NS_ENSURE_ARG_POINTER(aEvent);
 
-  nsCOMPtr<nsIObserverService> obsService =
-    mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
   NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsISimpleEnumerator> observers;
   obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC,
                                  getter_AddRefs(observers));
 
   NS_ENSURE_STATE(observers);
 
   bool hasObservers = false;
   observers->HasMoreElements(&hasObservers);
   if (hasObservers) {
-    nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
-    return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
+    nsCOMPtr<nsIAccessibleEvent> event = MakeXPCEvent(aEvent);
+    return obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Accessible::GetRole(uint32_t *aRole)
 {
--- a/accessible/src/jsat/EventManager.jsm
+++ b/accessible/src/jsat/EventManager.jsm
@@ -120,21 +120,21 @@ this.EventManager = {
           Presentation.pivotChanged(position, event.oldAccessible, reason));
 
         break;
       }
       case Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE:
       {
         let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
         if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
-            !(event.isExtraState())) {
+            !(event.isExtraState)) {
           this.present(
             Presentation.
               actionInvoked(aEvent.accessible,
-                            event.isEnabled() ? 'check' : 'uncheck'));
+                            event.isEnabled ? 'check' : 'uncheck'));
         }
         break;
       }
       case Ci.nsIAccessibleEvent.EVENT_SCROLLING_START:
       {
         let vc = Utils.getVirtualCursor(aEvent.accessibleDocument);
         vc.moveNext(TraversalRules.Simple, aEvent.accessible, true);
         break;
--- a/accessible/src/jsat/Utils.jsm
+++ b/accessible/src/jsat/Utils.jsm
@@ -214,17 +214,17 @@ this.Logger = {
 
     return str;
   },
 
   eventToString: function eventToString(aEvent) {
     let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
     if (aEvent.eventType == Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE) {
       let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
-      let stateStrings = (event.isExtraState()) ?
+      let stateStrings = event.isExtraState ?
         Utils.AccRetrieval.getStringStates(0, event.state) :
         Utils.AccRetrieval.getStringStates(event.state, 0);
       str += ' (' + stateStrings.item(0) + ')';
     }
 
     return str;
   },
 
new file mode 100755
--- /dev/null
+++ b/accessible/src/xpcom/AccEventGen.py
@@ -0,0 +1,240 @@
+#!/usr/bin/env python
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import sys, os, xpidl, makeutils
+
+def findIDL(includePath, interfaceFileName):
+    for d in includePath:
+        # Not os.path.join: we need a forward slash even on Windows because
+        # this filename ends up in makedepend output.
+        path = d + '/' + interfaceFileName
+        if os.path.exists(path):
+            return path
+    raise BaseException("No IDL file found for interface %s "
+                        "in include path %r"
+                        % (interfaceFileName, includePath))
+
+def loadEventIDL(parser, includePath, eventname):
+    eventidl = ("nsIAccessible%s.idl" % eventname)
+    idlFile = findIDL(includePath, eventidl)
+    if not idlFile in makeutils.dependencies:
+        makeutils.dependencies.append(idlFile)
+    idl = p.parse(open(idlFile).read(), idlFile)
+    idl.resolve(includePath, p)
+    return idl
+
+class Configuration:
+    def __init__(self, filename):
+        config = {}
+        execfile(filename, config)
+        self.simple_events = config.get('simple_events', [])
+
+def readConfigFile(filename):
+    return Configuration(filename)
+
+def firstCap(str):
+    return str[0].upper() + str[1:]
+
+def writeAttributeParams(a):
+    return ("%s a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
+
+def print_header_file(fd, conf):
+    fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n")
+    fd.write("#ifndef _mozilla_a11y_generated_AccEvents_h_\n"
+             "#define _mozilla_a11y_generated_AccEvents_h_\n\n")
+    fd.write("#include \"nscore.h\"\n")
+    fd.write("#include \"nsCOMPtr.h\"\n")
+    fd.write("#include \"nsCycleCollectionParticipant.h\"\n")
+    fd.write("#include \"nsString.h\"\n")
+    for e in conf.simple_events:
+        fd.write("#include \"nsIAccessible%s.h\"\n" % e)
+    for e in conf.simple_events:
+        idl = loadEventIDL(p, options.incdirs, e)
+        for iface in filter(lambda p: p.kind == "interface", idl.productions):
+            classname = ("xpcAcc%s" % e)
+            baseinterfaces = interfaces(iface)
+
+            fd.write("\nclass %s MOZ_FINAL : public %s\n" % (classname, iface.name))
+            fd.write("{\n")
+            fd.write("public:\n")
+
+            attributes = allAttributes(iface)
+            args = map(writeAttributeParams, attributes)
+            fd.write("  %s(%s) :\n" % (classname, ", ".join(args)))
+
+            initializers = []
+            for a in attributes:
+                initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name)))
+            fd.write("  %s\n  {}\n" % ", ".join(initializers))
+            fd.write("  ~%s() {}\n\n" % classname)
+            fd.write("  NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n")
+            fd.write("  NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname))
+
+            for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces):
+                fd.write("  NS_DECL_%s\n" % iface.name.upper())
+
+            fd.write("private:\n")
+            for a in attributes:
+                fd.write("  %s\n" % attributeVariableTypeAndName(a))
+            fd.write("};\n\n")
+
+    fd.write("#endif\n")
+
+def interfaceAttributeTypes(idl):
+    ifaces = filter(lambda p: p.kind == "interface", idl.productions)
+    attributes = []
+    for i in ifaces:
+        ifaceAttributes = allAttributes(i)
+        attributes.extend(ifaceAttributes)
+    ifaceAttrs = filter(lambda a: a.realtype.nativeType("in").endswith("*"), attributes)
+    return map(lambda a: a.realtype.nativeType("in").strip(" *"), ifaceAttrs)
+
+def print_cpp(idl, fd, conf, eventname):
+    for p in idl.productions:
+        if p.kind == 'interface':
+            write_cpp(eventname, p, fd)
+
+def print_cpp_file(fd, conf):
+    fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n")
+    fd.write('#include "xpcAccEvents.h"\n')
+
+    includes = []
+    for e in conf.simple_events:
+        if not e in includes:
+            includes.append(("nsIAccessible%s" % e))
+
+    types = []
+    for e in conf.simple_events:
+        idl = loadEventIDL(p, options.incdirs, e)
+        types.extend(interfaceAttributeTypes(idl))
+
+    for c in types:
+        fd.write("#include \"%s.h\"\n" % c)
+
+    fd.write("\n")
+    for e in conf.simple_events:
+        print_cpp(loadEventIDL(p, options.incdirs, e), fd, conf, e)
+
+def attributeVariableTypeAndName(a):
+    if a.realtype.nativeType('in').endswith('*'):
+        l = ["nsCOMPtr<%s> m%s;" % (a.realtype.nativeType('in').strip('* '),
+                   firstCap(a.name))]
+    elif a.realtype.nativeType('in').count("nsAString"):
+        l = ["nsString m%s;" % firstCap(a.name)]
+    elif a.realtype.nativeType('in').count("nsACString"):
+        l = ["nsCString m%s;" % firstCap(a.name)]
+    else:
+        l = ["%sm%s;" % (a.realtype.nativeType('in'),
+                       firstCap(a.name))]
+    return ", ".join(l)
+
+def writeAttributeGetter(fd, classname, a):
+    fd.write("NS_IMETHODIMP\n")
+    fd.write("%s::Get%s(" % (classname, firstCap(a.name)))
+    if a.realtype.nativeType('in').endswith('*'):
+        fd.write("%s** a%s" % (a.realtype.nativeType('in').strip('* '), firstCap(a.name)))
+    elif a.realtype.nativeType('in').count("nsAString"):
+        fd.write("nsAString& a%s" % firstCap(a.name))
+    elif a.realtype.nativeType('in').count("nsACString"):
+        fd.write("nsACString& a%s" % firstCap(a.name))
+    else:
+        fd.write("%s*a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
+    fd.write(")\n");
+    fd.write("{\n");
+    if a.realtype.nativeType('in').endswith('*'):
+        fd.write("  NS_IF_ADDREF(*a%s = m%s);\n" % (firstCap(a.name), firstCap(a.name)))
+    elif a.realtype.nativeType('in').count("nsAString"):
+        fd.write("  a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
+    elif a.realtype.nativeType('in').count("nsACString"):
+        fd.write("  a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
+    else:
+        fd.write("  *a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
+    fd.write("  return NS_OK;\n");
+    fd.write("}\n\n");
+
+def interfaces(iface):
+    interfaces = []
+    while iface.base:
+        interfaces.append(iface)
+        iface = iface.idl.getName(iface.base, iface.location)
+    interfaces.append(iface)
+    interfaces.reverse()
+    return interfaces
+
+def allAttributes(iface):
+    attributes = []
+    for i in interfaces(iface):
+        attrs = filter(lambda m: isinstance(m, xpidl.Attribute), i.members)
+        attributes.extend(attrs)
+
+    return attributes
+
+def write_cpp(eventname, iface, fd):
+    classname = "xpcAcc%s" % eventname
+    attributes = allAttributes(iface)
+    ccattributes = filter(lambda m: m.realtype.nativeType('in').endswith('*'), attributes)
+    fd.write("NS_IMPL_CYCLE_COLLECTION_%u(%s" % (len(ccattributes), classname))
+    for c in ccattributes:
+        fd.write(", m%s" % firstCap(c.name))
+    fd.write(")\n\n");
+
+    fd.write("NS_IMPL_CYCLE_COLLECTING_ADDREF(%s)\n" % classname)
+    fd.write("NS_IMPL_CYCLE_COLLECTING_RELEASE(%s)\n\n" % classname)
+
+    fd.write("NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(%s)\n" % classname)
+    for baseiface in interfaces(iface):
+        fd.write("  NS_INTERFACE_MAP_ENTRY(%s)\n" % baseiface.name)
+    fd.write("NS_INTERFACE_MAP_END\n\n")
+
+    for a in attributes:
+        writeAttributeGetter(fd, classname, a)
+
+
+def main():
+    from optparse import OptionParser
+    o = OptionParser(usage="usage: %prog [options] configfile")
+    o.add_option('-I', action='append', dest='incdirs', default=['.'],
+                 help="Directory to search for imported files")
+    o.add_option('-o', "--stub-output",
+                 type='string', dest='stub_output', default=None,
+                 help="C++ source output file", metavar="FILE")
+    o.add_option('--header-output', type='string', default=None,
+                 help="Quick stub header output file", metavar="FILE")
+    o.add_option('--makedepend-output', type='string', default=None,
+                 help="gnumake dependencies output file", metavar="FILE")
+    o.add_option('--cachedir', dest='cachedir', default=None,
+                 help="Directory in which to cache lex/parse tables.")
+    global options
+    (options, filenames) = o.parse_args()
+    if len(filenames) != 1:
+        o.error("Exactly one config filename is needed.")
+    filename = filenames[0]
+
+    if options.cachedir is not None:
+        if not os.path.isdir(options.cachedir):
+            os.mkdir(options.cachedir)
+        sys.path.append(options.cachedir)
+
+    # Instantiate the parser.
+    global p
+    p = xpidl.IDLParser(outputdir=options.cachedir)
+
+    conf = readConfigFile(filename)
+
+    if options.stub_output is not None:
+        makeutils.targets.append(options.stub_output)
+        outfd = open(options.stub_output, 'w')
+        print_cpp_file(outfd, conf)
+        outfd.close()
+        if options.makedepend_output is not None:
+            makeutils.writeMakeDependOutput(options.makedepend_output)
+    if options.header_output is not None:
+        outfd = open(options.header_output, 'w')
+        print_header_file(outfd, conf)
+        outfd.close()
+
+if __name__ == '__main__':
+    main()
new file mode 100644
--- /dev/null
+++ b/accessible/src/xpcom/AccEvents.conf
@@ -0,0 +1,17 @@
+""" -*- Mode: Python -*-
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ The name of the event which real interface should have nsIAccessible-prefix,
+ and should be in nsIAccessible<name>.idl file"""
+
+simple_events = [
+    'Event',
+    'StateChangeEvent',
+    'TextChangeEvent',
+    'HideEvent',
+    'CaretMoveEvent',
+    'TableChangeEvent',
+    'VirtualCursorChangeEvent'
+  ]
--- a/accessible/src/xpcom/Makefile.in
+++ b/accessible/src/xpcom/Makefile.in
@@ -9,26 +9,30 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_xpcom_s
 LIBXUL_LIBRARY = 1
 
+EXPORTS := xpcAccEvents.h
+
 CPPSRCS = \
-  nsAccEvent.cpp \
+  xpcAccEvents.cpp \
   nsAccessibleRelation.cpp \
   xpcAccessibleTable.cpp \
   xpcAccessibleTableCell.cpp \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
+EXTRA_MDDEPEND_FILES = xpcAccEvents.pp
+
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
   -I$(srcdir)/../base \
   -I$(srcdir)/../generic \
   $(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
@@ -51,8 +55,39 @@ LOCAL_INCLUDES += \
   $(NULL)
 endif
 endif
 endif
 
 ifneq ($(A11Y_LOG),0)
   DEFINES += -DA11Y_LOG
 endif
+
+xpcAccEvents.h: $(srcdir)/AccEvents.conf \
+                   $(srcdir)/AccEventGen.py \
+                   $(LIBXUL_DIST)/sdk/bin/header.py \
+                   $(LIBXUL_DIST)/sdk/bin/xpidl.py \
+                   $(DEPTH)/js/src/js-confdefs.h
+	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
+	  -I$(LIBXUL_DIST)/sdk/bin \
+	  $(srcdir)/AccEventGen.py \
+	  -I $(DEPTH)/dist/idl \
+	  --header-output xpcAccEvents.h \
+	  $(srcdir)/AccEvents.conf
+
+xpcAccEvents.cpp: $(srcdir)/AccEvents.conf \
+                     $(srcdir)/AccEventGen.py \
+                     $(LIBXUL_DIST)/sdk/bin/header.py \
+                     $(LIBXUL_DIST)/sdk/bin/xpidl.py \
+                     $(DEPTH)/js/src/js-confdefs.h
+	$(PYTHON) $(topsrcdir)/config/pythonpath.py \
+	  -I$(LIBXUL_DIST)/sdk/bin \
+	  $(srcdir)/AccEventGen.py \
+	  -I $(DEPTH)/dist/idl \
+	  --header-output xpcAccEvents.h \
+	  --stub-output xpcAccEvents.cpp \
+	  --makedepend-output $(MDDEPDIR)/xpcAccEvents.pp \
+	  $(srcdir)/AccEvents.conf
+
+GARBAGE += \
+  xpcAccEvents.cpp \
+  xpcAccEvents.h \
+  $(null)
deleted file mode 100644
--- a/accessible/src/xpcom/nsAccEvent.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsAccEvent.h"
-#include "nsAccUtils.h"
-#include "DocAccessible.h"
-
-using namespace mozilla::a11y;
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccEvent
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
-
-NS_IMETHODIMP
-nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
-{
-  *aIsFromUserInput = mEvent->IsFromUserInput();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetEventType(uint32_t* aEventType)
-{
-  *aEventType = mEvent->GetEventType();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nullptr;
-
-  NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
-{
-  NS_ENSURE_ARG_POINTER(aDOMNode);
-  *aDOMNode = nullptr;
-
-  nsINode* node = mEvent->GetAccessible()->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(uint32_t* aState)
-{
-  NS_ENSURE_ARG_POINTER(aState);
-
-  uint32_t state1 = 0, state2 = 0;
-  uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
-  nsAccUtils::To32States(state, &state1, &state2);
-
-  *aState = state1 | state2; // only one state is not 0
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccStateChangeEvent::IsExtraState(bool* aIsExtraState)
-{
-  NS_ENSURE_ARG_POINTER(aIsExtraState);
-
-  uint32_t state1 = 0, state2 = 0;
-  uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
-  nsAccUtils::To32States(state, &state1, &state2);
-
-  *aIsExtraState = (state2 != 0);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccStateChangeEvent::IsEnabled(bool* 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(int32_t* aStart)
-{
-  NS_ENSURE_ARG_POINTER(aStart);
-  *aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTextChangeEvent::GetLength(uint32_t* aLength)
-{
-  NS_ENSURE_ARG_POINTER(aLength);
-  *aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTextChangeEvent::IsInserted(bool* 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;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccHideEvent
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
-                             nsIAccessibleHideEvent)
-
-NS_IMETHODIMP
-nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aAccessible);
-
-  NS_IF_ADDREF(*aAccessible =
-    static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aAccessible);
-
-  NS_IF_ADDREF(*aAccessible =
-    static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aAccessible);
-
-  NS_IF_ADDREF(*aAccessible =
-    static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
-  return NS_OK;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccCaretMoveEvent
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
-                             nsIAccessibleCaretMoveEvent)
-
-NS_IMETHODIMP
-nsAccCaretMoveEvent::GetCaretOffset(int32_t *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(int32_t *aRowOrColIndex)
-{
-  NS_ENSURE_ARG_POINTER(aRowOrColIndex);
-
-  *aRowOrColIndex =
-    static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccTableChangeEvent::GetNumRowsOrCols(int32_t* aNumRowsOrCols)
-{
-  NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
-
-  *aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// nsAccVirtualCursorChangeEvent
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS_INHERITED1(nsAccVirtualCursorChangeEvent, nsAccEvent,
-                             nsIAccessibleVirtualCursorChangeEvent)
-
-NS_IMETHODIMP
-nsAccVirtualCursorChangeEvent::GetOldAccessible(nsIAccessible** aOldAccessible)
-{
-  NS_ENSURE_ARG_POINTER(aOldAccessible);
-
-  *aOldAccessible =
-    static_cast<AccVCChangeEvent*>(mEvent.get())->OldAccessible();
-  NS_IF_ADDREF(*aOldAccessible);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccVirtualCursorChangeEvent::GetOldStartOffset(int32_t* aOldStartOffset)
-{
-  NS_ENSURE_ARG_POINTER(aOldStartOffset);
-
-  *aOldStartOffset =
-    static_cast<AccVCChangeEvent*>(mEvent.get())->OldStartOffset();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccVirtualCursorChangeEvent::GetOldEndOffset(int32_t* aOldEndOffset)
-{
-  NS_ENSURE_ARG_POINTER(aOldEndOffset);
-
-  *aOldEndOffset =
-    static_cast<AccVCChangeEvent*>(mEvent.get())->OldEndOffset();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAccVirtualCursorChangeEvent::GetReason(int16_t* aReason)
-{
-  NS_ENSURE_ARG_POINTER(aReason);
-
-  *aReason = static_cast<AccVCChangeEvent*>(mEvent.get())->Reason();
-  return NS_OK;
-}
deleted file mode 100644
--- a/accessible/src/xpcom/nsAccEvent.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _nsAccEvent_H_
-#define _nsAccEvent_H_
-
-#include "nsIAccessibleEvent.h"
-
-#include "AccEvent.h"
-
-namespace mozilla {
-namespace a11y {
-
-/**
- * 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 hide event.
- */
-class nsAccHideEvent : public nsAccEvent,
-                       public nsIAccessibleHideEvent
-{
-public:
-  nsAccHideEvent(AccHideEvent* aEvent) : nsAccEvent(aEvent) { }
-  virtual ~nsAccHideEvent() { }
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLEHIDEEVENT
-
-private:
-  nsAccHideEvent() MOZ_DELETE;
-  nsAccHideEvent(const nsAccHideEvent&) MOZ_DELETE;
-  nsAccHideEvent& operator =(const nsAccHideEvent&) MOZ_DELETE;
-};
-
-
-/**
- * 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&);
-};
-
-/**
- * Accessible virtual cursor change event.
- */
-class nsAccVirtualCursorChangeEvent : public nsAccEvent,
-                                      public nsIAccessibleVirtualCursorChangeEvent
-{
-public:
-  nsAccVirtualCursorChangeEvent(AccVCChangeEvent* aEvent) :
-    nsAccEvent(aEvent) { }
-  virtual ~nsAccVirtualCursorChangeEvent() { }
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIACCESSIBLEVIRTUALCURSORCHANGEEVENT
-
-private:
-  nsAccVirtualCursorChangeEvent() MOZ_DELETE;
-  nsAccVirtualCursorChangeEvent(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
-  nsAccVirtualCursorChangeEvent& operator =(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
-};
-
-} // namespace a11y
-} // namespace mozilla
-
-#endif
-
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -1560,17 +1560,17 @@ function textChangeChecker(aID, aStart, 
       this.textOrFunc() : this.textOrFunc;
     var modifiedTextLen =
       (this.endOffset == -1) ? modifiedText.length : aEnd - aStart;
 
     is(aEvent.start, this.startOffset,
        "Wrong start offset for " + prettyName(aID));
     is(aEvent.length, modifiedTextLen, "Wrong length for " + prettyName(aID));
     var changeInfo = (aIsInserted ? "inserted" : "removed");
-    is(aEvent.isInserted(), aIsInserted,
+    is(aEvent.isInserted, aIsInserted,
        "Text was " + changeInfo + " for " + prettyName(aID));
     is(aEvent.modifiedText, modifiedText,
        "Wrong " + changeInfo + " text for " + prettyName(aID));
     if (typeof aFromUser != "undefined")
       is(aEvent.isFromUserInput, aFromUser,
          "wrong value of isFromUserInput() for " + prettyName(aID));
   }
 }
@@ -1608,21 +1608,21 @@ function stateChangeChecker(aState, aIsE
       var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
     } catch (e) {
       ok(false, "State change event was expected");
     }
 
     if (!event)
       return;
 
-    is(event.isExtraState(), aIsExtraState,
+    is(event.isExtraState, aIsExtraState,
        "Wrong extra state bit of the statechange event.");
     isState(event.state, aState, aIsExtraState,
             "Wrong state of the statechange event.");
-    is(event.isEnabled(), aIsEnabled,
+    is(event.isEnabled, aIsEnabled,
       "Wrong state of statechange event state");
 
     if (aSkipCurrentStateCheck) {
       todo(false, "State checking was skipped!");
       return;
     }
 
     var state = aIsEnabled ? (aIsExtraState ? 0 : aState) : 0;
@@ -1665,19 +1665,19 @@ function expandedStateChecker(aIsEnabled
     } catch (e) {
       ok(false, "State change event was expected");
     }
 
     if (!event)
       return;
 
     is(event.state, STATE_EXPANDED, "Wrong state of the statechange event.");
-    is(event.isExtraState(), false,
+    is(event.isExtraState, false,
        "Wrong extra state bit of the statechange event.");
-    is(event.isEnabled(), aIsEnabled,
+    is(event.isEnabled, aIsEnabled,
       "Wrong state of statechange event state");
 
     testStates(event.accessible,
                (aIsEnabled ? STATE_EXPANDED : STATE_COLLAPSED));
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1725,17 +1725,17 @@ var gA11yEventObserver =
       }
 
       if (!dumpElm || parent != dumpElm) {
         var type = eventTypeToString(event.eventType);
         var info = "Event type: " + type;
 
         if (event instanceof nsIAccessibleTextChangeEvent) {
           info += ", start: " + event.start + ", length: " + event.length +
-            ", " + (event.isInserted() ? "inserted" : "removed") +
+            ", " + (event.isInserted ? "inserted" : "removed") +
             " text: " + event.modifiedText;
         }
 
         info += ". Target: " + prettyName(event.accessible);
 
         if (listenersArray)
           info += ". Listeners count: " + listenersArray.length;
 
--- a/accessible/tests/mochitest/events/test_docload.xul
+++ b/accessible/tests/mochitest/events/test_docload.xul
@@ -39,17 +39,17 @@
         } catch (e) {
           ok(false, "State change event was expected");
         }
 
         if (!event)
           return;
 
         is(event.state, STATE_BUSY, "Wrong state of statechange event.");
-        is(event.isEnabled(), aIsEnabled,
+        is(event.isEnabled, aIsEnabled,
            "Wrong value of state of statechange event");
 
         testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
                    (aIsEnabled ? 0 : STATE_BUSY), 0);
       }
     }
 
     function documentReloadChecker(aIsFromUserInput)
--- a/accessible/tests/mochitest/events/test_statechange.html
+++ b/accessible/tests/mochitest/events/test_statechange.html
@@ -39,19 +39,19 @@
         try {
           var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
         } catch (e) {
           ok(false, "State change event was expected");
         }
 
         if (!event) { return; }
 
-        ok(event.isExtraState(), "Extra state change was expected");
+        ok(event.isExtraState, "Extra state change was expected");
         is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
-        ok(event.isEnabled(), "Expected editable state to be enabled");
+        ok(event.isEnabled, "Expected editable state to be enabled");
       }
 
       this.getID = function editabledoc_getID() {
         return prettyName(aDocNode) + " editable state changed";
       };
     }
 
     function invalidInput(aNodeOrID)