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

View File

@ -654,7 +654,7 @@ private:
nsStyleContext* aStyleContext);
// 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

View File

@ -71,19 +71,10 @@
#include "nsIAccessibilityService.h"
#endif
nsresult
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsHTMLButtonControlFrame;
}
nsHTMLButtonControlFrame::nsHTMLButtonControlFrame()

View File

@ -151,19 +151,10 @@ nsImageControlFrame::Destroy(nsPresContext *aPresContext)
return nsImageControlFrameSuper::Destroy(aPresContext);
}
nsresult
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewImageControlFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsImageControlFrame;
}
// Frames are not refcounted, no need to AddRef

View File

@ -82,19 +82,10 @@
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
nsresult
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewIsIndexFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsIsIndexFrame();
}
nsIsIndexFrame::nsIsIndexFrame()

View File

@ -55,19 +55,10 @@
static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
nsresult
NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewLegendFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsLegendFrame;
}
nsIAtom*

View File

@ -1223,19 +1223,10 @@ NS_IMETHODIMP nsTextInputSelectionImpl::GetFrameFromLevel(nsPresContext *aPresCo
nsresult
NS_NewTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewTextControlFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsTextControlFrame(aPresShell);
}
NS_IMPL_ADDREF_INHERITED(nsTextControlFrame, nsBoxFrame)

View File

@ -80,19 +80,10 @@ protected:
virtual ~BRFrame();
};
nsresult
NS_NewBRFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewBRFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) BRFrame;
}
BRFrame::~BRFrame()

View File

@ -442,19 +442,10 @@ void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
aRC->SetFont(font->mFont, visibility->mLangGroup);
}
nsresult
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewEmptyFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
new (aPresShell) 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
* 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
// (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);
if (tag == nsHTMLAtoms::frameset) {
result = NS_NewHTMLFramesetFrame(shell, &frame);
if (NS_FAILED(result))
return result;
frame = NS_NewHTMLFramesetFrame(shell);
if (NS_UNLIKELY(!frame))
return NS_ERROR_OUT_OF_MEMORY;
mChildTypes[mChildCount] = FRAMESET;
nsHTMLFramesetFrame* childFrame = (nsHTMLFramesetFrame*)frame;
@ -1571,19 +1571,10 @@ nsHTMLFramesetFrame::EndMouseDrag(nsPresContext* aPresContext)
gDragInProgress = PR_FALSE;
}
nsresult
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsHTMLFramesetFrame;
}
/*******************************************************************************

View File

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

View File

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

View File

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

View File

@ -167,19 +167,10 @@ inline PRBool HaveFixedSize(const nsHTMLReflowState& aReflowState)
: HaveFixedSize(aReflowState.mStylePosition);
}
nsresult
NS_NewImageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewImageFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) nsImageFrame;
}

View File

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

View File

@ -50,7 +50,7 @@
class SpacerFrame : public nsFrame {
public:
friend nsresult NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
friend nsIFrame* NS_NewSpacerFrame(nsIPresShell* aPresShell);
// nsIHTMLReflow
NS_IMETHOD Reflow(nsPresContext* aPresContext,
@ -65,19 +65,10 @@ protected:
virtual ~SpacerFrame();
};
nsresult
NS_NewSpacerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
nsIFrame*
NS_NewSpacerFrame(nsIPresShell* aPresShell)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
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;
return new (aPresShell) SpacerFrame;
}
SpacerFrame::SpacerFrame()