diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 7611bf5851ad..82c57670d6f6 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -152,13 +152,13 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); #include "nsIXTFElement.h" #include "nsIXTFElementWrapperPrivate.h" #include "nsIXTFVisualWrapperPrivate.h" -nsresult -NS_NewXTFXULDisplayFrame(nsIPresShell*, nsIFrame**); -nsresult -NS_NewXTFXMLDisplayFrame(nsIPresShell*, PRBool isBlock, nsIFrame**); +nsIFrame* +NS_NewXTFXULDisplayFrame(nsIPresShell*); +nsIFrame* +NS_NewXTFXMLDisplayFrame(nsIPresShell*, PRBool isBlock); #ifdef MOZ_SVG -nsresult -NS_NewXTFSVGDisplayFrame(nsIPresShell*, nsIContent*, nsIFrame**); +nsIFrame* +NS_NewXTFSVGDisplayFrame(nsIPresShell*, nsIContent*); #endif #endif @@ -172,62 +172,62 @@ NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell); #include "nsStyleUtil.h" #include "nsSVGUtils.h" -nsresult -NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +nsIFrame* +NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent); #ifdef MOZ_SVG_FOREIGNOBJECT -nsresult -NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +nsIFrame* +NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent); #endif -nsresult -NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +nsIFrame* +NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent); +nsIFrame* +NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent); +nsIFrame* +NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent); PRBool NS_SVG_TestFeatures (const nsAString& value); -extern nsresult -NS_NewSVGLinearGradientFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame** newFrame); -extern nsresult -NS_NewSVGRadialGradientFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame** newFrame); -extern nsresult -NS_NewSVGStopFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame *aParentFrame, nsIFrame** newFrame); -nsresult -NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -extern nsresult -NS_NewSVGImageFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame** newFrame); -nsresult -NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGTextPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent, nsIFrame** aNewFrame); -nsresult -NS_NewSVGFilterFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame** newFrame); -nsresult -NS_NewSVGPatternFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsIFrame* +NS_NewSVGLinearGradientFrame(nsIPresShell *aPresShell, nsIContent *aContent); +extern nsIFrame* +NS_NewSVGRadialGradientFrame(nsIPresShell *aPresShell, nsIContent *aContent); +extern nsIFrame* +NS_NewSVGStopFrame(nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame *aParentFrame); +nsIFrame* +NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent); +extern nsIFrame* +NS_NewSVGImageFrame(nsIPresShell *aPresShell, nsIContent *aContent); +nsIFrame* +NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent); +nsIFrame* +NS_NewSVGTextPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parent); +nsIFrame* +NS_NewSVGFilterFrame(nsIPresShell *aPresShell, nsIContent *aContent); +nsIFrame* +NS_NewSVGPatternFrame(nsIPresShell* aPresShell, nsIContent* aContent); #endif #include "nsIDocument.h" @@ -4606,9 +4606,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsFrameConstructorState& aState, #ifdef MOZ_SVG if (aDocElement->GetNameSpaceID() == kNameSpaceID_SVG && nsSVGUtils::SVGEnabled()) { - rv = NS_NewSVGOuterSVGFrame(mPresShell, aDocElement, &contentFrame); - if (NS_FAILED(rv)) { - return rv; + contentFrame = NS_NewSVGOuterSVGFrame(mPresShell, aDocElement); + if (!contentFrame) { + return NS_ERROR_FAILURE; } } else @@ -5440,7 +5440,7 @@ nsCSSFrameConstructor::ConstructTextFrame(nsFrameConstructorState& aState, nsCOMPtr svg_parent = do_QueryInterface(aParentFrame); if (svg_parent) { - NS_NewSVGGlyphFrame(mPresShell, aContent, aParentFrame, &newFrame); + newFrame = NS_NewSVGGlyphFrame(mPresShell, aContent, aParentFrame); } else { newFrame = NS_NewTextFrame(mPresShell); @@ -7104,46 +7104,46 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, aTag == nsMathMLAtoms::mn_ || aTag == nsMathMLAtoms::ms_ || aTag == nsMathMLAtoms::mtext_) - rv = NS_NewMathMLTokenFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLTokenFrame(mPresShell); else if (aTag == nsMathMLAtoms::mo_) - rv = NS_NewMathMLmoFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmoFrame(mPresShell); else if (aTag == nsMathMLAtoms::mfrac_) - rv = NS_NewMathMLmfracFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmfracFrame(mPresShell); else if (aTag == nsMathMLAtoms::msup_) - rv = NS_NewMathMLmsupFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmsupFrame(mPresShell); else if (aTag == nsMathMLAtoms::msub_) - rv = NS_NewMathMLmsubFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmsubFrame(mPresShell); else if (aTag == nsMathMLAtoms::msubsup_) - rv = NS_NewMathMLmsubsupFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmsubsupFrame(mPresShell); else if (aTag == nsMathMLAtoms::munder_) - rv = NS_NewMathMLmunderFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmunderFrame(mPresShell); else if (aTag == nsMathMLAtoms::mover_) - rv = NS_NewMathMLmoverFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmoverFrame(mPresShell); else if (aTag == nsMathMLAtoms::munderover_) - rv = NS_NewMathMLmunderoverFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmunderoverFrame(mPresShell); else if (aTag == nsMathMLAtoms::mphantom_) - rv = NS_NewMathMLmphantomFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmphantomFrame(mPresShell); else if (aTag == nsMathMLAtoms::mpadded_) - rv = NS_NewMathMLmpaddedFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmpaddedFrame(mPresShell); else if (aTag == nsMathMLAtoms::mspace_) - rv = NS_NewMathMLmspaceFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmspaceFrame(mPresShell); else if (aTag == nsMathMLAtoms::mfenced_) - rv = NS_NewMathMLmfencedFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmfencedFrame(mPresShell); else if (aTag == nsMathMLAtoms::mmultiscripts_) - rv = NS_NewMathMLmmultiscriptsFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmmultiscriptsFrame(mPresShell); else if (aTag == nsMathMLAtoms::mstyle_) - rv = NS_NewMathMLmstyleFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmstyleFrame(mPresShell); else if (aTag == nsMathMLAtoms::msqrt_) - rv = NS_NewMathMLmsqrtFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmsqrtFrame(mPresShell); else if (aTag == nsMathMLAtoms::mroot_) - rv = NS_NewMathMLmrootFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmrootFrame(mPresShell); else if (aTag == nsMathMLAtoms::maction_) - rv = NS_NewMathMLmactionFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmactionFrame(mPresShell); else if (aTag == nsMathMLAtoms::mrow_ || aTag == nsMathMLAtoms::merror_ || aTag == nsMathMLAtoms::none_ || aTag == nsMathMLAtoms::mprescripts_ ) - rv = NS_NewMathMLmrowFrame(mPresShell, &newFrame); + newFrame = NS_NewMathMLmrowFrame(mPresShell); // CONSTRUCTION of MTABLE elements else if (aTag == nsMathMLAtoms::mtable_ && disp->mDisplay == NS_STYLE_DISPLAY_TABLE) { @@ -7156,8 +7156,10 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, nsStyleSet *styleSet = mPresShell->StyleSet(); // first, create a MathML mrow frame that will wrap the block frame - rv = NS_NewMathMLmrowFrame(mPresShell, &newFrame); - if (NS_FAILED(rv)) return rv; + newFrame = NS_NewMathMLmrowFrame(mPresShell); + if (NS_UNLIKELY(!newFrame)) { + return NS_ERROR_OUT_OF_MEMORY; + } nsRefPtr mrowContext; mrowContext = styleSet->ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::mozMathInline, @@ -7211,15 +7213,15 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, // root element const nsStyleDisplay* display = aStyleContext->GetStyleDisplay(); PRBool isBlock = (NS_STYLE_DISPLAY_BLOCK == display->mDisplay); - rv = NS_NewMathMLmathFrame(mPresShell, &newFrame, isBlock); + newFrame = NS_NewMathMLmathFrame(mPresShell, isBlock); } else { - return rv; + return NS_OK; } // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list - if (NS_SUCCEEDED(rv) && newFrame) { + if (newFrame) { // If the frame is a replaced element, then set the frame state bit if (isReplaced) { newFrame->AddStateBits(NS_FRAME_REPLACED_ELEMENT); @@ -7254,9 +7256,11 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsFrameConstructorState& aState, newFrame->SetInitialChildList(aState.mPresContext, nsnull, childItems.childList); - rv = CreateInsertionPointChildren(aState, newFrame, aContent); + return CreateInsertionPointChildren(aState, newFrame, aContent); + } + else { + return NS_ERROR_OUT_OF_MEMORY; } - return rv; } #endif // MOZ_MATHML @@ -7296,7 +7300,7 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsFrameConstructorState& aState, switch(xtfElem->GetElementType()) { case nsIXTFElement::ELEMENT_TYPE_SVG_VISUAL: #ifdef MOZ_SVG - rv = NS_NewXTFSVGDisplayFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewXTFSVGDisplayFrame(mPresShell, aContent); #else NS_ERROR("xtf svg visuals are only supported in mozilla builds with native svg"); #endif @@ -7304,11 +7308,11 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsFrameConstructorState& aState, case nsIXTFElement::ELEMENT_TYPE_XML_VISUAL: { PRBool isBlock = (NS_STYLE_DISPLAY_BLOCK == disp->mDisplay); - rv = NS_NewXTFXMLDisplayFrame(mPresShell, isBlock, &newFrame); + newFrame = NS_NewXTFXMLDisplayFrame(mPresShell, isBlock); } break; case nsIXTFElement::ELEMENT_TYPE_XUL_VISUAL: - rv = NS_NewXTFXULDisplayFrame(mPresShell, &newFrame); + newFrame = NS_NewXTFXULDisplayFrame(mPresShell); break; case nsIXTFElement::ELEMENT_TYPE_GENERIC_ELEMENT: NS_ERROR("huh? ELEMENT_TYPE_GENERIC_ELEMENT should have been flagged by caller"); @@ -7320,7 +7324,7 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsFrameConstructorState& aState, // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list - if (NS_SUCCEEDED(rv) && newFrame != nsnull) { + if (newFrame) { InitAndRestoreFrame(aState, aContent, aState.GetGeometricParent(disp, aParentFrame), aStyleContext, nsnull, newFrame); @@ -7364,9 +7368,11 @@ nsCSSFrameConstructor::ConstructXTFFrame(nsFrameConstructorState& aState, // Note: we don't worry about insertionFrame here because we know // that XTF elements always insert into the primary frame of their // insertion content. - rv = CreateInsertionPointChildren(aState, newFrame, aContent, PR_FALSE); + return CreateInsertionPointChildren(aState, newFrame, aContent, PR_FALSE); + } + else { + return NS_ERROR_OUT_OF_MEMORY; } - return rv; } #endif // MOZ_XTF @@ -7582,73 +7588,73 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, geometricParent = aState.GetGeometricParent(disp, aParentFrame); forceView = PR_TRUE; - rv = NS_NewSVGOuterSVGFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGOuterSVGFrame(mPresShell, aContent); } else { // This is an inner element - rv = NS_NewSVGInnerSVGFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGInnerSVGFrame(mPresShell, aContent); } } else if (aTag == nsSVGAtoms::g) { - rv = NS_NewSVGGFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGGFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::polygon) - rv = NS_NewSVGPolygonFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGPolygonFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::polyline) - rv = NS_NewSVGPolylineFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGPolylineFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::circle) - rv = NS_NewSVGCircleFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGCircleFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::defs) { - rv = NS_NewSVGDefsFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGDefsFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::ellipse) - rv = NS_NewSVGEllipseFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGEllipseFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::line) - rv = NS_NewSVGLineFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGLineFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::rect) - rv = NS_NewSVGRectFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGRectFrame(mPresShell, aContent); #ifdef MOZ_SVG_FOREIGNOBJECT else if (aTag == nsSVGAtoms::foreignObject) { - rv = NS_NewSVGForeignObjectFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGForeignObjectFrame(mPresShell, aContent); } #endif else if (aTag == nsSVGAtoms::path) - rv = NS_NewSVGPathFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGPathFrame(mPresShell, aContent); else if (aTag == nsSVGAtoms::text) { - rv = NS_NewSVGTextFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGTextFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::tspan) { - rv = NS_NewSVGTSpanFrame(mPresShell, aContent, aParentFrame, &newFrame); + newFrame = NS_NewSVGTSpanFrame(mPresShell, aContent, aParentFrame); } else if (aTag == nsSVGAtoms::linearGradient) { - rv = NS_NewSVGLinearGradientFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGLinearGradientFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::radialGradient) { - rv = NS_NewSVGRadialGradientFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGRadialGradientFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::stop) { - rv = NS_NewSVGStopFrame(mPresShell, aContent, aParentFrame, &newFrame); + newFrame = NS_NewSVGStopFrame(mPresShell, aContent, aParentFrame); } else if (aTag == nsSVGAtoms::use) { - rv = NS_NewSVGUseFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGUseFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::marker) { - rv = NS_NewSVGMarkerFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGMarkerFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::image) { - rv = NS_NewSVGImageFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGImageFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::clipPath) { - rv = NS_NewSVGClipPathFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGClipPathFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::textPath) { - rv = NS_NewSVGTextPathFrame(mPresShell, aContent, aParentFrame, &newFrame); + newFrame = NS_NewSVGTextPathFrame(mPresShell, aContent, aParentFrame); } else if (aTag == nsSVGAtoms::filter) { - rv = NS_NewSVGFilterFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGFilterFrame(mPresShell, aContent); } else if (aTag == nsSVGAtoms::pattern) { - rv = NS_NewSVGPatternFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGPatternFrame(mPresShell, aContent); } if (newFrame == nsnull) { @@ -7667,11 +7673,11 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, // aTag->ToString(str); // printf("%s>\n", NS_ConvertUCS2toUTF8(str).get()); #endif - rv = NS_NewSVGGenericContainerFrame(mPresShell, aContent, &newFrame); + newFrame = NS_NewSVGGenericContainerFrame(mPresShell, aContent); } // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list - if (NS_SUCCEEDED(rv) && newFrame != nsnull) { + if (newFrame != nsnull) { #ifdef MOZ_SVG_FOREIGNOBJECT if (aTag == nsSVGAtoms::foreignObject) { // Claim to be relatively positioned so that we end up being the @@ -7719,8 +7725,12 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, if (!newFrame->IsLeaf()) rv = CreateInsertionPointChildren(aState, newFrame, aContent); + + return rv; + } + else { + return NS_ERROR_FAILURE; } - return rv; } #endif // MOZ_SVG diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 743200b3b6f8..70dda975bb08 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -716,16 +716,16 @@ nsMathMLContainerFrame::WrapForeignFrames() child->QueryInterface(kInlineFrameCID, (void**)&inlineFrame); if (inlineFrame) { // create a new wrapper frame to wrap this child - nsIFrame* wrapper; - nsresult rv = NS_NewMathMLForeignFrameWrapper(presContext->PresShell(), - &wrapper); - if (NS_FAILED(rv)) return rv; + nsIFrame* wrapper = NS_NewMathMLForeignFrameWrapper(presContext->PresShell()); + if (NS_UNLIKELY(!wrapper)) { + return NS_ERROR_OUT_OF_MEMORY; + } nsRefPtr newStyleContext; newStyleContext = presContext->StyleSet()-> ResolvePseudoStyleFor(mContent, nsCSSAnonBoxes::mozAnonymousBlock, mStyleContext); - rv = wrapper->Init(presContext, mContent, this, newStyleContext, nsnull); + nsresult rv = wrapper->Init(presContext, mContent, this, newStyleContext, nsnull); if (NS_FAILED(rv)) { wrapper->Destroy(presContext); return rv; @@ -1494,34 +1494,16 @@ nsMathMLContainerFrame::FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) //========================== -nsresult -NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmathBlockFrame* it = new (aPresShell) nsMathMLmathBlockFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmathBlockFrame; } //========================== -nsresult -NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmathInlineFrame* it = new (aPresShell) nsMathMLmathInlineFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmathInlineFrame; } diff --git a/layout/mathml/base/src/nsMathMLContainerFrame.h b/layout/mathml/base/src/nsMathMLContainerFrame.h index ce034eaa092f..5811b29b0bad 100644 --- a/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -329,7 +329,7 @@ protected: // Issues: If/when mathml becomes a pluggable component, the separation will be needed. class nsMathMLmathBlockFrame : public nsBlockFrame { public: - friend nsresult NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell); // beware, mFrames is not set by nsBlockFrame // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames @@ -418,7 +418,7 @@ protected: class nsMathMLmathInlineFrame : public nsInlineFrame { public: - friend nsresult NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell); NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext, diff --git a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp index bd4ee125df53..d54a95e5202a 100644 --- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp +++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp @@ -59,19 +59,10 @@ NS_IMPL_ADDREF_INHERITED(nsMathMLForeignFrameWrapper, nsMathMLFrame) NS_IMPL_RELEASE_INHERITED(nsMathMLForeignFrameWrapper, nsMathMLFrame) NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLForeignFrameWrapper, nsBlockFrame, nsMathMLFrame) -nsresult -NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLForeignFrameWrapper* it = new (aPresShell) nsMathMLForeignFrameWrapper; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLForeignFrameWrapper; } NS_IMETHODIMP diff --git a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h index 41b75f074ce0..e72d51a3d4b5 100644 --- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h +++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.h @@ -49,7 +49,7 @@ class nsMathMLForeignFrameWrapper : public nsBlockFrame, public nsMathMLFrame { public: - friend nsresult NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/layout/mathml/base/src/nsMathMLParts.h b/layout/mathml/base/src/nsMathMLParts.h index fb0499e0d7d4..563c22aa3b31 100644 --- a/layout/mathml/base/src/nsMathMLParts.h +++ b/layout/mathml/base/src/nsMathMLParts.h @@ -42,77 +42,46 @@ #include "nsISupports.h" // Factory methods for creating MathML objects -nsresult -NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell, - nsIFrame** aNewFrame); -nsresult -NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmsFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmsubFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmunderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); +nsIFrame* NS_NewMathMLForeignFrameWrapper(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmsFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmsubFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmsupFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmunderFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmoverFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell); -nsIFrame* -NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell); -inline nsIFrame* -NS_NewMathMLmtableFrame(nsIPresShell* aPresShell) +nsIFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell); +inline nsIFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell) { return NS_NewTableFrame(aPresShell); } -inline nsIFrame* -NS_NewMathMLmtrFrame(nsIPresShell* aPresShell) +inline nsIFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell) { return NS_NewTableRowFrame(aPresShell); } -nsIFrame* -NS_NewMathMLmtdFrame(nsIPresShell* aPresShell); -nsIFrame* -NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell); -nsresult -NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmrootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); +nsIFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell); -nsresult -NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -nsresult -NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); -inline nsresult -NS_NewMathMLmathFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, - PRBool aIsBlock) +nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell); +nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell); +inline nsIFrame* NS_NewMathMLmathFrame(nsIPresShell* aPresShell, PRBool aIsBlock) { return (aIsBlock) - ? NS_NewMathMLmathBlockFrame(aPresShell, aNewFrame) - : NS_NewMathMLmathInlineFrame(aPresShell, aNewFrame); + ? NS_NewMathMLmathBlockFrame(aPresShell) + : NS_NewMathMLmathInlineFrame(aPresShell); } #endif /* nsMathMLParts_h___ */ diff --git a/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/layout/mathml/base/src/nsMathMLTokenFrame.cpp index 1c5ae8e11856..4df2589a7ade 100644 --- a/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -54,19 +54,10 @@ #include "nsMathMLTokenFrame.h" -nsresult -NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLTokenFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLTokenFrame* it = new (aPresShell) nsMathMLTokenFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLTokenFrame; } nsMathMLTokenFrame::nsMathMLTokenFrame() diff --git a/layout/mathml/base/src/nsMathMLTokenFrame.h b/layout/mathml/base/src/nsMathMLTokenFrame.h index 8bb8b7ec50d5..630052db7a32 100644 --- a/layout/mathml/base/src/nsMathMLTokenFrame.h +++ b/layout/mathml/base/src/nsMathMLTokenFrame.h @@ -47,7 +47,7 @@ class nsMathMLTokenFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLTokenFrame(nsIPresShell* aPresShell); virtual nsIAtom* GetType() const; diff --git a/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/layout/mathml/base/src/nsMathMLmactionFrame.cpp index 4115980bf798..6dad8e545877 100644 --- a/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -76,19 +76,10 @@ NS_IMPL_ADDREF_INHERITED(nsMathMLmactionFrame, nsMathMLContainerFrame) NS_IMPL_RELEASE_INHERITED(nsMathMLmactionFrame, nsMathMLContainerFrame) NS_IMPL_QUERY_INTERFACE_INHERITED1(nsMathMLmactionFrame, nsMathMLContainerFrame, nsIDOMMouseListener) -nsresult -NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmactionFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmactionFrame* it = new (aPresShell) nsMathMLmactionFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmactionFrame; } nsMathMLmactionFrame::nsMathMLmactionFrame() diff --git a/layout/mathml/base/src/nsMathMLmactionFrame.h b/layout/mathml/base/src/nsMathMLmactionFrame.h index ddf942561169..931bd1427fcc 100644 --- a/layout/mathml/base/src/nsMathMLmactionFrame.h +++ b/layout/mathml/base/src/nsMathMLmactionFrame.h @@ -56,7 +56,7 @@ class nsMathMLmactionFrame : public nsMathMLContainerFrame, public nsIDOMMouseListener { public: - friend nsresult NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 5e6ada20c0eb..e2c47ff0e490 100644 --- a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -53,19 +53,10 @@ // -- surround content with a pair of fences // -nsresult -NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmfencedFrame* it = new (aPresShell) nsMathMLmfencedFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmfencedFrame; } nsMathMLmfencedFrame::nsMathMLmfencedFrame() diff --git a/layout/mathml/base/src/nsMathMLmfencedFrame.h b/layout/mathml/base/src/nsMathMLmfencedFrame.h index 07633b5ad774..da0836429413 100644 --- a/layout/mathml/base/src/nsMathMLmfencedFrame.h +++ b/layout/mathml/base/src/nsMathMLmfencedFrame.h @@ -48,7 +48,7 @@ class nsMathMLmfencedFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell); virtual void SetAdditionalStyleContext(PRInt32 aIndex, diff --git a/layout/mathml/base/src/nsMathMLmfracFrame.cpp b/layout/mathml/base/src/nsMathMLmfracFrame.cpp index c1dda7bbbbe3..1a7e918ee371 100644 --- a/layout/mathml/base/src/nsMathMLmfracFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmfracFrame.cpp @@ -70,19 +70,10 @@ static const PRUnichar kSlashChar = PRUnichar('/'); -nsresult -NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmfracFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmfracFrame* it = new (aPresShell) nsMathMLmfracFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmfracFrame; } nsMathMLmfracFrame::nsMathMLmfracFrame() diff --git a/layout/mathml/base/src/nsMathMLmfracFrame.h b/layout/mathml/base/src/nsMathMLmfracFrame.h index fe7bcc84f255..9be23ce10d0c 100644 --- a/layout/mathml/base/src/nsMathMLmfracFrame.h +++ b/layout/mathml/base/src/nsMathMLmfracFrame.h @@ -85,7 +85,7 @@ element. class nsMathMLmfracFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell); virtual void SetAdditionalStyleContext(PRInt32 aIndex, diff --git a/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp b/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp index adaa98a84421..ac15b07355bd 100644 --- a/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp @@ -53,19 +53,10 @@ // -- attach prescripts and tensor indices to a base - implementation // -nsresult -NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmmultiscriptsFrame* it = new (aPresShell) nsMathMLmmultiscriptsFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmmultiscriptsFrame; } nsMathMLmmultiscriptsFrame::nsMathMLmmultiscriptsFrame() diff --git a/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.h b/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.h index db4cb0a44ea2..cc46812389f0 100644 --- a/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.h +++ b/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.h @@ -49,7 +49,7 @@ class nsMathMLmmultiscriptsFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmmultiscriptsFrame(nsIPresShell* aPresShell); NS_IMETHOD TransmitAutomaticData(); diff --git a/layout/mathml/base/src/nsMathMLmoFrame.cpp b/layout/mathml/base/src/nsMathMLmoFrame.cpp index 970a8f1418c0..afee4619ce0c 100644 --- a/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -58,19 +58,10 @@ // additional style context to be used by our MathMLChar. #define NS_MATHML_CHAR_STYLE_CONTEXT_INDEX 0 -nsresult -NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmoFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmoFrame* it = new (aPresShell) nsMathMLmoFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmoFrame; } nsMathMLmoFrame::nsMathMLmoFrame() diff --git a/layout/mathml/base/src/nsMathMLmoFrame.h b/layout/mathml/base/src/nsMathMLmoFrame.h index af15716bed40..4cedd9663da6 100644 --- a/layout/mathml/base/src/nsMathMLmoFrame.h +++ b/layout/mathml/base/src/nsMathMLmoFrame.h @@ -49,7 +49,7 @@ class nsMathMLmoFrame : public nsMathMLTokenFrame { public: - friend nsresult NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell); virtual nsIAtom* GetType() const; diff --git a/layout/mathml/base/src/nsMathMLmoverFrame.cpp b/layout/mathml/base/src/nsMathMLmoverFrame.cpp index 31b92b81b779..bd78757523bb 100644 --- a/layout/mathml/base/src/nsMathMLmoverFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmoverFrame.cpp @@ -56,19 +56,10 @@ // -- attach an overscript to a base - implementation // -nsresult -NS_NewMathMLmoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmoverFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmoverFrame* it = new (aPresShell) nsMathMLmoverFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmoverFrame; } nsMathMLmoverFrame::nsMathMLmoverFrame() diff --git a/layout/mathml/base/src/nsMathMLmoverFrame.h b/layout/mathml/base/src/nsMathMLmoverFrame.h index 3bbd5878cdbc..584df9db6e69 100644 --- a/layout/mathml/base/src/nsMathMLmoverFrame.h +++ b/layout/mathml/base/src/nsMathMLmoverFrame.h @@ -49,7 +49,7 @@ class nsMathMLmoverFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmoverFrame(nsIPresShell* aPresShell); NS_IMETHOD Place(nsIRenderingContext& aRenderingContext, diff --git a/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp b/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp index a3568334ebc7..9ba7a0351604 100644 --- a/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp @@ -66,19 +66,10 @@ #define NS_MATHML_PSEUDO_UNIT_LSPACE 5 #define NS_MATHML_PSEUDO_UNIT_NAMEDSPACE 6 -nsresult -NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmpaddedFrame* it = new (aPresShell) nsMathMLmpaddedFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmpaddedFrame; } nsMathMLmpaddedFrame::nsMathMLmpaddedFrame() diff --git a/layout/mathml/base/src/nsMathMLmpaddedFrame.h b/layout/mathml/base/src/nsMathMLmpaddedFrame.h index 695a3e1fee0b..be93f8055b1b 100644 --- a/layout/mathml/base/src/nsMathMLmpaddedFrame.h +++ b/layout/mathml/base/src/nsMathMLmpaddedFrame.h @@ -48,7 +48,7 @@ class nsMathMLmpaddedFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell); NS_IMETHOD InheritAutomaticData(nsIFrame* aParent); diff --git a/layout/mathml/base/src/nsMathMLmphantomFrame.cpp b/layout/mathml/base/src/nsMathMLmphantomFrame.cpp index 1f278aa0c94f..e17076b618d0 100644 --- a/layout/mathml/base/src/nsMathMLmphantomFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmphantomFrame.cpp @@ -51,19 +51,10 @@ // -- make content invisible but preserve its size // -nsresult -NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmphantomFrame* it = new (aPresShell) nsMathMLmphantomFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmphantomFrame; } nsMathMLmphantomFrame::nsMathMLmphantomFrame() diff --git a/layout/mathml/base/src/nsMathMLmphantomFrame.h b/layout/mathml/base/src/nsMathMLmphantomFrame.h index 2571eab0ab93..effc622c35e2 100644 --- a/layout/mathml/base/src/nsMathMLmphantomFrame.h +++ b/layout/mathml/base/src/nsMathMLmphantomFrame.h @@ -48,7 +48,7 @@ class nsMathMLmphantomFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmphantomFrame(nsIPresShell* aPresShell); NS_IMETHOD InheritAutomaticData(nsIFrame* aParent); diff --git a/layout/mathml/base/src/nsMathMLmrootFrame.cpp b/layout/mathml/base/src/nsMathMLmrootFrame.cpp index ca601598cfd3..63eef04002b0 100644 --- a/layout/mathml/base/src/nsMathMLmrootFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmrootFrame.cpp @@ -68,19 +68,10 @@ static const PRUnichar kSqrChar = PRUnichar(0x221A); -nsresult -NS_NewMathMLmrootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmrootFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmrootFrame* it = new (aPresShell) nsMathMLmrootFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmrootFrame; } nsMathMLmrootFrame::nsMathMLmrootFrame() : diff --git a/layout/mathml/base/src/nsMathMLmrootFrame.h b/layout/mathml/base/src/nsMathMLmrootFrame.h index b3cb085e77cd..ac9948ebdb64 100644 --- a/layout/mathml/base/src/nsMathMLmrootFrame.h +++ b/layout/mathml/base/src/nsMathMLmrootFrame.h @@ -49,7 +49,7 @@ class nsMathMLmrootFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmrootFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmrootFrame(nsIPresShell* aPresShell); virtual void SetAdditionalStyleContext(PRInt32 aIndex, diff --git a/layout/mathml/base/src/nsMathMLmrowFrame.cpp b/layout/mathml/base/src/nsMathMLmrowFrame.cpp index 5ba44f92600e..77322b1aca52 100644 --- a/layout/mathml/base/src/nsMathMLmrowFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmrowFrame.cpp @@ -52,19 +52,10 @@ // -- horizontally group any number of subexpressions - implementation // -nsresult -NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmrowFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmrowFrame* it = new (aPresShell) nsMathMLmrowFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmrowFrame; } nsMathMLmrowFrame::nsMathMLmrowFrame() diff --git a/layout/mathml/base/src/nsMathMLmrowFrame.h b/layout/mathml/base/src/nsMathMLmrowFrame.h index 5eca29f144e0..18a3f98f9dc7 100644 --- a/layout/mathml/base/src/nsMathMLmrowFrame.h +++ b/layout/mathml/base/src/nsMathMLmrowFrame.h @@ -48,7 +48,7 @@ class nsMathMLmrowFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmrowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmrowFrame(nsIPresShell* aPresShell); NS_IMETHOD InheritAutomaticData(nsIFrame* aParent); diff --git a/layout/mathml/base/src/nsMathMLmspaceFrame.cpp b/layout/mathml/base/src/nsMathMLmspaceFrame.cpp index d9d9a88138c2..deec3b15665b 100644 --- a/layout/mathml/base/src/nsMathMLmspaceFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmspaceFrame.cpp @@ -52,19 +52,10 @@ // -- space - implementation // -nsresult -NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmspaceFrame* it = new (aPresShell) nsMathMLmspaceFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmspaceFrame; } nsMathMLmspaceFrame::nsMathMLmspaceFrame() diff --git a/layout/mathml/base/src/nsMathMLmspaceFrame.h b/layout/mathml/base/src/nsMathMLmspaceFrame.h index d3a2a6f20ebb..75414d27786a 100644 --- a/layout/mathml/base/src/nsMathMLmspaceFrame.h +++ b/layout/mathml/base/src/nsMathMLmspaceFrame.h @@ -47,7 +47,7 @@ class nsMathMLmspaceFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmspaceFrame(nsIPresShell* aPresShell); NS_IMETHOD Reflow(nsPresContext* aPresContext, diff --git a/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp b/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp index b3aa6f254a5d..c2121c0b367d 100644 --- a/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp @@ -68,19 +68,10 @@ static const PRUnichar kSqrChar = PRUnichar(0x221A); -nsresult -NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmsqrtFrame* it = new (aPresShell) nsMathMLmsqrtFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmsqrtFrame; } nsMathMLmsqrtFrame::nsMathMLmsqrtFrame() : diff --git a/layout/mathml/base/src/nsMathMLmsqrtFrame.h b/layout/mathml/base/src/nsMathMLmsqrtFrame.h index af111aa5e3b9..54cbc732151c 100644 --- a/layout/mathml/base/src/nsMathMLmsqrtFrame.h +++ b/layout/mathml/base/src/nsMathMLmsqrtFrame.h @@ -73,7 +73,7 @@ TODO: class nsMathMLmsqrtFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell); virtual void SetAdditionalStyleContext(PRInt32 aIndex, diff --git a/layout/mathml/base/src/nsMathMLmstyleFrame.cpp b/layout/mathml/base/src/nsMathMLmstyleFrame.cpp index 17fc13b75840..aebcf5842270 100644 --- a/layout/mathml/base/src/nsMathMLmstyleFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmstyleFrame.cpp @@ -53,19 +53,10 @@ // -- style change // -nsresult -NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmstyleFrame* it = new (aPresShell) nsMathMLmstyleFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmstyleFrame; } nsMathMLmstyleFrame::nsMathMLmstyleFrame() diff --git a/layout/mathml/base/src/nsMathMLmstyleFrame.h b/layout/mathml/base/src/nsMathMLmstyleFrame.h index 3dd37891b1c4..293adc785b19 100644 --- a/layout/mathml/base/src/nsMathMLmstyleFrame.h +++ b/layout/mathml/base/src/nsMathMLmstyleFrame.h @@ -48,7 +48,7 @@ class nsMathMLmstyleFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell); NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID, diff --git a/layout/mathml/base/src/nsMathMLmsubFrame.cpp b/layout/mathml/base/src/nsMathMLmsubFrame.cpp index e34b47275462..224d279cb9a7 100644 --- a/layout/mathml/base/src/nsMathMLmsubFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmsubFrame.cpp @@ -53,19 +53,10 @@ // -- attach a subscript to a base - implementation // -nsresult -NS_NewMathMLmsubFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmsubFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmsubFrame* it = new (aPresShell) nsMathMLmsubFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmsubFrame; } nsMathMLmsubFrame::nsMathMLmsubFrame() diff --git a/layout/mathml/base/src/nsMathMLmsubFrame.h b/layout/mathml/base/src/nsMathMLmsubFrame.h index 5659940a5b44..ddf6fc5aff13 100644 --- a/layout/mathml/base/src/nsMathMLmsubFrame.h +++ b/layout/mathml/base/src/nsMathMLmsubFrame.h @@ -49,7 +49,7 @@ class nsMathMLmsubFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmsubFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmsubFrame(nsIPresShell* aPresShell); NS_IMETHOD TransmitAutomaticData(); diff --git a/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp b/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp index 72b17fbc7530..954bfafef9cc 100644 --- a/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp @@ -53,19 +53,10 @@ // -- attach a subscript-superscript pair to a base - implementation // -nsresult -NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmsubsupFrame* it = new (aPresShell) nsMathMLmsubsupFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmsubsupFrame; } nsMathMLmsubsupFrame::nsMathMLmsubsupFrame() diff --git a/layout/mathml/base/src/nsMathMLmsubsupFrame.h b/layout/mathml/base/src/nsMathMLmsubsupFrame.h index 8722d2ac885e..5c9b386b19b9 100644 --- a/layout/mathml/base/src/nsMathMLmsubsupFrame.h +++ b/layout/mathml/base/src/nsMathMLmsubsupFrame.h @@ -49,7 +49,7 @@ class nsMathMLmsubsupFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmsubsupFrame(nsIPresShell* aPresShell); NS_IMETHOD TransmitAutomaticData(); diff --git a/layout/mathml/base/src/nsMathMLmsupFrame.cpp b/layout/mathml/base/src/nsMathMLmsupFrame.cpp index e5e9285c6fcd..ddda283d70e0 100644 --- a/layout/mathml/base/src/nsMathMLmsupFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmsupFrame.cpp @@ -52,19 +52,10 @@ // -- attach a superscript to a base - implementation // -nsresult -NS_NewMathMLmsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmsupFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmsupFrame* it = new (aPresShell) nsMathMLmsupFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmsupFrame; } nsMathMLmsupFrame::nsMathMLmsupFrame() diff --git a/layout/mathml/base/src/nsMathMLmsupFrame.h b/layout/mathml/base/src/nsMathMLmsupFrame.h index c4adafbd9d19..e3277a704200 100644 --- a/layout/mathml/base/src/nsMathMLmsupFrame.h +++ b/layout/mathml/base/src/nsMathMLmsupFrame.h @@ -49,7 +49,7 @@ class nsMathMLmsupFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmsupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmsupFrame(nsIPresShell* aPresShell); NS_IMETHOD TransmitAutomaticData(); diff --git a/layout/mathml/base/src/nsMathMLmunderFrame.cpp b/layout/mathml/base/src/nsMathMLmunderFrame.cpp index bbf818a5884a..ee8301207a2c 100644 --- a/layout/mathml/base/src/nsMathMLmunderFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmunderFrame.cpp @@ -56,19 +56,10 @@ // -- attach an underscript to a base - implementation // -nsresult -NS_NewMathMLmunderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmunderFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmunderFrame* it = new (aPresShell) nsMathMLmunderFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmunderFrame; } nsMathMLmunderFrame::nsMathMLmunderFrame() diff --git a/layout/mathml/base/src/nsMathMLmunderFrame.h b/layout/mathml/base/src/nsMathMLmunderFrame.h index 80ae71722989..241911ef1667 100644 --- a/layout/mathml/base/src/nsMathMLmunderFrame.h +++ b/layout/mathml/base/src/nsMathMLmunderFrame.h @@ -49,7 +49,7 @@ class nsMathMLmunderFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmunderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmunderFrame(nsIPresShell* aPresShell); NS_IMETHOD Place(nsIRenderingContext& aRenderingContext, diff --git a/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp b/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp index a476f712c2f8..c0a7a4d11b03 100644 --- a/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp +++ b/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp @@ -56,19 +56,10 @@ // -- attach an underscript-overscript pair to a base - implementation // -nsresult -NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell) { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsMathMLmunderoverFrame* it = new (aPresShell) nsMathMLmunderoverFrame; - if (nsnull == it) { - return NS_ERROR_OUT_OF_MEMORY; - } - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsMathMLmunderoverFrame; } nsMathMLmunderoverFrame::nsMathMLmunderoverFrame() diff --git a/layout/mathml/base/src/nsMathMLmunderoverFrame.h b/layout/mathml/base/src/nsMathMLmunderoverFrame.h index 146cbce2528b..b3de5dc4ee5b 100644 --- a/layout/mathml/base/src/nsMathMLmunderoverFrame.h +++ b/layout/mathml/base/src/nsMathMLmunderoverFrame.h @@ -49,7 +49,7 @@ class nsMathMLmunderoverFrame : public nsMathMLContainerFrame { public: - friend nsresult NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell); NS_IMETHOD Place(nsIRenderingContext& aRenderingContext, diff --git a/layout/svg/base/src/nsSVGCircleFrame.cpp b/layout/svg/base/src/nsSVGCircleFrame.cpp index 86558f5610cc..0786a491925b 100644 --- a/layout/svg/base/src/nsSVGCircleFrame.cpp +++ b/layout/svg/base/src/nsSVGCircleFrame.cpp @@ -50,8 +50,8 @@ class nsSVGCircleFrame : public nsSVGPathGeometryFrame { protected: - friend nsresult - NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGCircleFrame(); NS_IMETHOD InitSVG(); @@ -87,25 +87,18 @@ private: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr circle = do_QueryInterface(aContent); if (!circle) { #ifdef DEBUG printf("warning: trying to construct an SVGCircleFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGCircleFrame* it = new (aPresShell) nsSVGCircleFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGCircleFrame; } nsSVGCircleFrame::~nsSVGCircleFrame() diff --git a/layout/svg/base/src/nsSVGClipPathFrame.cpp b/layout/svg/base/src/nsSVGClipPathFrame.cpp index 05c42a5b358c..776169f9b030 100644 --- a/layout/svg/base/src/nsSVGClipPathFrame.cpp +++ b/layout/svg/base/src/nsSVGClipPathFrame.cpp @@ -74,26 +74,18 @@ nsSVGClipPathFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr transformable = do_QueryInterface(aContent); if (!transformable) { #ifdef DEBUG printf("warning: trying to construct an SVGClipPathFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGClipPathFrame* it = new (aPresShell) nsSVGClipPathFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGClipPathFrame; } nsresult diff --git a/layout/svg/base/src/nsSVGClipPathFrame.h b/layout/svg/base/src/nsSVGClipPathFrame.h index 8723f5b060a1..fa27c65ba32d 100644 --- a/layout/svg/base/src/nsSVGClipPathFrame.h +++ b/layout/svg/base/src/nsSVGClipPathFrame.h @@ -44,8 +44,8 @@ typedef nsSVGDefsFrame nsSVGClipPathFrameBase; class nsSVGClipPathFrame : public nsSVGClipPathFrameBase { - friend nsresult - NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGClipPathFrame(); NS_IMETHOD InitSVG(); diff --git a/layout/svg/base/src/nsSVGDefsFrame.cpp b/layout/svg/base/src/nsSVGDefsFrame.cpp index 2ccdd5cbcf50..e3155d484ebc 100644 --- a/layout/svg/base/src/nsSVGDefsFrame.cpp +++ b/layout/svg/base/src/nsSVGDefsFrame.cpp @@ -50,18 +50,10 @@ //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - - nsSVGDefsFrame* it = new (aPresShell) nsSVGDefsFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGDefsFrame; } nsSVGDefsFrame::nsSVGDefsFrame() diff --git a/layout/svg/base/src/nsSVGDefsFrame.h b/layout/svg/base/src/nsSVGDefsFrame.h index a7a44f4ad2db..cb9b7693c434 100644 --- a/layout/svg/base/src/nsSVGDefsFrame.h +++ b/layout/svg/base/src/nsSVGDefsFrame.h @@ -54,8 +54,8 @@ class nsSVGDefsFrame : public nsSVGDefsFrameBase, public nsISVGValueObserver, public nsSupportsWeakReference { - friend nsresult - NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGDefsFrame(); virtual ~nsSVGDefsFrame(); diff --git a/layout/svg/base/src/nsSVGEllipseFrame.cpp b/layout/svg/base/src/nsSVGEllipseFrame.cpp index e50dab8caaf2..7194c903d464 100644 --- a/layout/svg/base/src/nsSVGEllipseFrame.cpp +++ b/layout/svg/base/src/nsSVGEllipseFrame.cpp @@ -49,8 +49,8 @@ class nsSVGEllipseFrame : public nsSVGPathGeometryFrame { - friend nsresult - NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGEllipseFrame(); @@ -86,25 +86,18 @@ class nsSVGEllipseFrame : public nsSVGPathGeometryFrame //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr ellipse = do_QueryInterface(aContent); if (!ellipse) { #ifdef DEBUG printf("warning: trying to construct an SVGEllipseFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - nsSVGEllipseFrame* it = new (aPresShell) nsSVGEllipseFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGEllipseFrame; } nsSVGEllipseFrame::~nsSVGEllipseFrame() diff --git a/layout/svg/base/src/nsSVGFilterFrame.cpp b/layout/svg/base/src/nsSVGFilterFrame.cpp index 80e7313b672f..a2d8456fd909 100644 --- a/layout/svg/base/src/nsSVGFilterFrame.cpp +++ b/layout/svg/base/src/nsSVGFilterFrame.cpp @@ -67,10 +67,8 @@ class nsSVGFilterFrame : public nsSVGDefsFrame, public nsISVGFilterFrame { protected: - friend nsresult - NS_NewSVGFilterFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGFilterFrame(); NS_IMETHOD InitSVG(); @@ -126,18 +124,10 @@ NS_INTERFACE_MAP_BEGIN(nsSVGFilterFrame) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue) NS_INTERFACE_MAP_END_INHERITING(nsSVGDefsFrame) -nsresult -NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - - nsSVGFilterFrame* it = new (aPresShell) nsSVGFilterFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGFilterFrame; } nsresult diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index 78e36dd0fde1..f1543f1245b9 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -72,8 +72,8 @@ class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, public nsISVGValueObserver, public nsSupportsWeakReference { - friend nsresult - NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGForeignObjectFrame(); virtual ~nsSVGForeignObjectFrame(); @@ -178,26 +178,18 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr foreignObject = do_QueryInterface(aContent); if (!foreignObject) { #ifdef DEBUG printf("warning: trying to construct an SVGForeignObjectFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGForeignObjectFrame* it = new (aPresShell) nsSVGForeignObjectFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGForeignObjectFrame; } nsSVGForeignObjectFrame::nsSVGForeignObjectFrame() diff --git a/layout/svg/base/src/nsSVGGFrame.cpp b/layout/svg/base/src/nsSVGGFrame.cpp index c61f04a60ac1..1a2802fc828b 100644 --- a/layout/svg/base/src/nsSVGGFrame.cpp +++ b/layout/svg/base/src/nsSVGGFrame.cpp @@ -55,26 +55,18 @@ //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) -{ - *aNewFrame = nsnull; - +nsIFrame* +NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent) +{ nsCOMPtr transformable = do_QueryInterface(aContent); if (!transformable) { #ifdef DEBUG printf("warning: trying to construct an SVGGFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGGFrame* it = new (aPresShell) nsSVGGFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGGFrame; } nsIAtom * diff --git a/layout/svg/base/src/nsSVGGFrame.h b/layout/svg/base/src/nsSVGGFrame.h index 059bba2509e1..4d7cf46cb165 100644 --- a/layout/svg/base/src/nsSVGGFrame.h +++ b/layout/svg/base/src/nsSVGGFrame.h @@ -67,8 +67,8 @@ public: #endif protected: - friend nsresult - NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent); // nsISVGChildFrame interface: NS_IMETHOD PaintSVG(nsISVGRendererCanvas* canvas, diff --git a/layout/svg/base/src/nsSVGGenericContainerFrame.cpp b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp index 641b6859a68b..10d75335e975 100644 --- a/layout/svg/base/src/nsSVGGenericContainerFrame.cpp +++ b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp @@ -41,16 +41,10 @@ //---------------------------------------------------------------------- // nsSVGGenericContainerFrame Implementation -nsresult -NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - nsSVGGenericContainerFrame* it = new (aPresShell) nsSVGGenericContainerFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGGenericContainerFrame; } nsSVGGenericContainerFrame::nsSVGGenericContainerFrame() diff --git a/layout/svg/base/src/nsSVGGenericContainerFrame.h b/layout/svg/base/src/nsSVGGenericContainerFrame.h index 7bdc522b99e0..1c639f7c3484 100644 --- a/layout/svg/base/src/nsSVGGenericContainerFrame.h +++ b/layout/svg/base/src/nsSVGGenericContainerFrame.h @@ -54,8 +54,8 @@ class nsSVGGenericContainerFrame : public nsSVGGenericContainerFrameBase, public nsISVGChildFrame, public nsISVGContainerFrame { - friend nsresult - NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGGenericContainerFrame(); virtual ~nsSVGGenericContainerFrame(); diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 9f775e1568ec..5065c01d4a51 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -78,9 +78,9 @@ class nsSVGGlyphFrame : public nsSVGGlyphFrameBase, public nsISVGChildFrame { protected: - friend nsresult + friend nsIFrame* NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame* parentFrame, nsIFrame** aNewFrame); + nsIFrame* parentFrame); nsSVGGlyphFrame(); virtual ~nsSVGGlyphFrame(); @@ -210,12 +210,9 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parentFrame, - nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* parentFrame) { - *aNewFrame = nsnull; - #ifdef DEBUG NS_ASSERTION(parentFrame, "null parent"); nsISVGTextContainerFrame *text_container; @@ -225,14 +222,8 @@ NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame* pa nsCOMPtr tc = do_QueryInterface(aContent); NS_ASSERTION(tc, "trying to construct an SVGGlyphFrame for wrong content element"); #endif - - nsSVGGlyphFrame* it = new (aPresShell) nsSVGGlyphFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGGlyphFrame; } nsSVGGlyphFrame::nsSVGGlyphFrame() diff --git a/layout/svg/base/src/nsSVGGradient.h b/layout/svg/base/src/nsSVGGradient.h index d499a14e80b7..553c676dd9b2 100644 --- a/layout/svg/base/src/nsSVGGradient.h +++ b/layout/svg/base/src/nsSVGGradient.h @@ -48,13 +48,11 @@ nsresult NS_GetSVGGradient(nsISVGGradient** result, nsIContent* aContent, nsIPresShell* aPresShell); -nsresult NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); +nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); -nsresult NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); +nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); #endif // __NS_SVGGRADIENT_H__ diff --git a/layout/svg/base/src/nsSVGGradientFrame.cpp b/layout/svg/base/src/nsSVGGradientFrame.cpp index dac98492baea..9e5c48844ab7 100644 --- a/layout/svg/base/src/nsSVGGradientFrame.cpp +++ b/layout/svg/base/src/nsSVGGradientFrame.cpp @@ -80,18 +80,15 @@ class nsSVGGradientFrame : public nsSVGGradientFrameBase, public nsISVGGradient { protected: - friend nsresult NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); - friend nsresult NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); - friend nsresult NS_NewSVGStopFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame* aParentFrame, - nsIFrame** aNewFrame); + friend nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell, + nsIContent* aContent, + nsIFrame* aParentFrame); friend nsresult NS_GetSVGGradientFrame(nsIFrame** result, nsIURI* aURI, @@ -1160,20 +1157,17 @@ nsSVGRadialGradientFrame::GetR(float *aR) // Public functions // ------------------------------------------------------------------------- -nsresult NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame) +nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr grad = do_QueryInterface(aContent); NS_ASSERTION(grad, "NS_NewSVGLinearGradientFrame -- Content doesn't support nsIDOMSVGLinearGradient"); if (!grad) - return NS_ERROR_FAILURE; + return nsnull; nsSVGLinearGradientFrame* it = new (aPresShell) nsSVGLinearGradientFrame; if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; + return nsnull; nsCOMPtr aRef = do_QueryInterface(aContent); NS_ASSERTION(aRef, "NS_NewSVGLinearGradientFrame -- Content doesn't support nsIDOMSVGURIReference"); @@ -1191,25 +1185,20 @@ nsresult NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, } it->mLoopFlag = PR_FALSE; - *aNewFrame = it; - - return NS_OK; + return it; } -nsresult NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr grad = do_QueryInterface(aContent); NS_ASSERTION(grad, "NS_NewSVGRadialGradientFrame -- Content doesn't support nsIDOMSVGRadialGradient"); if (!grad) - return NS_ERROR_FAILURE; + return nsnull; nsSVGRadialGradientFrame* it = new (aPresShell) nsSVGRadialGradientFrame; if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; + return nsnull; nsCOMPtr aRef = do_QueryInterface(aContent); NS_ASSERTION(aRef, "NS_NewSVGRadialGradientFrame -- Content doesn't support nsIDOMSVGURIReference"); @@ -1227,9 +1216,7 @@ nsresult NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, } it->mLoopFlag = PR_FALSE; - *aNewFrame = it; - - return NS_OK; + return it; } // Public function to locate the SVGGradientFrame structure pointed to by a URI diff --git a/layout/svg/base/src/nsSVGGradientFrame.h b/layout/svg/base/src/nsSVGGradientFrame.h index baa1835732dd..53e754778124 100644 --- a/layout/svg/base/src/nsSVGGradientFrame.h +++ b/layout/svg/base/src/nsSVGGradientFrame.h @@ -43,12 +43,10 @@ #include "nsIContent.h" #include "nsIPresShell.h" -nsresult NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); +nsIFrame* NS_NewSVGLinearGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); -nsresult NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); +nsIFrame* NS_NewSVGRadialGradientFrame(nsIPresShell* aPresShell, + nsIContent* aContent); #endif // __NS_SVGGRADIENTFRAME_H__ diff --git a/layout/svg/base/src/nsSVGImageFrame.cpp b/layout/svg/base/src/nsSVGImageFrame.cpp index f6e21d813684..14477c069492 100644 --- a/layout/svg/base/src/nsSVGImageFrame.cpp +++ b/layout/svg/base/src/nsSVGImageFrame.cpp @@ -82,8 +82,8 @@ private: class nsSVGImageFrame : public nsSVGPathGeometryFrame { protected: - friend nsresult - NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGImageFrame(); NS_IMETHOD InitSVG(); @@ -139,25 +139,18 @@ private: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr Rect = do_QueryInterface(aContent); if (!Rect) { #ifdef DEBUG printf("warning: trying to construct an SVGImageFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - nsSVGImageFrame* it = new (aPresShell) nsSVGImageFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGImageFrame; } nsSVGImageFrame::~nsSVGImageFrame() diff --git a/layout/svg/base/src/nsSVGInnerSVGFrame.cpp b/layout/svg/base/src/nsSVGInnerSVGFrame.cpp index 646c604865f7..93525c43c1c0 100644 --- a/layout/svg/base/src/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGInnerSVGFrame.cpp @@ -67,8 +67,8 @@ class nsSVGInnerSVGFrame : public nsSVGInnerSVGFrameBase, public nsSupportsWeakReference, public nsISVGSVGFrame { - friend nsresult - NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGInnerSVGFrame(); virtual ~nsSVGInnerSVGFrame(); @@ -170,16 +170,10 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - nsSVGInnerSVGFrame* it = new (aPresShell) nsSVGInnerSVGFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGInnerSVGFrame; } nsSVGInnerSVGFrame::nsSVGInnerSVGFrame() : mFilter(nsnull), diff --git a/layout/svg/base/src/nsSVGLineFrame.cpp b/layout/svg/base/src/nsSVGLineFrame.cpp index f7ab31da8636..be733da6247d 100644 --- a/layout/svg/base/src/nsSVGLineFrame.cpp +++ b/layout/svg/base/src/nsSVGLineFrame.cpp @@ -52,8 +52,8 @@ class nsSVGLineFrame : public nsSVGPathGeometryFrame, public nsISVGMarkable { protected: - friend nsresult - NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGLineFrame(); NS_IMETHOD InitSVG(); @@ -103,25 +103,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame) //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr line = do_QueryInterface(aContent); if (!line) { #ifdef DEBUG printf("warning: trying to construct an SVGLineFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - nsSVGLineFrame* it = new (aPresShell) nsSVGLineFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGLineFrame; } nsSVGLineFrame::~nsSVGLineFrame() diff --git a/layout/svg/base/src/nsSVGMarkerFrame.cpp b/layout/svg/base/src/nsSVGMarkerFrame.cpp index fafcddf773fc..35939004c8cb 100644 --- a/layout/svg/base/src/nsSVGMarkerFrame.cpp +++ b/layout/svg/base/src/nsSVGMarkerFrame.cpp @@ -86,18 +86,10 @@ nsSVGMarkerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) return (nsSVGDefsFrame::QueryInterface(aIID, aInstancePtr)); } -nsresult -NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - - nsSVGMarkerFrame* it = new (aPresShell) nsSVGMarkerFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGMarkerFrame; } nsresult diff --git a/layout/svg/base/src/nsSVGMarkerFrame.h b/layout/svg/base/src/nsSVGMarkerFrame.h index 925192b24f70..a767d364ab00 100644 --- a/layout/svg/base/src/nsSVGMarkerFrame.h +++ b/layout/svg/base/src/nsSVGMarkerFrame.h @@ -57,10 +57,8 @@ class nsSVGPathGeometryFrame; class nsSVGMarkerFrame : public nsSVGDefsFrame { protected: - friend nsresult - NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGMarkerFrame(); NS_IMETHOD InitSVG(); diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index 4b0d2934a4c7..821e586493c9 100644 --- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -158,8 +158,8 @@ class nsSVGOuterSVGFrame : public nsSVGOuterSVGFrameBase, public nsSupportsWeakReference, public nsSVGCoordCtxProvider { - friend nsresult - NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGOuterSVGFrame(); virtual ~nsSVGOuterSVGFrame(); @@ -282,26 +282,18 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) -{ - *aNewFrame = nsnull; - +nsIFrame* +NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent) +{ nsCOMPtr svgElement = do_QueryInterface(aContent); if (!svgElement) { #ifdef DEBUG printf("warning: trying to construct an SVGOuterSVGFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - nsSVGOuterSVGFrame* it = new (aPresShell) nsSVGOuterSVGFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGOuterSVGFrame; } nsSVGOuterSVGFrame::nsSVGOuterSVGFrame() diff --git a/layout/svg/base/src/nsSVGPathFrame.cpp b/layout/svg/base/src/nsSVGPathFrame.cpp index a614516a8b61..a80acbea8889 100644 --- a/layout/svg/base/src/nsSVGPathFrame.cpp +++ b/layout/svg/base/src/nsSVGPathFrame.cpp @@ -56,8 +56,8 @@ class nsSVGPathFrame : public nsSVGPathGeometryFrame, public nsISVGPathFlatten { protected: - friend nsresult - NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent); ~nsSVGPathFrame(); NS_IMETHOD InitSVG(); @@ -108,25 +108,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame) //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr anim_data = do_QueryInterface(aContent); if (!anim_data) { #ifdef DEBUG printf("warning: trying to construct an SVGPathFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGPathFrame* it = new (aPresShell) nsSVGPathFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGPathFrame; } nsSVGPathFrame::~nsSVGPathFrame() diff --git a/layout/svg/base/src/nsSVGPatternFrame.cpp b/layout/svg/base/src/nsSVGPatternFrame.cpp index ff46f05cf874..b5651632f77e 100644 --- a/layout/svg/base/src/nsSVGPatternFrame.cpp +++ b/layout/svg/base/src/nsSVGPatternFrame.cpp @@ -96,9 +96,8 @@ class nsSVGPatternFrame : public nsSVGPatternFrameBase, public nsISVGPattern { protected: - friend nsresult NS_NewSVGPatternFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell, + nsIContent* aContent); friend nsresult NS_GetSVGPatternFrame(nsIFrame** result, nsIURI* aURI, @@ -1175,21 +1174,18 @@ nsSVGPatternFrame::GetPatternMatrix(nsIDOMSVGMatrix **ctm, nsIDOMSVGRect *bbox, // Public functions // ------------------------------------------------------------------------- -nsresult NS_NewSVGPatternFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame** aNewFrame) +nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell, + nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr pattern = do_QueryInterface(aContent); NS_ASSERTION(pattern, "NS_NewSVGPatternFrame -- Content doesn't support nsIDOMSVGPattern"); if (!pattern) - return NS_ERROR_FAILURE; + return nsnull; nsSVGPatternFrame* it = new (aPresShell) nsSVGPatternFrame; if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; + return nsnull; nsCOMPtr aRef = do_QueryInterface(aContent); NS_ASSERTION(aRef, @@ -1210,9 +1206,7 @@ nsresult NS_NewSVGPatternFrame(nsIPresShell* aPresShell, #endif } - *aNewFrame = it; - - return NS_OK; + return it; } // Public function to locate the SVGPatternFrame structure pointed to by a URI diff --git a/layout/svg/base/src/nsSVGPolygonFrame.cpp b/layout/svg/base/src/nsSVGPolygonFrame.cpp index a0814ed2a401..4f54f3079e20 100644 --- a/layout/svg/base/src/nsSVGPolygonFrame.cpp +++ b/layout/svg/base/src/nsSVGPolygonFrame.cpp @@ -50,8 +50,8 @@ class nsSVGPolygonFrame : public nsSVGPathGeometryFrame, public nsISVGMarkable { protected: - friend nsresult - NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent); ~nsSVGPolygonFrame(); @@ -100,23 +100,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame) //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent) { nsCOMPtr anim_points = do_QueryInterface(aContent); if (!anim_points) { #ifdef DEBUG printf("warning: trying to construct an SVGPolygonFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGPolygonFrame* it = new (aPresShell) nsSVGPolygonFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGPolygonFrame; } nsSVGPolygonFrame::~nsSVGPolygonFrame() diff --git a/layout/svg/base/src/nsSVGPolylineFrame.cpp b/layout/svg/base/src/nsSVGPolylineFrame.cpp index 4dc21980a7c3..de06f44814b6 100644 --- a/layout/svg/base/src/nsSVGPolylineFrame.cpp +++ b/layout/svg/base/src/nsSVGPolylineFrame.cpp @@ -50,8 +50,8 @@ class nsSVGPolylineFrame : public nsSVGPathGeometryFrame, public nsISVGMarkable { protected: - friend nsresult - NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGPolylineFrame(); NS_IMETHOD InitSVG(); @@ -100,23 +100,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame) //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent) { nsCOMPtr anim_points = do_QueryInterface(aContent); if (!anim_points) { #ifdef DEBUG printf("warning: trying to construct an SVGPolylineFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGPolylineFrame* it = new (aPresShell) nsSVGPolylineFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGPolylineFrame; } nsSVGPolylineFrame::~nsSVGPolylineFrame() diff --git a/layout/svg/base/src/nsSVGRectFrame.cpp b/layout/svg/base/src/nsSVGRectFrame.cpp index 37380489469b..8f255e1e4f23 100644 --- a/layout/svg/base/src/nsSVGRectFrame.cpp +++ b/layout/svg/base/src/nsSVGRectFrame.cpp @@ -51,9 +51,8 @@ class nsSVGRectFrame : public nsSVGPathGeometryFrame { protected: - friend nsresult - NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent); virtual ~nsSVGRectFrame(); NS_IMETHOD InitSVG(); @@ -92,24 +91,16 @@ private: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr Rect = do_QueryInterface(aContent); if (!Rect) { NS_ASSERTION(Rect != nsnull, "wrong content element"); - return NS_ERROR_NO_INTERFACE; + return nsnull; } - nsSVGRectFrame* it = new (aPresShell) nsSVGRectFrame; - if (!it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - return NS_OK; + return new (aPresShell) nsSVGRectFrame; } nsSVGRectFrame::~nsSVGRectFrame() diff --git a/layout/svg/base/src/nsSVGStopFrame.cpp b/layout/svg/base/src/nsSVGStopFrame.cpp index aa86cf2a973f..bef7d17fce3b 100644 --- a/layout/svg/base/src/nsSVGStopFrame.cpp +++ b/layout/svg/base/src/nsSVGStopFrame.cpp @@ -89,10 +89,9 @@ class nsSVGStopFrame : public nsSVGStopFrameBase, nsISVGValue::modificationType aModType); protected: - friend nsresult NS_NewSVGStopFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame* aParentFrame, - nsIFrame** aNewFrame); + friend nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell, + nsIContent* aContent, + nsIFrame* aParentFrame); virtual ~nsSVGStopFrame(); private: @@ -198,13 +197,10 @@ nsSVGStopFrame::DidModifySVGObservable(nsISVGValue* observable, // Public functions // ------------------------------------------------------------------------- -nsresult NS_NewSVGStopFrame(nsIPresShell* aPresShell, - nsIContent* aContent, - nsIFrame* aParentFrame, - nsIFrame** aNewFrame) +nsIFrame* NS_NewSVGStopFrame(nsIPresShell* aPresShell, + nsIContent* aContent, + nsIFrame* aParentFrame) { - *aNewFrame = nsnull; - #ifdef DEBUG_scooter printf("NS_NewSVGStopFrame\n"); #endif @@ -212,15 +208,9 @@ nsresult NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsCOMPtr grad = do_QueryInterface(aContent); NS_ASSERTION(grad, "NS_NewSVGStopFrame -- Content doesn't support nsIDOMSVGStopElement"); if (!grad) - return NS_ERROR_FAILURE; + return nsnull; - nsSVGStopFrame* it = new (aPresShell) nsSVGStopFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGStopFrame; } nsSVGStopFrame::~nsSVGStopFrame() diff --git a/layout/svg/base/src/nsSVGTSpanFrame.cpp b/layout/svg/base/src/nsSVGTSpanFrame.cpp index 5c3050147aff..1e3a5b88a463 100644 --- a/layout/svg/base/src/nsSVGTSpanFrame.cpp +++ b/layout/svg/base/src/nsSVGTSpanFrame.cpp @@ -42,35 +42,27 @@ //---------------------------------------------------------------------- // Implementation -nsresult +nsIFrame* NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame* parentFrame, nsIFrame** aNewFrame) + nsIFrame* parentFrame) { - *aNewFrame = nsnull; - NS_ASSERTION(parentFrame, "null parent"); nsISVGTextContainerFrame *text_container; parentFrame->QueryInterface(NS_GET_IID(nsISVGTextContainerFrame), (void**)&text_container); if (!text_container) { NS_ERROR("trying to construct an SVGTSpanFrame for an invalid container"); - return NS_ERROR_FAILURE; + return nsnull; } nsCOMPtr tspan_elem = do_QueryInterface(aContent); if (!tspan_elem) { NS_ERROR("Trying to construct an SVGTSpanFrame for a " "content element that doesn't support the right interfaces"); - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGTSpanFrame* it = new (aPresShell) nsSVGTSpanFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGTSpanFrame; } nsSVGTSpanFrame::nsSVGTSpanFrame() diff --git a/layout/svg/base/src/nsSVGTSpanFrame.h b/layout/svg/base/src/nsSVGTSpanFrame.h index e64045103488..3da2bc5aaa4a 100644 --- a/layout/svg/base/src/nsSVGTSpanFrame.h +++ b/layout/svg/base/src/nsSVGTSpanFrame.h @@ -75,9 +75,9 @@ class nsSVGTSpanFrame : public nsSVGTSpanFrameBase, public nsISVGValueObserver, public nsSupportsWeakReference { - friend nsresult + friend nsIFrame* NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame* parentFrame, nsIFrame** aNewFrame); + nsIFrame* parentFrame); protected: nsSVGTSpanFrame(); virtual ~nsSVGTSpanFrame(); diff --git a/layout/svg/base/src/nsSVGTextFrame.cpp b/layout/svg/base/src/nsSVGTextFrame.cpp index 6684aab2bacc..5cb93bdc71bc 100644 --- a/layout/svg/base/src/nsSVGTextFrame.cpp +++ b/layout/svg/base/src/nsSVGTextFrame.cpp @@ -79,9 +79,8 @@ class nsSVGTextFrame : public nsSVGTextFrameBase, public nsISVGTextContentMetrics, public nsSupportsWeakReference { - friend nsresult - NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: nsSVGTextFrame(); virtual ~nsSVGTextFrame(); @@ -214,28 +213,19 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr text_elem = do_QueryInterface(aContent); if (!text_elem) { #ifdef DEBUG printf("warning: trying to construct an SVGTextFrame for a " "content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGTextFrame* it = new (aPresShell) nsSVGTextFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGTextFrame; } nsSVGTextFrame::nsSVGTextFrame() diff --git a/layout/svg/base/src/nsSVGTextPathFrame.cpp b/layout/svg/base/src/nsSVGTextPathFrame.cpp index aef5b5605296..c05a7cd83ce5 100644 --- a/layout/svg/base/src/nsSVGTextPathFrame.cpp +++ b/layout/svg/base/src/nsSVGTextPathFrame.cpp @@ -111,34 +111,26 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanFrame) //---------------------------------------------------------------------- // Implementation -nsresult +nsIFrame* NS_NewSVGTextPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, - nsIFrame* parentFrame, nsIFrame** aNewFrame) + nsIFrame* parentFrame) { - *aNewFrame = nsnull; - NS_ASSERTION(parentFrame, "null parent"); nsISVGTextFrame *text_container; parentFrame->QueryInterface(NS_GET_IID(nsISVGTextFrame), (void**)&text_container); if (!text_container) { NS_ERROR("trying to construct an SVGTextPathFrame for an invalid container"); - return NS_ERROR_FAILURE; + return nsnull; } nsCOMPtr tspan_elem = do_QueryInterface(aContent); if (!tspan_elem) { NS_ERROR("Trying to construct an SVGTextPathFrame for a " "content element that doesn't support the right interfaces"); - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGTextPathFrame* it = new (aPresShell) nsSVGTextPathFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGTextPathFrame; } nsSVGTextPathFrame::~nsSVGTextPathFrame() diff --git a/layout/svg/base/src/nsSVGUseFrame.cpp b/layout/svg/base/src/nsSVGUseFrame.cpp index 586de8610257..eef6b8919bc4 100644 --- a/layout/svg/base/src/nsSVGUseFrame.cpp +++ b/layout/svg/base/src/nsSVGUseFrame.cpp @@ -50,8 +50,8 @@ typedef nsSVGGFrame nsSVGUseFrameBase; class nsSVGUseFrame : public nsSVGUseFrameBase, public nsIAnonymousContentCreator { - friend nsresult - NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent); protected: @@ -98,26 +98,18 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - *aNewFrame = nsnull; - nsCOMPtr transformable = do_QueryInterface(aContent); if (!transformable) { #ifdef DEBUG printf("warning: trying to construct an SVGUseFrame for a content element that doesn't support the right interfaces\n"); #endif - return NS_ERROR_FAILURE; + return nsnull; } - - nsSVGUseFrame* it = new (aPresShell) nsSVGUseFrame; - if (it == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsSVGUseFrame; } NS_IMETHODIMP diff --git a/layout/xtf/src/nsXTFSVGDisplayFrame.cpp b/layout/xtf/src/nsXTFSVGDisplayFrame.cpp index ff30f3949fd1..88b4504fd24c 100644 --- a/layout/xtf/src/nsXTFSVGDisplayFrame.cpp +++ b/layout/xtf/src/nsXTFSVGDisplayFrame.cpp @@ -50,8 +50,8 @@ class nsXTFSVGDisplayFrame : public nsXTFSVGDisplayFrameBase, public nsIAnonymousContentCreator { public: - friend nsresult - NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + friend nsIFrame* + NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent); // nsISupports interface: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); private: @@ -74,16 +74,10 @@ protected: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +nsIFrame* +NS_NewXTFSVGDisplayFrame(nsIPresShell* aPresShell, nsIContent* aContent) { - nsXTFSVGDisplayFrame* it = new (aPresShell) nsXTFSVGDisplayFrame; - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsXTFSVGDisplayFrame; } //---------------------------------------------------------------------- diff --git a/layout/xtf/src/nsXTFXMLDisplayFrame.cpp b/layout/xtf/src/nsXTFXMLDisplayFrame.cpp index e08d5d13fb6d..d0e4ee5ca3fa 100644 --- a/layout/xtf/src/nsXTFXMLDisplayFrame.cpp +++ b/layout/xtf/src/nsXTFXMLDisplayFrame.cpp @@ -51,9 +51,7 @@ //////////////////////////////////////////////////////////////////////// // nsXTFXMLBlockDisplayFrame -nsresult NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, - PRBool isBlock, nsIFrame** aNewFrame); - +nsIFrame* NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, PRBool isBlock); typedef nsBlockFrame nsXTFXMLBlockDisplayFrameBase; @@ -148,10 +146,6 @@ nsXTFXMLBlockDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext, //////////////////////////////////////////////////////////////////////// // nsXTFXMLInlineDisplayFrame -nsresult NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, - PRBool isInline, nsIFrame** aNewFrame); - - typedef nsInlineFrame nsXTFXMLInlineDisplayFrameBase; class nsXTFXMLInlineDisplayFrame : public nsXTFXMLInlineDisplayFrameBase, @@ -245,16 +239,11 @@ nsXTFXMLInlineDisplayFrame::CreateAnonymousContent(nsPresContext* aPresContext, //////////////////////////////////////////////////////////////////////// // Construction API -nsresult -NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, PRBool isBlock, nsIFrame** aNewFrame) +nsIFrame* +NS_NewXTFXMLDisplayFrame(nsIPresShell* aPresShell, PRBool isBlock) { if (isBlock) - *aNewFrame = new (aPresShell) nsXTFXMLBlockDisplayFrame(); + return new (aPresShell) nsXTFXMLBlockDisplayFrame(); else - *aNewFrame = new (aPresShell) nsXTFXMLInlineDisplayFrame(); - - if (nsnull == *aNewFrame) - return NS_ERROR_OUT_OF_MEMORY; - - return NS_OK; + return new (aPresShell) nsXTFXMLInlineDisplayFrame(); } diff --git a/layout/xtf/src/nsXTFXULDisplayFrame.cpp b/layout/xtf/src/nsXTFXULDisplayFrame.cpp index fac4690af648..b1e0c017588b 100644 --- a/layout/xtf/src/nsXTFXULDisplayFrame.cpp +++ b/layout/xtf/src/nsXTFXULDisplayFrame.cpp @@ -48,8 +48,7 @@ class nsXTFXULDisplayFrame : public nsXTFXULDisplayFrameBase, public nsIAnonymousContentCreator { public: - friend nsresult - NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); + friend nsIFrame* NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell); nsXTFXULDisplayFrame(nsIPresShell* aPresShell); @@ -81,16 +80,10 @@ public: //---------------------------------------------------------------------- // Implementation -nsresult -NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +nsIFrame* +NS_NewXTFXULDisplayFrame(nsIPresShell* aPresShell) { - nsXTFXULDisplayFrame* it = new (aPresShell) nsXTFXULDisplayFrame(aPresShell); - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - - return NS_OK; + return new (aPresShell) nsXTFXULDisplayFrame(aPresShell); } nsXTFXULDisplayFrame::nsXTFXULDisplayFrame(nsIPresShell* aPresShell)