Bug 589864: Revert nsView behavior unintentionally changed by refactoring. r=roc a=blocking-beta5
authorChris Jones <jones.chris.g@gmail.com>
Tue, 24 Aug 2010 01:28:16 -0500
changeset 51346 1d3d0dd88f0df5cdf85e28ae11b02133b1bf7025
parent 51345 9ba488f9cb8dc5a248475279fb1f6f6b741d4313
child 51347 cba36a832767816085a3c9299923018f565dfbf5
push id15279
push usercjones@mozilla.com
push dateTue, 24 Aug 2010 06:28:31 +0000
treeherdermozilla-central@1d3d0dd88f0d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocking-beta5
bugs589864
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 589864: Revert nsView behavior unintentionally changed by refactoring. r=roc a=blocking-beta5
view/src/nsView.cpp
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -686,45 +686,44 @@ nsresult nsIView::CreateWidgetForPopup(n
                                        PRBool aResetVisibility,
                                        nsContentType aContentType)
 {
   return Impl()->CreateWidgetForPopup(aWidgetInitData, aParentWidget,
                                       aEnableDragDrop, aResetVisibility,
                                       aContentType);
 }
 
+struct DefaultWidgetInitData : public nsWidgetInitData {
+  DefaultWidgetInitData() : nsWidgetInitData()
+  {
+    mWindowType = eWindowType_child;
+    clipChildren = PR_TRUE;
+    clipSiblings = PR_TRUE;
+  }
+};
+
 nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData,
                               PRBool aEnableDragDrop,
                               PRBool aResetVisibility,
                               nsContentType aContentType)
 {
   AssertNoWindow();
   NS_ABORT_IF_FALSE(!aWidgetInitData ||
                     aWidgetInitData->mWindowType != eWindowType_popup,
                     "Use CreateWidgetForPopup");
 
-  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;
-  }
+  DefaultWidgetInitData defaultInitData;
+  aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData;
   aWidgetInitData->mContentType = aContentType;
 
   nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
 
   nsCOMPtr<nsIDeviceContext> dx;
   mViewManager->GetDeviceContext(*getter_AddRefs(dx));
 
-  initData.mListenForResizes = (!initDataPassedIn && GetParent() && 
-                                GetParent()->GetViewManager() != mViewManager);
   nsIWidget* parentWidget =
     GetParent() ? GetParent()->GetNearestWidget(nsnull) : nsnull;
   if (!parentWidget) {
     NS_ERROR("nsView::CreateWidget without suitable parent widget??");
     return NS_ERROR_FAILURE;
   }
 
   // XXX: using aForceUseIWidgetParent=true to preserve previous
@@ -740,26 +739,29 @@ nsresult nsView::CreateWidget(nsWidgetIn
 
   return NS_OK;
 }
 
 nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
                                        nsWidgetInitData *aWidgetInitData,
                                        PRBool aEnableDragDrop,
                                        PRBool aResetVisibility,
-                                       nsContentType aWindowType)
+                                       nsContentType aContentType)
 {
   AssertNoWindow();
   NS_ABORT_IF_FALSE(!aWidgetInitData ||
                     aWidgetInitData->mWindowType != eWindowType_popup,
                     "Use CreateWidgetForPopup");
   NS_ABORT_IF_FALSE(aParentWidget, "Parent widget required");
 
-  nsIntRect trect = CalcWidgetBounds(
-    aWidgetInitData ? aWidgetInitData->mWindowType : eWindowType_child);
+  DefaultWidgetInitData defaultInitData;
+  aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData;
+  aWidgetInitData->mContentType = aContentType;
+
+  nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
 
   nsCOMPtr<nsIDeviceContext> dx;
   mViewManager->GetDeviceContext(*getter_AddRefs(dx));
 
   mWindow =
     aParentWidget->CreateChild(trect, ::HandleEvent,
                                dx, nsnull, nsnull, aWidgetInitData).get();
   if (!mWindow) {