Bug 582057, part c: Initialize default widget init data earlier so that it's always available. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Fri, 20 Aug 2010 14:29:01 -0500
changeset 51044 1007fbdaad19091f39d2886bd48147bab018a11c
parent 51043 8f2104cbe0e07dce5309c270ad213afd1c1ddea6
child 51045 418247b1dc8a311fabb4b07ae9ae0d6b2e4741ca
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 c: Initialize default widget init data earlier so that it's always available. r=roc
view/src/nsView.cpp
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -683,37 +683,35 @@ nsresult nsView::CreateWidget(const nsII
     NS_ERROR("We already have a window for this view? BAD");
     ViewWrapper* wrapper = GetWrapperFor(mWindow);
     NS_IF_RELEASE(wrapper);
     mWindow->SetClientData(nsnull);
     mWindow->Destroy();
     NS_RELEASE(mWindow);
   }
 
-  nsIntRect trect = CalcWidgetBounds(aWidgetInitData
-                                     ? aWidgetInitData->mWindowType
-                                     : eWindowType_child);
+  PRBool initDataPassedIn = PR_TRUE;
+  nsWidgetInitData initData;
+  if (!aWidgetInitData) {
+    // No initData, we're a child window
+    initDataPassedIn = PR_FALSE;
+    initData.mWindowType = eWindowType_child;
+    initData.clipChildren = PR_TRUE;
+    initData.clipSiblings = PR_TRUE;
+    aWidgetInitData = &initData;
+  }
+  aWidgetInitData->mContentType = aContentType;
+
+  nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
 
   if (NS_OK == LoadWidget(aWindowIID))
   {
     nsCOMPtr<nsIDeviceContext> dx;
     mViewManager->GetDeviceContext(*getter_AddRefs(dx));
 
-    PRBool initDataPassedIn = PR_TRUE;
-    nsWidgetInitData initData;
-    if (!aWidgetInitData) {
-      // No initData, we're a child window
-      // Create initData to pass in params
-      initDataPassedIn = PR_FALSE;
-      initData.clipChildren = PR_TRUE; // Clip child window's children
-      initData.clipSiblings = PR_TRUE; // Clip child window's siblings
-      aWidgetInitData = &initData;
-    }
-    aWidgetInitData->mContentType = aContentType;
-
     if (aNative && aWidgetInitData->mWindowType != eWindowType_popup)
       mWindow->Create(nsnull, aNative, trect, ::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
     else
     {
       if (!initDataPassedIn && GetParent() && 
           GetParent()->GetViewManager() != mViewManager)
         initData.mListenForResizes = PR_TRUE;
       if (aParentWidget) {