From 67a2b8c37c1b2937d7138d5c78d6c093b662db7b Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 20 Aug 2010 14:29:01 -0500 Subject: [PATCH] Bug 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc --- view/src/nsView.cpp | 12 ++++++++++-- view/src/nsView.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index 73a09cc4561..828e679f068 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -745,6 +745,16 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData); } + InitializeWindow(aEnableDragDrop, aResetVisibility); + + return NS_OK; +} + +void +nsView::InitializeWindow(bool aEnableDragDrop, bool aResetVisibility) +{ + NS_ABORT_IF_FALSE(mWindow, "Must have a window to initialize"); + if (aEnableDragDrop) { mWindow->EnableDragDrop(PR_TRUE); } @@ -757,8 +767,6 @@ nsresult nsView::CreateWidget(const nsIID &aWindowIID, if (aResetVisibility) { SetVisibility(GetVisibility()); } - - return NS_OK; } // Attach to a top level widget and start receiving mirrored events. diff --git a/view/src/nsView.h b/view/src/nsView.h index ae4db7c8350..76caeced888 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -194,6 +194,9 @@ protected: void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize); nsRegion* mDirtyRegion; + +private: + void InitializeWindow(bool aEnableDragDrop, bool aResetVisibility); }; #endif