зеркало из https://github.com/mozilla/pjs.git
Bug 282708. Position <object>'s view before creating its widget, to avoid flicker from creating it in the wrong position and then instantly moving it. r+sr=bzbarsky,a=asa
This commit is contained in:
Родитель
cd790656e9
Коммит
34b98c1b02
|
@ -819,6 +819,18 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
|
|||
viewMan->AllowDoubleBuffering(doubleBuffer);
|
||||
#endif
|
||||
|
||||
//this is ugly. it was ripped off from didreflow(). MMP
|
||||
// Position and size view relative to its parent, not relative to our
|
||||
// parent frame (our parent frame may not have a view).
|
||||
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
|
||||
GetOffsetFromView(origin, &parentWithView);
|
||||
viewMan->ResizeView(view, r);
|
||||
viewMan->MoveViewTo(view, origin.x, origin.y);
|
||||
|
||||
if (!aViewOnly && !view->HasWidget()) {
|
||||
nsresult rv = CreateWidgetForView(view);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -841,22 +853,9 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//this is ugly. it was ripped off from didreflow(). MMP
|
||||
// Position and size view relative to its parent, not relative to our
|
||||
// parent frame (our parent frame may not have a view).
|
||||
|
||||
nsIView* parentWithView;
|
||||
nsPoint origin;
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
|
||||
GetOffsetFromView(origin, &parentWithView);
|
||||
viewMan->ResizeView(view, r);
|
||||
viewMan->MoveViewTo(view, origin.x, origin.y);
|
||||
viewMan->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
}
|
||||
|
||||
SetView(view);
|
||||
viewMan->SetViewVisibility(view, nsViewVisibility_kShow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -602,13 +602,12 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
|
|||
{
|
||||
nsIDeviceContext *dx;
|
||||
nsRect trect = mDimBounds;
|
||||
float scale;
|
||||
|
||||
NS_ASSERTION(!mWindow, "We already have a window for this view? BAD");
|
||||
NS_IF_RELEASE(mWindow);
|
||||
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
scale = dx->AppUnitsToDevUnits();
|
||||
float scale = dx->AppUnitsToDevUnits();
|
||||
|
||||
trect *= scale;
|
||||
|
||||
|
@ -641,8 +640,10 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
|
|||
GetParent()->GetViewManager() != mViewManager)
|
||||
initData.mListenForResizes = PR_TRUE;
|
||||
|
||||
nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(nsnull)
|
||||
nsPoint offset(0, 0);
|
||||
nsIWidget* parentWidget = GetParent() ? GetParent()->GetNearestWidget(&offset)
|
||||
: nsnull;
|
||||
trect += offset;
|
||||
if (aWidgetInitData->mWindowType == eWindowType_popup) {
|
||||
mWindow->Create(parentWidget->GetNativeData(NS_NATIVE_WIDGET), trect,
|
||||
::HandleEvent, dx, nsnull, nsnull, aWidgetInitData);
|
||||
|
|
Загрузка…
Ссылка в новой задаче