зеркало из https://github.com/mozilla/gecko-dev.git
Bug 899900 - Avoid null checking result of NS_NewBlahFrame. r=dbaron
This commit is contained in:
Родитель
3280537429
Коммит
fb70293fcd
|
@ -1330,19 +1330,12 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
|
|||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(mStyleContext);
|
||||
|
||||
// Start by by creating our anonymous block frame
|
||||
// Start by creating our anonymous block frame
|
||||
mDisplayFrame = new (shell) nsComboboxDisplayFrame(styleContext, this);
|
||||
if (MOZ_UNLIKELY(!mDisplayFrame)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mDisplayFrame->Init(mContent, this, nullptr);
|
||||
|
||||
// Create a text frame and put it inside the block frame
|
||||
nsIFrame* textFrame = NS_NewTextFrame(shell, textStyleContext);
|
||||
if (MOZ_UNLIKELY(!textFrame)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// initialize the text frame
|
||||
textFrame->Init(aContent, mDisplayFrame, nullptr);
|
||||
|
|
|
@ -100,11 +100,9 @@ nsGfxButtonControlFrame::CreateFrameFor(nsIContent* aContent)
|
|||
ResolveStyleForNonElement(mStyleContext);
|
||||
|
||||
newFrame = NS_NewTextFrame(presContext->PresShell(), textStyleContext);
|
||||
if (newFrame) {
|
||||
// initialize the text frame
|
||||
newFrame->Init(mTextContent, parentFrame, nullptr);
|
||||
mTextContent->SetPrimaryFrame(newFrame);
|
||||
}
|
||||
// initialize the text frame
|
||||
newFrame->Init(mTextContent, parentFrame, nullptr);
|
||||
mTextContent->SetPrimaryFrame(newFrame);
|
||||
}
|
||||
|
||||
return newFrame;
|
||||
|
|
|
@ -93,9 +93,7 @@ NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
nsListControlFrame* it =
|
||||
new (aPresShell) nsListControlFrame(aPresShell, aPresShell->GetDocument(), aContext);
|
||||
|
||||
if (it) {
|
||||
it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
|
||||
}
|
||||
it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,9 @@ NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsStyleContext* aContext, uint32_t
|
|||
{
|
||||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame(aContext);
|
||||
|
||||
if (it) {
|
||||
// We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
|
||||
// aren't expanded by right floats outside the select.
|
||||
it->SetFlags(aFlags | NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
// We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
|
||||
// aren't expanded by right floats outside the select.
|
||||
it->SetFlags(aFlags | NS_BLOCK_FLOAT_MGR);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
|
|
@ -972,27 +972,21 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
|||
borderWidth,
|
||||
false,
|
||||
false);
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
mHorBorders[cellIndex.y-1] = borderFrame;
|
||||
// set the neighbors for determining drag boundaries
|
||||
borderFrame->mPrevNeighbor = lastRow;
|
||||
borderFrame->mNextNeighbor = cellIndex.y;
|
||||
}
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
mHorBorders[cellIndex.y-1] = borderFrame;
|
||||
// set the neighbors for determining drag boundaries
|
||||
borderFrame->mPrevNeighbor = lastRow;
|
||||
borderFrame->mNextNeighbor = cellIndex.y;
|
||||
} else {
|
||||
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
}
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
nsSize borderSize(aDesiredSize.width, borderWidth);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
nsSize borderSize(aDesiredSize.width, borderWidth);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
offset.y += borderWidth;
|
||||
} else {
|
||||
if (cellIndex.x > 0) { // moved to next col in same row
|
||||
|
@ -1008,27 +1002,21 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
|||
borderWidth,
|
||||
true,
|
||||
false);
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
mVerBorders[cellIndex.x-1] = borderFrame;
|
||||
// set the neighbors for determining drag boundaries
|
||||
borderFrame->mPrevNeighbor = lastCol;
|
||||
borderFrame->mNextNeighbor = cellIndex.x;
|
||||
}
|
||||
borderFrame->Init(mContent, this, nullptr);
|
||||
mChildCount++;
|
||||
mFrames.AppendFrame(nullptr, borderFrame);
|
||||
mVerBorders[cellIndex.x-1] = borderFrame;
|
||||
// set the neighbors for determining drag boundaries
|
||||
borderFrame->mPrevNeighbor = lastCol;
|
||||
borderFrame->mNextNeighbor = cellIndex.x;
|
||||
} else {
|
||||
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
}
|
||||
if (MOZ_LIKELY(borderFrame != nullptr)) {
|
||||
nsSize borderSize(borderWidth, aDesiredSize.height);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
borderFrame->mWidth = borderWidth;
|
||||
borderChildX++;
|
||||
}
|
||||
nsSize borderSize(borderWidth, aDesiredSize.height);
|
||||
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
||||
borderFrame = nullptr;
|
||||
}
|
||||
offset.x += borderWidth;
|
||||
}
|
||||
|
|
|
@ -1551,9 +1551,7 @@ NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
|
|||
uint32_t aFlags)
|
||||
{
|
||||
nsMathMLmathBlockFrame* it = new (aPresShell) nsMathMLmathBlockFrame(aContext);
|
||||
if (it) {
|
||||
it->SetFlags(aFlags);
|
||||
}
|
||||
it->SetFlags(aFlags);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
|
|
@ -596,10 +596,8 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsTableColGroupType aColGroupType)
|
|||
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::tableColGroup, mStyleContext);
|
||||
// Create a col group frame
|
||||
nsIFrame* newFrame = NS_NewTableColGroupFrame(shell, colGroupStyle);
|
||||
if (newFrame) {
|
||||
((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType);
|
||||
newFrame->Init(colGroupContent, this, nullptr);
|
||||
}
|
||||
((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType);
|
||||
newFrame->Init(colGroupContent, this, nullptr);
|
||||
return (nsTableColGroupFrame *)newFrame;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
{
|
||||
nsXULLabelFrame* it = new (aPresShell) nsXULLabelFrame(aContext);
|
||||
|
||||
if (it)
|
||||
it->SetFlags(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
it->SetFlags(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче