Bug 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Fri, 20 Aug 2010 14:29:01 -0500
changeset 51047 1df224a593837a47d6a34d6248e636a7f26e23c9
parent 51046 17ccf212ce682029152a3b386c0368c7bccbf4cb
child 51048 7852880685f86e5cd7239d78c3f66aba4d1b1b28
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)
reviewersroc
bugs582057
milestone2.0b5pre
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 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc
view/src/nsView.cpp
view/src/nsView.h
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -740,30 +740,38 @@ nsresult nsView::CreateWidget(const nsII
     initData.mListenForResizes = (!initDataPassedIn && GetParent() && 
                                   GetParent()->GetViewManager() != mViewManager);
     nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(nsnull)
                                           : nsnull;
     mWindow->Create(parentWidget, nsnull, trect,
                     ::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);
   }
       
   // propagate the z-index to the widget.
   UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this));
 
   //make sure visibility state is accurate
 
   if (aResetVisibility) {
     SetVisibility(GetVisibility());
   }
-
-  return NS_OK;
 }
 
 // Attach to a top level widget and start receiving mirrored events.
 nsresult nsIView::AttachToTopLevelWidget(nsIWidget* aWidget)
 {
   NS_PRECONDITION(nsnull != aWidget, "null widget ptr");
   /// XXXjimm This is a temporary workaround to an issue w/document
   // viewer (bug 513162).
--- a/view/src/nsView.h
+++ b/view/src/nsView.h
@@ -189,11 +189,14 @@ public:
   nsIWidget* GetNearestWidget(nsPoint* aOffset, const PRInt32 aAPD) const;
 
 protected:
   // Do the actual work of ResetWidgetBounds, unconditionally.  Don't
   // call this method if we have no widget.
   void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize);
 
   nsRegion*    mDirtyRegion;
+
+private:
+  void InitializeWindow(bool aEnableDragDrop, bool aResetVisibility);
 };
 
 #endif