зеркало из https://github.com/mozilla/pjs.git
Don't create a widget if the view already has one and check error return code from CreateViewForFrame(). b=374102 r+sr=roc
This commit is contained in:
Родитель
dfafa9fea1
Коммит
230f7cbe4e
|
@ -199,13 +199,15 @@ nsBoxFrame::Init(nsIContent* aContent,
|
|||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
MarkIntrinsicWidthsDirty();
|
||||
|
||||
// see if we need a widget
|
||||
if (aParent && aParent->IsBoxFrame()) {
|
||||
if (aParent->ChildrenMustHaveWidgets()) {
|
||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
rv = nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIView* view = GetView();
|
||||
if (!view->HasWidget())
|
||||
|
|
|
@ -97,13 +97,15 @@ nsLeafBoxFrame::Init(
|
|||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsLeafFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// see if we need a widget
|
||||
if (aParent && aParent->IsBoxFrame()) {
|
||||
if (aParent->ChildrenMustHaveWidgets()) {
|
||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
rv = nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIView* view = GetView();
|
||||
if (!view->HasWidget())
|
||||
view->CreateWidget(kWidgetCID);
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
|
|||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set up a mediator which can be used for callbacks on this frame.
|
||||
mTimerMediator = new nsMenuPopupTimerMediator(this);
|
||||
|
@ -171,7 +172,8 @@ nsMenuPopupFrame::Init(nsIContent* aContent,
|
|||
GetMetric(nsILookAndFeel::eMetric_MenusCanOverlapOSBar, tempBool);
|
||||
mMenuCanOverlapOSBar = tempBool;
|
||||
|
||||
CreateViewForFrame(presContext, this, GetStyleContext(), PR_TRUE);
|
||||
rv = CreateViewForFrame(presContext, this, GetStyleContext(), PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now that we've made a view, remove it and insert it at the correct
|
||||
// position in the view hierarchy (as the root view). We do this so that we
|
||||
|
|
|
@ -358,17 +358,22 @@ nsSplitterFrame::Init(nsIContent* aContent,
|
|||
}
|
||||
|
||||
nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
nsIView* view = GetView();
|
||||
rv = nsHTMLContainerFrame::CreateViewForFrame(this, nsnull, PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!realTimeDrag) {
|
||||
nsIView* view = GetView();
|
||||
// currently this only works on win32 and mac
|
||||
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||
|
||||
// Need to have a widget to appear on top of other widgets.
|
||||
NS_ASSERTION(!view->HasWidget(), "have an unwanted widget");
|
||||
if (!view->HasWidget()) {
|
||||
view->CreateWidget(kCChildCID);
|
||||
}
|
||||
}
|
||||
|
||||
mInner->mState = nsSplitterFrameInner::Open;
|
||||
mInner->AddListener(PresContext());
|
||||
|
|
|
@ -207,8 +207,15 @@ nsTreeBodyFrame::Init(nsIContent* aContent,
|
|||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsLeafBoxFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
nsBoxFrame::CreateViewForFrame(PresContext(), this, GetStyleContext(), PR_TRUE);
|
||||
nsLeafBoxFrame::GetView()->CreateWidget(kWidgetCID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = nsBoxFrame::CreateViewForFrame(PresContext(), this, GetStyleContext(), PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIView* view = nsLeafBoxFrame::GetView();
|
||||
if (!view->HasWidget()) {
|
||||
view->CreateWidget(kWidgetCID);
|
||||
}
|
||||
|
||||
mIndentation = GetIndentation();
|
||||
mRowHeight = GetRowHeight();
|
||||
|
|
Загрузка…
Ссылка в новой задаче