Bug 675405 part 3. Expand the event list to contain more information than just the name and move all the information from the tables in nsContentUtils to it. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Sun, 07 Aug 2011 22:30:17 -0400
changeset 73971 840e9e5c5059b55d70e034d8024f0e493cc705f8
parent 73970 28a12583603ba6b8d6dc65662b98c19f7201095c
child 73972 5f5c92568eb8bba09ad0a4bca20ee1ab7d806995
push id1039
push userbzbarsky@mozilla.com
push dateMon, 08 Aug 2011 02:36:57 +0000
treeherdermozilla-inbound@840e9e5c5059 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs675405
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 675405 part 3. Expand the event list to contain more information than just the name and move all the information from the tables in nsContentUtils to it. r=smaug
content/base/src/nsContentUtils.cpp
content/events/public/nsEventNameList.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
widget/public/nsGUIEvent.h
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -487,182 +487,24 @@ nsContentUtils::InitImgLoader()
 }
 
 PRBool
 nsContentUtils::InitializeEventTable() {
   NS_ASSERTION(!sAtomEventTable, "EventTable already initialized!");
   NS_ASSERTION(!sStringEventTable, "EventTable already initialized!");
 
   static const EventNameMapping eventArray[] = {
-    { nsGkAtoms::onmousedown,                   NS_MOUSE_BUTTON_DOWN, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::onmouseup,                     NS_MOUSE_BUTTON_UP, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::onclick,                       NS_MOUSE_CLICK, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::ondblclick,                    NS_MOUSE_DOUBLECLICK, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
-    { nsGkAtoms::onmouseover,                   NS_MOUSE_ENTER_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::onmouseout,                    NS_MOUSE_EXIT_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::onMozMouseHittest,             NS_MOUSE_MOZHITTEST, EventNameType_None, NS_MOUSE_EVENT },
-    { nsGkAtoms::onmousemove,                   NS_MOUSE_MOVE, EventNameType_All, NS_MOUSE_EVENT },
-    { nsGkAtoms::oncontextmenu,                 NS_CONTEXTMENU, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
-
-    { nsGkAtoms::onkeydown,                     NS_KEY_DOWN, EventNameType_HTMLXUL, NS_KEY_EVENT },
-    { nsGkAtoms::onkeyup,                       NS_KEY_UP, EventNameType_HTMLXUL, NS_KEY_EVENT },
-    { nsGkAtoms::onkeypress,                    NS_KEY_PRESS, EventNameType_HTMLXUL, NS_KEY_EVENT },
-                                                
-    { nsGkAtoms::onfocus,                       NS_FOCUS_CONTENT, EventNameType_HTMLXUL, NS_FOCUS_EVENT },
-    { nsGkAtoms::onblur,                        NS_BLUR_CONTENT, EventNameType_HTMLXUL, NS_FOCUS_EVENT },
-
-    { nsGkAtoms::onoffline,                     NS_OFFLINE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::ononline,                      NS_ONLINE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onsubmit,                      NS_FORM_SUBMIT, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onreset,                       NS_FORM_RESET, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onchange,                      NS_FORM_CHANGE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onselect,                      NS_FORM_SELECTED, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::oninvalid,                     NS_FORM_INVALID, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onload,                        NS_LOAD, EventNameType_All, NS_EVENT },
-    { nsGkAtoms::onpopstate,                    NS_POPSTATE, EventNameType_HTMLXUL, NS_EVENT_NULL },
-    { nsGkAtoms::onunload,                      NS_PAGE_UNLOAD,
-                                                (EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
-    { nsGkAtoms::onhashchange,                  NS_HASHCHANGE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onreadystatechange,            NS_READYSTATECHANGE, EventNameType_HTMLXUL },
-    { nsGkAtoms::onbeforeunload,                NS_BEFORE_PAGE_UNLOAD, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onabort,                       NS_IMAGE_ABORT,
-                                                (EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
-    { nsGkAtoms::onerror,                       NS_LOAD_ERROR,
-                                                (EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
-    { nsGkAtoms::onbeforescriptexecute,         NS_BEFORE_SCRIPT_EXECUTE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onafterscriptexecute,          NS_AFTER_SCRIPT_EXECUTE, EventNameType_HTMLXUL, NS_EVENT },
-
-    { nsGkAtoms::onDOMAttrModified,             NS_MUTATION_ATTRMODIFIED, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMCharacterDataModified,    NS_MUTATION_CHARACTERDATAMODIFIED, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMNodeInserted,             NS_MUTATION_NODEINSERTED, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMNodeRemoved,              NS_MUTATION_NODEREMOVED, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMNodeInsertedIntoDocument, NS_MUTATION_NODEINSERTEDINTODOCUMENT, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMNodeRemovedFromDocument,  NS_MUTATION_NODEREMOVEDFROMDOCUMENT, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-    { nsGkAtoms::onDOMSubtreeModified,          NS_MUTATION_SUBTREEMODIFIED, EventNameType_HTMLXUL, NS_MUTATION_EVENT },
-
-    { nsGkAtoms::onDOMActivate,                 NS_UI_ACTIVATE, EventNameType_HTMLXUL, NS_UI_EVENT },
-    { nsGkAtoms::onDOMFocusIn,                  NS_UI_FOCUSIN, EventNameType_HTMLXUL, NS_UI_EVENT },
-    { nsGkAtoms::onDOMFocusOut,                 NS_UI_FOCUSOUT, EventNameType_HTMLXUL, NS_UI_EVENT },
-    { nsGkAtoms::oninput,                       NS_FORM_INPUT, EventNameType_HTMLXUL, NS_UI_EVENT },
-                                                
-    { nsGkAtoms::onDOMMouseScroll,              NS_MOUSE_SCROLL, EventNameType_HTMLXUL, NS_MOUSE_SCROLL_EVENT },
-    { nsGkAtoms::onMozMousePixelScroll,         NS_MOUSE_PIXEL_SCROLL, EventNameType_HTMLXUL, NS_MOUSE_SCROLL_EVENT },
-                                                
-    { nsGkAtoms::onpageshow,                    NS_PAGE_SHOW, EventNameType_HTML, NS_EVENT },
-    { nsGkAtoms::onpagehide,                    NS_PAGE_HIDE, EventNameType_HTML, NS_EVENT },
-    { nsGkAtoms::onMozBeforeResize,             NS_BEFORERESIZE_EVENT, EventNameType_None, NS_EVENT },
-    { nsGkAtoms::onresize,                      NS_RESIZE_EVENT,
-                                                (EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
-    { nsGkAtoms::onscroll,                      NS_SCROLL_EVENT,
-                                                (EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT_NULL },
-    { nsGkAtoms::oncopy,                        NS_COPY, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::oncut,                         NS_CUT, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onpaste,                       NS_PASTE, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onopen,                        NS_OPEN, EventNameType_None, NS_EVENT },
-    { nsGkAtoms::onmessage,                     NS_MESSAGE, EventNameType_None, NS_EVENT },
-    // XUL specific events
-    { nsGkAtoms::ontext,                        NS_TEXT_TEXT, EventNameType_XUL, NS_EVENT_NULL },
-
-    { nsGkAtoms::oncompositionstart,            NS_COMPOSITION_START, EventNameType_XUL, NS_COMPOSITION_EVENT },
-    { nsGkAtoms::oncompositionend,              NS_COMPOSITION_END, EventNameType_XUL, NS_COMPOSITION_EVENT },
-
-    { nsGkAtoms::oncommand,                     NS_XUL_COMMAND, EventNameType_XUL, NS_INPUT_EVENT },
-
-    { nsGkAtoms::onclose,                       NS_XUL_CLOSE, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onpopupshowing,                NS_XUL_POPUP_SHOWING, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onpopupshown,                  NS_XUL_POPUP_SHOWN, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onpopuphiding,                 NS_XUL_POPUP_HIDING, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onpopuphidden,                 NS_XUL_POPUP_HIDDEN, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onbroadcast,                   NS_XUL_BROADCAST, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::oncommandupdate,               NS_XUL_COMMAND_UPDATE, EventNameType_XUL, NS_EVENT_NULL},
-
-    { nsGkAtoms::ondragenter,                   NS_DRAGDROP_ENTER, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragover,                    NS_DRAGDROP_OVER_SYNTH, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragexit,                    NS_DRAGDROP_EXIT_SYNTH, EventNameType_XUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragdrop,                    NS_DRAGDROP_DRAGDROP, EventNameType_XUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondraggesture,                 NS_DRAGDROP_GESTURE, EventNameType_XUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondrag,                        NS_DRAGDROP_DRAG, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragend,                     NS_DRAGDROP_END, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragstart,                   NS_DRAGDROP_START, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondragleave,                   NS_DRAGDROP_LEAVE_SYNTH, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-    { nsGkAtoms::ondrop,                        NS_DRAGDROP_DROP, EventNameType_HTMLXUL, NS_DRAG_EVENT },
-
-    { nsGkAtoms::onoverflow,                    NS_SCROLLPORT_OVERFLOW, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onunderflow,                   NS_SCROLLPORT_UNDERFLOW, EventNameType_XUL, NS_EVENT_NULL},
-    { nsGkAtoms::onSVGLoad,                     NS_SVG_LOAD, EventNameType_None, NS_SVG_EVENT },
-    { nsGkAtoms::onSVGUnload,                   NS_SVG_UNLOAD, EventNameType_None, NS_SVG_EVENT },
-    { nsGkAtoms::onSVGAbort,                    NS_SVG_ABORT, EventNameType_None, NS_SVG_EVENT },
-    { nsGkAtoms::onSVGError,                    NS_SVG_ERROR, EventNameType_None, NS_SVG_EVENT },
-    { nsGkAtoms::onSVGResize,                   NS_SVG_RESIZE, EventNameType_None, NS_SVG_EVENT },
-    { nsGkAtoms::onSVGScroll,                   NS_SVG_SCROLL, EventNameType_None, NS_SVG_EVENT },
-
-    { nsGkAtoms::onSVGZoom,                     NS_SVG_ZOOM, EventNameType_None, NS_SVGZOOM_EVENT },
-
-    // This is a bit hackish, but SVG's event names are weird.
-    { nsGkAtoms::onzoom,                        NS_SVG_ZOOM, EventNameType_SVGSVG, NS_EVENT_NULL },
-#ifdef MOZ_SMIL
-    { nsGkAtoms::onbegin,                       NS_SMIL_BEGIN, EventNameType_SMIL, NS_EVENT_NULL },
-    { nsGkAtoms::onbeginEvent,                  NS_SMIL_BEGIN, EventNameType_None, NS_SMIL_TIME_EVENT },
-    { nsGkAtoms::onend,                         NS_SMIL_END, EventNameType_SMIL, NS_EVENT_NULL },
-    { nsGkAtoms::onendEvent,                    NS_SMIL_END, EventNameType_None, NS_SMIL_TIME_EVENT },
-    { nsGkAtoms::onrepeat,                      NS_SMIL_REPEAT, EventNameType_SMIL, NS_EVENT_NULL },
-    { nsGkAtoms::onrepeatEvent,                 NS_SMIL_REPEAT, EventNameType_None, NS_SMIL_TIME_EVENT },
-#endif // MOZ_SMIL
-#ifdef MOZ_MEDIA
-    { nsGkAtoms::onloadstart,                   NS_LOADSTART, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onprogress,                    NS_PROGRESS, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onsuspend,                     NS_SUSPEND, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onemptied,                     NS_EMPTIED, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onstalled,                     NS_STALLED, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onplay,                        NS_PLAY, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onpause,                       NS_PAUSE, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onloadedmetadata,              NS_LOADEDMETADATA, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onloadeddata,                  NS_LOADEDDATA, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onwaiting,                     NS_WAITING, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onplaying,                     NS_PLAYING, EventNameType_HTML,  NS_EVENT_NULL },
-    { nsGkAtoms::oncanplay,                     NS_CANPLAY, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::oncanplaythrough,              NS_CANPLAYTHROUGH, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onseeking,                     NS_SEEKING, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onseeked,                      NS_SEEKED, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::ontimeupdate,                  NS_TIMEUPDATE, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onended,                       NS_ENDED, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onratechange,                  NS_RATECHANGE, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::ondurationchange,              NS_DURATIONCHANGE, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onvolumechange,                NS_VOLUMECHANGE, EventNameType_HTML, NS_EVENT_NULL },
-    { nsGkAtoms::onMozAudioAvailable,           NS_MOZAUDIOAVAILABLE, EventNameType_None, NS_EVENT_NULL },
-#endif // MOZ_MEDIA
-    { nsGkAtoms::onMozAfterPaint,               NS_AFTERPAINT, EventNameType_None, NS_EVENT },
-    { nsGkAtoms::onMozBeforePaint,              NS_BEFOREPAINT, EventNameType_None, NS_EVENT_NULL },
-
-    { nsGkAtoms::onMozScrolledAreaChanged,      NS_SCROLLEDAREACHANGED, EventNameType_None, NS_SCROLLAREA_EVENT },
-
-    // Simple gesture events
-    { nsGkAtoms::onMozSwipeGesture,             NS_SIMPLE_GESTURE_SWIPE, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozMagnifyGestureStart,      NS_SIMPLE_GESTURE_MAGNIFY_START, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozMagnifyGestureUpdate,     NS_SIMPLE_GESTURE_MAGNIFY_UPDATE, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozMagnifyGesture,           NS_SIMPLE_GESTURE_MAGNIFY, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozRotateGestureStart,       NS_SIMPLE_GESTURE_ROTATE_START, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozRotateGestureUpdate,      NS_SIMPLE_GESTURE_ROTATE_UPDATE, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozRotateGesture,            NS_SIMPLE_GESTURE_ROTATE, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozTapGesture,               NS_SIMPLE_GESTURE_TAP, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-    { nsGkAtoms::onMozPressTapGesture,          NS_SIMPLE_GESTURE_PRESSTAP, EventNameType_None, NS_SIMPLE_GESTURE_EVENT },
-
-    { nsGkAtoms::onMozTouchDown,                NS_MOZTOUCH_DOWN, EventNameType_None, NS_MOZTOUCH_EVENT },
-    { nsGkAtoms::onMozTouchMove,                NS_MOZTOUCH_MOVE, EventNameType_None, NS_MOZTOUCH_EVENT },
-    { nsGkAtoms::onMozTouchUp,                  NS_MOZTOUCH_UP, EventNameType_None, NS_MOZTOUCH_EVENT },
-
-    { nsGkAtoms::ondevicemotion,                NS_DEVICE_MOTION, EventNameType_None, NS_EVENT },
-    { nsGkAtoms::ondeviceorientation,           NS_DEVICE_ORIENTATION, EventNameType_None, NS_EVENT },
-
-    { nsGkAtoms::ontransitionend,               NS_TRANSITION_END, EventNameType_None, NS_TRANSITION_EVENT },
-    { nsGkAtoms::onanimationstart,              NS_ANIMATION_START, EventNameType_None, NS_ANIMATION_EVENT },
-    { nsGkAtoms::onanimationend,                NS_ANIMATION_END, EventNameType_None, NS_ANIMATION_EVENT },
-    { nsGkAtoms::onanimationiteration,          NS_ANIMATION_ITERATION, EventNameType_None, NS_ANIMATION_EVENT },
-    { nsGkAtoms::onbeforeprint,                 NS_BEFOREPRINT, EventNameType_HTMLXUL, NS_EVENT },
-    { nsGkAtoms::onafterprint,                  NS_AFTERPRINT, EventNameType_HTMLXUL, NS_EVENT }
+#define EVENT(name_,  _id, _type, _struct)          \
+    { nsGkAtoms::on##name_, _id, _type, _struct },
+#define WINDOW_ONLY_EVENT EVENT
+#define NON_IDL_EVENT EVENT
+#include "nsEventNameList.h"
+#undef WINDOW_ONLY_EVENT
+#undef EVENT
+    nsnull
   };
 
   sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>;
   sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>;
   sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
 
   if (!sAtomEventTable || !sStringEventTable || !sUserDefinedEvents ||
       !sAtomEventTable->Init(int(NS_ARRAY_LENGTH(eventArray) / 0.75) + 1) ||
@@ -671,17 +513,18 @@ nsContentUtils::InitializeEventTable() {
     sAtomEventTable = nsnull;
     delete sStringEventTable;
     sStringEventTable = nsnull;
     delete sUserDefinedEvents;
     sUserDefinedEvents = nsnull;
     return PR_FALSE;
   }
 
-  for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(eventArray); ++i) {
+  // Subtract one from the length because of the trailing null
+  for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(eventArray) - 1; ++i) {
     if (!sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]) ||
         !sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
                                 eventArray[i])) {
       delete sAtomEventTable;
       sAtomEventTable = nsnull;
       delete sStringEventTable;
       sStringEventTable = nsnull;
       return PR_FALSE;
@@ -693,24 +536,26 @@ nsContentUtils::InitializeEventTable() {
 
 void
 nsContentUtils::InitializeTouchEventTable()
 {
   static PRBool sEventTableInitialized = PR_FALSE;
   if (!sEventTableInitialized && sAtomEventTable && sStringEventTable) {
     sEventTableInitialized = PR_TRUE;
     static const EventNameMapping touchEventArray[] = {
-      { nsGkAtoms::ontouchstart, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT },
-      { nsGkAtoms::ontouchend, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT },
-      { nsGkAtoms::ontouchmove, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT },
-      { nsGkAtoms::ontouchenter, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT },
-      { nsGkAtoms::ontouchleave, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT },
-      { nsGkAtoms::ontouchcancel, NS_USER_DEFINED_EVENT, EventNameType_All, NS_INPUT_EVENT }
+#define EVENT(name_,  _id, _type, _struct)
+#define TOUCH_EVENT(name_,  _id, _type, _struct)      \
+      { nsGkAtoms::on##name_, _id, _type, _struct },
+#include "nsEventNameList.h"
+#undef TOUCH_EVENT
+#undef EVENT
+      nsnull
     };
-    for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(touchEventArray); ++i) {
+    // Subtract one from the length because of the trailing null
+    for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(touchEventArray) - 1; ++i) {
       if (!sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]) ||
           !sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
                                   touchEventArray[i])) {
         delete sAtomEventTable;
         sAtomEventTable = nsnull;
         delete sStringEventTable;
         sStringEventTable = nsnull;
         return;
--- a/content/events/public/nsEventNameList.h
+++ b/content/events/public/nsEventNameList.h
@@ -35,17 +35,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * This file contains the list of event names that are exposed via IDL
  * on various objects.  It is designed to be used as inline input to
  * various consumers through the magic of C preprocessing.
  *
- * Each entry is the name of an event.
+ * Each entry consists of 4 pieces of information:
+ * 1) The name of the event
+ * 2) The event ID (see nsGUIEvent.h)
+ * 3) The event type (see the EventNameType enum in nsContentUtils.h)
+ * 4) The event struct type for this event.
+ * Items 2-4 might be empty strings for events for which they don't make sense.
  *
  * Event names that are exposed as content attributes on HTML elements
  * and as IDL attributes on Elements, Documents and Windows and have
  * no forwarding behavior should be enclosed in the EVENT macro.
  *
  * Event names that are exposed as content attributes on HTML elements
  * and as IDL attributes on Elements, Documents and Windows and are
  * forwarded from <body> and <frameset> to the Window should be
@@ -60,141 +65,667 @@
  * <body> and <frameset>, which forward them to the Window, and are
  * exposed as IDL attributes on the Window should be enclosed in the
  * WINDOW_EVENT macro.  If this macro is not defined, it will be
  * defined to be equivalent to WINDOW_ONLY_EVENT.
  *
  * Touch-specific event names should be enclosed in TOUCH_EVENT.  They
  * are otherwise equivalent to those enclosed in EVENT.  If
  * TOUCH_EVENT is not defined, it will be defined to the empty string.
+ *
+ * Event names that are not exposed as IDL attributes at all should be
+ * enclosed in NON_IDL_EVENT.  If NON_IDL_EVENT is not defined, it
+ * will be defined to the empty string.
  */
 
 #ifdef DEFINED_FORWARDED_EVENT
 #error "Don't define DEFINED_FORWARDED_EVENT"
 #endif /* DEFINED_FORWARDED_EVENT */
 
 #ifndef FORWARDED_EVENT
-#define FORWARDED_EVENT(_name) EVENT(_name)
+#define FORWARDED_EVENT EVENT
 #define DEFINED_FORWARDED_EVENT
 #endif /* FORWARDED_EVENT */
 
 #ifdef DEFINED_WINDOW_ONLY_EVENT
 #error "Don't define DEFINED_WINDOW_ONLY_EVENT"
 #endif /* DEFINED_WINDOW_ONLY_EVENT */
 
 #ifndef WINDOW_ONLY_EVENT
-#define WINDOW_ONLY_EVENT(_name)
+#define WINDOW_ONLY_EVENT(_name, _id, _type, _struct)
 #define DEFINED_WINDOW_ONLY_EVENT
 #endif /* WINDOW_ONLY_EVENT */
 
 #ifdef DEFINED_WINDOW_EVENT
 #error "Don't define DEFINED_WINDOW_EVENT"
 #endif /* DEFINED_WINDOW_EVENT */
 
 #ifndef WINDOW_EVENT
-#define WINDOW_EVENT(_name) WINDOW_ONLY_EVENT(_name)
+#define WINDOW_EVENT WINDOW_ONLY_EVENT
 #define DEFINED_WINDOW_EVENT
 #endif /* WINDOW_EVENT */
 
 #ifdef DEFINED_TOUCH_EVENT
 #error "Don't define DEFINED_TOUCH_EVENT"
 #endif /* DEFINED_TOUCH_EVENT */
 
 #ifndef TOUCH_EVENT
-#define TOUCH_EVENT(_name)
+#define TOUCH_EVENT(_name, _id, _type, _struct)
 #define DEFINED_TOUCH_EVENT
 #endif /* TOUCH_EVENT */
 
-EVENT(abort)
-EVENT(canplay)
-EVENT(canplaythrough)
-EVENT(change)
-EVENT(click)
-EVENT(contextmenu)
-EVENT(cuechange)
-EVENT(dblclick)
-EVENT(drag)
-EVENT(dragend)
-EVENT(dragenter)
-EVENT(dragleave)
-EVENT(dragover)
-EVENT(dragstart)
-EVENT(drop)
-EVENT(durationchange)
-EVENT(emptied)
-EVENT(ended)
-EVENT(input)
-EVENT(invalid)
-EVENT(keydown)
-EVENT(keypress)
-EVENT(keyup)
-EVENT(loadeddata)
-EVENT(loadedmetadata)
-EVENT(loadstart)
-EVENT(mousedown)
-EVENT(mousemove)
-EVENT(mouseout)
-EVENT(mouseover)
-EVENT(mouseup)
-EVENT(mousewheel)
-EVENT(pause)
-EVENT(play)
-EVENT(playing)
-EVENT(progress)
-EVENT(ratechange)
-EVENT(readystatechange)
-EVENT(reset)
-EVENT(seeked)
-EVENT(seeking)
-EVENT(select)
-EVENT(show)
-EVENT(stalled)
-EVENT(submit)
-EVENT(suspend)
-EVENT(timeupdate)
-EVENT(volumechange)
-EVENT(waiting)
+#ifdef DEFINED_NON_IDL_EVENT
+#error "Don't define DEFINED_NON_IDL_EVENT"
+#endif /* DEFINED_NON_IDL_EVENT */
+
+#ifndef NON_IDL_EVENT
+#define NON_IDL_EVENT(_name, _id, _type, _struct)
+#define DEFINED_NON_IDL_EVENT
+#endif /* NON_IDL_EVENT */
+
+EVENT(abort,
+      NS_IMAGE_ABORT,
+      (EventNameType_HTMLXUL | EventNameType_SVGSVG),
+      NS_EVENT)
+EVENT(canplay,
+      NS_CANPLAY,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(canplaythrough,
+      NS_CANPLAYTHROUGH,
+      EventNameType_HTML,
+      NS_EVENT_NULL )
+EVENT(change,
+      NS_FORM_CHANGE,
+      EventNameType_HTMLXUL,
+      NS_EVENT )
+EVENT(click,
+      NS_MOUSE_CLICK,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+EVENT(contextmenu,
+      NS_CONTEXTMENU,
+      EventNameType_HTMLXUL,
+      NS_MOUSE_EVENT)
+// Not supported yet
+// EVENT(cuechange)
+EVENT(dblclick,
+      NS_MOUSE_DOUBLECLICK,
+      EventNameType_HTMLXUL,
+      NS_MOUSE_EVENT)
+EVENT(drag,
+      NS_DRAGDROP_DRAG,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(dragend,
+      NS_DRAGDROP_END,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(dragenter,
+      NS_DRAGDROP_ENTER,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(dragleave,
+      NS_DRAGDROP_LEAVE_SYNTH,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(dragover,
+      NS_DRAGDROP_OVER_SYNTH,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(dragstart,
+      NS_DRAGDROP_START,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(drop,
+      NS_DRAGDROP_DROP,
+      EventNameType_HTMLXUL,
+      NS_DRAG_EVENT)
+EVENT(durationchange,
+      NS_DURATIONCHANGE,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(emptied,
+      NS_EMPTIED,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(ended,
+      NS_ENDED,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(input,
+      NS_FORM_INPUT,
+      EventNameType_HTMLXUL,
+      NS_UI_EVENT)
+EVENT(invalid,
+      NS_FORM_INVALID,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(keydown,
+      NS_KEY_DOWN,
+      EventNameType_HTMLXUL,
+      NS_KEY_EVENT)
+EVENT(keypress,
+      NS_KEY_PRESS,
+      EventNameType_HTMLXUL,
+      NS_KEY_EVENT)
+EVENT(keyup,
+      NS_KEY_UP,
+      EventNameType_HTMLXUL,
+      NS_KEY_EVENT)
+EVENT(loadeddata,
+      NS_LOADEDDATA,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(loadedmetadata,
+      NS_LOADEDMETADATA,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(loadstart,
+      NS_LOADSTART,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(mousedown,
+      NS_MOUSE_BUTTON_DOWN,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+EVENT(mousemove,
+      NS_MOUSE_MOVE,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+EVENT(mouseout,
+      NS_MOUSE_EXIT_SYNTH,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+EVENT(mouseover,
+      NS_MOUSE_ENTER_SYNTH,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+EVENT(mouseup,
+      NS_MOUSE_BUTTON_UP,
+      EventNameType_All,
+      NS_MOUSE_EVENT)
+// Not supported yet; probably never because "wheel" is a better idea.
+// EVENT(mousewheel)
+EVENT(pause,
+      NS_PAUSE,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(play,
+      NS_PLAY,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(playing,
+      NS_PLAYING,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(progress,
+      NS_PROGRESS,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(ratechange,
+      NS_RATECHANGE,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(readystatechange,
+      NS_READYSTATECHANGE,
+      EventNameType_HTMLXUL,
+      NS_EVENT_NULL)
+EVENT(reset,
+      NS_FORM_RESET,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(seeked,
+      NS_SEEKED,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(seeking,
+      NS_SEEKING,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(select,
+      NS_FORM_SELECTED,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+// Not supported yet
+// EVENT(show)
+EVENT(stalled,
+      NS_STALLED,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(submit,
+      NS_FORM_SUBMIT,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(suspend,
+      NS_SUSPEND,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(timeupdate,
+      NS_TIMEUPDATE,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(volumechange,
+      NS_VOLUMECHANGE,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
+EVENT(waiting,
+      NS_WAITING,
+      EventNameType_HTML,
+      NS_EVENT_NULL)
 // Gecko-specific extensions that apply to elements
-EVENT(copy)
-EVENT(cut)
-EVENT(paste)
-EVENT(beforescriptexecute)
-EVENT(afterscriptexecute)
+EVENT(copy,
+      NS_COPY,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(cut,
+      NS_CUT,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(paste,
+      NS_PASTE,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(beforescriptexecute,
+      NS_BEFORE_SCRIPT_EXECUTE,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+EVENT(afterscriptexecute,
+      NS_AFTER_SCRIPT_EXECUTE,
+      EventNameType_HTMLXUL,
+      NS_EVENT)
+
+FORWARDED_EVENT(blur,
+                NS_BLUR_CONTENT,
+                EventNameType_HTMLXUL,
+                NS_FOCUS_EVENT)
+FORWARDED_EVENT(error,
+                NS_LOAD_ERROR,
+                (EventNameType_HTMLXUL | EventNameType_SVGSVG),
+                NS_EVENT)
+FORWARDED_EVENT(focus,
+                NS_FOCUS_CONTENT,
+                EventNameType_HTMLXUL,
+                NS_FOCUS_EVENT)
+FORWARDED_EVENT(load,
+                NS_LOAD,
+                EventNameType_All,
+                NS_EVENT)
+FORWARDED_EVENT(scroll,
+                NS_SCROLL_EVENT,
+                (EventNameType_HTMLXUL | EventNameType_SVGSVG),
+                NS_EVENT_NULL)
+
+WINDOW_EVENT(afterprint,
+             NS_AFTERPRINT,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(beforeprint,
+             NS_BEFOREPRINT,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(beforeunload,
+             NS_BEFORE_PAGE_UNLOAD,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(hashchange,
+             NS_HASHCHANGE,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(message,
+             NS_MESSAGE,
+             EventNameType_None,
+             NS_EVENT)
+WINDOW_EVENT(offline,
+             NS_OFFLINE,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(online,
+             NS_ONLINE,
+             EventNameType_HTMLXUL,
+             NS_EVENT)
+WINDOW_EVENT(pagehide,
+             NS_PAGE_HIDE,
+             EventNameType_HTML,
+             NS_EVENT)
+WINDOW_EVENT(pageshow,
+             NS_PAGE_SHOW,
+             EventNameType_HTML,
+             NS_EVENT)
+WINDOW_EVENT(popstate,
+             NS_POPSTATE,
+             EventNameType_HTMLXUL,
+             NS_EVENT_NULL)
+// Not supported yet
+// WINDOW_EVENT(redo)
+WINDOW_EVENT(resize,
+             NS_RESIZE_EVENT,
+             (EventNameType_HTMLXUL | EventNameType_SVGSVG),
+             NS_EVENT)
+// Not supported yet
+// WINDOW_EVENT(storage)
+// Not supported yet
+// WINDOW_EVENT(undo)
+WINDOW_EVENT(unload,
+             NS_PAGE_UNLOAD,
+             (EventNameType_HTMLXUL | EventNameType_SVGSVG),
+             NS_EVENT)
 
-FORWARDED_EVENT(blur)
-FORWARDED_EVENT(error)
-FORWARDED_EVENT(focus)
-FORWARDED_EVENT(load)
-FORWARDED_EVENT(scroll)
+WINDOW_ONLY_EVENT(devicemotion,
+                  NS_DEVICE_MOTION,
+                  EventNameType_None,
+                  NS_EVENT)
+WINDOW_ONLY_EVENT(deviceorientation,
+                  NS_DEVICE_ORIENTATION,
+                  EventNameType_None,
+                  NS_EVENT)
+
+TOUCH_EVENT(touchstart,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT)
+TOUCH_EVENT(touchend,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT)
+TOUCH_EVENT(touchmove,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT )
+TOUCH_EVENT(touchenter,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT )
+TOUCH_EVENT(touchleave,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT)
+TOUCH_EVENT(touchcancel,
+            NS_USER_DEFINED_EVENT,
+            EventNameType_All,
+            NS_INPUT_EVENT)
+
+NON_IDL_EVENT(MozMouseHittest,
+              NS_MOUSE_MOZHITTEST,
+              EventNameType_None,
+              NS_MOUSE_EVENT)
+
+NON_IDL_EVENT(DOMAttrModified,
+              NS_MUTATION_ATTRMODIFIED,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMCharacterDataModified,
+              NS_MUTATION_CHARACTERDATAMODIFIED,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMNodeInserted,
+              NS_MUTATION_NODEINSERTED,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMNodeRemoved,
+              NS_MUTATION_NODEREMOVED,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMNodeInsertedIntoDocument,
+              NS_MUTATION_NODEINSERTEDINTODOCUMENT,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMNodeRemovedFromDocument,
+              NS_MUTATION_NODEREMOVEDFROMDOCUMENT,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+NON_IDL_EVENT(DOMSubtreeModified,
+              NS_MUTATION_SUBTREEMODIFIED,
+              EventNameType_HTMLXUL,
+              NS_MUTATION_EVENT)
+
+NON_IDL_EVENT(DOMActivate,
+              NS_UI_ACTIVATE,
+              EventNameType_HTMLXUL,
+              NS_UI_EVENT)
+NON_IDL_EVENT(DOMFocusIn,
+              NS_UI_FOCUSIN,
+              EventNameType_HTMLXUL,
+              NS_UI_EVENT)
+NON_IDL_EVENT(DOMFocusOut,
+              NS_UI_FOCUSOUT,
+              EventNameType_HTMLXUL,
+              NS_UI_EVENT)
+                                  
+NON_IDL_EVENT(DOMMouseScroll,
+              NS_MOUSE_SCROLL,
+              EventNameType_HTMLXUL,
+              NS_MOUSE_SCROLL_EVENT)
+NON_IDL_EVENT(MozMousePixelScroll,
+              NS_MOUSE_PIXEL_SCROLL,
+              EventNameType_HTMLXUL,
+              NS_MOUSE_SCROLL_EVENT)
+                                                
+NON_IDL_EVENT(MozBeforeResize,
+              NS_BEFORERESIZE_EVENT,
+              EventNameType_None,
+              NS_EVENT)
+NON_IDL_EVENT(open,
+              NS_OPEN,
+              EventNameType_None,
+              NS_EVENT)
 
-WINDOW_EVENT(afterprint)
-WINDOW_EVENT(beforeprint)
-WINDOW_EVENT(beforeunload)
-WINDOW_EVENT(hashchange)
-WINDOW_EVENT(message)
-WINDOW_EVENT(offline)
-WINDOW_EVENT(online)
-WINDOW_EVENT(pagehide)
-WINDOW_EVENT(pageshow)
-WINDOW_EVENT(popstate)
-WINDOW_EVENT(redo)
-WINDOW_EVENT(resize)
-WINDOW_EVENT(storage)
-WINDOW_EVENT(undo)
-WINDOW_EVENT(unload)
+// Events that only have on* attributes on XUL elements
+NON_IDL_EVENT(text,
+              NS_TEXT_TEXT,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(compositionstart,
+              NS_COMPOSITION_START,
+              EventNameType_XUL,
+              NS_COMPOSITION_EVENT)
+NON_IDL_EVENT(compositionend,
+              NS_COMPOSITION_END,
+              EventNameType_XUL,
+              NS_COMPOSITION_EVENT)
+NON_IDL_EVENT(command,
+              NS_XUL_COMMAND,
+              EventNameType_XUL,
+              NS_INPUT_EVENT)
+NON_IDL_EVENT(close,
+              NS_XUL_CLOSE,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(popupshowing,
+              NS_XUL_POPUP_SHOWING,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(popupshown,
+              NS_XUL_POPUP_SHOWN,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(popuphiding,
+              NS_XUL_POPUP_HIDING,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(popuphidden,
+              NS_XUL_POPUP_HIDDEN,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(broadcast,
+              NS_XUL_BROADCAST,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(commandupdate,
+              NS_XUL_COMMAND_UPDATE,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(dragexit,
+              NS_DRAGDROP_EXIT_SYNTH,
+              EventNameType_XUL,
+              NS_DRAG_EVENT)
+NON_IDL_EVENT(dragdrop,
+              NS_DRAGDROP_DRAGDROP,
+              EventNameType_XUL,
+              NS_DRAG_EVENT)
+NON_IDL_EVENT(draggesture,
+              NS_DRAGDROP_GESTURE,
+              EventNameType_XUL,
+              NS_DRAG_EVENT)
+NON_IDL_EVENT(overflow,
+              NS_SCROLLPORT_OVERFLOW,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(underflow,
+              NS_SCROLLPORT_UNDERFLOW,
+              EventNameType_XUL,
+              NS_EVENT_NULL)
+
+// Various SVG events
+NON_IDL_EVENT(SVGLoad,
+              NS_SVG_LOAD,
+              EventNameType_None,
+              NS_SVG_EVENT)
+NON_IDL_EVENT(SVGUnload,
+              NS_SVG_UNLOAD,
+              EventNameType_None,
+              NS_SVG_EVENT)
+NON_IDL_EVENT(SVGAbort,
+              NS_SVG_ABORT,
+              EventNameType_None,
+              NS_SVG_EVENT)
+NON_IDL_EVENT(SVGError,
+              NS_SVG_ERROR,
+              EventNameType_None,
+              NS_SVG_EVENT)
+NON_IDL_EVENT(SVGResize,
+              NS_SVG_RESIZE,
+              EventNameType_None,
+              NS_SVG_EVENT)
+NON_IDL_EVENT(SVGScroll,
+              NS_SVG_SCROLL,
+              EventNameType_None,
+              NS_SVG_EVENT)
 
-WINDOW_ONLY_EVENT(devicemotion)
-WINDOW_ONLY_EVENT(deviceorientation)
+NON_IDL_EVENT(SVGZoom,
+              NS_SVG_ZOOM,
+              EventNameType_None,
+              NS_SVGZOOM_EVENT)
+// This is a bit hackish, but SVG's event names are weird.
+NON_IDL_EVENT(zoom,
+              NS_SVG_ZOOM,
+              EventNameType_SVGSVG,
+              NS_EVENT_NULL)
+#ifdef MOZ_SMIL
+NON_IDL_EVENT(begin,
+              NS_SMIL_BEGIN,
+              EventNameType_SMIL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(beginEvent,
+              NS_SMIL_BEGIN,
+              EventNameType_None,
+              NS_SMIL_TIME_EVENT)
+NON_IDL_EVENT(end,
+              NS_SMIL_END,
+              EventNameType_SMIL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(endEvent,
+              NS_SMIL_END,
+              EventNameType_None,
+              NS_SMIL_TIME_EVENT)
+NON_IDL_EVENT(repeat,
+              NS_SMIL_REPEAT,
+              EventNameType_SMIL,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(repeatEvent,
+              NS_SMIL_REPEAT,
+              EventNameType_None,
+              NS_SMIL_TIME_EVENT)
+#endif // MOZ_SMIL
+
+NON_IDL_EVENT(MozAudioAvailable,
+              NS_MOZAUDIOAVAILABLE,
+              EventNameType_None,
+              NS_EVENT_NULL)
+NON_IDL_EVENT(MozAfterPaint,
+              NS_AFTERPAINT,
+              EventNameType_None,
+              NS_EVENT)
+NON_IDL_EVENT(MozBeforePaint,
+              NS_BEFOREPAINT,
+              EventNameType_None,
+              NS_EVENT_NULL)
+
+NON_IDL_EVENT(MozScrolledAreaChanged,
+              NS_SCROLLEDAREACHANGED,
+              EventNameType_None,
+              NS_SCROLLAREA_EVENT)
 
-TOUCH_EVENT(touchstart)
-TOUCH_EVENT(touchend)
-TOUCH_EVENT(touchmove)
-TOUCH_EVENT(touchenter)
-TOUCH_EVENT(touchleave)
-TOUCH_EVENT(touchcancel)
+// Simple gesture events
+NON_IDL_EVENT(MozSwipeGesture,
+              NS_SIMPLE_GESTURE_SWIPE,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozMagnifyGestureStart,
+              NS_SIMPLE_GESTURE_MAGNIFY_START,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozMagnifyGestureUpdate,
+              NS_SIMPLE_GESTURE_MAGNIFY_UPDATE,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozMagnifyGesture,
+              NS_SIMPLE_GESTURE_MAGNIFY,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozRotateGestureStart,
+              NS_SIMPLE_GESTURE_ROTATE_START,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozRotateGestureUpdate,
+              NS_SIMPLE_GESTURE_ROTATE_UPDATE,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozRotateGesture,
+              NS_SIMPLE_GESTURE_ROTATE,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozTapGesture,
+              NS_SIMPLE_GESTURE_TAP,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+NON_IDL_EVENT(MozPressTapGesture,
+              NS_SIMPLE_GESTURE_PRESSTAP,
+              EventNameType_None,
+              NS_SIMPLE_GESTURE_EVENT)
+
+NON_IDL_EVENT(MozTouchDown,
+              NS_MOZTOUCH_DOWN,
+              EventNameType_None,
+              NS_MOZTOUCH_EVENT)
+NON_IDL_EVENT(MozTouchMove,
+              NS_MOZTOUCH_MOVE,
+              EventNameType_None,
+              NS_MOZTOUCH_EVENT)
+NON_IDL_EVENT(MozTouchUp,
+              NS_MOZTOUCH_UP,
+              EventNameType_None,
+              NS_MOZTOUCH_EVENT)
+
+NON_IDL_EVENT(transitionend,
+              NS_TRANSITION_END,
+              EventNameType_None,
+              NS_TRANSITION_EVENT)
+NON_IDL_EVENT(animationstart,
+              NS_ANIMATION_START,
+              EventNameType_None,
+              NS_ANIMATION_EVENT)
+NON_IDL_EVENT(animationend,
+              NS_ANIMATION_END,
+              EventNameType_None,
+              NS_ANIMATION_EVENT)
+NON_IDL_EVENT(animationiteration,
+              NS_ANIMATION_ITERATION,
+              EventNameType_None,
+              NS_ANIMATION_EVENT)
 
 #ifdef DEFINED_FORWARDED_EVENT
 #undef DEFINED_FORWARDED_EVENT
 #undef FORWARDED_EVENT
 #endif /* DEFINED_FORWARDED_EVENT */
 
 #ifdef DEFINED_WINDOW_EVENT
 #undef DEFINED_WINDOW_EVENT
@@ -206,8 +737,13 @@ TOUCH_EVENT(touchcancel)
 #undef WINDOW_ONLY_EVENT
 #endif /* DEFINED_WINDOW_ONLY_EVENT */
 
 #ifdef DEFINED_TOUCH_EVENT
 #undef DEFINED_TOUCH_EVENT
 #undef TOUCH_EVENT
 #endif /* DEFINED_TOUCH_EVENT */
 
+#ifdef DEFINED_NON_IDL_EVENT
+#undef DEFINED_NON_IDL_EVENT
+#undef NON_IDL_EVENT
+#endif /* DEFINED_NON_IDL_EVENT */
+
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1615,20 +1615,20 @@ jsid nsDOMClassInfo::sDocumentURIObject_
 jsid nsDOMClassInfo::sJava_id            = JSID_VOID;
 jsid nsDOMClassInfo::sPackages_id        = JSID_VOID;
 jsid nsDOMClassInfo::sWrappedJSObject_id = JSID_VOID;
 jsid nsDOMClassInfo::sURL_id             = JSID_VOID;
 jsid nsDOMClassInfo::sKeyPath_id         = JSID_VOID;
 jsid nsDOMClassInfo::sAutoIncrement_id   = JSID_VOID;
 jsid nsDOMClassInfo::sUnique_id          = JSID_VOID;
 
-#define EVENT(name_) \
+#define EVENT(name_, id_, type_, struct_)             \
 jsid nsDOMClassInfo::sOn##name_##_id     = JSID_VOID;
-#define WINDOW_ONLY_EVENT(name_) EVENT(name_)
-#define TOUCH_EVENT(name_) EVENT(name_)
+#define WINDOW_ONLY_EVENT EVENT
+#define TOUCH_EVENT EVENT
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef WINDOW_ONLY_EVENT
 #undef EVENT
 
 static const JSClass *sObjectClass = nsnull;
 
 /**
@@ -1885,20 +1885,20 @@ nsDOMClassInfo::DefineStaticJSVals(JSCon
   SET_JSID_TO_STRING(sJava_id,            cx, "java");
   SET_JSID_TO_STRING(sPackages_id,        cx, "Packages");
   SET_JSID_TO_STRING(sWrappedJSObject_id, cx, "wrappedJSObject");
   SET_JSID_TO_STRING(sURL_id,             cx, "URL");
   SET_JSID_TO_STRING(sKeyPath_id,         cx, "keyPath");
   SET_JSID_TO_STRING(sAutoIncrement_id,   cx, "autoIncrement");
   SET_JSID_TO_STRING(sUnique_id,          cx, "unique");
 
-#define EVENT(name_) \
+#define EVENT(name_, id_, type_, struct_)               \
   SET_JSID_TO_STRING(sOn##name_##_id, cx, "on" #name_); 
-#define WINDOW_ONLY_EVENT(name_) EVENT(name_)
-#define TOUCH_EVENT(name_) EVENT(name_)
+#define WINDOW_ONLY_EVENT EVENT
+#define TOUCH_EVENT EVENT
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef WINDOW_ONLY_EVENT
 #undef EVENT 
   
   return NS_OK;
 }
 
@@ -4902,20 +4902,20 @@ nsDOMClassInfo::ShutDown()
   sDocumentURIObject_id=JSID_VOID;
   sJava_id            = JSID_VOID;
   sPackages_id        = JSID_VOID;
   sWrappedJSObject_id = JSID_VOID;
   sKeyPath_id         = JSID_VOID;
   sAutoIncrement_id   = JSID_VOID;
   sUnique_id          = JSID_VOID;
 
-#define EVENT(name_) \
+#define EVENT(name_, id_, type_, struct_)       \
   sOn##name_##_id     = JSID_VOID;
-#define WINDOW_ONLY_EVENT(name_) EVENT(name_)
-#define TOUCH_EVENT(name_) EVENT(name_)
+#define WINDOW_ONLY_EVENT EVENT
+#define TOUCH_EVENT EVENT
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef WINDOW_ONLY_EVENT
 #undef EVENT
 
   NS_IF_RELEASE(sXPConnect);
   NS_IF_RELEASE(sSecMan);
   sIsInitialized = PR_FALSE;
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -288,19 +288,20 @@ public:
   static jsid sJava_id;
   static jsid sPackages_id;
   static jsid sWrappedJSObject_id;
   static jsid sURL_id;
   static jsid sKeyPath_id;
   static jsid sAutoIncrement_id;
   static jsid sUnique_id;
 
-#define EVENT(name_) static jsid sOn##name_##_id;
-#define WINDOW_ONLY_EVENT(name_) EVENT(name_)
-#define TOUCH_EVENT(name_) EVENT(name_)
+#define EVENT(name_, id_, type_, struct_)       \
+  static jsid sOn##name_##_id;
+#define WINDOW_ONLY_EVENT EVENT
+#define TOUCH_EVENT EVENT
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef WINDOW_ONLY_EVENT
 #undef EVENT
   
 protected:
   static JSPropertyOp sXPCNativeWrapperGetPropertyOp;
   static JSPropertyOp sXrayWrapperPropertyHolderGetPropertyOp;
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -414,17 +414,16 @@ class nsHashKey;
 // Query for some information about mouse wheel event's target
 // XXX This is used only for supporting high resolution mouse scroll on Windows
 //     and it's going to be reimplemented with another approach.  At that time,
 //     this even is going to be removed. Therefore,  DON'T use this event for
 //     other purpose.
 #define NS_QUERY_SCROLL_TARGET_INFO     (NS_QUERY_CONTENT_EVENT_START + 99)
 
 // Video events
-#ifdef MOZ_MEDIA
 #define NS_MEDIA_EVENT_START            3300
 #define NS_LOADSTART           (NS_MEDIA_EVENT_START)
 #define NS_PROGRESS            (NS_MEDIA_EVENT_START+1)
 #define NS_SUSPEND             (NS_MEDIA_EVENT_START+2)
 #define NS_EMPTIED             (NS_MEDIA_EVENT_START+3)
 #define NS_STALLED             (NS_MEDIA_EVENT_START+4)
 #define NS_PLAY                (NS_MEDIA_EVENT_START+5)
 #define NS_PAUSE               (NS_MEDIA_EVENT_START+6)
@@ -437,17 +436,16 @@ class nsHashKey;
 #define NS_SEEKING             (NS_MEDIA_EVENT_START+13)
 #define NS_SEEKED              (NS_MEDIA_EVENT_START+14)
 #define NS_TIMEUPDATE          (NS_MEDIA_EVENT_START+15)
 #define NS_ENDED               (NS_MEDIA_EVENT_START+16)
 #define NS_RATECHANGE          (NS_MEDIA_EVENT_START+17)
 #define NS_DURATIONCHANGE      (NS_MEDIA_EVENT_START+18)
 #define NS_VOLUMECHANGE        (NS_MEDIA_EVENT_START+19)
 #define NS_MOZAUDIOAVAILABLE   (NS_MEDIA_EVENT_START+20)
-#endif // MOZ_MEDIA
 
 // paint notification events
 #define NS_NOTIFYPAINT_START    3400
 #define NS_AFTERPAINT           (NS_NOTIFYPAINT_START)
 #define NS_BEFOREPAINT          (NS_NOTIFYPAINT_START+1)
 
 // Simple gesture events
 #define NS_SIMPLE_GESTURE_EVENT_START    3500