Bug 589864: Revert nsView behavior unintentionally changed by refactoring. r=roc a=blocking-beta5

This commit is contained in:
Chris Jones 2010-08-24 01:28:16 -05:00
Родитель 520b621b7c
Коммит a0717c5547
1 изменённых файлов: 17 добавлений и 15 удалений

Просмотреть файл

@ -691,6 +691,15 @@ nsresult nsIView::CreateWidgetForPopup(nsWidgetInitData *aWidgetInitData,
aContentType); aContentType);
} }
struct DefaultWidgetInitData : public nsWidgetInitData {
DefaultWidgetInitData() : nsWidgetInitData()
{
mWindowType = eWindowType_child;
clipChildren = PR_TRUE;
clipSiblings = PR_TRUE;
}
};
nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData, nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData,
PRBool aEnableDragDrop, PRBool aEnableDragDrop,
PRBool aResetVisibility, PRBool aResetVisibility,
@ -701,16 +710,8 @@ nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData,
aWidgetInitData->mWindowType != eWindowType_popup, aWidgetInitData->mWindowType != eWindowType_popup,
"Use CreateWidgetForPopup"); "Use CreateWidgetForPopup");
PRBool initDataPassedIn = PR_TRUE; DefaultWidgetInitData defaultInitData;
nsWidgetInitData initData; aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData;
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; aWidgetInitData->mContentType = aContentType;
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType); nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
@ -718,8 +719,6 @@ nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData,
nsCOMPtr<nsIDeviceContext> dx; nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx)); mViewManager->GetDeviceContext(*getter_AddRefs(dx));
initData.mListenForResizes = (!initDataPassedIn && GetParent() &&
GetParent()->GetViewManager() != mViewManager);
nsIWidget* parentWidget = nsIWidget* parentWidget =
GetParent() ? GetParent()->GetNearestWidget(nsnull) : nsnull; GetParent() ? GetParent()->GetNearestWidget(nsnull) : nsnull;
if (!parentWidget) { if (!parentWidget) {
@ -745,7 +744,7 @@ nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
nsWidgetInitData *aWidgetInitData, nsWidgetInitData *aWidgetInitData,
PRBool aEnableDragDrop, PRBool aEnableDragDrop,
PRBool aResetVisibility, PRBool aResetVisibility,
nsContentType aWindowType) nsContentType aContentType)
{ {
AssertNoWindow(); AssertNoWindow();
NS_ABORT_IF_FALSE(!aWidgetInitData || NS_ABORT_IF_FALSE(!aWidgetInitData ||
@ -753,8 +752,11 @@ nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
"Use CreateWidgetForPopup"); "Use CreateWidgetForPopup");
NS_ABORT_IF_FALSE(aParentWidget, "Parent widget required"); NS_ABORT_IF_FALSE(aParentWidget, "Parent widget required");
nsIntRect trect = CalcWidgetBounds( DefaultWidgetInitData defaultInitData;
aWidgetInitData ? aWidgetInitData->mWindowType : eWindowType_child); aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData;
aWidgetInitData->mContentType = aContentType;
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
nsCOMPtr<nsIDeviceContext> dx; nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx)); mViewManager->GetDeviceContext(*getter_AddRefs(dx));