Bug 431634 - Part 1 - clean up header pollution; r+sr=roc
authorJeremy D. Lea <reg@openpave.org>
Wed, 01 Apr 2009 13:59:02 -0800
changeset 26846 6052ce2d3507e3498fb09e62c3ea25b910c2bdcc
parent 26845 725b47d5d4ec4132a09f46d8b247bf4338535b54
child 26847 37d76d13964e3ba5e236b12825ee475650d57a0b
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs431634
milestone1.9.2a1pre
Bug 431634 - Part 1 - clean up header pollution; r+sr=roc
accessible/src/base/nsCaretAccessible.cpp
accessible/src/msaa/nsDocAccessibleWrap.cpp
accessible/src/msaa/nsTextAccessibleWrap.cpp
content/base/src/nsContentSink.cpp
content/events/public/nsEventDispatcher.h
content/events/src/nsEventStateManager.h
content/events/src/nsIMEStateManager.h
docshell/base/nsDocShell.h
dom/base/nsWindowRoot.cpp
editor/libeditor/html/nsHTMLEditor.cpp
embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
embedding/qa/testembed/BrowserView.cpp
embedding/qa/testembed/BrowserView.h
gfx/public/nsIDeviceContext.h
gfx/src/thebes/nsThebesDeviceContext.cpp
gfx/tests/coverage/main.cpp
layout/base/nsStyleConsts.h
layout/forms/nsHTMLButtonControlFrame.cpp
layout/generic/nsFrameFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsImageFrame.cpp
layout/style/nsCSSProps.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleStruct.cpp
layout/xul/base/public/nsXULPopupManager.h
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsBoxObject.cpp
layout/xul/base/src/nsDocElementBoxFrame.cpp
layout/xul/base/src/nsMenuBarFrame.h
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.h
layout/xul/base/src/nsResizerFrame.cpp
view/public/nsIView.h
view/src/nsView.h
view/src/nsViewManager.h
widget/public/Makefile.in
widget/public/nsEvent.h
widget/public/nsGUIEvent.h
widget/public/nsIEventListener.h
widget/public/nsIMenuRollup.h
widget/public/nsIWidget.h
widget/public/nsNativeWidget.h
widget/public/nsWidgetInitData.h
widget/src/cocoa/nsChildView.h
widget/src/cocoa/nsCocoaUtils.h
widget/src/cocoa/nsDragService.mm
widget/src/cocoa/nsMenuUtilsX.h
widget/src/qt/nsFilePicker.cpp
widget/src/windows/nsDeviceContextSpecWin.h
widget/src/windows/nsNativeDragTarget.h
widget/src/windows/nsWindow.h
widget/src/xpwidgets/nsBaseFilePicker.h
widget/src/xpwidgets/nsNativeTheme.cpp
xpfe/appshell/src/nsAppShellService.cpp
xpfe/appshell/src/nsWebShellWindow.h
xpfe/appshell/src/nsXULWindow.h
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -46,17 +46,18 @@
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsRootAccessible.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelection2.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIViewManager.h"
-#include "nsIWidget.h"
+
+class nsIWidget;
 
 NS_IMPL_ISUPPORTS1(nsCaretAccessible, nsISelectionListener)
   
 nsCaretAccessible::nsCaretAccessible( nsRootAccessible *aRootAccessible):
 mLastCaretOffset(-1), mRootAccessible(aRootAccessible)
 {
 }
 
--- a/accessible/src/msaa/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -44,17 +44,16 @@
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPresShell.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
 #include "nsIViewManager.h"
 #include "nsIWebNavigation.h"
-#include "nsIWidget.h"
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 //----- nsDocAccessibleWrap -----
 
 nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell): 
--- a/accessible/src/msaa/nsTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsTextAccessibleWrap.cpp
@@ -40,17 +40,16 @@
 #include "nsTextAccessibleWrap.h"
 #include "ISimpleDOMText_i.c"
 #include "nsIAccessibleDocument.h"
 #include "nsIFontMetrics.h"
 #include "nsIFrame.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIRenderingContext.h"
-#include "nsIWidget.h"
 #include "nsIComponentManager.h"
 
 // --------------------------------------------------------
 // nsTextAccessibleWrap Accessible
 // --------------------------------------------------------
 
 nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
 nsTextAccessible(aDOMNode, aShell)
