Bug 912956 part.2 Rename nsEvent.h to mozilla/EventForwards.h and sort out it r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 24 Sep 2013 19:04:14 +0900
changeset 162243 f2fce6c8e493f9ed6510f1d69291bcf3e8477380
parent 162242 6d6942eeef1a162aeda1adc9fa01e8e445caa967
child 162244 70bbbaa3c1d0c2fab1e5c201b6a1c3472f42613e
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs912956
milestone27.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 912956 part.2 Rename nsEvent.h to mozilla/EventForwards.h and sort out it r=roc
content/base/public/Element.h
content/base/public/nsContentUtils.h
content/events/public/nsEventDispatcher.h
content/events/public/nsIPrivateTextEvent.h
content/events/src/TextComposition.h
content/events/src/Touch.h
content/events/src/nsContentEventHandler.h
content/events/src/nsDOMUIEvent.h
content/events/src/nsEventStateManager.h
content/events/src/nsIMEStateManager.h
content/svg/content/src/SVGZoomEvent.h
docshell/base/nsILinkHandler.h
dom/base/nsDOMWindowUtils.h
dom/base/nsIScriptGlobalObject.h
dom/base/nsPIDOMWindow.h
dom/base/nsQueryContentEventResult.h
dom/interfaces/events/nsIDOMEvent.idl
dom/interfaces/events/nsIDOMEventTarget.idl
dom/plugins/base/nsIPluginInstanceOwner.idl
dom/plugins/ipc/PluginLibrary.h
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
gfx/layers/Layers.h
gfx/layers/composite/APZCTreeManager.h
gfx/layers/ipc/AsyncPanZoomController.cpp
gfx/layers/ipc/AsyncPanZoomController.h
gfx/layers/ipc/GestureEventListener.h
layout/base/PositionedEventTargeting.h
layout/base/nsIPresShell.h
layout/forms/nsRangeFrame.h
layout/generic/nsCanvasFrame.h
layout/generic/nsFrameSetFrame.h
parser/html/nsHtml5TreeBuilderCppSupplement.h
view/public/nsView.h
view/public/nsViewManager.h
widget/EventForwards.h
widget/InputData.h
widget/cocoa/TextInputHandler.h
widget/cocoa/nsCocoaUtils.h
widget/cocoa/nsMenuUtilsX.h
widget/cocoa/nsStandaloneNativeMenu.mm
widget/gonk/GonkKeyMapping.h
widget/gtk/nsGtkKeyUtils.h
widget/moz.build
widget/nsEvent.h
widget/nsGUIEvent.h
widget/nsINativeKeyBindings.h
widget/nsIWidget.h
widget/nsIWidgetListener.h
widget/qt/nsQtKeyUtils.h
widget/shared/WidgetUtils.h
widget/windows/KeyboardLayout.h
widget/windows/WinIMEHandler.h
widget/windows/WinMouseScrollHandler.h
widget/windows/nsTextStore.h
widget/windows/nsWindow.h
widget/windows/winrt/MetroInput.h
widget/xpwidgets/nsBaseWidget.h
xpfe/appshell/src/nsWebShellWindow.h
xpfe/appshell/src/nsXULWindow.h
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -28,18 +28,18 @@
 #include "nsPresContext.h"
 #include "nsDOMClassInfoID.h" // DOMCI_DATA
 #include "mozilla/CORSMode.h"
 #include "mozilla/Attributes.h"
 #include "nsIScrollableFrame.h"
 #include "mozilla/dom/Attr.h"
 #include "nsISMILAttr.h"
 #include "nsClientRect.h"
-#include "nsEvent.h"
 #include "nsAttrValue.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "Units.h"
 
 class nsIDOMEventListener;
 class nsIFrame;
 class nsIDOMMozNamedAttrMap;
 class nsIDOMCSSStyleDeclaration;
 class nsIURI;
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -16,31 +16,30 @@
 
 #if defined(SOLARIS)
 #include <ieeefp.h>
 #endif
 
 #include "js/TypeDecls.h"
 #include "js/RootingAPI.h"
 #include "mozilla/Assertions.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/TimeStamp.h"
 #include "nsContentListDeclarations.h"
 #include "nsMathUtils.h"
 #include "Units.h"
 
 class imgICache;
 class imgIContainer;
 class imgINotificationObserver;
 class imgIRequest;
 class imgLoader;
 class imgRequestProxy;
 class nsAutoScriptBlockerSuppressNodeRemoved;
-class nsDragEvent;
-class nsEvent;
 class nsEventListenerManager;
 class nsHtml5StringParser;
 class nsIChannel;
 class nsIConsoleService;
 class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
 class nsIDocShell;
@@ -79,17 +78,16 @@ class nsIScriptSecurityManager;
 class nsIStringBundle;
 class nsIStringBundleService;
 class nsISupportsHashKey;
 class nsIURI;
 class nsIWidget;
 class nsIWordBreaker;
 class nsIXPConnect;
 class nsIXPConnectJSObjectHolder;
-class nsKeyEvent;
 class nsNodeInfoManager;
 class nsPIDOMWindow;
 class nsPresContext;
 class nsScriptObjectTracer;
 class nsStringBuffer;
 class nsStringHashKey;
 class nsTextFragment;
 class nsViewportInfo;
--- a/content/events/public/nsEventDispatcher.h
+++ b/content/events/public/nsEventDispatcher.h
@@ -2,18 +2,18 @@
 /* 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/. */
 
 #ifdef MOZILLA_INTERNAL_API
 #ifndef nsEventDispatcher_h___
 #define nsEventDispatcher_h___
 
+#include "mozilla/EventForwards.h"
 #include "nsCOMPtr.h"
-#include "nsEvent.h"
 
 class nsEventTargetChainItem;
 class nsIDOMEvent;
 class nsIScriptGlobalObject;
 class nsPresContext;
 
 template<class E> class nsCOMArray;
 
