Bug 281709. When Show()ing a widget, unconditionally reset its bounds *right now* even if updates are suppressed. patch by bzbarsky, r+sr=roc

This commit is contained in:
roc+%cs.cmu.edu 2005-10-21 02:40:04 +00:00
Родитель 4ccdd4f21f
Коммит 126059ec86
2 изменённых файлов: 70 добавлений и 57 удалений

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

@ -370,12 +370,24 @@ void nsView::ResetWidgetBounds(PRBool aRecurse, PRBool aMoveOnly,
return;
}
DoResetWidgetBounds(aMoveOnly, aInvalidateChangedSize);
} else if (aRecurse) {
// reposition any widgets under this view
for (nsView* v = GetFirstChild(); v; v = v->GetNextSibling()) {
v->ResetWidgetBounds(PR_TRUE, aMoveOnly, aInvalidateChangedSize);
}
}
}
void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
PRBool aInvalidateChangedSize) {
// The geometry of a root view's widget is controlled externally,
// NOT by sizing or positioning the view
if (mViewManager->GetRootView() == this) {
return;
}
NS_PRECONDITION(mWindow, "Why was this called??");
nsIDeviceContext *dx;
float t2p, p2t;
@ -427,12 +439,6 @@ void nsView::ResetWidgetBounds(PRBool aRecurse, PRBool aMoveOnly,
mWindow->Resize(newBounds.width, newBounds.height, aInvalidateChangedSize);
} // else do nothing!
}
} else if (aRecurse) {
// reposition any widgets under this view
for (nsView* v = GetFirstChild(); v; v = v->GetNextSibling()) {
v->ResetWidgetBounds(PR_TRUE, aMoveOnly, aInvalidateChangedSize);
}
}
}
void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint, PRBool aResizeWidget)
@ -469,7 +475,10 @@ NS_IMETHODIMP nsView::SetVisibility(nsViewVisibility aVisibility)
{
#ifndef HIDE_ALL_WIDGETS
if (mVis == nsViewVisibility_kShow)
{
DoResetWidgetBounds(PR_FALSE, PR_TRUE);
mWindow->Show(PR_TRUE);
}
else
#endif
mWindow->Show(PR_FALSE);

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

@ -302,6 +302,10 @@ public:
virtual ~nsView();
protected:
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
// call this method if we have no widget.
void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize);
nsZPlaceholderView* mZParent;
// mClipRect is relative to the view's origin.