Bug 313817. DeCOMtaminate more NS_New*Frame functions. r+sr=roc, patch by Marc Liddell

This commit is contained in:
roc+%cs.cmu.edu 2005-11-01 20:40:54 +00:00
parent dd7fc0840a
commit a5f65bfee7
17 changed files with 121 additions and 210 deletions

View File

@ -163,8 +163,8 @@ NS_NewXTFSVGDisplayFrame(nsIPresShell*, nsIContent*, nsIFrame**);
#endif #endif
#endif #endif
nsresult nsIFrame*
NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell);
#ifdef MOZ_SVG #ifdef MOZ_SVG
#include "nsSVGAtoms.h" #include "nsSVGAtoms.h"
@ -2092,10 +2092,9 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIFrame* aParentFram
content->SetNativeAnonymous(PR_TRUE); content->SetNativeAnonymous(PR_TRUE);
// Create an image frame and initialize it // Create an image frame and initialize it
nsIFrame* imageFrame = nsnull; nsIFrame* imageFrame = NS_NewImageFrame(mPresShell);
rv = NS_NewImageFrame(mPresShell, &imageFrame); if (NS_UNLIKELY(!imageFrame)) {
if (!imageFrame) { return NS_ERROR_OUT_OF_MEMORY;
return rv;
} }
rv = imageFrame->Init(presContext, content, aParentFrame, aStyleContext, rv = imageFrame->Init(presContext, content, aParentFrame, aStyleContext,
@ -2437,7 +2436,11 @@ nsCSSFrameConstructor::CreateInputFrame(nsIContent *aContent,
case NS_FORM_INPUT_TEXT: case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD: case NS_FORM_INPUT_PASSWORD:
return NS_NewTextControlFrame(mPresShell, aFrame); {
*aFrame = NS_NewTextControlFrame(mPresShell);
return NS_UNLIKELY(!*aFrame) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}
default: default:
NS_ASSERTION(0, "Unknown input type!"); NS_ASSERTION(0, "Unknown input type!");
@ -2453,7 +2456,9 @@ nsCSSFrameConstructor::CreateHTMLImageFrame(nsIContent* aContent,
{ {
// Make sure to keep IsSpecialContent in synch with this code // Make sure to keep IsSpecialContent in synch with this code
if (nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) { if (nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) {
return (*aFunc)(mPresShell, aFrame); *aFrame = (*aFunc)(mPresShell);
return NS_UNLIKELY(!*aFrame) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
} }
*aFrame = nsnull; *aFrame = nsnull;
@ -5489,6 +5494,8 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
PRBool isFloatContainer = PR_FALSE; PRBool isFloatContainer = PR_FALSE;
PRBool addedToFrameList = PR_FALSE; PRBool addedToFrameList = PR_FALSE;
nsresult rv = NS_OK; nsresult rv = NS_OK;
PRBool triedFrame = PR_FALSE;
// See if the element is absolute or fixed positioned // See if the element is absolute or fixed positioned
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay(); const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
@ -5509,7 +5516,9 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewBRFrame(mPresShell, &newFrame); newFrame = NS_NewBRFrame(mPresShell);
triedFrame = PR_TRUE;
isReplaced = PR_TRUE; isReplaced = PR_TRUE;
// BR frames don't go in the content->frame hash table: typically // BR frames don't go in the content->frame hash table: typically
// there are many BR content objects and this would increase the size // there are many BR content objects and this would increase the size
@ -5520,7 +5529,8 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewWBRFrame(mPresShell, &newFrame); newFrame = NS_NewWBRFrame(mPresShell);
triedFrame = PR_TRUE;
} }
else if (nsHTMLAtoms::input == aTag) { else if (nsHTMLAtoms::input == aTag) {
// Make sure to keep IsSpecialContent in synch with this code // Make sure to keep IsSpecialContent in synch with this code
@ -5537,7 +5547,8 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
isReplaced = PR_TRUE; isReplaced = PR_TRUE;
rv = NS_NewTextControlFrame(mPresShell, &newFrame); newFrame = NS_NewTextControlFrame(mPresShell);
triedFrame = PR_TRUE;
} }
else if (nsHTMLAtoms::select == aTag) { else if (nsHTMLAtoms::select == aTag) {
if (!gUseXBLForms) { if (!gUseXBLForms) {
@ -5579,25 +5590,21 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
objContent->GetDisplayedType(&type); objContent->GetDisplayedType(&type);
if (type == nsIObjectLoadingContent::TYPE_LOADING) { if (type == nsIObjectLoadingContent::TYPE_LOADING) {
// Ideally, this should show the standby attribute // Ideally, this should show the standby attribute
rv = NS_NewEmptyFrame(mPresShell, &newFrame); newFrame = NS_NewEmptyFrame(mPresShell);
} }
else if (type == nsIObjectLoadingContent::TYPE_PLUGIN) else if (type == nsIObjectLoadingContent::TYPE_PLUGIN)
rv = NS_NewObjectFrame(mPresShell, &newFrame); newFrame = NS_NewObjectFrame(mPresShell);
else if (type == nsIObjectLoadingContent::TYPE_IMAGE) else if (type == nsIObjectLoadingContent::TYPE_IMAGE)
rv = NS_NewImageFrame(mPresShell, &newFrame); newFrame = NS_NewImageFrame(mPresShell);
else if (type == nsIObjectLoadingContent::TYPE_DOCUMENT) { else if (type == nsIObjectLoadingContent::TYPE_DOCUMENT)
newFrame = NS_NewSubDocumentFrame(mPresShell); newFrame = NS_NewSubDocumentFrame(mPresShell);
// xxx marc
if (!newFrame) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
}
#ifdef DEBUG #ifdef DEBUG
else else
NS_ERROR("Shouldn't get here if we're not broken and not " NS_ERROR("Shouldn't get here if we're not broken and not "
"suppressed and not blocked"); "suppressed and not blocked");
#endif #endif
triedFrame = PR_TRUE;
} }
} }
else if (nsHTMLAtoms::fieldset == aTag) { else if (nsHTMLAtoms::fieldset == aTag) {
@ -5619,7 +5626,9 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewLegendFrame(mPresShell, &newFrame); newFrame = NS_NewLegendFrame(mPresShell);
triedFrame = PR_TRUE;
isFloatContainer = PR_TRUE; isFloatContainer = PR_TRUE;
} }
else if (nsHTMLAtoms::frameset == aTag) { else if (nsHTMLAtoms::frameset == aTag) {
@ -5630,7 +5639,8 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewHTMLFramesetFrame(mPresShell, &newFrame); newFrame = NS_NewHTMLFramesetFrame(mPresShell);
triedFrame = PR_TRUE;
} }
else if (nsHTMLAtoms::iframe == aTag) { else if (nsHTMLAtoms::iframe == aTag) {
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
@ -5639,12 +5649,8 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
isReplaced = PR_TRUE; isReplaced = PR_TRUE;
newFrame = NS_NewSubDocumentFrame(mPresShell); newFrame = NS_NewSubDocumentFrame(mPresShell);
triedFrame = PR_TRUE;
// xxx marc
if (!newFrame) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
if (newFrame) { if (newFrame) {
// the nsSubDocumentFrame needs to know about its content parent during ::Init. // the nsSubDocumentFrame needs to know about its content parent during ::Init.
// there is no reasonable way to get the value there. // there is no reasonable way to get the value there.
@ -5661,13 +5667,16 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewSpacerFrame(mPresShell, &newFrame); newFrame = NS_NewSpacerFrame(mPresShell);
triedFrame = PR_TRUE;
} }
else if (nsHTMLAtoms::button == aTag) { else if (nsHTMLAtoms::button == aTag) {
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
rv = NS_NewHTMLButtonControlFrame(mPresShell, &newFrame); newFrame = NS_NewHTMLButtonControlFrame(mPresShell);
triedFrame = PR_TRUE;
// the html4 button needs to act just like a // the html4 button needs to act just like a
// regular button except contain html content // regular button except contain html content
// so it must be replaced or html outside it will // so it must be replaced or html outside it will
@ -5680,18 +5689,24 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsFrameConstructorState& aState,
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
isReplaced = PR_TRUE; isReplaced = PR_TRUE;
rv = NS_NewIsIndexFrame(mPresShell, &newFrame); newFrame = NS_NewIsIndexFrame(mPresShell);
triedFrame = PR_TRUE;
} }
else if (nsHTMLAtoms::canvas == aTag) { else if (nsHTMLAtoms::canvas == aTag) {
if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) { if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aFrameItems); ProcessPseudoFrames(aState, aFrameItems);
} }
isReplaced = PR_TRUE; isReplaced = PR_TRUE;
rv = NS_NewHTMLCanvasFrame(mPresShell, &newFrame); newFrame = NS_NewHTMLCanvasFrame(mPresShell);
triedFrame = PR_TRUE;
} }
if (NS_FAILED(rv) || !newFrame) if (NS_UNLIKELY(triedFrame && !newFrame)) {
return NS_ERROR_OUT_OF_MEMORY;
}
else if (NS_FAILED(rv) || !newFrame) {
return rv; return rv;
}
// If we succeeded in creating a frame then initialize it, process its // If we succeeded in creating a frame then initialize it, process its
// children (if requested), and set the initial child list // children (if requested), and set the initial child list
@ -11101,8 +11116,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
} }
} else if (nsLayoutAtoms::imageFrame == frameType) { } else if (nsLayoutAtoms::imageFrame == frameType) {
rv = NS_NewImageFrame(shell, &newFrame); newFrame = NS_NewImageFrame(shell);
if (NS_SUCCEEDED(rv)) { if (NS_LIKELY(newFrame != nsnull)) {
newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame); newFrame->Init(aPresContext, content, aParentFrame, styleContext, aFrame);
} }
} else if (nsLayoutAtoms::placeholderFrame == frameType) { } else if (nsLayoutAtoms::placeholderFrame == frameType) {

View File

@ -654,7 +654,7 @@ private:
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
// A function that can be invoked to create some sort of image frame. // A function that can be invoked to create some sort of image frame.
typedef nsresult (* ImageFrameCreatorFunc)(nsIPresShell*, nsIFrame**); typedef nsIFrame* (* ImageFrameCreatorFunc)(nsIPresShell*);
/** /**
* CreateHTMLImageFrame will do some tests on aContent, and if it determines * CreateHTMLImageFrame will do some tests on aContent, and if it determines

View File

@ -71,19 +71,10 @@
#include "nsIAccessibilityService.h" #include "nsIAccessibilityService.h"
#endif #endif
nsresult nsIFrame*
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsHTMLButtonControlFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLButtonControlFrame* it = new (aPresShell) nsHTMLButtonControlFrame;
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
nsHTMLButtonControlFrame::nsHTMLButtonControlFrame() nsHTMLButtonControlFrame::nsHTMLButtonControlFrame()

View File

@ -151,19 +151,10 @@ nsImageControlFrame::Destroy(nsPresContext *aPresContext)
return nsImageControlFrameSuper::Destroy(aPresContext); return nsImageControlFrameSuper::Destroy(aPresContext);
} }
nsresult nsIFrame*
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewImageControlFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsImageControlFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsImageControlFrame* it = new (aPresShell) nsImageControlFrame;
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
// Frames are not refcounted, no need to AddRef // Frames are not refcounted, no need to AddRef

View File

@ -82,19 +82,10 @@
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
nsresult nsIFrame*
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewIsIndexFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsIsIndexFrame();
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsIsIndexFrame* it = new (aPresShell) nsIsIndexFrame();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
nsIsIndexFrame::nsIsIndexFrame() nsIsIndexFrame::nsIsIndexFrame()

View File

@ -55,19 +55,10 @@
static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
nsresult nsIFrame*
NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewLegendFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsLegendFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsLegendFrame* it = new (aPresShell) nsLegendFrame;
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
nsIAtom* nsIAtom*

View File

@ -1223,19 +1223,10 @@ NS_IMETHODIMP nsTextInputSelectionImpl::GetFrameFromLevel(nsPresContext *aPresCo
nsresult nsIFrame*
NS_NewTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewTextControlFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsTextControlFrame(aPresShell);
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsTextControlFrame* it = new (aPresShell) nsTextControlFrame(aPresShell);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
NS_IMPL_ADDREF_INHERITED(nsTextControlFrame, nsBoxFrame) NS_IMPL_ADDREF_INHERITED(nsTextControlFrame, nsBoxFrame)

View File

@ -80,19 +80,10 @@ protected:
virtual ~BRFrame(); virtual ~BRFrame();
}; };
nsresult nsIFrame*
NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewBRFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) BRFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsIFrame* frame = new (aPresShell) BRFrame;
if (nsnull == frame) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = frame;
return NS_OK;
} }
BRFrame::~BRFrame() BRFrame::~BRFrame()

View File

@ -442,19 +442,10 @@ void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
aRC->SetFont(font->mFont, visibility->mLangGroup); aRC->SetFont(font->mFont, visibility->mLangGroup);
} }
nsresult nsIFrame*
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewEmptyFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); new (aPresShell) nsFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsFrame* it = new (aPresShell) nsFrame;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
MOZ_DECL_CTOR_COUNTER(nsFrame) MOZ_DECL_CTOR_COUNTER(nsFrame)

View File

@ -135,7 +135,7 @@ public:
* Create a new "empty" frame that maps a given piece of content into a * Create a new "empty" frame that maps a given piece of content into a
* 0,0 area. * 0,0 area.
*/ */
friend nsresult NS_NewEmptyFrame(nsIPresShell* aShell, nsIFrame** aInstancePtrResult); friend nsIFrame* NS_NewEmptyFrame(nsIPresShell* aShell);
// Overloaded new operator. Initializes the memory to 0 and relies on an arena // Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation. // (which comes from the presShell) to perform the allocation.

View File

@ -408,9 +408,9 @@ nsHTMLFramesetFrame::Init(nsPresContext* aPresContext,
kidSC = shell->StyleSet()->ResolveStyleFor(child, mStyleContext); kidSC = shell->StyleSet()->ResolveStyleFor(child, mStyleContext);
if (tag == nsHTMLAtoms::frameset) { if (tag == nsHTMLAtoms::frameset) {
result = NS_NewHTMLFramesetFrame(shell, &frame); frame = NS_NewHTMLFramesetFrame(shell);
if (NS_FAILED(result)) if (NS_UNLIKELY(!frame))
return result; return NS_ERROR_OUT_OF_MEMORY;
mChildTypes[mChildCount] = FRAMESET; mChildTypes[mChildCount] = FRAMESET;
nsHTMLFramesetFrame* childFrame = (nsHTMLFramesetFrame*)frame; nsHTMLFramesetFrame* childFrame = (nsHTMLFramesetFrame*)frame;
@ -1571,19 +1571,10 @@ nsHTMLFramesetFrame::EndMouseDrag(nsPresContext* aPresContext)
gDragInProgress = PR_FALSE; gDragInProgress = PR_FALSE;
} }
nsresult nsIFrame*
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsHTMLFramesetFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLFramesetFrame* it = new (aPresShell) nsHTMLFramesetFrame;
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
/******************************************************************************* /*******************************************************************************

View File

@ -44,15 +44,10 @@
#include "nsHTMLCanvasFrame.h" #include "nsHTMLCanvasFrame.h"
#include "nsICanvasElement.h" #include "nsICanvasElement.h"
nsresult nsIFrame*
NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell)
{ {
nsHTMLCanvasFrame* it = new (aPresShell) nsHTMLCanvasFrame; return new (aPresShell) nsHTMLCanvasFrame;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
nsHTMLCanvasFrame::nsHTMLCanvasFrame() nsHTMLCanvasFrame::nsHTMLCanvasFrame()

View File

@ -46,7 +46,7 @@
#include "gfxIImageFrame.h" #include "gfxIImageFrame.h"
#include "imgIContainer.h" #include "imgIContainer.h"
nsresult NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell);
class nsHTMLCanvasFrame : public nsSplittableFrame class nsHTMLCanvasFrame : public nsSplittableFrame
{ {

View File

@ -138,8 +138,8 @@ NS_NewRelativeItemWrapperFrame(nsIPresShell* aPresShell) {
return NS_NewAreaFrame(aPresShell, 0); return NS_NewAreaFrame(aPresShell, 0);
} }
nsresult nsIFrame*
NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewBRFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult); NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
@ -148,32 +148,32 @@ NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
nsIFrame* nsIFrame*
NS_NewSubDocumentFrame(nsIPresShell* aPresShell); NS_NewSubDocumentFrame(nsIPresShell* aPresShell);
// <frameset> // <frameset>
nsresult nsIFrame*
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewViewportFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsresult
NS_NewCanvasFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewCanvasFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsIFrame*
NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult); NS_NewImageFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsresult
NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewPositionedInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsIFrame*
NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult); NS_NewObjectFrame(nsIPresShell* aPresShell);
nsresult nsIFrame*
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewSpacerFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsresult
NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewContinuingTextFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsIFrame*
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewEmptyFrame(nsIPresShell* aPresShell);
inline nsresult inline nsIFrame*
NS_NewWBRFrame(nsIPresShell* aPresShell, nsIFrame** aResult) { NS_NewWBRFrame(nsIPresShell* aPresShell) {
return NS_NewEmptyFrame(aPresShell, aResult); return NS_NewEmptyFrame(aPresShell);
} }
nsresult nsresult
@ -197,10 +197,10 @@ nsresult
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsresult
NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewNativeButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsIFrame*
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewImageControlFrame(nsIPresShell* aPresShell);
nsresult nsIFrame*
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsresult
@ -209,12 +209,12 @@ nsresult
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags); NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
nsresult nsresult
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsIFrame*
NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewLegendFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsIFrame*
NS_NewTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewTextControlFrame(nsIPresShell* aPresShell);
nsresult nsresult
NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); NS_NewGfxAutoTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
nsresult nsresult
@ -227,8 +227,8 @@ nsresult
NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewListControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
nsresult nsresult
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags); NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags);
nsresult nsIFrame*
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsIFrame** aResult); NS_NewIsIndexFrame(nsIPresShell* aPresShell);
// Table frame factories // Table frame factories
nsresult nsresult

View File

@ -167,19 +167,10 @@ inline PRBool HaveFixedSize(const nsHTMLReflowState& aReflowState)
: HaveFixedSize(aReflowState.mStylePosition); : HaveFixedSize(aReflowState.mStylePosition);
} }
nsresult nsIFrame*
NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewImageFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsImageFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsImageFrame* it = new (aPresShell) nsImageFrame;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }

View File

@ -1208,8 +1208,8 @@ nsObjectFrame::CreateDefaultFrames(nsPresContext *aPresContext,
nsHTMLContainerFrame::CreateViewForFrame(anchorFrame, this, PR_FALSE); nsHTMLContainerFrame::CreateViewForFrame(anchorFrame, this, PR_FALSE);
rv = NS_NewImageFrame(shell, &imgFrame); imgFrame = NS_NewImageFrame(shell);
if (NS_FAILED(rv)) if (NS_UNLIKELY(!imgFrame))
return; return;
rv = imgFrame->Init(aPresContext, img, anchorFrame, imgStyleContext, PR_FALSE); rv = imgFrame->Init(aPresContext, img, anchorFrame, imgStyleContext, PR_FALSE);
@ -1850,19 +1850,10 @@ nsObjectFrame::GetNextObjectFrame(nsPresContext* aPresContext, nsIFrame* aRoot)
return nsnull; return nsnull;
} }
nsresult nsIFrame*
NS_NewObjectFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewObjectFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) nsObjectFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsObjectFrame* it = new (aPresShell) nsObjectFrame;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }

View File

@ -50,7 +50,7 @@
class SpacerFrame : public nsFrame { class SpacerFrame : public nsFrame {
public: public:
friend nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); friend nsIFrame* NS_NewSpacerFrame(nsIPresShell* aPresShell);
// nsIHTMLReflow // nsIHTMLReflow
NS_IMETHOD Reflow(nsPresContext* aPresContext, NS_IMETHOD Reflow(nsPresContext* aPresContext,
@ -65,19 +65,10 @@ protected:
virtual ~SpacerFrame(); virtual ~SpacerFrame();
}; };
nsresult nsIFrame*
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) NS_NewSpacerFrame(nsIPresShell* aPresShell)
{ {
NS_PRECONDITION(aNewFrame, "null OUT ptr"); return new (aPresShell) SpacerFrame;
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
SpacerFrame* it = new (aPresShell) SpacerFrame;
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
*aNewFrame = it;
return NS_OK;
} }
SpacerFrame::SpacerFrame() SpacerFrame::SpacerFrame()