Fixing bug 550905. Don't use uninitialized values. r=jonas@sicking.cc

This commit is contained in:
Johnny Stenback 2010-03-19 15:06:13 -07:00
Родитель 4942620cbb
Коммит 08c926ac63
1 изменённых файлов: 17 добавлений и 18 удалений

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

@ -3671,33 +3671,34 @@ nsGlobalWindow::CheckSecurityLeftAndTop(PRInt32* aLeft, PRInt32* aTop)
nsContentUtils::HidePopupsInDocument(doc);
#endif
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
PRInt32 winLeft, winTop, winWidth, winHeight;
nsGlobalWindow* rootWindow =
static_cast<nsGlobalWindow*>(GetPrivateRoot());
if (rootWindow) {
rootWindow->FlushPendingNotifications(Flush_Layout);
}
// Get the window size
nsCOMPtr<nsIBaseWindow> treeOwner;
GetTreeOwner(getter_AddRefs(treeOwner));
if (treeOwner)
treeOwner->GetPositionAndSize(&winLeft, &winTop, &winWidth, &winHeight);
// convert those values to CSS pixels
// XXX four separate retrievals of the prescontext
winLeft = DevToCSSIntPixels(winLeft);
winTop = DevToCSSIntPixels(winTop);
winWidth = DevToCSSIntPixels(winWidth);
winHeight = DevToCSSIntPixels(winHeight);
// Get the screen dimensions
// XXX This should use nsIScreenManager once it's fully fleshed out.
nsCOMPtr<nsIDOMScreen> screen;
GetScreen(getter_AddRefs(screen));
if (screen) {
if (treeOwner && screen) {
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
PRInt32 winLeft, winTop, winWidth, winHeight;
// Get the window size
treeOwner->GetPositionAndSize(&winLeft, &winTop, &winWidth, &winHeight);
// convert those values to CSS pixels
// XXX four separate retrievals of the prescontext
winLeft = DevToCSSIntPixels(winLeft);
winTop = DevToCSSIntPixels(winTop);
winWidth = DevToCSSIntPixels(winWidth);
winHeight = DevToCSSIntPixels(winHeight);
// Get the screen dimensions
// XXX This should use nsIScreenManager once it's fully fleshed out.
screen->GetAvailLeft(&screenLeft);
screen->GetAvailWidth(&screenWidth);
screen->GetAvailHeight(&screenHeight);
@ -3713,9 +3714,7 @@ nsGlobalWindow::CheckSecurityLeftAndTop(PRInt32* aLeft, PRInt32* aTop)
#else
screen->GetAvailTop(&screenTop);
#endif
}
if (screen && treeOwner) {
if (aLeft) {
if (screenLeft+screenWidth < *aLeft+winWidth)
*aLeft = screenLeft+screenWidth - winWidth;