--- a/content/events/public/nsIPrivateTextEvent.h
+++ b/content/events/public/nsIPrivateTextEvent.h
@@ -1,17 +1,16 @@
 /* -*- 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 nsIPrivateTextEvent_h__
 #define nsIPrivateTextEvent_h__
 
-#include "nsEvent.h"
 #include "nsISupports.h"
 #include "nsIPrivateTextRange.h"
 
 #define NS_IPRIVATETEXTEVENT_IID \
 { 0xb6840e02, 0x9e56, 0x49d8, \
   { 0x84, 0xd, 0x5f, 0xc1, 0xcb, 0x6c, 0xff, 0xb3 } }
 
 class nsIPrivateTextEvent : public nsISupports {
--- a/content/events/src/TextComposition.h
+++ b/content/events/src/TextComposition.h
@@ -3,22 +3,22 @@
 /* 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 mozilla_TextComposition_h
 #define mozilla_TextComposition_h
 
 #include "nsCOMPtr.h"
-#include "nsEvent.h"
 #include "nsINode.h"
 #include "nsIWidget.h"
 #include "nsTArray.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/EventForwards.h"
 
 class nsDispatchingCallback;
 class nsIMEStateManager;
 class nsIWidget;
 
 namespace mozilla {
 
 /**
--- a/content/events/src/Touch.h
+++ b/content/events/src/Touch.h
@@ -2,22 +2,22 @@
 /* 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 mozilla_dom_Touch_h
 #define mozilla_dom_Touch_h
 
 #include "mozilla/Attributes.h"
+#include "mozilla/EventForwards.h"
 #include "nsWrapperCache.h"
 #include "nsAutoPtr.h"
 #include "Units.h"
 
 class nsPresContext;
-class nsEvent;
 
 namespace mozilla {
 namespace dom {
 
 class EventTarget;
 
 class Touch MOZ_FINAL : public nsISupports
                       , public nsWrapperCache
--- a/content/events/src/nsContentEventHandler.h
+++ b/content/events/src/nsContentEventHandler.h
@@ -5,21 +5,20 @@
 
 #ifndef nsContentEventHandler_h__
 #define nsContentEventHandler_h__
 
 #include "nsCOMPtr.h"
 
 #include "nsISelection.h"
 #include "nsRange.h"
+#include "mozilla/EventForwards.h"
 
 class nsCaret;
 class nsPresContext;
-class nsQueryContentEvent;
-class nsSelectionEvent;
 
 struct nsRect;
 
 /*
  * Query Content Event Handler
  *   nsContentEventHandler is a helper class for nsEventStateManager.
  *   The platforms request some content informations, e.g., the selected text,
  *   the offset of the selected text and the text for specified range.
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -5,17 +5,16 @@
 
 #ifndef nsDOMUIEvent_h
 #define nsDOMUIEvent_h
 
 #include "mozilla/Attributes.h"
 #include "nsIDOMUIEvent.h"
 #include "nsDOMEvent.h"
 #include "nsLayoutUtils.h"
-#include "nsEvent.h"
 #include "mozilla/dom/UIEventBinding.h"
 #include "nsPresContext.h"
 #include "nsDeviceContext.h"
 
 class nsDOMUIEvent : public nsDOMEvent,
                      public nsIDOMUIEvent
 {
   typedef mozilla::CSSIntPoint CSSIntPoint;
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -3,17 +3,16 @@
  * 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 nsEventStateManager_h__
 #define nsEventStateManager_h__
 
 #include "mozilla/TypedEnum.h"
 
-#include "nsEvent.h"
 #include "nsGUIEvent.h"
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsFocusManager.h"
 #include "mozilla/TimeStamp.h"
@@ -23,17 +22,16 @@
 class nsIContent;
 class nsIDocument;
 class nsIDocShell;
 class nsIDocShellTreeNode;
 class nsIDocShellTreeItem;
 class imgIContainer;
 class nsDOMDataTransfer;
 class MouseEnterLeaveDispatcher;
-class nsEventStates;
 class nsIMarkupDocumentViewer;
 class nsIScrollableFrame;
 class nsITimer;
 
 namespace mozilla {
 namespace dom {
 class TabParent;
 }
--- a/content/events/src/nsIMEStateManager.h
+++ b/content/events/src/nsIMEStateManager.h
@@ -1,17 +1,17 @@
 /* -*- 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 nsIMEStateManager_h__
 #define nsIMEStateManager_h__
 
-#include "nsEvent.h"
+#include "mozilla/EventForwards.h"
 #include "nsIWidget.h"
 
 class nsDispatchingCallback;
 class nsIContent;
 class nsIDOMMouseEvent;
 class nsINode;
 class nsPIDOMWindow;
 class nsPresContext;
--- a/content/svg/content/src/SVGZoomEvent.h
+++ b/content/svg/content/src/SVGZoomEvent.h
@@ -4,19 +4,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_SVGZoomEvent_h
 #define mozilla_dom_SVGZoomEvent_h
 
 #include "nsAutoPtr.h"
 #include "nsDOMUIEvent.h"
 #include "DOMSVGPoint.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/dom/SVGZoomEventBinding.h"
 
-class nsGUIEvent;
 class nsISVGPoint;
 class nsPresContext;
 
 namespace mozilla {
 namespace dom {
 
 class SVGZoomEvent MOZ_FINAL : public nsDOMUIEvent
 {
--- a/docshell/base/nsILinkHandler.h
+++ b/docshell/base/nsILinkHandler.h
@@ -1,18 +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/. */
 #ifndef nsILinkHandler_h___
 #define nsILinkHandler_h___
 
 #include "nsISupports.h"
+#include "mozilla/EventForwards.h"
 
-class nsGUIEvent;
 class nsIContent;
 class nsIDocShell;
 class nsIInputStream;
 class nsIRequest;
 class nsString;
 
 // Interface ID for nsILinkHandler
 #define NS_ILINKHANDLER_IID \
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsDOMWindowUtils_h_
 #define nsDOMWindowUtils_h_
 
 #include "nsWeakReference.h"
 
 #include "nsIDOMWindowUtils.h"