@@ -207,19 +206,16 @@ nsresult nsTextAccessibleWrap::GetCharac
 {
   *aX = *aY = *aWidth = *aHeight = 0;
   nsPresContext *presContext = GetPresContext();
   NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
 
   nsIFrame *frame = GetFrame();
   NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
 
-  nsIWidget *widget = frame->GetWindow();
-  NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
-  
   nsPoint startPoint, endPoint;
   nsIFrame *startFrame = GetPointFromOffset(frame, aStartOffset, PR_TRUE, startPoint);
   nsIFrame *endFrame = GetPointFromOffset(frame, aEndOffset, PR_FALSE, endPoint);
   if (!startFrame || !endFrame) {
     return E_FAIL;
   }
   
   nsIntRect sum(0, 0, 0, 0);
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -84,16 +84,17 @@
 #include "nsParserUtils.h"
 #include "nsCRT.h"
 #include "nsEscape.h"
 #include "nsWeakReference.h"
 #include "nsUnicharUtils.h"
 #include "nsNodeInfoManager.h"
 #include "nsTimer.h"
 #include "nsIAppShell.h"
+#include "nsIWidget.h"
 #include "nsWidgetsCID.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIRequest.h"
 #include "nsNodeUtils.h"
 #include "nsIDOMNode.h"
 #include "nsThreadUtils.h"
 #include "nsPresShellIterator.h"
 #include "nsPIDOMWindow.h"
--- a/content/events/public/nsEventDispatcher.h
+++ b/content/events/public/nsEventDispatcher.h
@@ -34,21 +34,23 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifdef MOZILLA_INTERNAL_API
 #ifndef nsEventDispatcher_h___
 #define nsEventDispatcher_h___
 
-#include "nsGUIEvent.h"
+#include "nsCOMPtr.h"
+#include "nsEvent.h"
 
 class nsIContent;
 class nsIDocument;
 class nsPresContext;
+class nsIDOMEvent;
 class nsPIDOMEventTarget;
 class nsIScriptGlobalObject;
 class nsEventTargetChainItem;
 
 
 /**
  * About event dispatching:
  * When either nsEventDispatcher::Dispatch or
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsEventStateManager_h__
 #define nsEventStateManager_h__
 
 #include "nsIEventStateManager.h"
-#include "nsGUIEvent.h"
+#include "nsEvent.h"
 #include "nsIContent.h"
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsHashtable.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "nsCOMArray.h"
--- a/content/events/src/nsIMEStateManager.h
+++ b/content/events/src/nsIMEStateManager.h
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIMEStateManager_h__
 #define nsIMEStateManager_h__
 
 #include "nscore.h"
-#include "nsGUIEvent.h"
 
 class nsIContent;
 class nsPIDOMWindow;
 class nsPresContext;
 class nsIWidget;
 class nsIFocusController;
 class nsTextStateManager;
 class nsISelection;
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -103,16 +103,17 @@
 #include "nsIAuthPromptProvider.h"
 #include "nsISecureBrowserUI.h"
 #include "nsIObserver.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsPIDOMEventTarget.h"
 #include "nsIURIClassifier.h"
 #include "nsIChannelClassifier.h"
 #include "nsILoadContext.h"
+#include "nsIWidget.h"
 
 class nsIScrollableView;
 class nsDocShell;
 
 /* load commands were moved to nsIDocShell.h */
 /* load types were moved to nsDocShellLoadTypes.h */
 
 /* internally used ViewMode types */
--- a/dom/base/nsWindowRoot.cpp
+++ b/dom/base/nsWindowRoot.cpp
@@ -49,16 +49,17 @@
 #include "nsContentCID.h"
 #include "nsIEventStateManager.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsFocusController.h"
 #include "nsString.h"
 #include "nsEventDispatcher.h"
 #include "nsIProgrammingLanguage.h"
+#include "nsGUIEvent.h"
 
 #include "nsCycleCollectionParticipant.h"
 
 static NS_DEFINE_CID(kEventListenerManagerCID,    NS_EVENTLISTENERMANAGER_CID);
 
 nsWindowRoot::nsWindowRoot(nsIDOMWindow* aWindow)
 {
   mWindow = aWindow;
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -123,17 +123,16 @@
 #include "TextEditorTest.h"
 #include "nsEditorUtils.h"
 #include "nsWSRunObject.h"
 #include "nsHTMLObjectResizer.h"
 #include "nsGkAtoms.h"
 
 #include "nsIFrame.h"
 #include "nsIView.h"
-#include "nsIWidget.h"
 #include "nsIParserService.h"
 #include "nsIEventStateManager.h"
 
 // Some utilities to handle annoying overloading of "A" tag for link and named anchor
 static char hrefText[] = "href";
 static char anchorTxt[] = "anchor";
 static char namedanchorText[] = "namedanchor";
 
--- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
+++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
@@ -66,17 +66,16 @@ WIN_LIBS=                               
 
 #include <unknwn.h>
 #include <commdlg.h>
 
 #include "nsIWebBrowserPrint.h"
 #include "nsString.h"
 #include "nsIServiceManager.h"
 #include "nsReadableUtils.h"
-#include "nsIWidget.h"
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsWin.h"
 #include "nsIPrintOptions.h"
 
 #include "nsRect.h"
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -82,16 +82,17 @@
 #include "nsIContentViewer.h"
 #include "nsIDocumentViewer.h"
 #include "nsIWindowProvider.h"
 #include "nsIMutableArray.h"
 #include "nsISupportsArray.h"
 #include "nsIDeviceContext.h"
 #include "nsIDOMStorage.h"
 #include "nsPIDOMStorage.h"
+#include "nsIWidget.h"
 
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 
 #include "jsinterp.h" // for js_AllocStack() and js_FreeStack()
 
 #ifdef USEWEAKREFS
 #include "nsIWeakReference.h"
--- a/embedding/qa/testembed/BrowserView.cpp
+++ b/embedding/qa/testembed/BrowserView.cpp
@@ -72,19 +72,16 @@
 #include "Tests.h"
 //#include "nsiRequest.h"
 #include "QaUtils.h"
 
 // Print Includes
 #include "PrintProgressDialog.h"
 //#include "PrintSetupDialog.h"
 
-// Mozilla Includes
-#include "nsIWidget.h"
-
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
 static char THIS_FILE[] = __FILE__;
 #endif
 
 // Register message for FindDialog communication
 static UINT WM_FINDMSG = ::RegisterWindowMessage(FINDMSGSTRING);
--- a/embedding/qa/testembed/BrowserView.h
+++ b/embedding/qa/testembed/BrowserView.h
@@ -100,18 +100,16 @@ public:
 	//CNsIRequest *nsiRequest;
 
 	// Mozilla interfaces
 	//
 	nsCOMPtr<nsIWebBrowser> mWebBrowser;
 	nsCOMPtr<nsIBaseWindow> mBaseWindow;
 	nsCOMPtr<nsIWebNavigation> mWebNav;	
 
-	typedef void* nsNativeWidget;
-
 	//nsCOMPtr<nsISHistory> mSessionHistory; // de: added in 5/11/01
 
 	void UpdateBusyState(PRBool aBusy);
 	PRBool mbDocumentLoading;
 
 	void SetCtxMenuLinkUrl(nsAutoString& strLinkUrl);
 	nsAutoString mCtxMenuLinkUrl;
 
--- a/gfx/public/nsIDeviceContext.h
+++ b/gfx/public/nsIDeviceContext.h
@@ -37,20 +37,20 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIDeviceContext_h___
 #define nsIDeviceContext_h___
 
 #include "nsISupports.h"
 #include "nsCoord.h"
 #include "nsRect.h"
-#include "nsIWidget.h"
 #include "nsIRenderingContext.h"
 // XXX we need only gfxTypes.h, but we cannot include it directly.
 #include "gfxPoint.h"
+#include "nsNativeWidget.h"
 
 class nsIView;
 class nsIFontMetrics;
 class nsIWidget;
 class nsIDeviceContextSpec;
 class nsIAtom;
 class gfxUserFontSet;
 
--- a/gfx/src/thebes/nsThebesDeviceContext.cpp
+++ b/gfx/src/thebes/nsThebesDeviceContext.cpp
@@ -39,16 +39,17 @@
 
 #include "nsIServiceManager.h"
 #include "nsIPref.h"
 #include "nsCRT.h"
 
 #include "nsThebesDeviceContext.h"
 #include "nsThebesRenderingContext.h"
 
+#include "nsIWidget.h"
 #include "nsIView.h"
 #include "nsILookAndFeel.h"
 
 #ifdef MOZ_ENABLE_GTK2
 // for getenv
 #include <cstdlib>
 // for round
 #include <cmath>
--- a/gfx/tests/coverage/main.cpp
+++ b/gfx/tests/coverage/main.cpp
@@ -29,17 +29,16 @@
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-#include "nsIWidget.h"
 
 extern nsresult CoverageTest(int * argc, char **argv);
 
 #if defined(XP_WIN) || defined(XP_OS2)
 
 #include <windows.h>
 
 void main(int argc, char **argv)
--- a/layout/base/nsStyleConsts.h
+++ b/layout/base/nsStyleConsts.h
@@ -37,17 +37,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 /* constants used in the style struct data provided by nsStyleContext */
 
 #ifndef nsStyleConsts_h___
 #define nsStyleConsts_h___
 
 #include "nsFont.h"
-#include "nsIWidget.h"
 
 // cairo doesn't support invert
 // #define GFX_HAS_INVERT
 
 // XXX fold this into nsStyleContext and group by nsStyleXXX struct
 
 // Indices into border/padding/margin arrays
 #define NS_SIDE_TOP     0
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -49,17 +49,16 @@
 #include "nsStyleContext.h"
 #include "nsLeafFrame.h"
 #include "nsCSSRendering.h"
 #include "nsISupports.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsIImage.h"
 #include "nsStyleConsts.h"
-#include "nsIWidget.h"
 #include "nsIComponentManager.h"
 #include "nsIDocument.h"
 #include "nsButtonFrameRenderer.h"
 #include "nsFormControlFrame.h"
 #include "nsFrameManager.h"
 #include "nsINameSpaceManager.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLButtonElement.h"
--- a/layout/generic/nsFrameFrame.cpp
+++ b/layout/generic/nsFrameFrame.cpp
@@ -74,17 +74,16 @@
 #include "nsIDOMHTMLFrameElement.h"
 #include "nsIDOMHTMLIFrameElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIFrameLoader.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsXPIDLString.h"
 #include "nsIScrollable.h"
 #include "nsINameSpaceManager.h"
-#include "nsIWidget.h"
 #include "nsWeakReference.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIRenderingContext.h"
 #include "nsIFrameFrame.h"
 #include "nsAutoPtr.h"
 #include "nsIDOMNSHTMLDocument.h"
 #include "nsDisplayList.h"
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -41,17 +41,16 @@
 #define nsGfxScrollFrame_h___
 
 #include "nsHTMLContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsBoxFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollPositionListener.h"
 #include "nsIStatefulFrame.h"
-#include "nsGUIEvent.h"
 #include "nsThreadUtils.h"
 #include "nsIScrollableView.h"
 #include "nsIView.h"
 #include "nsIReflowCallback.h"
 #include "nsBoxLayoutState.h"
 
 class nsPresContext;
 class nsIPresShell;
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -44,17 +44,16 @@
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIContent.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "nsCSSAnonBoxes.h"
-#include "nsIWidget.h"
 #include "nsILinkHandler.h"
 #include "nsGUIEvent.h"
 #include "nsIDocument.h"
 #include "nsIURL.h"
 #include "nsPlaceholderFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -43,17 +43,16 @@
 #include "nsImageFrame.h"
 #include "nsIImageLoadingContent.h"
 #include "nsString.h"
 #include "nsPrintfCString.h"
 #include "nsPresContext.h"
 #include "nsIRenderingContext.h"
 #include "nsIPresShell.h"
 #include "nsIImage.h"
-#include "nsIWidget.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsINodeInfo.h"
 #include "nsContentUtils.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsImageMap.h"
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -39,16 +39,17 @@
 /*
  * methods for dealing with CSS properties and tables of the keyword
  * values they accept
  */
 
 #include "nsCSSProps.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleConsts.h"
+#include "nsIWidget.h"
 #include "nsThemeConstants.h"  // For system widget appearance types
 
 #include "nsILookAndFeel.h" // for system colors
 
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsStaticNameTable.h"
 
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -47,16 +47,17 @@
  * a node in the lexicographic tree of rules that match an element,
  * responsible for converting the rules' information into computed style
  */
 
 #include "nsRuleNode.h"
 #include "nscore.h"
 #include "nsIServiceManager.h"
 #include "nsIDeviceContext.h"
+#include "nsIWidget.h"
 #include "nsILookAndFeel.h"
 #include "nsIPresShell.h"
 #include "nsIThebesFontMetrics.h"
 #include "gfxFont.h"
 #include "nsStyleUtil.h"
 #include "nsCSSPseudoElements.h"
 #include "nsThemeConstants.h"
 #include "nsITheme.h"
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -45,16 +45,17 @@
 
 #include "nsStyleStruct.h"
 #include "nsStyleStructInlines.h"
 #include "nsStyleConsts.h"
 #include "nsThemeConstants.h"
 #include "nsString.h"
 #include "nsPresContext.h"
 #include "nsIDeviceContext.h"
+#include "nsIWidget.h"
 #include "nsIStyleRule.h"
 #include "nsCRT.h"
 
 #include "nsCOMPtr.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
 #include "nsHTMLReflowState.h"
 #include "prenv.h"
--- a/layout/xul/base/public/nsXULPopupManager.h
+++ b/layout/xul/base/public/nsXULPopupManager.h
@@ -39,17 +39,16 @@
  */
 
 #ifndef nsXULPopupManager_h__
 #define nsXULPopupManager_h__
 
 #include "prlog.h"
 #include "nsGUIEvent.h"
 #include "nsIContent.h"
-#include "nsIWidget.h"
 #include "nsIRollupListener.h"
 #include "nsIMenuRollup.h"
 #include "nsIDOMKeyListener.h"
 #include "nsPoint.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 #include "nsThreadUtils.h"
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -46,17 +46,16 @@
 #include "nsIPresShell.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsFrameManager.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIDOMAttr.h"
-#include "nsIWidget.h"
 #include "nsIRenderingContext.h"
 #include "nsIDocument.h"
 #include "nsIDeviceContext.h"
 #include "nsITheme.h"
 #include "nsIServiceManager.h"
 #include "nsIBoxLayout.h"
 
 #ifdef DEBUG_LAYOUT
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -82,17 +82,16 @@
 #include "nsIBoxLayout.h"
 #include "nsSprocketLayout.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "nsWidgetsCID.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsIScrollableView.h"
 #include "nsHTMLContainerFrame.h"
-#include "nsIWidget.h"
 #include "nsIEventStateManager.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsITheme.h"
 #include "nsTransform2D.h"
 #include "nsIEventStateManager.h"
 #include "nsEventDispatcher.h"
 #include "nsIDOMEvent.h"
--- a/layout/xul/base/src/nsBoxObject.cpp
+++ b/layout/xul/base/src/nsBoxObject.cpp
@@ -43,17 +43,16 @@
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIDocShell.h"
 #include "nsReadableUtils.h"
 #include "nsIDOMClassInfo.h"
 #include "nsIView.h"
-#include "nsIWidget.h"
 #ifdef MOZ_XUL
 #include "nsIDOMXULElement.h"
 #else
 #include "nsIDOMElement.h"
 #endif
 #include "nsIFrame.h"
 #include "nsLayoutUtils.h"
 #include "nsISupportsPrimitives.h"
--- a/layout/xul/base/src/nsDocElementBoxFrame.cpp
+++ b/layout/xul/base/src/nsDocElementBoxFrame.cpp
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsHTMLParts.h"
 #include "nsContainerFrame.h"
 #include "nsCSSRendering.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
-#include "nsIWidget.h"
 #include "nsPageFrame.h"
 #include "nsIRenderingContext.h"
 #include "nsGUIEvent.h"
 #include "nsIDOMEvent.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsIEventStateManager.h"
 #include "nsIDeviceContext.h"
--- a/layout/xul/base/src/nsMenuBarFrame.h
+++ b/layout/xul/base/src/nsMenuBarFrame.h
@@ -47,17 +47,16 @@
 
 #include "prtypes.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
 #include "nsBoxFrame.h"
 #include "nsMenuFrame.h"
 #include "nsMenuBarListener.h"
 #include "nsMenuParent.h"
-#include "nsIWidget.h"
 
 class nsIContent;
 
 nsIFrame* NS_NewMenuBarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 class nsMenuBarFrame : public nsBoxFrame, public nsMenuParent
 {
 public:
--- a/layout/xul/base/src/nsMenuFrame.cpp
+++ b/layout/xul/base/src/nsMenuFrame.cpp
@@ -49,17 +49,16 @@
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleContext.h"
 #include "nsCSSRendering.h"
 #include "nsINameSpaceManager.h"
 #include "nsMenuPopupFrame.h"
 #include "nsMenuBarFrame.h"
 #include "nsIView.h"
-#include "nsIWidget.h"
 #include "nsIDocument.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMText.h"
 #include "nsILookAndFeel.h"
 #include "nsIComponentManager.h"
 #include "nsWidgetsCID.h"
--- a/layout/xul/base/src/nsMenuPopupFrame.h
+++ b/layout/xul/base/src/nsMenuPopupFrame.h
@@ -49,20 +49,21 @@
 #include "nsIAtom.h"
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsMenuFrame.h"
 #include "nsIDOMEventTarget.h"
 
 #include "nsBoxFrame.h"
 #include "nsMenuParent.h"
-#include "nsIWidget.h"
 
 #include "nsITimer.h"
 
+class nsIWidget;
+
 // XUL popups can be in several different states. When opening a popup, the
 // state changes as follows:
 //   ePopupClosed - initial state
 //   ePopupShowing - during the period when the popupshowing event fires
 //   ePopupOpen - between the popupshowing event and being visible. Creation
 //                of the child frames, layout and reflow occurs in this state.
 //   ePopupOpenAndVisible - layout is done and AdjustView is called to make
 //                          the popup's widget visible. The popup is now
--- a/layout/xul/base/src/nsResizerFrame.cpp
+++ b/layout/xul/base/src/nsResizerFrame.cpp
@@ -40,17 +40,16 @@
 #include "nsResizerFrame.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsGkAtoms.h"
 #include "nsINameSpaceManager.h"
 
-#include "nsIWidget.h"
 #include "nsPresContext.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIBaseWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsGUIEvent.h"
 #include "nsEventDispatcher.h"
--- a/view/public/nsIView.h
+++ b/view/public/nsIView.h
@@ -33,26 +33,29 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIView_h___
 #define nsIView_h___
 
+#include "nsISupports.h"
 #include "nsCoord.h"
 #include "nsRect.h"
 #include "nsPoint.h"
-#include "nsIWidget.h"
+#include "nsNativeWidget.h"
+#include "nsWidgetInitData.h"
 
 class nsIViewManager;
 class nsIScrollableView;
 class nsViewManager;
 class nsView;
 class nsWeakView;
+class nsIWidget;
 
 // 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 
 //        the layer's parent.
 enum nsViewVisibility {
   nsViewVisibility_kHide = 0,
   nsViewVisibility_kShow = 1
--- a/view/src/nsView.h
+++ b/view/src/nsView.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsView_h___
 #define nsView_h___
 
 #include "nsIView.h"
-#include "nsIWidget.h"
 #include "nsRegion.h"
 #include "nsRect.h"
 #include "nsCRT.h"
 #include "nsIFactory.h"
 #include "nsEvent.h"
 #include <stdio.h>
 
 //mmptemp
--- a/view/src/nsViewManager.h
+++ b/view/src/nsViewManager.h
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsViewManager_h___
 #define nsViewManager_h___
 #include "nsCOMPtr.h"
 #include "nsIViewManager.h"
 #include "nsCRT.h"
-#include "nsIWidget.h"
 #include "nsITimer.h"
 #include "prtime.h"
 #include "prinrval.h"
 #include "nsVoidArray.h"
 #include "nsThreadUtils.h"
 #include "nsIScrollableView.h"
 #include "nsIRegion.h"
 #include "nsView.h"
--- a/widget/public/Makefile.in
+++ b/widget/public/Makefile.in
@@ -45,16 +45,18 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= widget
 XPIDL_MODULE	= widget
 GRE_MODULE	= 1
 
 EXPORTS		= \
 		nsIWidget.h \
 		nsGUIEvent.h \
 		nsEvent.h \
+		nsNativeWidget.h \
+		nsWidgetInitData.h \
 		nsIEventListener.h \
 		nsWidgetsCID.h \
 		nsILookAndFeel.h \
 		nsIPluginWidget.h \
 		nsINativeKeyBindings.h \
 		nsIDeviceContextSpec.h \
 		nsIMenuRollup.h \
 		$(NULL)
--- a/widget/public/nsEvent.h
+++ b/widget/public/nsEvent.h
@@ -52,27 +52,37 @@ 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
+};
+
 class nsEvent;
 
 class nsGUIEvent;
 class nsSizeEvent;
 class nsSizeModeEvent;
 class nsZLevelEvent;
 class nsPaintEvent;
 class nsScrollbarEvent;
 class nsScrollPortEvent;
 class nsInputEvent;
 class nsMouseEvent;
+class nsDragEvent;
 class nsAccessibleEvent;
 class nsKeyEvent;
 class nsTextEvent;
 class nsCompositionEvent;
 class nsMouseScrollEvent;
 class nsReconversionEvent;
 class nsTooltipEvent;
 class nsMenuEvent;
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -421,25 +421,16 @@ class nsHashKey;
 #define NS_SELECTION_SET                (NS_SELECTION_EVENT_START)
 
 /**
  * Return status for event processors, nsEventStatus, is defined in
  * nsEvent.h.
  */
 
 /**
- * sizemode is an adjunct to widget size
- */
-enum nsSizeMode {
-  nsSizeMode_Normal = 0,
-  nsSizeMode_Minimized,
-  nsSizeMode_Maximized
-};
-
-/**
  * different types of (top-level) window z-level positioning
  */
 enum nsWindowZ {
   nsWindowZTop = 0,   // on top
   nsWindowZBottom,    // on bottom
   nsWindowZRelative   // just below some specified widget
 };
 
--- a/widget/public/nsIEventListener.h
+++ b/widget/public/nsIEventListener.h
@@ -34,18 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIEventListener_h__
 #define nsIEventListener_h__
 
 #include "nsISupports.h"
-
-class nsGUIEvent;
+#include "nsEvent.h"
 
 /**
  * Event listener interface.
  * Alternative to a callback for receiving events.
  */
 
 // {c83f6b80-d7ce-11d2-8360-c4c894c4917c}
 #define NS_IEVENTLISTENER_IID \
--- a/widget/public/nsIMenuRollup.h
+++ b/widget/public/nsIMenuRollup.h
@@ -35,19 +35,20 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #ifndef nsIMenuRollup_h___
 #define nsIMenuRollup_h___
 
 #include "nsISupports.h"
-#include "nsIWidget.h"
 #include "nsTArray.h"
 
+class nsIWidget;
+
 #define NS_IMENUROLLUP_IID \
   {0x2b65d177, 0xc3e4, 0x4564, \
     { 0x8d, 0xed, 0x86, 0xd2, 0xfa, 0x2f, 0x65, 0x9a }}
 
 class nsIMenuRollup : public nsISupports {
  public: 
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMENUROLLUP_IID)
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -42,16 +42,18 @@
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "nsRect.h"
 
 #include "prthread.h"
 #include "nsEvent.h"
 #include "nsCOMPtr.h"
 #include "nsITheme.h"
+#include "nsNativeWidget.h"
+#include "nsWidgetInitData.h"
 
 // forward declarations
 class   nsIAppShell;
 class   nsIToolkit;
 class   nsIFontMetrics;
 class   nsIRenderingContext;
 class   nsIDeviceContext;
 class   nsIRegion;
@@ -61,22 +63,24 @@ class   nsIRollupListener;
 class   nsGUIEvent;
 struct  nsColorMap;
 class   imgIContainer;
 class   gfxASurface;
 class   nsIContent;
 
 /**
  * Callback function that processes events.
+ *
  * The argument is actually a subtype (subclass) of nsEvent which carries
- * platform specific information about the event. Platform specific code knows
- * how to deal with it.
- * The return value determines whether or not the default action should take place.
+ * platform specific information about the event. Platform specific code
+ * knows how to deal with it.
+ *
+ * The return value determines whether or not the default action should take
+ * place.
  */
-
 typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
 
 /**
  * Flags for the getNativeData function.
  * See getNativeData()
  */
 #define NS_NATIVE_WINDOW      0
 #define NS_NATIVE_GRAPHIC     1
@@ -113,80 +117,16 @@ typedef void* nsNativeWidget;
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
 
 /**
- * Border styles
- */
-
-enum nsWindowType {     // Don't alter previously encoded enum values - 3rd party apps may look at these
-  // default top level window
-  eWindowType_toplevel,
-  // top level window but usually handled differently by the OS
-  eWindowType_dialog,
-  // used for combo boxes, etc
-  eWindowType_popup,
-  // child windows (contained inside a window on the desktop (has no border))
-  eWindowType_child,
-  // windows that are invisible or offscreen
-  eWindowType_invisible,
-  // plugin window
-  eWindowType_plugin,
-  // java plugin window
-  eWindowType_java,
-  // MacOSX sheet (special dialog class)
-  eWindowType_sheet
-};
-
-enum nsPopupType {
-  ePopupTypePanel,
-  ePopupTypeMenu,
-  ePopupTypeTooltip,
-  ePopupTypeAny = 0xF000 // used only to pass to nsXULPopupManager::GetTopPopup
-};
-
-enum nsBorderStyle
-{
-  // no border, titlebar, etc.. opposite of all
-  eBorderStyle_none     = 0,
-
-  // all window decorations
-  eBorderStyle_all      = 1 << 0,
-
-  // enables the border on the window.  these are only for decoration and are not resize hadles
-  eBorderStyle_border   = 1 << 1,
-
-  // enables the resize handles for the window.  if this is set, border is implied to also be set
-  eBorderStyle_resizeh  = 1 << 2,
-
-  // enables the titlebar for the window
-  eBorderStyle_title    = 1 << 3,
-
-  // enables the window menu button on the title bar.  this being on should force the title bar to display
-  eBorderStyle_menu     = 1 << 4,
-
-  // enables the minimize button so the user can minimize the window.
-  //   turned off for tranient windows since they can not be minimized separate from their parent
-  eBorderStyle_minimize = 1 << 5,
-
-  // enables the maxmize button so the user can maximize the window
-  eBorderStyle_maximize = 1 << 6,
-
-  // show the close button
-  eBorderStyle_close    = 1 << 7,
-
-  // whatever the OS wants... i.e. don't do anything
-  eBorderStyle_default  = -1
-};
-
-/**
  * Cursor types.
  */
 
 enum nsCursor {   ///(normal cursor,       usually rendered as an arrow)
                 eCursor_standard, 
                   ///(system is busy,      usually rendered as a hourglass or watch)
                 eCursor_wait, 
                   ///(Selecting something, usually rendered as an IBeam)
@@ -225,57 +165,22 @@ enum nsCursor {   ///(normal cursor,    
                 eCursor_nwse_resize,
                 eCursor_ns_resize,
                 eCursor_ew_resize,
                 eCursor_none,
                 // This one better be the last one in this list.
                 eCursorCount
                 }; 
 
-enum nsContentType {
-  eContentTypeInherit = -1,
-  eContentTypeUI = 0,
-  eContentTypeContent = 1,
-  eContentTypeContentFrame = 2
-};
-
 enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
   eZPlacementBottom = 0,  // bottom of the window stack
   eZPlacementBelow,       // just below another widget
   eZPlacementTop          // top of the window stack
 };
 
-/**
- * Basic struct for widget initialization data.
- * @see Create member function of nsIWidget
- */
-
-struct nsWidgetInitData {
-  nsWidgetInitData()
-    : clipChildren(PR_FALSE), 
-      clipSiblings(PR_FALSE), 
-      mDropShadow(PR_FALSE),
-      mListenForResizes(PR_FALSE),
-      mWindowType(eWindowType_child),
-      mBorderStyle(eBorderStyle_default),
-      mContentType(eContentTypeInherit),
-      mUnicode(PR_TRUE),
-      mPopupHint(ePopupTypePanel)
-  {
-  }
-
-  // when painting exclude area occupied by child windows and sibling windows
-  PRPackedBool  clipChildren, clipSiblings, mDropShadow;
-  PRPackedBool  mListenForResizes;
-  nsWindowType mWindowType;
-  nsBorderStyle mBorderStyle;
-  nsContentType mContentType;  // Exposed so screen readers know what's UI
-  PRPackedBool mUnicode;
-  nsPopupType mPopupHint;
-};
 
 /**
  * The base class for all the widgets. It provides the interface for
  * all basic and necessary functionality.
  */
 class nsIWidget : public nsISupports {
 
   public:
new file mode 100644
--- /dev/null
+++ b/widget/public/nsNativeWidget.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsNativeWidget_h__
+#define nsNativeWidget_h__
+
+// Hide the native window systems real window type so as to avoid
+// including native window system types and APIs. This is necessary
+// to ensure cross-platform code.
+typedef void* nsNativeWidget;
+
+#endif // nsNativeWidget_h__
new file mode 100644
--- /dev/null
+++ b/widget/public/nsWidgetInitData.h
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsWidgetInitData_h__
+#define nsWidgetInitData_h__
+
+#include "prtypes.h"
+
+/**
+ * Window types
+ *
+ * Don't alter previously encoded enum values - 3rd party apps may look at
+ * these.
+ */
+enum nsWindowType {
+  eWindowType_toplevel,  // default top level window
+  eWindowType_dialog,    // top level window but usually handled differently
+                         // by the OS
+  eWindowType_popup,     // used for combo boxes, etc
+  eWindowType_child,     // child windows (contained inside a window on the
+                         // desktop (has no border))
+  eWindowType_invisible, // windows that are invisible or offscreen
+  eWindowType_plugin,    // plugin window
+  eWindowType_java,      // java plugin window
+  eWindowType_sheet      // MacOSX sheet (special dialog class)
+};
+
+/**
+ * Popup types
+ *
+ * For eWindowType_popup
+ */
+enum nsPopupType {
+  ePopupTypePanel,
+  ePopupTypeMenu,
+  ePopupTypeTooltip,
+  ePopupTypeAny      = 0xF000 // used only to pass to
+                              // nsXULPopupManager::GetTopPopup
+};
+
+/**
+ * Border styles
+ */
+enum nsBorderStyle {
+  eBorderStyle_none     = 0,      // no border, titlebar, etc.. opposite of
+                                  // all
+  eBorderStyle_all      = 1 << 0, // all window decorations
+  eBorderStyle_border   = 1 << 1, // enables the border on the window. these
+                                  // are only for decoration and are not
+                                  // resize handles
+  eBorderStyle_resizeh  = 1 << 2, // enables the resize handles for the
+                                  // window. if this is set, border is
+                                  // implied to also be set
+  eBorderStyle_title    = 1 << 3, // enables the titlebar for the window
+  eBorderStyle_menu     = 1 << 4, // enables the window menu button on the
+                                  // title bar. this being on should force
+                                  // the title bar to display
+  eBorderStyle_minimize = 1 << 5, // enables the minimize button so the user
+                                  // can minimize the window. turned off for
+                                  // tranient windows since they can not be
+                                  // minimized separate from their parent
+  eBorderStyle_maximize = 1 << 6, // enables the maxmize button so the user
+                                  // can maximize the window
+  eBorderStyle_close    = 1 << 7, // show the close button
+  eBorderStyle_default  = -1      // whatever the OS wants... i.e. don't do
+                                  // anything
+};
+
+/**
+ * Content types
+ *
+ * Exposed so screen readers know what's UI
+ */
+enum nsContentType {
+  eContentTypeInherit      = -1,
+  eContentTypeUI           = 0,
+  eContentTypeContent      = 1,
+  eContentTypeContentFrame = 2
+};
+
+/**
+ * Basic struct for widget initialization data.
+ * @see Create member function of nsIWidget
+ */
+
+struct nsWidgetInitData {
+  nsWidgetInitData() :
+      mWindowType(eWindowType_child),
+      mBorderStyle(eBorderStyle_default),
+      mContentType(eContentTypeInherit),
+      mPopupHint(ePopupTypePanel),
+      clipChildren(PR_FALSE), 
+      clipSiblings(PR_FALSE), 
+      mDropShadow(PR_FALSE),
+      mListenForResizes(PR_FALSE),
+      mUnicode(PR_TRUE)
+  {
+  }
+
+  nsWindowType  mWindowType;
+  nsBorderStyle mBorderStyle;
+  nsContentType mContentType;  // Exposed so screen readers know what's UI
+  nsPopupType   mPopupHint;
+  // when painting exclude area occupied by child windows and sibling windows
+  PRPackedBool  clipChildren, clipSiblings, mDropShadow;
+  PRPackedBool  mListenForResizes;
+  PRPackedBool  mUnicode;
+};
+
+#endif // nsWidgetInitData_h__
--- a/widget/src/cocoa/nsChildView.h
+++ b/widget/src/cocoa/nsChildView.h
@@ -49,17 +49,16 @@
 #include "nsAutoPtr.h"
 #include "nsISupports.h"
 #include "nsBaseWidget.h"
 #include "nsIPluginInstanceOwner.h"
 #include "nsIPluginWidget.h"
 #include "nsIScrollableView.h"
 #include "nsWeakPtr.h"
 
-#include "nsIWidget.h"
 #include "nsIAppShell.h"
 
 #include "nsIEventListener.h"
 #include "nsString.h"
 #include "nsIDragService.h"
 
 #include "nsplugindefs.h"
 
--- a/widget/src/cocoa/nsCocoaUtils.h
+++ b/widget/src/cocoa/nsCocoaUtils.h
@@ -39,19 +39,20 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsCocoaUtils_h_
 #define nsCocoaUtils_h_
 
 #import <Cocoa/Cocoa.h>
 
 #include "nsRect.h"
-#include "nsIWidget.h"
 #include "nsObjCExceptions.h"
 
+class nsIWidget;
+
 // "Borrowed" in part from the QTKit framework's QTKitDefines.h.  This is
 // needed when building on OS X Tiger (10.4.X) or with a 10.4 SDK.  It won't
 // be used when building on Leopard (10.5.X) or higher (or with a 10.5 or
 // higher SDK).
 //
 // These definitions for NSInteger and NSUInteger are the 32-bit ones -- since
 // we assume we'll always be building 32-bit binaries when building on Tiger
 // (or with a 10.4 SDK).
--- a/widget/src/cocoa/nsDragService.mm
+++ b/widget/src/cocoa/nsDragService.mm
@@ -45,17 +45,16 @@
 #include "nsISupportsPrimitives.h"
 #include "nsCOMPtr.h"
 #include "nsPrimitiveHelpers.h"
 #include "nsLinebreakConverter.h"
 #include "nsIMacUtils.h"
 #include "nsIDOMNode.h"
 #include "nsRect.h"
 #include "nsPoint.h"
-#include "nsIWidget.h"
 #include "nsIImage.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIIOService.h"
 #include "nsNetUtil.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
--- a/widget/src/cocoa/nsMenuUtilsX.h
+++ b/widget/src/cocoa/nsMenuUtilsX.h
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsMenuUtilsX_h_
 #define nsMenuUtilsX_h_
 
 #include "nscore.h"
-#include "nsGUIEvent.h"
+#include "nsEvent.h"
 #include "nsMenuBaseX.h"
 
 #import <Cocoa/Cocoa.h>
 #import <Carbon/Carbon.h>
 
 class nsIContent;
 class nsString;
 class nsMenuBarX;
--- a/widget/src/qt/nsFilePicker.cpp
+++ b/widget/src/qt/nsFilePicker.cpp
@@ -41,16 +41,17 @@
 
 #include "nsILocalFile.h"
 #include "nsIURI.h"
 #include "nsISupportsArray.h"
 #include "nsMemory.h"
 #include "nsEnumeratorUtils.h"
 #include "nsNetUtil.h"
 #include "nsReadableUtils.h"
+#include "nsIWidget.h"
 
 #include <qfile.h>
 #include <qstringlist.h>
 
 /* Implementation file */
 NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
 
 nsFilePicker::nsFilePicker()
--- a/widget/src/windows/nsDeviceContextSpecWin.h
+++ b/widget/src/windows/nsDeviceContextSpecWin.h
@@ -37,20 +37,21 @@
 
 #ifndef nsDeviceContextSpecWin_h___
 #define nsDeviceContextSpecWin_h___
 
 #include "nsCOMPtr.h"
 #include "nsIDeviceContextSpec.h"
 #include "nsIPrintOptions.h" // For nsIPrinterEnumerator
 #include "nsIPrintSettings.h"
-#include "nsIWidget.h"
 #include "nsISupportsPrimitives.h"
 #include <windows.h>
 
+class nsIWidget;
+
 class nsDeviceContextSpecWin : public nsIDeviceContextSpec
 {
 public:
   nsDeviceContextSpecWin();
 
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
--- a/widget/src/windows/nsNativeDragTarget.h
+++ b/widget/src/windows/nsNativeDragTarget.h
@@ -32,17 +32,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef _nsNativeDragTarget_h_
 #define _nsNativeDragTarget_h_
 
-#include "nsGUIEvent.h"
 #include "nsCOMPtr.h"
 #include "nsIDragSession.h"
 #include <ole2.h>
 #include <shlobj.h>
 
 #ifndef IDropTargetHelper
 #ifndef __MINGW32__   // MingW does not provide shobjidl.h.
 #include <shobjidl.h> // Vista drag image interfaces
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -44,18 +44,16 @@
 #ifndef Window_h__
 #define Window_h__
 
 #include "nsBaseWidget.h"
 #include "nsdefs.h"
 #include "nsSwitchToUIThread.h"
 #include "nsToolkit.h"
 
-#include "nsIWidget.h"
-
 #include "nsIEventListener.h"
 #include "nsString.h"
 
 #include "nsTArray.h"
 
 class nsNativeDragTarget;
 class nsIRollupListener;
 
--- a/widget/src/xpwidgets/nsBaseFilePicker.h
+++ b/widget/src/xpwidgets/nsBaseFilePicker.h
@@ -36,20 +36,23 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsBaseFilePicker_h__
 #define nsBaseFilePicker_h__
 
+#include "nsISupports.h"
 #include "nsIFilePicker.h"
-#include "nsIWidget.h"
 #include "nsISimpleEnumerator.h"
 #include "nsArrayEnumerator.h"
+#include "nsCOMPtr.h"
+
+class nsIWidget;
 
 #define BASEFILEPICKER_HAS_DISPLAYDIRECTORY 1
 
 class nsBaseFilePicker : public nsIFilePicker
 {
 public:
   nsBaseFilePicker(); 
   virtual ~nsBaseFilePicker();
--- a/widget/src/xpwidgets/nsNativeTheme.cpp
+++ b/widget/src/xpwidgets/nsNativeTheme.cpp
@@ -32,16 +32,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsNativeTheme.h"
+#include "nsIWidget.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIEventStateManager.h"
 #include "nsString.h"
 #include "nsINameSpaceManager.h"
--- a/xpfe/appshell/src/nsAppShellService.cpp
+++ b/xpfe/appshell/src/nsAppShellService.cpp
@@ -46,17 +46,16 @@
 #include "nsIServiceManager.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
 #include "nsIXPConnect.h"
 #include "nsIJSContextStack.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 
-#include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsIWindowWatcher.h"
 #include "nsPIWindowWatcher.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsWebShellWindow.h"
 
 #include "nsIEnumerator.h"
 #include "nsCRT.h"
--- a/xpfe/appshell/src/nsWebShellWindow.h
+++ b/xpfe/appshell/src/nsWebShellWindow.h
@@ -33,17 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsWebShellWindow_h__
 #define nsWebShellWindow_h__
 
-#include "nsGUIEvent.h"
+#include "nsEvent.h"
 #include "nsIWebProgressListener.h"
 #include "nsITimer.h"
 
 // can't use forward class decl's because of template bugs on Solaris 
 #include "nsIDOMDocument.h"
 
 #include "nsCOMPtr.h"
 #include "nsXULWindow.h"
--- a/xpfe/appshell/src/nsXULWindow.h
+++ b/xpfe/appshell/src/nsXULWindow.h
@@ -53,17 +53,16 @@
 
 // Interfaces needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIWidget.h"
 #include "nsIXULWindow.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsGUIEvent.h"
 #include "nsIXULBrowserWindow.h"
 #include "nsIWeakReference.h"
 
 // nsXULWindow