-#include "nsEvent.h"
 #include "mozilla/Attributes.h"
 
 class nsGlobalWindow;
 class nsIPresShell;
 
 class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
                                    public nsSupportsWeakReference
 {
--- a/dom/base/nsIScriptGlobalObject.h
+++ b/dom/base/nsIScriptGlobalObject.h
@@ -3,22 +3,21 @@
 /* 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 nsIScriptGlobalObject_h__
 #define nsIScriptGlobalObject_h__
 
 #include "nsISupports.h"
-#include "nsEvent.h"
 #include "nsIGlobalObject.h"
 #include "js/TypeDecls.h"
+#include "mozilla/EventForwards.h"
 
 class nsIScriptContext;
-class nsScriptErrorEvent;
 class nsIScriptGlobalObject;
 
 // A helper function for nsIScriptGlobalObject implementations to use
 // when handling a script error.  Generally called by the global when a context
 // notifies it of an error via nsIScriptGlobalObject::HandleScriptError.
 // Returns true if HandleDOMEvent was actually called, in which case
 // aStatus will be filled in with the status.
 bool
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -47,16 +47,23 @@ class Element;
 // nsGlobalWindow::PushPopupControlState()).
 enum PopupControlState {
   openAllowed = 0,  // open that window without worries
   openControlled,   // it's a popup, but allow it
   openAbused,       // it's a popup. disallow it, but allow domain override.
   openOverridden    // disallow window open
 };
 
+enum UIStateChangeType
+{
+  UIStateChangeType_NoChange,
+  UIStateChangeType_Set,
+  UIStateChangeType_Clear
+};
+
 #define NS_PIDOMWINDOW_IID \
 { 0x4f4eadf9, 0xe795, 0x48e5, \
   { 0x89, 0x4b, 0x04, 0x40, 0xb2, 0x5d, 0xa6, 0xfa } }
 
 class nsPIDOMWindow : public nsIDOMWindowInternal
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMWINDOW_IID)
--- a/dom/base/nsQueryContentEventResult.h
+++ b/dom/base/nsQueryContentEventResult.h
@@ -2,18 +2,18 @@
 /* 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 "nsIQueryContentEventResult.h"
 #include "nsString.h"
 #include "nsRect.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/EventForwards.h"
 
-class nsQueryContentEvent;
 class nsIWidget;
 
 class nsQueryContentEventResult MOZ_FINAL : public nsIQueryContentEventResult
 {
 public:
   nsQueryContentEventResult();
   ~nsQueryContentEventResult();
   NS_DECL_ISUPPORTS
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -12,27 +12,24 @@ interface nsIDOMEventTarget;
 [ptr] native IPCMessagePtr(IPC::Message);
 [ptr] native ConstIPCMessagePtr(const IPC::Message);
 [ptr] native EventTargetPtr(mozilla::dom::EventTarget);
 %{C++
 #ifdef ERROR
 #undef ERROR
 #endif
 
-class nsEvent;
+#include "mozilla/EventForwards.h"
 class nsDOMEvent;
-class nsCommandEvent;
 class nsPresContext;
 class nsInvalidateRequestList;
 namespace IPC {
 class Message;
 }
 namespace mozilla {
-class WheelEvent;
-
 namespace dom {
 class EventTarget;
 } // namespace dom
 } // namespace mozilla
 %}
 
 /**
  * The nsIDOMEvent interface is the primary datatype for all events in
--- a/dom/interfaces/events/nsIDOMEventTarget.idl
+++ b/dom/interfaces/events/nsIDOMEventTarget.idl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; 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 "domstubs.idl"
 
 %{C++
-#include "nsEvent.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/dom/Nullable.h"
 #include "js/TypeDecls.h"
 
 using mozilla::dom::Nullable;
 
 namespace mozilla {
 namespace dom {
 class EventTarget;
--- a/dom/plugins/base/nsIPluginInstanceOwner.idl
+++ b/dom/plugins/base/nsIPluginInstanceOwner.idl
@@ -6,18 +6,18 @@
 #include "nsISupports.idl"
 #include "nspluginroot.idl"
 #include "nsIInputStream.idl"
 
 interface nsIDocument;
 
 %{C++
 #include "npapi.h"
+#include "mozilla/EventForwards.h"
 class nsNPAPIPluginInstance;
-class nsPluginEvent;
 %}
 
 [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
 
 // Do not make this interface scriptable, because the virtual functions in C++
 // blocks will make script call the wrong functions.
 [uuid(59BE4CA5-3CB0-40E6-A111-9A88C8477610)]
 interface nsIPluginInstanceOwner : nsISupports
--- a/dom/plugins/ipc/PluginLibrary.h
+++ b/dom/plugins/ipc/PluginLibrary.h
@@ -8,24 +8,24 @@
 #define mozilla_PluginLibrary_h 1
 
 #include "prlink.h"
 #include "npapi.h"
 #include "npfunctions.h"
 #include "nscore.h"
 #include "nsTArray.h"
 #include "nsError.h"
+#include "mozilla/EventForwards.h"
 
 class gfxASurface;
 class gfxContext;
 class nsCString;
 struct nsIntRect;
 struct nsIntSize;
 class nsNPAPIPlugin;
-class nsGUIEvent;
 
 namespace mozilla {
 namespace layers {
 class Image;
 class ImageContainer;
 }
 }
 
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -39,17 +39,16 @@
 #include "nsContentUtils.h"             // for nsContentUtils
 #include "nsDOMString.h"                // for DOMStringIsNull
 #include "nsDebug.h"                    // for NS_ENSURE_TRUE, etc
 #include "nsEditProperty.h"             // for nsEditProperty, etc
 #include "nsEditor.h"
 #include "nsEditorEventListener.h"      // for nsEditorEventListener
 #include "nsEditorUtils.h"              // for nsAutoRules, etc
 #include "nsError.h"                    // for NS_OK, etc
-#include "nsEvent.h"                    // for nsEventStatus, etc
 #include "nsFocusManager.h"             // for nsFocusManager
 #include "nsFrameSelection.h"           // for nsFrameSelection
 #include "nsGUIEvent.h"                 // for nsKeyEvent, nsEvent, etc
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::dir
 #include "nsIAbsorbingTransaction.h"    // for nsIAbsorbingTransaction
 #include "nsIAtom.h"                    // for nsIAtom
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIDOMAttr.h"                 // for nsIDOMAttr
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -2,16 +2,17 @@
 /* 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 __editor_h__
 #define __editor_h__
 
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc.
+#include "mozilla/EventForwards.h"      // for nsKeyEvent
 #include "mozilla/TypedEnum.h"          // for MOZ_BEGIN_ENUM_CLASS, etc.
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMArray.h"                 // for nsCOMArray
 #include "nsCOMPtr.h"                   // for already_AddRefed, nsCOMPtr
 #include "nsCycleCollectionParticipant.h"
 #include "nsEditProperty.h"             // for nsEditProperty, etc
 #include "nsIEditor.h"                  // for nsIEditor::EDirection, etc
 #include "nsIEditorIMESupport.h"        // for NS_DECL_NSIEDITORIMESUPPORT, etc
@@ -58,17 +59,16 @@ class nsIEditorObserver;
 class nsIInlineSpellChecker;
 class nsINode;
 class nsIPresShell;
 class nsIPrivateTextRangeList;
 class nsISelection;
 class nsISupports;
 class nsITransaction;
 class nsIWidget;
-class nsKeyEvent;
 class nsRange;
 class nsString;
 class nsTransactionManager;
 
 namespace mozilla {
 class Selection;
 
 namespace dom {
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -16,16 +16,17 @@
 #include "gfxASurface.h"                // for gfxASurface, etc
 #include "gfxColor.h"                   // for gfxRGBA
 #include "gfxMatrix.h"                  // for gfxMatrix
 #include "gfxPattern.h"                 // for gfxPattern, etc
 #include "gfxPoint.h"                   // for gfxPoint, gfxIntSize
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2, etc
 #include "mozilla/DebugOnly.h"          // for DebugOnly
+#include "mozilla/EventForwards.h"      // for nsPaintEvent
 #include "mozilla/RefPtr.h"             // for TemporaryRef
 #include "mozilla/TimeStamp.h"          // for TimeStamp, TimeDuration
 #include "mozilla/gfx/BaseMargin.h"     // for BaseMargin
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/gfx/Types.h"          // for SurfaceFormat
 #include "mozilla/gfx/UserData.h"       // for UserData, etc
 #include "mozilla/layers/LayersTypes.h"
@@ -42,17 +43,16 @@
 #include "nsStyleAnimation.h"           // for nsStyleAnimation::Value, etc
 #include "nsTArray.h"                   // for nsTArray
 #include "nsTArrayForwardDeclare.h"     // for InfallibleTArray
 #include "nscore.h"                     // for nsACString, nsAString
 #include "prlog.h"                      // for PRLogModuleInfo
 
 
 class gfxContext;
-class nsPaintEvent;
 
 extern uint8_t gLayerManagerLayerBuilder;
 
 namespace mozilla {
 
 class FrameLayerBuilder;
 class WebGLContext;
 
--- a/gfx/layers/composite/APZCTreeManager.h
+++ b/gfx/layers/composite/APZCTreeManager.h
@@ -7,25 +7,24 @@
 #define mozilla_layers_APZCTreeManager_h
 
 #include <stdint.h>                     // for uint64_t, uint32_t
 #include "FrameMetrics.h"               // for FrameMetrics, etc
 #include "Units.h"                      // for CSSPoint, CSSRect, etc
 #include "gfxPoint.h"                   // for gfxPoint
 #include "gfx3DMatrix.h"                // for gfx3DMatrix
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2
+#include "mozilla/EventForwards.h"      // for nsInputEvent, nsEventStatus
 #include "mozilla/Monitor.h"            // for Monitor
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
-#include "nsEvent.h"                    // for nsEventStatus
 #include "nsISupportsImpl.h"
 #include "nsTraceRefcnt.h"              // for MOZ_COUNT_CTOR, etc
 
 class gfx3DMatrix;
-class nsInputEvent;
 template <class E> class nsTArray;
 
 namespace mozilla {
 class InputData;
 
 namespace layers {
 
 class Layer;
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -36,17 +36,16 @@
 #include "mozilla/layers/Axis.h"        // for AxisX, AxisY, Axis, etc
 #include "mozilla/layers/GeckoContentController.h"
 #include "mozilla/layers/TaskThrottler.h"  // for TaskThrottler
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsAlgorithm.h"                // for clamped
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_WARNING
-#include "nsEvent.h"
 #include "nsGUIEvent.h"                 // for nsInputEvent, nsTouchEvent, etc
 #include "nsISupportsImpl.h"
 #include "nsMathUtils.h"                // for NS_hypot
 #include "nsPoint.h"                    // for nsIntPoint
 #include "nsStyleConsts.h"
 #include "nsStyleStruct.h"              // for nsTimingFunction
 #include "nsTArray.h"                   // for nsTArray, nsTArray_Impl, etc
 #include "nsThreadUtils.h"              // for NS_IsMainThread
--- a/gfx/layers/ipc/AsyncPanZoomController.h
+++ b/gfx/layers/ipc/AsyncPanZoomController.h
@@ -4,24 +4,24 @@
  * 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 mozilla_layers_AsyncPanZoomController_h
 #define mozilla_layers_AsyncPanZoomController_h
 
 #include "GeckoContentController.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/RefPtr.h"
 #include "InputData.h"
 #include "Axis.h"
 #include "TaskThrottler.h"
 #include "gfx3DMatrix.h"
-#include "nsEvent.h"
 
 #include "base/message_loop.h"
 
 namespace mozilla {
 namespace layers {
 
 struct ScrollableLayerGuid;
 class CompositorParent;
--- a/gfx/layers/ipc/GestureEventListener.h
+++ b/gfx/layers/ipc/GestureEventListener.h
@@ -6,18 +6,18 @@
 
 #ifndef mozilla_layers_GestureEventListener_h
 #define mozilla_layers_GestureEventListener_h
 
 #include <stdint.h>                     // for uint64_t
 #include "InputData.h"                  // for MultiTouchInput, etc
 #include "Units.h"                      // for ScreenIntPoint
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2
+#include "mozilla/EventForwards.h"      // for nsEventStatus
 #include "nsAutoPtr.h"                  // for nsRefPtr
-#include "nsEvent.h"                    // for nsEventStatus
 #include "nsISupportsImpl.h"
 #include "nsTArray.h"                   // for nsTArray
 
 class CancelableTask;
 
 namespace mozilla {
 namespace layers {
 
--- a/layout/base/PositionedEventTargeting.h
+++ b/layout/base/PositionedEventTargeting.h
@@ -1,19 +1,19 @@
 /* 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 mozilla_PositionedEventTargeting_h
 #define mozilla_PositionedEventTargeting_h
 
 #include <stdint.h>
+#include "mozilla/EventForwards.h"
 
 class nsIFrame;
-class nsGUIEvent;
 struct nsPoint;
 
 namespace mozilla {
 
 enum {
   INPUT_IGNORE_ROOT_SCROLL_FRAME = 0x01
 };
 /**
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -15,25 +15,25 @@
  * 05/03/2000   IBM Corp.       Observer related defines for reflow
  */
 
 /* a presentation of a document, part 2 */
 
 #ifndef nsIPresShell_h___
 #define nsIPresShell_h___
 
+#include "mozilla/EventForwards.h"
 #include "mozilla/MemoryReporting.h"
 #include "gfxPoint.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsISupports.h"
 #include "nsQueryFrame.h"
 #include "nsCoord.h"
 #include "nsColor.h"
-#include "nsEvent.h"
 #include "nsCompatibility.h"
 #include "nsFrameManagerBase.h"
 #include "mozFlushType.h"
 #include "nsWeakReference.h"
 #include <stdio.h> // for FILE definition
 #include "nsChangeHint.h"
 #include "nsRefPtrHashtable.h"
 #include "nsEventStates.h"
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -3,22 +3,22 @@
  * 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 nsRangeFrame_h___
 #define nsRangeFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Decimal.h"
+#include "mozilla/EventForwards.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsCOMPtr.h"
 
 class nsBaseContentList;
-class nsGUIEvent;
 
 class nsRangeFrame : public nsContainerFrame,
                      public nsIAnonymousContentCreator
 {
   friend nsIFrame*
   NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   nsRangeFrame(nsStyleContext* aContext);
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -4,23 +4,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object that goes directly inside the document's scrollbars */
 
 #ifndef nsCanvasFrame_h___
 #define nsCanvasFrame_h___
 
 #include "mozilla/Attributes.h"
+#include "mozilla/EventForwards.h"
 #include "nsContainerFrame.h"
 #include "nsIScrollPositionListener.h"
 #include "nsDisplayList.h"
 
 class nsPresContext;
 class nsRenderingContext;
-class nsEvent;
 
 /**
  * Root frame class.
  *
  * The root frame is the parent frame for the document element's frame.
  * It only supports having a single child frame which must be an area
  * frame
  */
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -14,17 +14,16 @@
 
 class  nsIContent;
 class  nsPresContext;
 struct nsRect;
 struct nsHTMLReflowState;
 struct nsSize;
 class  nsIAtom;
 class  nsHTMLFramesetBorderFrame;
-class  nsGUIEvent;
 class  nsHTMLFramesetFrame;
 
 #define NO_COLOR 0xFFFFFFFA
 
 // defined at HTMLFrameSetElement.h
 struct nsFramesetSpec;
 
 struct nsBorderColor 
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=78: */
 /* 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 "nsError.h"
 #include "nsIPresShell.h"
-#include "nsEvent.h"
-#include "nsGUIEvent.h"
 #include "nsEventDispatcher.h"
 #include "nsNodeUtils.h"
 #include "nsIFrame.h"
 #include "mozilla/Likely.h"
 
 class nsPresContext;
 
 nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsAHtml5TreeOpSink* aOpSink,
--- a/view/public/nsView.h
+++ b/view/public/nsView.h
@@ -6,18 +6,18 @@
 #ifndef nsView_h__
 #define nsView_h__
 
 #include "nsCoord.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsRegion.h"
 #include "nsCRT.h"
-#include "nsEvent.h"
 #include "nsIWidgetListener.h"
+#include "mozilla/EventForwards.h"
 
 class nsViewManager;
 class nsIWidget;
 class nsIFrame;
 
 // Enumerated type to indicate the visibility of a layer.
 // hide - the layer is not shown.
 // show - the layer is shown irrespective of the visibility of 
--- a/view/public/nsViewManager.h
+++ b/view/public/nsViewManager.h
@@ -3,21 +3,21 @@
  * 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 nsViewManager_h___
 #define nsViewManager_h___
 
 #include "nscore.h"
 #include "nsView.h"
-#include "nsEvent.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsVoidArray.h"
 #include "nsDeviceContext.h"
+#include "mozilla/EventForwards.h"
 
 class nsIWidget;
 struct nsRect;
 class nsRegion;
 class nsDeviceContext;
 class nsIPresShell;
 
 class nsViewManager MOZ_FINAL
rename from widget/nsEvent.h
rename to widget/EventForwards.h
--- a/widget/nsEvent.h
+++ b/widget/EventForwards.h
@@ -1,94 +1,44 @@
 /* -*- 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 nsEvent_h__
-#define nsEvent_h__
+#ifndef mozilla_EventForwards_h__
+#define mozilla_EventForwards_h__
 
 #include <stdint.h>
 
-/*
- * This is in a separate header file because it needs to be included
- * in many places where including nsGUIEvent.h would bring in many
- * header files that are totally unnecessary.
+/**
+ * XXX Following enums should be in BasicEvents.h.  However, currently, it's
+ *     impossible to use foward delearation for enum.
  */
 
-enum UIStateChangeType {
-  UIStateChangeType_NoChange,
-  UIStateChangeType_Set,
-  UIStateChangeType_Clear
-};
-
 /**
  * Return status for event processors.
  */
-
-enum nsEventStatus {  
-    /// The event is ignored, do default processing
-  nsEventStatus_eIgnore,            
-    /// The event is consumed, don't do default processing
-  nsEventStatus_eConsumeNoDefault, 
-    /// The event is consumed, but do default processing
-  nsEventStatus_eConsumeDoDefault  
-};
-
-/**
- * sizemode is an adjunct to widget size
- */
-enum nsSizeMode {
-  nsSizeMode_Normal = 0,
-  nsSizeMode_Minimized,
-  nsSizeMode_Maximized,
-  nsSizeMode_Fullscreen
+enum nsEventStatus
+{
+  // The event is ignored, do default processing
+  nsEventStatus_eIgnore,
+  // The event is consumed, don't do default processing
+  nsEventStatus_eConsumeNoDefault,
+  // The event is consumed, but do default processing
+  nsEventStatus_eConsumeDoDefault
 };
 
-struct nsAlternativeCharCode;
-struct nsTextRangeStyle;
-struct nsTextRange;
-
-class nsEvent;
-class nsGUIEvent;
-class nsScriptErrorEvent;
-class nsScrollbarEvent;
-class nsScrollPortEvent;
-class nsScrollAreaEvent;
-class nsInputEvent;
-class nsMouseEvent_base;
-class nsMouseEvent;
-class nsDragEvent;
-class nsKeyEvent;
-class nsTextEvent;
-class nsCompositionEvent;
-class nsMouseScrollEvent;
-class nsGestureNotifyEvent;
-class nsQueryContentEvent;
-class nsFocusEvent;
-class nsSelectionEvent;
-class nsContentCommandEvent;
-class nsTouchEvent;
-class nsFormEvent;
-class nsCommandEvent;
-class nsUIEvent;
-class nsSimpleGestureEvent;
-class nsTransitionEvent;
-class nsAnimationEvent;
-class nsPluginEvent;
-
 namespace mozilla {
 
-struct EventFlags;
-
-class WheelEvent;
-
-// All modifier keys should be defined here.  This is used for managing
-// modifier states for DOM Level 3 or later.
-enum Modifier {
+/**
+ * All modifier keys should be defined here.  This is used for managing
+ * modifier states for DOM Level 3 or later.
+ */
+enum Modifier
+{
   MODIFIER_ALT        = 0x0001,
   MODIFIER_ALTGRAPH   = 0x0002,
   MODIFIER_CAPSLOCK   = 0x0004,
   MODIFIER_CONTROL    = 0x0008,
   MODIFIER_FN         = 0x0010,
   MODIFIER_META       = 0x0020,
   MODIFIER_NUMLOCK    = 0x0040,
   MODIFIER_SCROLLLOCK = 0x0080,
@@ -97,32 +47,79 @@ enum Modifier {
   MODIFIER_OS         = 0x0400
 };
 
 typedef uint16_t Modifiers;
 
 #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \
   KEY_NAME_INDEX_##aCPPName,
 
-enum KeyNameIndex {
+enum KeyNameIndex
+{
 #include "nsDOMKeyNameList.h"
   // There shouldn't be "," at the end of enum definition, this dummy item
   // avoids bustage on some platforms.
   NUMBER_OF_KEY_NAME_INDEX
 };
 
 #undef NS_DEFINE_KEYNAME
 
 } // namespace mozilla
 
-#define NS_DOM_KEYNAME_ALT        "Alt"
-#define NS_DOM_KEYNAME_ALTGRAPH   "AltGraph"
-#define NS_DOM_KEYNAME_CAPSLOCK   "CapsLock"
-#define NS_DOM_KEYNAME_CONTROL    "Control"
-#define NS_DOM_KEYNAME_FN         "Fn"
-#define NS_DOM_KEYNAME_META       "Meta"
-#define NS_DOM_KEYNAME_NUMLOCK    "NumLock"
-#define NS_DOM_KEYNAME_SCROLLLOCK "ScrollLock"
-#define NS_DOM_KEYNAME_SHIFT      "Shift"
-#define NS_DOM_KEYNAME_SYMBOLLOCK "SymbolLock"
-#define NS_DOM_KEYNAME_OS         "OS"
+/**
+ * All header files should include this header instead of *Events.h.
+ */
+
+// BasicEvents.h
+namespace mozilla {
+struct EventFlags;
+} // namespace mozilla
+
+class nsEvent;
+class nsGUIEvent;
+class nsInputEvent;
+class nsUIEvent;
+
+// TextEvents.h
+struct nsAlternativeCharCode;
+struct nsTextRangeStyle;
+struct nsTextRange;
+
+class nsKeyEvent;
+class nsTextEvent;
+class nsCompositionEvent;
+class nsQueryContentEvent;
+class nsSelectionEvent;
 
-#endif // nsEvent_h__
+// MouseEvents.h
+class nsMouseEvent_base;
+class nsMouseEvent;
+class nsDragEvent;
+class nsMouseScrollEvent;
+
+namespace mozilla {
+class WheelEvent;
+} // namespace mozilla
+
+// TouchEvents.h
+class nsGestureNotifyEvent;
+class nsTouchEvent;
+class nsSimpleGestureEvent;
+
+// ContentEvents.h
+class nsScriptErrorEvent;
+class nsScrollPortEvent;
+class nsScrollAreaEvent;
+class nsFormEvent;
+class nsClipboardEvent;
+class nsFocusEvent;
+class nsTransitionEvent;
+class nsAnimationEvent;
+
+// MiscEvents.h
+class nsCommandEvent;
+class nsContentCommandEvent;
+class nsPluginEvent;
+
+// content/events/public/nsMutationEvent.h
+class nsMutationEvent;
+
+#endif // mozilla_EventForwards_h__
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -5,19 +5,18 @@
 
 #ifndef InputData_h__
 #define InputData_h__
 
 #include "nsDebug.h"
 #include "nsPoint.h"
 #include "nsTArray.h"
 #include "Units.h"
+#include "mozilla/EventForwards.h"
 
-class nsTouchEvent;
-class nsMouseEvent;
 namespace mozilla {
 
 
 enum InputType
 {
   MULTITOUCH_INPUT,
   PINCHGESTURE_INPUT,
   TAPGESTURE_INPUT
--- a/widget/cocoa/TextInputHandler.h
+++ b/widget/cocoa/TextInputHandler.h
@@ -12,20 +12,19 @@
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 #include "mozView.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsITimer.h"
 #include "npapi.h"
 #include "nsTArray.h"
-#include "nsEvent.h"
+#include "mozilla/EventForwards.h"
 
 class nsChildView;
-struct nsTextRange;
 
 namespace mozilla {
 namespace widget {
 
 // Key code constants
 enum
 {
   kVK_RightCommand    = 0x36, // right command key
--- a/widget/cocoa/nsCocoaUtils.h
+++ b/widget/cocoa/nsCocoaUtils.h
@@ -5,23 +5,24 @@
 
 #ifndef nsCocoaUtils_h_
 #define nsCocoaUtils_h_
 
 #import <Cocoa/Cocoa.h>
 
 #include "nsRect.h"
 #include "imgIContainer.h"
-#include "nsEvent.h"
 #include "npapi.h"
 #include "nsTArray.h"
 
 // This must be the last include:
 #include "nsObjCExceptions.h"
 
+#include "mozilla/EventForwards.h"
+
 // Declare the backingScaleFactor method that we want to call
 // on NSView/Window/Screen objects, if they recognize it.
 @interface NSObject (BackingScaleFactorCategory)
 - (CGFloat)backingScaleFactor;
 @end
 
 class nsIWidget;
 
--- a/widget/cocoa/nsMenuUtilsX.h
+++ b/widget/cocoa/nsMenuUtilsX.h
@@ -2,17 +2,16 @@
 /* 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 nsMenuUtilsX_h_
 #define nsMenuUtilsX_h_
 
 #include "nscore.h"
-#include "nsEvent.h"
 #include "nsMenuBaseX.h"
 
 #import <Cocoa/Cocoa.h>
 
 class nsIContent;
 class nsString;
 class nsMenuBarX;
 
--- a/widget/cocoa/nsStandaloneNativeMenu.mm
+++ b/widget/cocoa/nsStandaloneNativeMenu.mm
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #import <Cocoa/Cocoa.h>
 
 #include "nsStandaloneNativeMenu.h"
 #include "nsMenuUtilsX.h"
 #include "nsIDOMElement.h"
 #include "nsIMutationObserver.h"
-#include "nsEvent.h"
 #include "nsGUIEvent.h"
 #include "nsGkAtoms.h"
 #include "nsObjCExceptions.h"
 
 
 NS_IMPL_ISUPPORTS2(nsStandaloneNativeMenu, nsIMutationObserver, nsIStandaloneNativeMenu)
 
 nsStandaloneNativeMenu::nsStandaloneNativeMenu()
--- a/widget/gonk/GonkKeyMapping.h
+++ b/widget/gonk/GonkKeyMapping.h
@@ -11,18 +11,18 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #ifndef GONKKEYMAPPING_H
 #define GONKKEYMAPPING_H
 
-#include "nsEvent.h"
 #include "libui/android_keycodes.h"
+#include "mozilla/EventForwards.h"
 
 namespace mozilla {
 namespace widget {
 
 /* See libui/KeycodeLabels.h for the mapping */
 static const unsigned long kKeyMapping[] = {
     0,
     0, // SOFT_LEFT
--- a/widget/gtk/nsGtkKeyUtils.h
+++ b/widget/gtk/nsGtkKeyUtils.h
@@ -3,18 +3,18 @@
  */
 /* 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 __nsGdkKeyUtils_h__
 #define __nsGdkKeyUtils_h__
 
-#include "nsEvent.h"
 #include "nsTArray.h"
+#include "mozilla/EventForwards.h"
 
 #include <gdk/gdk.h>
 
 namespace mozilla {
 namespace widget {
 
 /**
  *  KeymapWrapper is a wrapper class of GdkKeymap.  GdkKeymap doesn't support
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -94,29 +94,29 @@ if CONFIG['MOZ_METRO']:
         'MetroUIUtils.idl',
         'nsIWinMetroUtils.idl',
     ]
 
 MODULE = 'widget'
 
 EXPORTS += [
     'InputData.h',
-    'nsEvent.h',
     'nsGUIEvent.h',
     'nsIDeviceContextSpec.h',
     'nsINativeKeyBindings.h',
     'nsIPluginWidget.h',
     'nsIRollupListener.h',
     'nsIWidget.h',
     'nsIWidgetListener.h',
     'nsWidgetInitData.h',
     'nsWidgetsCID.h',
 ]
 
 EXPORTS.mozilla += [
+    'EventForwards.h',
     'LookAndFeel.h',
     'WidgetUtils.h',
 ]
 
 if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
     EXPORTS.mozilla += [
         'WidgetTraceEvent.h',
     ]
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -5,31 +5,31 @@
 
 #ifndef nsGUIEvent_h__
 #define nsGUIEvent_h__
 
 #include "mozilla/MathAlgorithms.h"
 
 #include "nsPoint.h"
 #include "nsRect.h"
-#include "nsEvent.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMWheelEvent.h"
 #include "nsIDOMDataTransfer.h"
 #include "nsWeakPtr.h"
 #include "nsIWidget.h"
 #include "nsTArray.h"
 #include "nsTraceRefcnt.h"
 #include "nsITransferable.h"
 #include "nsStyleConsts.h"
 #include "nsAutoPtr.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/Touch.h"
 #include "Units.h"
 
 namespace mozilla {
 namespace dom {
   class PBrowserParent;
   class PBrowserChild;
@@ -472,28 +472,29 @@ enum nsEventStructType {
 #define NS_GAMEPAD_AXISMOVE      (NS_GAMEPAD_START+2)
 #define NS_GAMEPAD_CONNECTED     (NS_GAMEPAD_START+3)
 #define NS_GAMEPAD_DISCONNECTED  (NS_GAMEPAD_START+4)
 // Keep this defined to the same value as the event above
 #define NS_GAMEPAD_END           (NS_GAMEPAD_START+4)
 #endif
 
 /**
- * Return status for event processors, nsEventStatus, is defined in
- * nsEvent.h.
+ * Modifier key names.
  */
-
-/**
- * different types of (top-level) window z-level positioning
- */
-enum nsWindowZ {
-  nsWindowZTop = 0,   // on top
-  nsWindowZBottom,    // on bottom
-  nsWindowZRelative   // just below some specified widget
-};
+#define NS_DOM_KEYNAME_ALT        "Alt"
+#define NS_DOM_KEYNAME_ALTGRAPH   "AltGraph"
+#define NS_DOM_KEYNAME_CAPSLOCK   "CapsLock"
+#define NS_DOM_KEYNAME_CONTROL    "Control"
+#define NS_DOM_KEYNAME_FN         "Fn"
+#define NS_DOM_KEYNAME_META       "Meta"
+#define NS_DOM_KEYNAME_NUMLOCK    "NumLock"
+#define NS_DOM_KEYNAME_SCROLLLOCK "ScrollLock"
+#define NS_DOM_KEYNAME_SHIFT      "Shift"
+#define NS_DOM_KEYNAME_SYMBOLLOCK "SymbolLock"
+#define NS_DOM_KEYNAME_OS         "OS"
 
 namespace mozilla {
 
 // BaseEventFlags must be a POD struct for safe to use memcpy (including
 // in ParamTraits<BaseEventFlags>).  So don't make virtual methods, constructor,
 // destructor and operators.
 // This is necessary for VC which is NOT C++0x compiler.
 struct BaseEventFlags
--- a/widget/nsINativeKeyBindings.h
+++ b/widget/nsINativeKeyBindings.h
@@ -2,17 +2,17 @@
 /* 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 nsINativeKeyBindings_h_
 #define nsINativeKeyBindings_h_
 
 #include "nsISupports.h"
-#include "nsEvent.h"
+#include "mozilla/EventForwards.h"
 
 #define NS_INATIVEKEYBINDINGS_IID \
 {0xc2baecc3, 0x1758, 0x4211, {0x96, 0xbe, 0xee, 0x1b, 0x1b, 0x7c, 0xd7, 0x6d}}
 
 #define NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX \
   "@mozilla.org/widget/native-key-bindings;1?type="
 
 #define NS_NATIVEKEYBINDINGSINPUT_CONTRACTID \
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -6,32 +6,31 @@
 #ifndef nsIWidget_h__
 #define nsIWidget_h__
 
 #include "nsISupports.h"
 #include "nsColor.h"
 #include "nsRect.h"
 #include "nsString.h"
 
-#include "nsEvent.h"
 #include "nsCOMPtr.h"
 #include "nsWidgetInitData.h"
 #include "nsTArray.h"
 #include "nsXULAppAPI.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/RefPtr.h"
 #include "Units.h"
 
 // forward declarations
 class   nsFontMetrics;
 class   nsRenderingContext;
 class   nsDeviceContext;
 struct  nsFont;
 class   nsIRollupListener;
-class   nsGUIEvent;
 class   imgIContainer;
 class   gfxASurface;
 class   nsIContent;
 class   ViewWrapper;
 class   nsIWidgetListener;
 class   nsIntRegion;
 
 namespace mozilla {
--- a/widget/nsIWidgetListener.h
+++ b/widget/nsIWidgetListener.h
@@ -8,16 +8,37 @@
 #include "nscore.h"
 #include "nsGUIEvent.h"
 #include "nsIXULWindow.h"
 #include "nsRegion.h"
 
 class nsView;
 class nsIPresShell;
 
+/**
+ * sizemode is an adjunct to widget size
+ */
+enum nsSizeMode
+{
+  nsSizeMode_Normal = 0,
+  nsSizeMode_Minimized,
+  nsSizeMode_Maximized,
+  nsSizeMode_Fullscreen
+};
+
+/**
+ * different types of (top-level) window z-level positioning
+ */
+enum nsWindowZ
+{
+  nsWindowZTop = 0,   // on top
+  nsWindowZBottom,    // on bottom
+  nsWindowZRelative   // just below some specified widget
+};
+
 class nsIWidgetListener
 {
 public:
 
   /**
    * If this listener is for an nsIXULWindow, return it. If this is null, then
    * this is likely a listener for a view, which can be determined using
    * GetView. If both methods return null, this will be an nsWebBrowser.
--- a/widget/qt/nsQtKeyUtils.h
+++ b/widget/qt/nsQtKeyUtils.h
@@ -3,16 +3,16 @@
  */
 /* 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 __nsQtKeyUtils_h__
 #define __nsQtKeyUtils_h__
 
-#include "nsEvent.h"
+#include "mozilla/EventForwards.h"
 
 int      QtKeyCodeToDOMKeyCode     (int aKeysym);
 int      DOMKeyCodeToQtKeyCode     (int aKeysym);
 
 mozilla::KeyNameIndex QtKeyCodeToDOMKeyNameIndex(int aKeysym);
 
 #endif /* __nsQtKeyUtils_h__ */
--- a/widget/shared/WidgetUtils.h
+++ b/widget/shared/WidgetUtils.h
@@ -4,19 +4,19 @@
  * 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 __mozilla_widget_WidgetUtils_h__
 #define __mozilla_widget_WidgetUtils_h__
 
 #include "nsCOMPtr.h"
 #include "nsIWidget.h"
-#include "nsEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMWindow.h"
+#include "mozilla/EventForwards.h"
 
 namespace mozilla {
 namespace widget {
 
 class WidgetUtils
 {
 public:
 
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -3,20 +3,20 @@
  * 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 KeyboardLayout_h__
 #define KeyboardLayout_h__
 
 #include "nscore.h"
 #include "nsAutoPtr.h"
-#include "nsEvent.h"
 #include "nsString.h"
 #include "nsWindowBase.h"
 #include "nsWindowDefs.h"
+#include "mozilla/EventForwards.h"
 #include <windows.h>
 
 #define NS_NUM_OF_KEYS          70
 
 #define VK_OEM_1                0xBA   // ';:' for US
 #define VK_OEM_PLUS             0xBB   // '+' any country
 #define VK_OEM_COMMA            0xBC
 #define VK_OEM_MINUS            0xBD   // '-' any country
--- a/widget/windows/WinIMEHandler.h
+++ b/widget/windows/WinIMEHandler.h
@@ -2,17 +2,16 @@
 /* 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 WinIMEHandler_h_
 #define WinIMEHandler_h_
 
 #include "nscore.h"
-#include "nsEvent.h"
 #include "nsIWidget.h"
 #include <windows.h>
 #include <inputscope.h>
 
 #define NS_WM_IMEFIRST WM_IME_SETCONTEXT
 #define NS_WM_IMELAST  WM_IME_KEYUP
 
 class nsWindow;
--- a/widget/windows/WinMouseScrollHandler.h
+++ b/widget/windows/WinMouseScrollHandler.h
@@ -4,18 +4,18 @@
  * 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 mozilla_widget_WinMouseScrollHandler_h__
 #define mozilla_widget_WinMouseScrollHandler_h__
 
 #include "nscore.h"
 #include "nsDebug.h"
-#include "nsEvent.h"
 #include "mozilla/Assertions.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/TimeStamp.h"
 #include <windows.h>
 
 class nsWindowBase;
 struct nsIntPoint;
 
 namespace mozilla {
 namespace widget {
--- a/widget/windows/nsTextStore.h
+++ b/widget/windows/nsTextStore.h
@@ -27,17 +27,16 @@
 // TSF InputScope, for earlier SDK 8
 #define IS_SEARCH static_cast<InputScope>(50)
 
 struct ITfThreadMgr;
 struct ITfDocumentMgr;
 struct ITfDisplayAttributeMgr;
 struct ITfCategoryMgr;
 class nsWindow;
-class nsTextEvent;
 #ifdef MOZ_METRO
 class MetroWidget;
 #endif
 
 // It doesn't work well when we notify TSF of text change
 // during a mutation observer call because things get broken.
 // So we post a message and notify TSF when we get it later.
 #define WM_USER_TSF_TEXTCHANGE  (WM_USER + 0x100)
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -13,22 +13,22 @@
 #include "nsAutoPtr.h"
 #include "nsBaseWidget.h"
 #include "nsWindowBase.h"
 #include "nsdefs.h"
 #include "nsIdleService.h"
 #include "nsToolkit.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "nsEvent.h"
 #include "gfxWindowsSurface.h"
 #include "nsWindowDbg.h"
 #include "cairo.h"
 #include "nsITimer.h"
 #include "nsRegion.h"
+#include "mozilla/EventForwards.h"
 #include "mozilla/TimeStamp.h"
 #include "nsMargin.h"
 
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 #endif
 
 #include "nsWinGesture.h"
--- a/widget/windows/winrt/MetroInput.h
+++ b/widget/windows/winrt/MetroInput.h
@@ -3,31 +3,29 @@
  * 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/. */
 
 #pragma once
 
 // Moz headers (alphabetical)
 #include "keyboardlayout.h"   // mModifierKeyState
 #include "nsBaseHashtable.h"  // mTouches
-#include "nsGUIEvent.h"       // mTouchEvent (nsTouchEvent)
 #include "nsHashKeys.h"       // type of key for mTouches
 #include "mozwrlbase.h"
 #include "nsDeque.h"
+#include "mozilla/EventForwards.h"
 
 // System headers (alphabetical)
 #include <EventToken.h>     // EventRegistrationToken
 #include <stdint.h>         // uint32_t
 #include <wrl\client.h>     // Microsoft::WRL::ComPtr class
 #include <wrl\implements.h> // Microsoft::WRL::InspectableClass macro
 
 // Moz forward declarations
 class MetroWidget;
-enum nsEventStatus;
-class nsGUIEvent;
 struct nsIntPoint;
 
 namespace mozilla {
 namespace dom {
 class Touch;
 }
 }
 
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -11,16 +11,18 @@
 #include "nsWidgetsCID.h"
 #include "nsIFile.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsGUIEvent.h"
 #include "nsAutoPtr.h"
 #include "nsIRollupListener.h"
 #include "nsIObserver.h"
+#include "nsIWidgetListener.h"
+#include "nsPIDOMWindow.h"
 #include <algorithm>
 class nsIContent;
 class nsAutoRollup;
 class gfxContext;
 
 namespace mozilla {
 #ifdef ACCESSIBILITY
 namespace a11y {
--- a/xpfe/appshell/src/nsWebShellWindow.h
+++ b/xpfe/appshell/src/nsWebShellWindow.h
@@ -2,17 +2,16 @@
 /* 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 nsWebShellWindow_h__
 #define nsWebShellWindow_h__
 
 #include "mozilla/Mutex.h"
-#include "nsEvent.h"
 #include "nsIWebProgressListener.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsXULWindow.h"
 #include "nsIWidgetListener.h"
 
 /* Forward declarations.... */
 class nsIURI;
--- a/xpfe/appshell/src/nsXULWindow.h
+++ b/xpfe/appshell/src/nsXULWindow.h
@@ -23,19 +23,19 @@
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindow.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIXULWindow.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
-#include "nsGUIEvent.h"
 #include "nsIXULBrowserWindow.h"
 #include "nsIWeakReference.h"
+#include "nsIWidgetListener.h"
 
 namespace mozilla {
 namespace dom {
 class Element;
 }
 }
 
 // nsXULWindow