diff --git a/mozilla/content/base/src/nsImageLoadingContent.cpp b/mozilla/content/base/src/nsImageLoadingContent.cpp index 49a456dfae5..71e430bb9fe 100644 --- a/mozilla/content/base/src/nsImageLoadingContent.cpp +++ b/mozilla/content/base/src/nsImageLoadingContent.cpp @@ -478,8 +478,7 @@ nsImageLoadingContent::ImageURIChanged(const nsACString& aNewURI) // to be easily detectable. For example, I suspect that this code will // fail for in the current CantRenderReplacedElement // implementation... - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = frame->GetType(); if (frameType != nsLayoutAtoms::imageFrame && frameType != nsLayoutAtoms::imageControlFrame && frameType != nsLayoutAtoms::objectFrame) { diff --git a/mozilla/content/base/src/nsPrintEngine.cpp b/mozilla/content/base/src/nsPrintEngine.cpp index 8c8dfeb7495..9284c7000ee 100644 --- a/mozilla/content/base/src/nsPrintEngine.cpp +++ b/mozilla/content/base/src/nsPrintEngine.cpp @@ -3067,9 +3067,7 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY) nsPoint pt = frame->GetPosition(); aX += pt.x; aY += pt.y; - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::pageContentFrame == frameType.get()) { + if (nsLayoutAtoms::pageContentFrame == frame->GetType()) { break; } frame = frame->GetParent(); diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp index 0d728a9a73b..39430a63fa3 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp @@ -2697,9 +2697,7 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame, nsRect rect = aFrame->GetRect(); nsRect containerRect = container->GetRect(); - nsCOMPtr typeAtom; - container->GetFrameType(getter_AddRefs(typeAtom)); - if (typeAtom == nsLayoutAtoms::viewportFrame) { + if (container->GetType() == nsLayoutAtoms::viewportFrame) { // For absolutely positioned frames scrollbars are taken into // account by virtue of getting a containing block that does // _not_ include the scrollbars. For fixed positioned frames, diff --git a/mozilla/content/html/style/src/nsInspectorCSSUtils.cpp b/mozilla/content/html/style/src/nsInspectorCSSUtils.cpp index 35640942941..5b1f4e79ce8 100644 --- a/mozilla/content/html/style/src/nsInspectorCSSUtils.cpp +++ b/mozilla/content/html/style/src/nsInspectorCSSUtils.cpp @@ -128,9 +128,7 @@ nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame) * frame" actually inherits style from the "inner frame" so we can * just move one level up in the style context hierarchy.... */ - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::tableOuterFrame) + if (aFrame->GetType() == nsLayoutAtoms::tableOuterFrame) return styleContext->GetParent(); return styleContext; diff --git a/mozilla/content/shared/public/nsLayoutAtoms.h b/mozilla/content/shared/public/nsLayoutAtoms.h index e49465cc289..aca928d3399 100644 --- a/mozilla/content/shared/public/nsLayoutAtoms.h +++ b/mozilla/content/shared/public/nsLayoutAtoms.h @@ -64,4 +64,9 @@ public: #undef LAYOUT_ATOM }; +static inline PRBool IS_TABLE_CELL(nsIAtom* frameType) { + return nsLayoutAtoms::tableCellFrame == frameType || + nsLayoutAtoms::bcTableCellFrame == frameType; +} + #endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp b/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp index a5399200701..c516d1e8762 100644 --- a/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp +++ b/mozilla/embedding/browser/webBrowser/nsContextMenuInfo.cpp @@ -358,10 +358,8 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon // the frame is the body frame, so we provide the canvas frame nsIFrame *pCanvasFrame = aFrame->GetParent(); while (pCanvasFrame) { - nsCOMPtr parentType; - pCanvasFrame->GetFrameType(getter_AddRefs(parentType)); - nsCOMPtr mTag_canvasFrame = do_GetAtom("CanvasFrame"); - if (parentType.get() == mTag_canvasFrame) { + nsCOMPtr mTag_canvasFrame = do_GetAtom("CanvasFrame"); + if (pCanvasFrame->GetType() == mTag_canvasFrame) { *aBGFrame = pCanvasFrame; break; } diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 446b41f7fdf..b24255e6fba 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -257,10 +257,10 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, PRBool isTextFrame = PR_FALSE; nsIFrame* frame = nsnull; nsIFrame* nextBidi; - nsCOMPtr frameType; nsIContent* content = nsnull; nsCOMPtr textContent; const nsTextFragment* fragment; + nsIAtom* frameType = nsnull; for (; ;) { if (fragmentLength <= 0) { @@ -270,9 +270,8 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, contentOffset = 0; frame = (nsIFrame*) (mLogicalFrames[frameIndex]); - - frame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::textFrame == frameType.get() ) { + frameType = frame->GetType(); + if (nsLayoutAtoms::textFrame == frameType) { content = frame->GetContent(); if (!content) { mSuccess = NS_OK; @@ -310,7 +309,7 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, } } // if (runLength <= 0) - if (nsLayoutAtoms::directionalFrame == frameType.get()) { + if (nsLayoutAtoms::directionalFrame == frameType) { delete frame; ++lineOffset; } @@ -370,7 +369,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, nsIFrame* frame; nsIFrame* directionalFrame; nsIFrame* kid; - nsCOMPtr frameType; nsresult rv; nsresult res = NS_OK; @@ -408,13 +406,13 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, } } - frame->GetFrameType(getter_AddRefs(frameType) ); + nsIAtom* frameType = frame->GetType(); if ( (!display->IsBlockLevel() ) - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + && ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) ) { frame->FirstChild(aPresContext, nsnull, &kid); res = InitLogicalArray(aPresContext, kid, aNextInFlow, aAddMarkers); } @@ -450,16 +448,15 @@ nsBidiPresUtils::CreateBlockBuffer(nsIPresContext* aPresContext) nsIFrame* frame; nsIContent* prevContent = nsnull; nsCOMPtr textContent; - nsCOMPtr frameType; const nsTextFragment* frag; PRUint32 i; PRUint32 count = mLogicalFrames.Count(); for (i = 0; i < count; i++) { frame = (nsIFrame*) (mLogicalFrames[i]); - frame->GetFrameType(getter_AddRefs(frameType) ); + nsIAtom* frameType = frame->GetType(); - if (nsLayoutAtoms::textFrame == frameType.get() ) { + if (nsLayoutAtoms::textFrame == frameType) { nsIContent* content = frame->GetContent(); if (!content) { mSuccess = NS_OK; @@ -480,11 +477,11 @@ nsBidiPresUtils::CreateBlockBuffer(nsIPresContext* aPresContext) } frag->AppendTo(mBuffer); } - else if (nsLayoutAtoms::brFrame == frameType.get() ) { // break frame + else if (nsLayoutAtoms::brFrame == frameType) { // break frame // Append line separator mBuffer.Append( (PRUnichar) kLineSeparator); } - else if (nsLayoutAtoms::directionalFrame == frameType.get() ) { + else if (nsLayoutAtoms::directionalFrame == frameType) { nsDirectionalFrame* dirFrame; frame->QueryInterface(NS_GET_IID(nsDirectionalFrame), (void**) &dirFrame); @@ -684,16 +681,13 @@ nsBidiPresUtils::RepositionInlineFrames(nsIPresContext* aPresContext, // We assume that rectangle takes all the room from "english" left edge to // "WERBEH" right edge. - nsCOMPtr frameType; - frame = aFirstChild; for (i = 0; i < aChildCount; i++) { - frame->GetFrameType(getter_AddRefs(frameType) ); - if ( frameType.get() - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + nsIAtom* frameType = frame->GetType(); + if ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) { PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; RepositionContainerFrame(aPresContext, frame, minX, maxX); @@ -710,19 +704,17 @@ nsBidiPresUtils::RepositionContainerFrame(nsIPresContext* aPresContext, { nsIFrame* frame; nsIFrame* firstChild; - nsCOMPtr frameType; PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; aContainer->FirstChild(aPresContext, nsnull, &firstChild); for (frame = firstChild; frame; frame = frame->GetNextSibling()) { - frame->GetFrameType(getter_AddRefs(frameType) ); - if ( (frameType.get() ) - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + nsIAtom* frameType = frame->GetType(); + if ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) { RepositionContainerFrame(aPresContext, frame, minX, maxX); } else { @@ -791,7 +783,6 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext, PRInt32 aLastIndex, PRInt32& aOffset) const { - nsCOMPtr frameType; nsIFrame* frame; PRInt32 index; nsIFrame* parent = aFrame->GetParent(); @@ -803,8 +794,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext, for (index = aLastIndex; index > aFirstIndex; index--) { frame = (nsIFrame*) mLogicalFrames[index]; - frame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::directionalFrame == frameType.get() ) { + if (nsLayoutAtoms::directionalFrame == frame->GetType()) { delete frame; ++aOffset; } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 12339417fdc..e1b2464337c 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -815,9 +815,7 @@ AdjustAbsoluteContainingBlock(nsIPresContext* aPresContext, PRBool paginated; aPresContext->IsPaginated(&paginated); if (!paginated) { - nsCOMPtr fType; - containingBlock->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::positionedInlineFrame == fType) { + if (nsLayoutAtoms::positionedInlineFrame == containingBlock->GetType()) { containingBlock = ((nsPositionedInlineFrame*)containingBlock)->GetFirstInFlow(); } } @@ -877,9 +875,7 @@ static PRBool IsBorderCollapse(nsIFrame* aFrame) { for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) { - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == frame->GetType()) { return ((nsTableFrame*)frame)->IsBorderCollapse(); } } @@ -894,11 +890,8 @@ GetRealFrame(nsIFrame* aFrame) nsIFrame* result = aFrame; // We may be a placeholder. If we are, go to the real frame. - nsCOMPtr frameType; - // See if it's a placeholder frame for a float. - aFrame->GetFrameType(getter_AddRefs(frameType)); - PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get()); + PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == aFrame->GetType()); if (isPlaceholder) { // Get the out-of-flow frame that the placeholder points to. // This is the real float that we should examine. @@ -1182,14 +1175,10 @@ GetCaptionAdjustedParent(nsIFrame* aParentFrame, { *aAdjParentFrame = aParentFrame; PRBool haveCaption = PR_FALSE; - nsCOMPtr childFrameType; - aChildFrame->GetFrameType(getter_AddRefs(childFrameType)); - if (nsLayoutAtoms::tableCaptionFrame == childFrameType.get()) { + if (nsLayoutAtoms::tableCaptionFrame == aChildFrame->GetType()) { haveCaption = PR_TRUE; - nsCOMPtr parentFrameType; - aParentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (nsLayoutAtoms::tableFrame == parentFrameType.get()) { + if (nsLayoutAtoms::tableFrame == aParentFrame->GetType()) { *aAdjParentFrame = aParentFrame->GetParent(); } } @@ -1768,16 +1757,10 @@ IsTableRelated(nsIAtom* aParentType, static nsIFrame* GetOuterTableFrame(nsIFrame* aParentFrame) { - nsIFrame* parent; - nsCOMPtr frameType; - aParentFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableOuterFrame == frameType.get()) { - parent = aParentFrame; + if (nsLayoutAtoms::tableOuterFrame == aParentFrame->GetType()) { + return aParentFrame; } - else { - parent = aParentFrame->GetParent(); - } - return parent; + return aParentFrame->GetParent(); } static nsresult @@ -2079,7 +2062,7 @@ nsCSSFrameConstructor::CreatePseudoColGroupFrame(nsIPresShell* aPresS parentFrame, childStyle, aTableCreator, PR_TRUE, items, pseudo.mFrame, pseudoParent); if (NS_FAILED(rv)) return rv; - ((nsTableColGroupFrame*)pseudo.mFrame)->SetType(eColGroupAnonymousCol); + ((nsTableColGroupFrame*)pseudo.mFrame)->SetColType(eColGroupAnonymousCol); // set pseudo data for the parent if (aState.mPseudoFrames.mTableInner.mFrame) { @@ -2192,17 +2175,16 @@ nsCSSFrameConstructor::GetPseudoTableFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get()) { // row group parent + if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); if (NS_FAILED(rv)) return rv; created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType.get())) { // row parent + if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType)) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); if (NS_FAILED(rv)) return rv; } @@ -2236,21 +2218,20 @@ nsCSSFrameConstructor::GetPseudoColGroupFrame(nsIPresShell* aPresShel if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get()) { // row group parent + if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType.get())) { // row parent + if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType)) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (created || IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoColGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2284,17 +2265,16 @@ nsCSSFrameConstructor::GetPseudoRowGroupFrame(nsIPresShell* aPresShel if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowFrame == parentFrameType.get()) { // row parent + if (nsLayoutAtoms::tableRowFrame == parentFrameType) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (created || IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2325,17 +2305,16 @@ nsCSSFrameConstructor::GetPseudoRowFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableFrame == parentFrameType.get())) { // table parent + if (created || (nsLayoutAtoms::tableFrame == parentFrameType)) { // table parent rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2366,16 +2345,15 @@ nsCSSFrameConstructor::GetPseudoCellFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableFrame == parentFrameType.get()) { // table parent + if (nsLayoutAtoms::tableFrame == parentFrameType) { // table parent rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get())) { // row group parent + if (created || (nsLayoutAtoms::tableRowGroupFrame == parentFrameType)) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } @@ -2406,37 +2384,36 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, nsresult rv = NS_OK; if (!aPresShell || !aPresContext) return rv; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); nsIFrame* pseudoParentFrame = nsnull; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; aParentFrame = &aParentFrameIn; aIsPseudoParent = PR_FALSE; if (nsLayoutAtoms::tableOuterFrame == aChildFrameType) { // table child - if (IsTableRelated(parentFrameType.get(), PR_TRUE) && - (nsLayoutAtoms::tableCaptionFrame != parentFrameType.get()) ) { // need pseudo cell parent + if (IsTableRelated(parentFrameType, PR_TRUE) && + (nsLayoutAtoms::tableCaptionFrame != parentFrameType) ) { // need pseudo cell parent rv = GetPseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mCellInner.mFrame; } } else if (nsLayoutAtoms::tableCaptionFrame == aChildFrameType) { // caption child - if (nsLayoutAtoms::tableOuterFrame != parentFrameType.get()) { // need pseudo table parent + if (nsLayoutAtoms::tableOuterFrame != parentFrameType) { // need pseudo table parent rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mTableOuter.mFrame; } } else if (nsLayoutAtoms::tableColGroupFrame == aChildFrameType) { // col group child - if (nsLayoutAtoms::tableFrame != parentFrameType.get()) { // need pseudo table parent + if (nsLayoutAtoms::tableFrame != parentFrameType) { // need pseudo table parent rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mTableInner.mFrame; } } else if (nsLayoutAtoms::tableColFrame == aChildFrameType) { // col child - if (nsLayoutAtoms::tableColGroupFrame != parentFrameType.get()) { // need pseudo col group parent + if (nsLayoutAtoms::tableColGroupFrame != parentFrameType) { // need pseudo col group parent rv = GetPseudoColGroupFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mColGroup.mFrame; @@ -2444,7 +2421,7 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, } else if (nsLayoutAtoms::tableRowGroupFrame == aChildFrameType) { // row group child // XXX can this go away? - if (nsLayoutAtoms::tableFrame != parentFrameType.get()) { + if (nsLayoutAtoms::tableFrame != parentFrameType) { // trees allow row groups to contain row groups, so don't create pseudo frames rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; @@ -2452,14 +2429,14 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, } } else if (nsLayoutAtoms::tableRowFrame == aChildFrameType) { // row child - if (nsLayoutAtoms::tableRowGroupFrame != parentFrameType.get()) { // need pseudo row group parent + if (nsLayoutAtoms::tableRowGroupFrame != parentFrameType) { // need pseudo row group parent rv = GetPseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mRowGroup.mFrame; } } else if (IS_TABLE_CELL(aChildFrameType)) { // cell child - if (nsLayoutAtoms::tableRowFrame != parentFrameType.get()) { // need pseudo row parent + if (nsLayoutAtoms::tableRowFrame != parentFrameType) { // need pseudo row parent rv = GetPseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mRow.mFrame; @@ -2469,7 +2446,7 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, NS_ASSERTION(PR_FALSE, "GetParentFrame called on nsLayoutAtoms::tableFrame child"); } else { // foreign frame - if (IsTableRelated(parentFrameType.get(), PR_FALSE)) { // need pseudo cell parent + if (IsTableRelated(parentFrameType, PR_FALSE)) { // need pseudo cell parent rv = GetPseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mCellInner.mFrame; @@ -2845,7 +2822,7 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv; InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol); - ((nsTableColFrame*)newCol)->SetType(eColAnonymousCol); + ((nsTableColFrame*)newCol)->SetColType(eColAnonymousCol); lastCol->SetNextSibling(newCol); lastCol = newCol; } @@ -3073,8 +3050,7 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresShell* aPresShell, nsPseudoFrames priorPseudoFrames; aState.mPseudoFrames.Reset(&priorPseudoFrames); - nsCOMPtr parentFrameType; - aParentFrame->GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrame->GetType(); nsStyleContext* parentStyleContext = aParentFrame->GetStyleContext(); ChildIterator iter, last; @@ -5701,10 +5677,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, // if not then we are in a box so do what boxes like. On example is boxes // do not support the absolute positioning of their children. While html blocks // thats why we call different things here. - nsCOMPtr frameType; - geometricParent->GetFrameType(getter_AddRefs(frameType)); - if ((frameType.get() == nsLayoutAtoms::blockFrame) || - (frameType.get() == nsLayoutAtoms::areaFrame)) { + nsIAtom* frameType = geometricParent->GetType(); + if ((frameType == nsLayoutAtoms::blockFrame) || + (frameType == nsLayoutAtoms::areaFrame)) { */ // See if we need to create a view, e.g. the frame is absolutely positioned nsHTMLContainerFrame::CreateViewForFrame(newFrame, aParentFrame, PR_FALSE); @@ -5840,9 +5815,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh PRBool noScalingOfTwips = PR_FALSE; nsCOMPtr printPreviewContext(do_QueryInterface(aPresContext)); if (printPreviewContext) { - nsCOMPtr typeAtom; - aParentFrame->GetFrameType(getter_AddRefs(typeAtom)); - noScalingOfTwips = typeAtom == nsLayoutAtoms::viewportFrame; + noScalingOfTwips = aParentFrame->GetType() == nsLayoutAtoms::viewportFrame; if (noScalingOfTwips) { printPreviewContext->SetScalingOfTwips(PR_FALSE); } @@ -5999,9 +5972,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell, PRBool noScalingOfTwips = PR_FALSE; nsCOMPtr printPreviewContext(do_QueryInterface(aPresContext)); if (printPreviewContext) { - nsCOMPtr typeAtom; - aParentFrame->GetFrameType(getter_AddRefs(typeAtom)); - noScalingOfTwips = typeAtom == nsLayoutAtoms::viewportFrame; + noScalingOfTwips = aParentFrame->GetType() == nsLayoutAtoms::viewportFrame; if (noScalingOfTwips) { printPreviewContext->SetScalingOfTwips(PR_FALSE); } @@ -6114,10 +6085,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre // if the new frame is not table related and the parent is a table, row group, or row, // then we need to get or create the pseudo table cell frame and use it as the parent. if (adjParentFrame) { - nsCOMPtr parentType; - adjParentFrame->GetFrameType(getter_AddRefs(parentType)); if (!IsTableRelated(aDisplay->mDisplay, PR_TRUE) && - IsTableRelated(parentType.get(), PR_FALSE) && + IsTableRelated(adjParentFrame->GetType(), PR_FALSE) && aTag != nsHTMLAtoms::form) { GetPseudoCellFrame(aPresShell, aPresContext, tableCreator, aState, *adjParentFrame); if (aState.mPseudoFrames.mCellInner.mFrame) { @@ -6419,10 +6388,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre // In this case we need to get the outer frame. nsIFrame* parentFrame = adjParentFrame; nsIFrame* outerFrame = adjParentFrame->GetParent(); - nsCOMPtr frameType; if (outerFrame) { - outerFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableOuterFrame == frameType.get()) { + if (nsLayoutAtoms::tableOuterFrame == outerFrame->GetType()) { parentFrame = outerFrame; } } @@ -7242,9 +7209,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe inline PRBool IsRootBoxFrame(nsIFrame *aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - return (frameType == nsLayoutAtoms::rootFrame); + return (aFrame->GetType() == nsLayoutAtoms::rootFrame); } NS_IMETHODIMP @@ -7445,30 +7410,26 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, const nsStyleDisplay* disp = frame->GetStyleDisplay(); if (disp->IsPositioned() && disp->mDisplay != NS_STYLE_DISPLAY_TABLE) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - + nsIAtom* frameType = frame->GetType(); if (nsLayoutAtoms::scrollFrame == frameType) { // We want the scrolled frame, not either of the two scroll frames nsIFrame* scrolledFrame; frame->FirstChild(aPresContext, nsnull, &scrolledFrame); if (scrolledFrame) { - scrolledFrame->GetFrameType(getter_AddRefs(frameType)); + frameType = scrolledFrame->GetType(); if (nsLayoutAtoms::areaFrame == frameType) { containingBlock = scrolledFrame; break; } else if (nsLayoutAtoms::scrollFrame == frameType) { scrolledFrame->FirstChild(aPresContext, nsnull, &scrolledFrame); if (scrolledFrame) { - scrolledFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::areaFrame == frameType) { + if (nsLayoutAtoms::areaFrame == scrolledFrame->GetType()) { containingBlock = scrolledFrame; break; } } } } - } else if ((nsLayoutAtoms::areaFrame == frameType) || (nsLayoutAtoms::positionedInlineFrame == frameType)) { containingBlock = frame; @@ -7511,9 +7472,7 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext, if ((NS_STYLE_FLOAT_NONE != display->mFloats) || (display->IsAbsolutelyPositioned())) { if (NS_STYLE_FLOAT_NONE != display->mFloats) { - nsCOMPtr frameType; - containingBlock->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame != frameType.get()) { + if (nsLayoutAtoms::letterFrame != containingBlock->GetType()) { break; } } @@ -7572,13 +7531,10 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext, nsresult rv = NS_OK; // a col group or col appended to a table may result in an insert rather than an append - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (nsLayoutAtoms::tableFrame == parentType.get()) { + if (nsLayoutAtoms::tableFrame == aParentFrame->GetType()) { nsTableFrame* tableFrame = NS_REINTERPRET_CAST(nsTableFrame*, aParentFrame); - nsCOMPtr childType; - aFrameList->GetFrameType(getter_AddRefs(childType)); - if (nsLayoutAtoms::tableColFrame == childType.get()) { + nsIAtom* childType = aFrameList->GetType(); + if (nsLayoutAtoms::tableColFrame == childType) { // table column nsIFrame* parentFrame = aFrameList->GetParent(); rv = aFrameManager->AppendFrames(parentFrame, @@ -7831,12 +7787,9 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell, return PR_FALSE; } else { - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (nsLayoutAtoms::fieldSetFrame == parentType) { + if (nsLayoutAtoms::fieldSetFrame == aParentFrame->GetType()) { // Legends can be sibling of legends but not of other content in the fieldset - nsCOMPtr sibType; - aSibling.GetFrameType(getter_AddRefs(sibType)); + nsIAtom* sibType = aSibling.GetType(); nsCOMPtr legendContent(do_QueryInterface(&aContent)); if ((legendContent && (nsLayoutAtoms::legendFrame != sibType)) || @@ -8303,9 +8256,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // If we didn't process children when we originally created the frame, // then don't do any processing now - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::objectFrame) { + nsIAtom* frameType = parentFrame->GetType(); + if (frameType == nsLayoutAtoms::objectFrame) { // This handles APPLET, EMBED, and OBJECT return NS_OK; } @@ -8348,13 +8300,11 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // moving it into the appropriate list. This is more efficient than checking the display // type of childContent. During the construction of a caption frame, the outer // table frame will be used as its parent. - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == frameType) { nsFrameItems tempItems; ConstructFrame(shell, aPresContext, state, childContent, parentFrame, tempItems); if (tempItems.childList) { - nsCOMPtr childFrameType; - tempItems.childList->GetFrameType(getter_AddRefs(childFrameType)); - if (nsLayoutAtoms::tableCaptionFrame == childFrameType.get()) { + if (nsLayoutAtoms::tableCaptionFrame == tempItems.childList->GetType()) { PRBool abortCaption = PR_FALSE; // check if a caption already exists in captionItems, and if so, abort the caption if (captionItems.childList) { @@ -8385,7 +8335,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, } // Don't create child frames for iframes/frames, they should not // display any content that they contain. - else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType.get()) { + else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType) { // Construct a child frame (that does not have a table as parent) ConstructFrame(shell, aPresContext, state, childContent, parentFrame, frameItems); } @@ -8431,7 +8381,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, } // Append the flowed frames to the principal child list, tables need special treatment - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == frameType) { if (captionItems.childList) { // append the caption to the outer table nsIFrame* outerTable = parentFrame->GetParent(); if (outerTable) { @@ -8915,9 +8865,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // If we didn't process children when we originally created the frame, // then don't do any processing now - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::objectFrame) { + nsIAtom* frameType = parentFrame->GetType(); + if (frameType == nsLayoutAtoms::objectFrame) { // This handles APPLET, EMBED, and OBJECT return NS_OK; } @@ -8985,9 +8934,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, if (haveFirstLetterStyle) { // Get the correct parentFrame and prevSibling - if a // letter-frame is present, use its parent. - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType.get() == nsLayoutAtoms::letterFrame) { + if (parentFrame->GetType() == nsLayoutAtoms::letterFrame) { if (prevSibling) prevSibling = parentFrame; @@ -9207,10 +9154,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, nsIFrame* subtree = childFrame; // See if it's a placeholder frame - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == childFrame->GetType()) { // Get the out-of-flow frame nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)childFrame)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -9692,7 +9636,6 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, // now do children of frame PRInt32 listIndex = 0; nsIAtom* childList = nsnull; - nsIAtom* frameType = nsnull; do { nsIFrame* child = nsnull; @@ -9700,8 +9643,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder // get out of flow frame and start over there nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -9714,7 +9656,6 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, UpdateViewsForTree(aPresContext, child, aViewManager, aFrameManager, childBounds, aChange); bounds.UnionRect(bounds, childBounds); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); } @@ -10437,13 +10378,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell, static PRBool IsPlaceholderFrame(nsIFrame* aFrame) { - nsIAtom* frameType; - PRBool result; - - aFrame->GetFrameType(&frameType); - result = frameType == nsLayoutAtoms::placeholderFrame; - NS_IF_RELEASE(frameType); - return result; + return aFrame->GetType() == nsLayoutAtoms::placeholderFrame; } #endif @@ -10462,9 +10397,7 @@ HasDisplayableChildren(nsIPresContext* aPresContext, nsIFrame* aContainerFrame) while (frame) { // If it's not a text frame, then assume that it's displayable. - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::textFrame) + if (frame->GetType() != nsLayoutAtoms::textFrame) return PR_TRUE; nsCOMPtr text = do_QueryInterface(frame->GetContent()); @@ -10736,11 +10669,8 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, aFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* tableType; - // See if it's the inner table frame - childFrame->GetFrameType(&tableType); - if (nsLayoutAtoms::tableFrame == tableType) { + if (nsLayoutAtoms::tableFrame == childFrame->GetType()) { nsIFrame* continuingTableFrame; // It's the inner table frame, so create a continuing frame @@ -10778,7 +10708,6 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, } newChildFrames.AddChild(captionFrame); } - NS_IF_RELEASE(tableType); childFrame = childFrame->GetNextSibling(); } @@ -10873,13 +10802,12 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, nsIFrame* aParentFrame, nsIFrame** aContinuingFrame) { - nsCOMPtr frameType; nsStyleContext* styleContext = aFrame->GetStyleContext(); nsIFrame* newFrame = nsnull; nsresult rv = NS_OK; // Use the frame type to determine what type of frame to create - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); nsIContent* content = aFrame->GetContent(); if (nsLayoutAtoms::textFrame == frameType) { @@ -10956,18 +10884,13 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, aFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* tableType; - // See if it's a table cell frame - cellFrame->GetFrameType(&tableType); - if (IS_TABLE_CELL(tableType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { nsIFrame* continuingCellFrame; CreateContinuingFrame(aPresShell, aPresContext, cellFrame, newFrame, &continuingCellFrame); newChildList.AddChild(continuingCellFrame); } - - NS_IF_RELEASE(tableType); cellFrame = cellFrame->GetNextSibling(); } @@ -11047,9 +10970,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, return NS_OK; } - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (parentType != nsLayoutAtoms::pageContentFrame) { + if (aParentFrame->GetType() != nsLayoutAtoms::pageContentFrame) { return NS_OK; } @@ -11185,9 +11106,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, if (kidContent == aContent) { // We found a match. See if it's a placeholder frame - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == kidFrame->GetType()) { // Ignore the placeholder and return the out-of-flow frame instead return ((nsPlaceholderFrame*)kidFrame)->GetOutOfFlowFrame(); } @@ -11865,9 +11784,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames( nsresult rv = NS_OK; nsFrameList blockFrames(blockKid); nsIFrame* lastBlockKid = blockFrames.LastChild(); - nsCOMPtr frameType; - lastBlockKid->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::lineFrame) { + if (lastBlockKid->GetType() != nsLayoutAtoms::lineFrame) { // No first-line frame at the end of the list, therefore there is // an interveening block between any first-line frame the frames // we are appending. Therefore, we don't need any special @@ -11944,9 +11861,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( // already have a first-line frame or we don't. nsIFrame* firstBlockKid; aBlockFrame->FirstChild(nsnull, &firstBlockKid); - nsCOMPtr frameType; - firstBlockKid->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::lineFrame) { + if (firstBlockKid->GetType() == nsLayoutAtoms::lineFrame) { // We already have a first-line frame nsIFrame* lineFrame = firstBlockKid; nsStyleContext* firstLineStyle = lineFrame->GetStyleContext(); @@ -12363,9 +12278,8 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( while (frame) { nsIFrame* nextFrame = frame->GetNextSibling(); - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::textFrame == frameType.get()) { + nsIAtom* frameType = frame->GetType(); + if (nsLayoutAtoms::textFrame == frameType) { // Wrap up first-letter content in a letter frame nsIContent* textContent = frame->GetContent(); if (IsFirstLetterContent(textContent)) { @@ -12384,8 +12298,8 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( return NS_OK; } } - else if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + else if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { nsIFrame* kids; frame->FirstChild(aPresContext, nsnull, &kids); WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids, @@ -12426,9 +12340,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame); while (floatFrame) { // See if we found a floating letter frame - nsCOMPtr frameType; - floatFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame == frameType.get()) { + if (nsLayoutAtoms::letterFrame == floatFrame->GetType()) { break; } floatFrame = floatFrame->GetNextSibling(); @@ -12544,9 +12456,8 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, aFrame->FirstChild(aPresContext, nsnull, &kid); while (kid) { - nsCOMPtr frameType; - kid->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame == frameType.get()) { + nsIAtom* frameType = kid->GetType(); + if (nsLayoutAtoms::letterFrame == frameType) { // Bingo. Found it. First steal away the text frame. nsIFrame* textFrame; kid->FirstChild(aPresContext, nsnull, &textFrame); @@ -12583,8 +12494,8 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, *aStopLooking = PR_TRUE; break; } - else if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + else if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { // Look inside child inline frame for the letter frame RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, kid, aStopLooking); @@ -13131,9 +13042,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext, nsIFrame* frame = aFrameIn; // if the frame is a placeholder use the out of flow frame - nsCOMPtr frameType; - aFrameIn->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == aFrameIn->GetType()) { frame = ((nsPlaceholderFrame*)frame)->GetOutOfFlowFrame(); NS_ASSERTION(frame, "program error - null of of flow frame in placeholder"); } diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index ad32828e716..ffcd59b6a6b 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -1619,9 +1619,7 @@ nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFra // the frame is the body frame, so we provide the canvas frame nsIFrame *pCanvasFrame = aFrame->GetParent(); while (pCanvasFrame) { - nsCOMPtr parentType; - pCanvasFrame->GetFrameType(getter_AddRefs(parentType)); - if (parentType.get() == nsLayoutAtoms::canvasFrame) { + if (pCanvasFrame->GetType() == nsLayoutAtoms::canvasFrame) { *aBGFrame = pCanvasFrame; break; } @@ -2516,11 +2514,8 @@ static nsIFrame* GetNearestScrollFrame(nsIFrame* aFrame) { for (nsIFrame* f = aFrame; f; f = f->GetParent()) { - nsCOMPtr frameType; - // Is it a scroll frame? - f->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::scrollFrame == frameType) { + if (nsLayoutAtoms::scrollFrame == f->GetType()) { return f; } } @@ -2535,17 +2530,12 @@ GetRootScrollableFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame) { nsIScrollableFrame* scrollableFrame = nsnull; - nsCOMPtr frameType; - aRootFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::viewportFrame == frameType) { + if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { nsIFrame* childFrame; aRootFrame->FirstChild(aPresContext, nsnull, &childFrame); if (childFrame) { - childFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::scrollFrame == frameType) { + if (nsLayoutAtoms::scrollFrame == childFrame->GetType()) { // Use this frame, even if we are using GFX frames for the // viewport, which contains another scroll frame below this // frame, since the GFX scrollport frame does not implement @@ -2632,8 +2622,7 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext, inline nsIFrame* IsCanvasFrame(nsIPresContext* aPresContext, nsIFrame *aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); if (frameType == nsLayoutAtoms::canvasFrame || frameType == nsLayoutAtoms::rootFrame || frameType == nsLayoutAtoms::pageFrame) { @@ -2662,11 +2651,9 @@ FindCanvasBackground(nsIPresContext* aPresContext, const nsStyleBackground* result = firstChild->GetStyleBackground(); // for printing and print preview.. this should be a pageContentFrame - nsCOMPtr frameType; nsStyleContext* parentContext; - firstChild->GetFrameType(getter_AddRefs(frameType)); - if ( (frameType == nsLayoutAtoms::pageContentFrame) ){ + if (firstChild->GetType() == nsLayoutAtoms::pageContentFrame) { // we have to find the background style ourselves.. since the // pageContentframe does not have content while(firstChild){ @@ -2978,8 +2965,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext, nsRect bgOriginArea; - nsCOMPtr frameType; - aForFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aForFrame->GetType(); if (frameType == nsLayoutAtoms::inlineFrame) { switch (aColor.mBackgroundInlinePolicy) { case NS_STYLE_BG_INLINE_POLICY_EACH_BOX: diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 8d7b49392eb..040d072b009 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -547,9 +547,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const // get each sibling of the child and check them, startig at the child nsIFrame *siblingFrame = childFrame; while (siblingFrame) { - nsCOMPtr frameType; - siblingFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::canvasFrame) { + if (siblingFrame->GetType() == nsLayoutAtoms::canvasFrame) { // this is it: set the out-arg and stop looking *aCanvasFrame = siblingFrame; break; @@ -734,12 +732,8 @@ FrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame) { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aPlaceholderFrame, "null param unexpected"); -#ifdef DEBUG - nsCOMPtr frameType; - aPlaceholderFrame->GetFrameType(getter_AddRefs(frameType)); - NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == frameType, + NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == aPlaceholderFrame->GetType(), "unexpected frame type"); -#endif if (!mPlaceholderMap.ops) { if (!PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nsnull, sizeof(PlaceholderMapEntry), 16)) { @@ -764,12 +758,8 @@ FrameManager::UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame) { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aPlaceholderFrame, "null param unexpected"); -#ifdef DEBUG - nsCOMPtr frameType; - aPlaceholderFrame->GetFrameType(getter_AddRefs(frameType)); - NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == frameType, + NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == aPlaceholderFrame->GetType(), "unexpected frame type"); -#endif /* * nsCSSFrameConstructor::ReconstructDocElementHierarchy calls @@ -1172,9 +1162,7 @@ CantRenderReplacedElementEvent::CantRenderReplacedElementEvent(FrameManager* aFr (PLDestroyEventProc)&FrameManager::DestroyPLEvent); mFrame = aFrame; - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::objectFrame == frameType) { + if (nsLayoutAtoms::objectFrame == aFrame->GetType()) { AddLoadGroupRequest(aPresShell); } } @@ -1410,7 +1398,6 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* PRInt32 listIndex = 0; nsIAtom* childList = nsnull; nsIFrame* child; - nsIAtom* frameType; do { child = nsnull; @@ -1418,8 +1405,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* while ((NS_SUCCEEDED(result)) && child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder: first recirse and verify the out of flow frame, // then verify the placeholder's context nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); @@ -1435,7 +1421,6 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* else { // regular frame VerifyStyleTree(aPresContext, child, nsnull); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); } @@ -1494,7 +1479,6 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, PRInt32 listIndex = 0; nsIAtom* childList = nsnull; nsIFrame* child; - nsIAtom* frameType; do { child = nsnull; @@ -1502,8 +1486,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, while ((NS_SUCCEEDED(result)) && child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // get out of flow frame and recurse there nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -1517,7 +1500,6 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, else { // regular frame result = ReParentStyleContext(child, newContext); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); @@ -1914,9 +1896,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, while (NS_SUCCEEDED(result) && child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - nsCOMPtr frameType; - child->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder // get out of flow frame and recur there nsIFrame* outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*,child)->GetOutOfFlowFrame(); diff --git a/mozilla/layout/base/nsFrameTraversal.cpp b/mozilla/layout/base/nsFrameTraversal.cpp index 6575b5b2630..e91b3117681 100644 --- a/mozilla/layout/base/nsFrameTraversal.cpp +++ b/mozilla/layout/base/nsFrameTraversal.cpp @@ -335,11 +335,9 @@ nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart) static PRBool IsRootFrame(nsIFrame* aFrame) { - nsCOMPtratom; - - aFrame->GetFrameType(getter_AddRefs(atom)); - return (atom.get() == nsLayoutAtoms::canvasFrame) || - (atom.get() == nsLayoutAtoms::rootFrame); + nsIAtom* atom = aFrame->GetType(); + return (atom == nsLayoutAtoms::canvasFrame) || + (atom == nsLayoutAtoms::rootFrame); } NS_IMETHODIMP @@ -386,11 +384,8 @@ nsLeafIterator::Next() // check if FrameType of result is TextInputFrame if (mLockScroll) //lock the traversal when we hit a scroll frame { - nsCOMPtr atom; - nsresult res = result->GetFrameType(getter_AddRefs(atom)); - if ( NS_SUCCEEDED(res) && atom ) { - if ( atom.get() == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; - } + if ( result->GetType() == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; } if (mExtensive) break; @@ -423,22 +418,20 @@ nsLeafIterator::Prev() // check if FrameType of grandParent is TextInputFrame if (mLockScroll) //lock the traversal when we hit a scroll frame { - nsCOMPtr atom; - nsresult res = grandParent->GetFrameType(getter_AddRefs(atom)); - if ( NS_SUCCEEDED(res) && atom ) - { + nsIAtom* atom = grandParent->GetType(); #ifdef DEBUG_skamio + if ( atom ) + { nsAutoString aString; res = atom->ToString(aString); if ( NS_SUCCEEDED(res) ) { printf("%s:%d\n", __FILE__, __LINE__); printf("FrameType: %s\n", NS_ConvertUCS2toUTF8(aString).get()); } - #endif - if ( atom.get() == nsLayoutAtoms::scrollFrame ) - return NS_ERROR_FAILURE; - } + #endif + if ( atom == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; } if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) { @@ -524,9 +517,7 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame) // See if it's a placeholder frame for a float. if (aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get()); + PRBool isPlaceholder = nsLayoutAtoms::placeholderFrame == aFrame->GetType(); if (isPlaceholder) { // Get the out-of-flow frame that the placeholder points to. // This is the real float that we should examine. diff --git a/mozilla/layout/base/nsLayoutAtoms.h b/mozilla/layout/base/nsLayoutAtoms.h index e49465cc289..aca928d3399 100644 --- a/mozilla/layout/base/nsLayoutAtoms.h +++ b/mozilla/layout/base/nsLayoutAtoms.h @@ -64,4 +64,9 @@ public: #undef LAYOUT_ATOM }; +static inline PRBool IS_TABLE_CELL(nsIAtom* frameType) { + return nsLayoutAtoms::tableCellFrame == frameType || + nsLayoutAtoms::bcTableCellFrame == frameType; +} + #endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/layout/base/nsLayoutUtils.cpp b/mozilla/layout/base/nsLayoutUtils.cpp index bcae0ad49e5..6ac9e9a3afd 100644 --- a/mozilla/layout/base/nsLayoutUtils.cpp +++ b/mozilla/layout/base/nsLayoutUtils.cpp @@ -169,9 +169,7 @@ nsIFrame* nsLayoutUtils::GetPageFrame(nsIFrame* aFrame) { for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) { - nsCOMPtr type; - frame->GetFrameType(getter_AddRefs(type)); - if (type.get() == nsLayoutAtoms::pageFrame) { + if (frame->GetType() == nsLayoutAtoms::pageFrame) { return frame; } } @@ -190,7 +188,7 @@ nsLayoutUtils::IsGeneratedContentFor(nsIContent* aContent, if (!aFrame->IsGeneratedContentFrame()) { return PR_FALSE; } - + if (aContent && aFrame->GetContent() != aContent) { return PR_FALSE; } diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 5e855f197ea..c778f57ed46 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -2697,22 +2697,18 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* *aScrollFrame = nsnull; nsIFrame* theFrame = nsnull; if (aRootFrame) { - nsCOMPtr fType; - aRootFrame->GetFrameType(getter_AddRefs(fType)); - if (fType && (nsLayoutAtoms::viewportFrame == fType.get())) { + if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { // If child is scrollframe keep it (native) aRootFrame->FirstChild(aPresContext, nsnull, &theFrame); if (theFrame) { - theFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; // If the first child of that is scrollframe, use it instead (gfx) theFrame->FirstChild(aPresContext, nsnull, &theFrame); if (theFrame) { - theFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; } } @@ -3356,10 +3352,10 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) if (!frame) return NS_ERROR_FAILURE; //we need to get to the area frame. - nsCOMPtr frameType; + nsIAtom* frameType; do { - frame->GetFrameType(getter_AddRefs(frameType)); + frameType = frame->GetType(); if (frameType != nsLayoutAtoms::areaFrame) { result = frame->FirstChild(mPresContext, nsnull, &frame); @@ -4345,12 +4341,12 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // layout model) or aVPercent is not NS_PRESSHELL_SCROLL_ANYWHERE, we need to // change the top of the bounds to include the whole line. if (frameBounds.height == 0 || aVPercent != NS_PRESSHELL_SCROLL_ANYWHERE) { - nsCOMPtr frameType; + nsIAtom* frameType; nsIFrame *prevFrame = aFrame; nsIFrame *frame = aFrame; - while (frame && (frame->GetFrameType(getter_AddRefs(frameType)), - frameType == nsLayoutAtoms::inlineFrame)) { + while (frame && + (frameType = frame->GetType()) == nsLayoutAtoms::inlineFrame) { prevFrame = frame; frame = prevFrame->GetParent(); } @@ -6619,9 +6615,8 @@ PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC) nsIFrame* target; aRC->GetTarget(target); - nsCOMPtr type; - target->GetFrameType(getter_AddRefs(type)); - NS_ASSERTION(type, "frame didn't override GetFrameType()"); + nsIAtom* type = target->GetType(); + NS_ASSERTION(type, "frame didn't override GetType()"); nsAutoString typeStr(NS_LITERAL_STRING("unknown")); if (type) diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 83fb6c0b81d..51a34378304 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -1013,7 +1013,7 @@ public: * * @see nsLayoutAtoms */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const = 0; + virtual nsIAtom* GetType() const = 0; /** * Is this frame a "containing block"? diff --git a/mozilla/layout/base/public/nsIFrameDebug.h b/mozilla/layout/base/public/nsIFrameDebug.h index 591d94247da..3ff296729dc 100644 --- a/mozilla/layout/base/public/nsIFrameDebug.h +++ b/mozilla/layout/base/public/nsIFrameDebug.h @@ -63,7 +63,7 @@ public: static void RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); /** * Get a printable from of the name of the frame type. - * XXX This should be eliminated and we use GetFrameType() instead... + * XXX This should be eliminated and we use GetType() instead... */ NS_IMETHOD GetFrameName(nsAString& aResult) const = 0; /** diff --git a/mozilla/layout/base/src/nsBidiPresUtils.cpp b/mozilla/layout/base/src/nsBidiPresUtils.cpp index 446b41f7fdf..b24255e6fba 100644 --- a/mozilla/layout/base/src/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/src/nsBidiPresUtils.cpp @@ -257,10 +257,10 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, PRBool isTextFrame = PR_FALSE; nsIFrame* frame = nsnull; nsIFrame* nextBidi; - nsCOMPtr frameType; nsIContent* content = nsnull; nsCOMPtr textContent; const nsTextFragment* fragment; + nsIAtom* frameType = nsnull; for (; ;) { if (fragmentLength <= 0) { @@ -270,9 +270,8 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, contentOffset = 0; frame = (nsIFrame*) (mLogicalFrames[frameIndex]); - - frame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::textFrame == frameType.get() ) { + frameType = frame->GetType(); + if (nsLayoutAtoms::textFrame == frameType) { content = frame->GetContent(); if (!content) { mSuccess = NS_OK; @@ -310,7 +309,7 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext, } } // if (runLength <= 0) - if (nsLayoutAtoms::directionalFrame == frameType.get()) { + if (nsLayoutAtoms::directionalFrame == frameType) { delete frame; ++lineOffset; } @@ -370,7 +369,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, nsIFrame* frame; nsIFrame* directionalFrame; nsIFrame* kid; - nsCOMPtr frameType; nsresult rv; nsresult res = NS_OK; @@ -408,13 +406,13 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, } } - frame->GetFrameType(getter_AddRefs(frameType) ); + nsIAtom* frameType = frame->GetType(); if ( (!display->IsBlockLevel() ) - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + && ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) ) { frame->FirstChild(aPresContext, nsnull, &kid); res = InitLogicalArray(aPresContext, kid, aNextInFlow, aAddMarkers); } @@ -450,16 +448,15 @@ nsBidiPresUtils::CreateBlockBuffer(nsIPresContext* aPresContext) nsIFrame* frame; nsIContent* prevContent = nsnull; nsCOMPtr textContent; - nsCOMPtr frameType; const nsTextFragment* frag; PRUint32 i; PRUint32 count = mLogicalFrames.Count(); for (i = 0; i < count; i++) { frame = (nsIFrame*) (mLogicalFrames[i]); - frame->GetFrameType(getter_AddRefs(frameType) ); + nsIAtom* frameType = frame->GetType(); - if (nsLayoutAtoms::textFrame == frameType.get() ) { + if (nsLayoutAtoms::textFrame == frameType) { nsIContent* content = frame->GetContent(); if (!content) { mSuccess = NS_OK; @@ -480,11 +477,11 @@ nsBidiPresUtils::CreateBlockBuffer(nsIPresContext* aPresContext) } frag->AppendTo(mBuffer); } - else if (nsLayoutAtoms::brFrame == frameType.get() ) { // break frame + else if (nsLayoutAtoms::brFrame == frameType) { // break frame // Append line separator mBuffer.Append( (PRUnichar) kLineSeparator); } - else if (nsLayoutAtoms::directionalFrame == frameType.get() ) { + else if (nsLayoutAtoms::directionalFrame == frameType) { nsDirectionalFrame* dirFrame; frame->QueryInterface(NS_GET_IID(nsDirectionalFrame), (void**) &dirFrame); @@ -684,16 +681,13 @@ nsBidiPresUtils::RepositionInlineFrames(nsIPresContext* aPresContext, // We assume that rectangle takes all the room from "english" left edge to // "WERBEH" right edge. - nsCOMPtr frameType; - frame = aFirstChild; for (i = 0; i < aChildCount; i++) { - frame->GetFrameType(getter_AddRefs(frameType) ); - if ( frameType.get() - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + nsIAtom* frameType = frame->GetType(); + if ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) { PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; RepositionContainerFrame(aPresContext, frame, minX, maxX); @@ -710,19 +704,17 @@ nsBidiPresUtils::RepositionContainerFrame(nsIPresContext* aPresContext, { nsIFrame* frame; nsIFrame* firstChild; - nsCOMPtr frameType; PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; aContainer->FirstChild(aPresContext, nsnull, &firstChild); for (frame = firstChild; frame; frame = frame->GetNextSibling()) { - frame->GetFrameType(getter_AddRefs(frameType) ); - if ( (frameType.get() ) - && ( (nsLayoutAtoms::inlineFrame == frameType.get() ) - || (nsLayoutAtoms::positionedInlineFrame == frameType.get() ) - || (nsLayoutAtoms::letterFrame == frameType.get() ) - || (nsLayoutAtoms::blockFrame == frameType.get() ) ) ) { + nsIAtom* frameType = frame->GetType(); + if ( (nsLayoutAtoms::inlineFrame == frameType) + || (nsLayoutAtoms::positionedInlineFrame == frameType) + || (nsLayoutAtoms::letterFrame == frameType) + || (nsLayoutAtoms::blockFrame == frameType) ) { RepositionContainerFrame(aPresContext, frame, minX, maxX); } else { @@ -791,7 +783,6 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext, PRInt32 aLastIndex, PRInt32& aOffset) const { - nsCOMPtr frameType; nsIFrame* frame; PRInt32 index; nsIFrame* parent = aFrame->GetParent(); @@ -803,8 +794,7 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext, for (index = aLastIndex; index > aFirstIndex; index--) { frame = (nsIFrame*) mLogicalFrames[index]; - frame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::directionalFrame == frameType.get() ) { + if (nsLayoutAtoms::directionalFrame == frame->GetType()) { delete frame; ++aOffset; } diff --git a/mozilla/layout/base/src/nsFrameList.cpp b/mozilla/layout/base/src/nsFrameList.cpp index 356696a0a45..b461d1819cf 100644 --- a/mozilla/layout/base/src/nsFrameList.cpp +++ b/mozilla/layout/base/src/nsFrameList.cpp @@ -472,10 +472,8 @@ nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const { NS_PRECONDITION(nsnull != aFrame, "null ptr"); nsILineIterator* iter; - nsCOMPtratom; - aFrame->GetFrameType(getter_AddRefs(atom)); - if (atom.get() == nsLayoutAtoms::blockFrame) + if (aFrame->GetType() == nsLayoutAtoms::blockFrame) return GetPrevSiblingFor(aFrame); nsIFrame* frame; @@ -537,10 +535,8 @@ nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const { NS_PRECONDITION(nsnull != aFrame, "null ptr"); nsILineIterator* iter; - nsCOMPtratom; - aFrame->GetFrameType(getter_AddRefs(atom)); - if (atom.get() == nsLayoutAtoms::blockFrame) { + if (aFrame->GetType() == nsLayoutAtoms::blockFrame) { return aFrame->GetNextSibling(); } diff --git a/mozilla/layout/base/src/nsFrameTraversal.cpp b/mozilla/layout/base/src/nsFrameTraversal.cpp index 6575b5b2630..e91b3117681 100644 --- a/mozilla/layout/base/src/nsFrameTraversal.cpp +++ b/mozilla/layout/base/src/nsFrameTraversal.cpp @@ -335,11 +335,9 @@ nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart) static PRBool IsRootFrame(nsIFrame* aFrame) { - nsCOMPtratom; - - aFrame->GetFrameType(getter_AddRefs(atom)); - return (atom.get() == nsLayoutAtoms::canvasFrame) || - (atom.get() == nsLayoutAtoms::rootFrame); + nsIAtom* atom = aFrame->GetType(); + return (atom == nsLayoutAtoms::canvasFrame) || + (atom == nsLayoutAtoms::rootFrame); } NS_IMETHODIMP @@ -386,11 +384,8 @@ nsLeafIterator::Next() // check if FrameType of result is TextInputFrame if (mLockScroll) //lock the traversal when we hit a scroll frame { - nsCOMPtr atom; - nsresult res = result->GetFrameType(getter_AddRefs(atom)); - if ( NS_SUCCEEDED(res) && atom ) { - if ( atom.get() == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; - } + if ( result->GetType() == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; } if (mExtensive) break; @@ -423,22 +418,20 @@ nsLeafIterator::Prev() // check if FrameType of grandParent is TextInputFrame if (mLockScroll) //lock the traversal when we hit a scroll frame { - nsCOMPtr atom; - nsresult res = grandParent->GetFrameType(getter_AddRefs(atom)); - if ( NS_SUCCEEDED(res) && atom ) - { + nsIAtom* atom = grandParent->GetType(); #ifdef DEBUG_skamio + if ( atom ) + { nsAutoString aString; res = atom->ToString(aString); if ( NS_SUCCEEDED(res) ) { printf("%s:%d\n", __FILE__, __LINE__); printf("FrameType: %s\n", NS_ConvertUCS2toUTF8(aString).get()); } - #endif - if ( atom.get() == nsLayoutAtoms::scrollFrame ) - return NS_ERROR_FAILURE; - } + #endif + if ( atom == nsLayoutAtoms::scrollFrame ) + return NS_ERROR_FAILURE; } if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) { @@ -524,9 +517,7 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame) // See if it's a placeholder frame for a float. if (aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get()); + PRBool isPlaceholder = nsLayoutAtoms::placeholderFrame == aFrame->GetType(); if (isPlaceholder) { // Get the out-of-flow frame that the placeholder points to. // This is the real float that we should examine. diff --git a/mozilla/layout/base/src/nsLayoutUtils.cpp b/mozilla/layout/base/src/nsLayoutUtils.cpp index bcae0ad49e5..6ac9e9a3afd 100644 --- a/mozilla/layout/base/src/nsLayoutUtils.cpp +++ b/mozilla/layout/base/src/nsLayoutUtils.cpp @@ -169,9 +169,7 @@ nsIFrame* nsLayoutUtils::GetPageFrame(nsIFrame* aFrame) { for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) { - nsCOMPtr type; - frame->GetFrameType(getter_AddRefs(type)); - if (type.get() == nsLayoutAtoms::pageFrame) { + if (frame->GetType() == nsLayoutAtoms::pageFrame) { return frame; } } @@ -190,7 +188,7 @@ nsLayoutUtils::IsGeneratedContentFor(nsIContent* aContent, if (!aFrame->IsGeneratedContentFrame()) { return PR_FALSE; } - + if (aContent && aFrame->GetContent() != aContent) { return PR_FALSE; } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 385003e6204..6bda6ffbdbb 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -430,7 +430,7 @@ nsComboboxControlFrame::InitializeControl(nsIPresContext* aPresContext) //-------------------------------------------------------------- NS_IMETHODIMP_(PRInt32) -nsComboboxControlFrame::GetType() const +nsComboboxControlFrame::GetFormControlType() const { return NS_FORM_SELECT; } @@ -2301,7 +2301,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext, nsIFormControlFrame* fcFrame = nsnull; CallQueryInterface(child, &fcFrame); if (fcFrame) { - if (fcFrame->GetType() == NS_FORM_INPUT_BUTTON) { + if (fcFrame->GetFormControlType() == NS_FORM_INPUT_BUTTON) { mButtonFrame = child; } } else { diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 77ff778b16e..cb6b7aeddf2 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -145,7 +145,7 @@ public: // nsIFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsAString* aName); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsAString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index 097170802cd..2f7e8d0da08 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -107,7 +107,7 @@ public: const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); @@ -157,13 +157,10 @@ nsFieldSetFrame::nsFieldSetFrame() } -NS_IMETHODIMP -nsFieldSetFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFieldSetFrame::GetType() const { - NS_PRECONDITION(aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::fieldSetFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::fieldSetFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 59c958501fd..49588bbc77b 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -212,7 +212,7 @@ nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) } NS_IMETHODIMP_(PRInt32) -nsFileControlFrame::GetType() const +nsFileControlFrame::GetFormControlType() const { return NS_FORM_INPUT_FILE; } diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index ecf3464188d..36d98115cac 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -103,7 +103,7 @@ public: PRInt32 aModType); NS_IMETHOD GetName(nsAString* aName); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 54d072df9b9..45b8389fc94 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -696,7 +696,7 @@ nsFormControlFrame::GetSizeFromContent(PRInt32* aSize) const } NS_IMETHODIMP_(PRInt32) -nsFormControlFrame::GetType() const +nsFormControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index d82d058d0f7..c846df7aed9 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -152,7 +152,7 @@ public: */ virtual const nsIID& GetIID(); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD GetValue(nsAString* aName); diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp index 9b6403728a9..6d8bd17d8bb 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp @@ -83,13 +83,10 @@ NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) return NS_OK; } -NS_IMETHODIMP -nsGfxButtonControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsGfxButtonControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::gfxButtonControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::gfxButtonControlFrame; } // Special check for the browse button of a file input. @@ -314,7 +311,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) { const char * propname = nsFormControlHelper::GetHTMLPropertiesFileName(); nsresult rv = NS_OK; - PRInt32 type = GetType(); + PRInt32 type = GetFormControlType(); if (type == NS_FORM_INPUT_RESET) { rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Reset").get(), aString); } diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.h b/mozilla/layout/forms/nsGfxButtonControlFrame.h index 050bef2fd2e..d743c9f17f2 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.h +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.h @@ -78,7 +78,7 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; // nsFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 11a6b8b892d..31f25d5eced 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -201,7 +201,7 @@ NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessibl NS_IMETHODIMP_(PRInt32) -nsHTMLButtonControlFrame::GetType() const +nsHTMLButtonControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.h b/mozilla/layout/forms/nsHTMLButtonControlFrame.h index 99b8a530246..80710fad0a3 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.h @@ -127,7 +127,7 @@ public: virtual nsresult RequiresWidget(PRBool &aRequiresWidget); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD GetValue(nsAString* aName); virtual void MouseClicked(nsIPresContext* aPresContext); diff --git a/mozilla/layout/forms/nsIFormControlFrame.h b/mozilla/layout/forms/nsIFormControlFrame.h index 5c116d8dc75..9b4e770cf34 100644 --- a/mozilla/layout/forms/nsIFormControlFrame.h +++ b/mozilla/layout/forms/nsIFormControlFrame.h @@ -61,7 +61,7 @@ class nsIFormControlFrame : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORMCONTROLFRAME_IID) - NS_IMETHOD_(PRInt32) GetType() const = 0; + NS_IMETHOD_(PRInt32) GetFormControlType() const = 0; NS_IMETHOD GetName(nsAString* aName) = 0; diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index 5bb7e35e4c2..4e21fdfcd1a 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -103,7 +103,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); @@ -121,7 +121,7 @@ public: virtual void MouseClicked(nsIPresContext* aPresContext); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); @@ -247,13 +247,10 @@ nsrefcnt nsImageControlFrame::Release(void) return 1; } -NS_IMETHODIMP -nsImageControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsImageControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::imageControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::imageControlFrame; } NS_IMETHODIMP @@ -384,7 +381,7 @@ nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRe } NS_IMETHODIMP_(PRInt32) -nsImageControlFrame::GetType() const +nsImageControlFrame::GetFormControlType() const { return NS_FORM_INPUT_IMAGE; } diff --git a/mozilla/layout/forms/nsLegendFrame.cpp b/mozilla/layout/forms/nsLegendFrame.cpp index 2e97acaa4ed..9d4917c53af 100644 --- a/mozilla/layout/forms/nsLegendFrame.cpp +++ b/mozilla/layout/forms/nsLegendFrame.cpp @@ -80,13 +80,10 @@ nsLegendFrame::~nsLegendFrame() { } -NS_IMETHODIMP -nsLegendFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsLegendFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::legendFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::legendFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsLegendFrame.h b/mozilla/layout/forms/nsLegendFrame.h index 87e81f69c91..5eb5da598c3 100644 --- a/mozilla/layout/forms/nsLegendFrame.h +++ b/mozilla/layout/forms/nsLegendFrame.h @@ -73,7 +73,7 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index cc7f76b55d1..41a5cb2aa8f 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -2034,7 +2034,7 @@ nsListControlFrame::GetSkipSides() const //--------------------------------------------------------- NS_IMETHODIMP_(PRInt32) -nsListControlFrame::GetType() const +nsListControlFrame::GetFormControlType() const { return NS_FORM_SELECT; } @@ -2637,13 +2637,10 @@ nsListControlFrame::DidReflow(nsIPresContext* aPresContext, } } -NS_IMETHODIMP -nsListControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsListControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::listControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::listControlFrame; } #ifdef DEBUG diff --git a/mozilla/layout/forms/nsListControlFrame.h b/mozilla/layout/forms/nsListControlFrame.h index 9f15d1d2fbd..95d9627a892 100644 --- a/mozilla/layout/forms/nsListControlFrame.h +++ b/mozilla/layout/forms/nsListControlFrame.h @@ -222,7 +222,7 @@ public: * * @see nsLayoutAtoms::scrollFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG // nsIFrameDebug @@ -230,7 +230,7 @@ public: #endif // nsIFormControlFrame - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsAString& aValue); diff --git a/mozilla/layout/forms/nsSelectsAreaFrame.cpp b/mozilla/layout/forms/nsSelectsAreaFrame.cpp index 08493bed16d..e0ced89b76f 100644 --- a/mozilla/layout/forms/nsSelectsAreaFrame.cpp +++ b/mozilla/layout/forms/nsSelectsAreaFrame.cpp @@ -143,9 +143,7 @@ nsSelectsAreaFrame::Paint(nsIPresContext* aPresContext, nsIFrame* frame = this; while (frame) { frame = frame->GetParent(); - nsCOMPtr type; - frame->GetFrameType(getter_AddRefs(type)); - if (type == nsLayoutAtoms::listControlFrame) { + if (frame->GetType() == nsLayoutAtoms::listControlFrame) { nsListControlFrame* listFrame = NS_STATIC_CAST(nsListControlFrame*, frame); listFrame->PaintFocus(aRenderingContext, aWhichLayer); return NS_OK; diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 98baa4e6b0a..74d34d557db 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1314,19 +1314,16 @@ nsTextControlFrame::RemovedAsPrimaryFrame(nsIPresContext* aPresContext) else NS_ASSERTION(PR_FALSE, "RemovedAsPrimaryFrame called after PreDestroy"); } -NS_IMETHODIMP -nsTextControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTextControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::textInputFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::textInputFrame; } // XXX: wouldn't it be nice to get this from the style context! PRBool nsTextControlFrame::IsSingleLineTextControl() const { - PRInt32 type = GetType(); + PRInt32 type = GetFormControlType(); return (type == NS_FORM_INPUT_TEXT) || (type == NS_FORM_INPUT_PASSWORD); } @@ -1353,7 +1350,7 @@ PRBool nsTextControlFrame::IsPlainTextControl() const PRBool nsTextControlFrame::IsPasswordTextControl() const { - return GetType() == NS_FORM_INPUT_PASSWORD; + return GetFormControlType() == NS_FORM_INPUT_PASSWORD; } @@ -2098,7 +2095,7 @@ nsTextControlFrame::GetName(nsAString* aResult) } NS_IMETHODIMP_(PRInt32) -nsTextControlFrame::GetType() const +nsTextControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/forms/nsTextControlFrame.h b/mozilla/layout/forms/nsTextControlFrame.h index 11e1b5a7c74..93ba772a3ae 100644 --- a/mozilla/layout/forms/nsTextControlFrame.h +++ b/mozilla/layout/forms/nsTextControlFrame.h @@ -134,7 +134,7 @@ public: nsIFrame* aChildList); //==== BEGIN NSIFORMCONTROLFRAME - NS_IMETHOD_(PRInt32) GetType() const; //* + NS_IMETHOD_(PRInt32) GetFormControlType() const; //* NS_IMETHOD GetName(nsAString* aName);//* virtual void SetFocus(PRBool aOn , PRBool aRepaint); virtual void ScrollIntoView(nsIPresContext* aPresContext); @@ -176,7 +176,7 @@ public: //==== END NSIGFXTEXTCONTROLFRAME2 //==== OVERLOAD of nsIFrame - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; /** handler for attribute changes to mContent */ NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index 86b1157f951..cd3f2c0559e 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -186,13 +186,10 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext, } #endif -NS_IMETHODIMP -nsAreaFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsAreaFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::areaFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::areaFrame; } ///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/layout/generic/nsAreaFrame.h b/mozilla/layout/generic/nsAreaFrame.h index 15e58c41887..37d07620068 100644 --- a/mozilla/layout/generic/nsAreaFrame.h +++ b/mozilla/layout/generic/nsAreaFrame.h @@ -79,7 +79,7 @@ public: * * @see nsLayoutAtoms::areaFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/generic/nsBRFrame.cpp b/mozilla/layout/generic/nsBRFrame.cpp index e71bcbb2ce2..5504769315a 100644 --- a/mozilla/layout/generic/nsBRFrame.cpp +++ b/mozilla/layout/generic/nsBRFrame.cpp @@ -74,7 +74,7 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: virtual ~BRFrame(); }; @@ -210,13 +210,10 @@ BRFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -BRFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +BRFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::brFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::brFrame; } NS_IMETHODIMP BRFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, diff --git a/mozilla/layout/generic/nsBidiFrames.cpp b/mozilla/layout/generic/nsBidiFrames.cpp index d345b06b503..4da6f82bad7 100644 --- a/mozilla/layout/generic/nsBidiFrames.cpp +++ b/mozilla/layout/generic/nsBidiFrames.cpp @@ -49,13 +49,10 @@ nsDirectionalFrame::GetChar(void) const * * @see nsLayoutAtoms::directionalFrame */ -NS_IMETHODIMP -nsDirectionalFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsDirectionalFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::directionalFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::directionalFrame; } const nsIID& diff --git a/mozilla/layout/generic/nsBidiFrames.h b/mozilla/layout/generic/nsBidiFrames.h index d2b9d663916..f1be66c45bd 100644 --- a/mozilla/layout/generic/nsBidiFrames.h +++ b/mozilla/layout/generic/nsBidiFrames.h @@ -50,7 +50,7 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; PRUnichar GetChar(void) const; diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 14ba42ee2da..ae41ac77ed1 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -445,13 +445,10 @@ nsBlockFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsBlockFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBlockFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::blockFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::blockFrame; } ///////////////////////////////////////////////////////////////////////////// @@ -834,8 +831,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, ancestorRS; ancestorRS = ancestorRS->parentReflowState) { nsIFrame* ancestor = ancestorRS->frame; - nsCOMPtr fType; - ancestor->GetFrameType(getter_AddRefs(fType)); + nsIAtom* fType = ancestor->GetType(); if ((nsLayoutAtoms::blockFrame == fType) || (nsLayoutAtoms::areaFrame == fType)) { if (aReflowState.mSpaceManager == ancestorRS->mSpaceManager) { // Put the continued floats in ancestor since it uses the same space manager @@ -3793,8 +3789,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) { // Frame is not-complete, no special breaking status - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); // Create a continuation for the incomplete frame. Note that the // frame may already have a continuation. @@ -3813,8 +3808,8 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool splitLine = !reflowingFirstLetter && (nsLayoutAtoms::placeholderFrame != frameType); if (reflowingFirstLetter) { - if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { splitLine = PR_TRUE; } } @@ -3838,9 +3833,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, else if (NS_FRAME_IS_TRUNCATED(frameReflowStatus)) { // if the frame is a placeholder and was complete but truncated (and not at the top // of page), the entire line will be pushed to give it another chance to not truncate. - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) { *aLineReflowStatus = LINE_REFLOW_TRUNCATED; } } @@ -4382,10 +4375,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) // Note: A floating table (example: style="position: relative; float: right") // is an example of an out-of-flow frame with a view - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == frame->GetType()) { nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame(); if (outOfFlowFrame) { const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay(); @@ -4795,16 +4785,11 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext, // find the containing block, this is either the parent or the grandparent // if the parent is an inline frame nsIFrame* parent = aFrame->GetParent(); - nsCOMPtr parentType; - parent->GetFrameType(getter_AddRefs(parentType)); - while (parent && (nsLayoutAtoms::blockFrame != parentType) && - (nsLayoutAtoms::areaFrame != parentType)) { + nsIAtom* parentType = parent->GetType(); + while ((nsLayoutAtoms::blockFrame != parentType) && + (nsLayoutAtoms::areaFrame != parentType)) { parent = parent->GetParent(); - parent->GetFrameType(getter_AddRefs(parentType)); - } - if (!parent) { - NS_ASSERTION(PR_FALSE, "null parent"); - return; + parentType = parent->GetType(); } nsBlockFrame* block = (nsBlockFrame*)parent; @@ -5197,9 +5182,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, PRBool lastPlaceholder = PR_TRUE; nsIFrame* next = aPlaceholder->GetNextSibling(); if (next) { - nsCOMPtr nextType; - next->GetFrameType(getter_AddRefs(nextType)); - if (nsLayoutAtoms::placeholderFrame == nextType) { + if (nsLayoutAtoms::placeholderFrame == next->GetType()) { lastPlaceholder = PR_FALSE; } } @@ -5969,10 +5952,8 @@ nsBlockFrame::IsChild(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetPrevInFlow(&prevInFlow); if (prevInFlow) { nsFrameState state = aFrame->GetStateBits(); - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); skipLineList = (state & NS_FRAME_OUT_OF_FLOW); - skipSiblingList = (nsLayoutAtoms::placeholderFrame == frameType) || + skipSiblingList = (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) || (state & NS_FRAME_OUT_OF_FLOW); } @@ -6191,9 +6172,7 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext, nsIFrame* kid = aKid; // if the frame is a placeholder, then get the out of flow frame - nsCOMPtr frameType; - aKid->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == aKid->GetType()) { kid = NS_STATIC_CAST(nsPlaceholderFrame*, aKid)->GetOutOfFlowFrame(); NS_ASSERTION(kid, "no out-of-flow frame"); } diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index ed9d15e4922..9f0424076c0 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -132,7 +132,7 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 45776944ca7..37498bc0b17 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -232,15 +232,10 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, /* bug 18445: treat elements mapped to display: block such as text controls * just like normal blocks */ - PRBool treatAsNotSplittable=PR_FALSE; - nsCOMPtrframeType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType) { - // text controls are not splittable, so make a special case here - // XXXldb Why not just set the frame state bit? - if (nsLayoutAtoms::textInputFrame == frameType.get()) - treatAsNotSplittable = PR_TRUE; - } + // text controls are not splittable, so make a special case here + // XXXldb Why not just set the frame state bit? + PRBool treatAsNotSplittable = + nsLayoutAtoms::textInputFrame == aFrame->GetType(); if (NS_FRAME_SPLITTABLE_NON_RECTANGULAR == aSplitType || // normal blocks NS_FRAME_NOT_SPLITTABLE == aSplitType || // things like images mapped to display: block @@ -927,9 +922,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache, if(prevFrame) { //get the frame type - nsIAtom* atom; - prevFrame->GetFrameType(&atom); - if(nsLayoutAtoms::tableOuterFrame == atom) { + if (nsLayoutAtoms::tableOuterFrame == prevFrame->GetType()) { //see if it has "align=" // IE makes a difference between align and he float property nsIContent* content = prevFrame->GetContent(); diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index d0ea772ea7f..23e4ab19a52 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -168,13 +168,10 @@ nsBulletFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsBulletFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBulletFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::bulletFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::bulletFrame; } #include "nsIDOMNode.h" diff --git a/mozilla/layout/generic/nsBulletFrame.h b/mozilla/layout/generic/nsBulletFrame.h index cd3b44e073e..a9362a12864 100644 --- a/mozilla/layout/generic/nsBulletFrame.h +++ b/mozilla/layout/generic/nsBulletFrame.h @@ -65,7 +65,7 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 01f22d7acdc..1c7787fdf01 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -899,9 +899,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) // XXX Check for the frame being a block frame and only force a view // in that case, because adding a view for box frames seems to cause // problems for XUL... - nsCOMPtr frameType; - - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); if ((frameType == nsLayoutAtoms::blockFrame) || (frameType == nsLayoutAtoms::areaFrame)) { return PR_TRUE; diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index 27b25f84e01..b164aa66848 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -61,7 +61,7 @@ public: #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, @@ -115,13 +115,10 @@ nsFirstLetterFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsFirstLetterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFirstLetterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::letterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::letterFrame; } PRIntn diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index d661ecdffc2..7d7a905f054 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -2523,12 +2523,10 @@ nsIWidget* nsIFrame::GetWindow() const return window; } -NS_IMETHODIMP -nsFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsnull; - return NS_OK; + return nsnull; } void @@ -3267,32 +3265,28 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; if ( isEditor ) { - nsIAtom *resultFrameType; - if(NS_SUCCEEDED(resultFrame->GetFrameType(&resultFrameType)) && resultFrameType) + if (resultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { - if (resultFrameType == nsLayoutAtoms::tableOuterFrame) + if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side { - if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side + nsIContent* content = resultFrame->GetContent(); + if (content) { - nsIContent* content = resultFrame->GetContent(); - if (content) + nsIContent* parent = content->GetParent(); + if (parent) { - nsIContent* parent = content->GetParent(); - if (parent) + aPos->mResultContent = parent; + aPos->mContentOffset = parent->IndexOf(content); + aPos->mPreferLeft = PR_FALSE; + if ((point.x - offset.x+ tempRect.x)>tempRect.width) { - aPos->mResultContent = parent; - aPos->mContentOffset = parent->IndexOf(content); - aPos->mPreferLeft = PR_FALSE; - if ((point.x - offset.x+ tempRect.x)>tempRect.width) - { - aPos->mContentOffset++;//go to end of this frame - aPos->mPreferLeft = PR_TRUE; - } - aPos->mContentOffsetEnd = aPos->mContentOffset; - //result frame is the result frames parent. - aPos->mResultFrame = resultFrame->GetParent(); - return NS_POSITION_BEFORE_TABLE; + aPos->mContentOffset++;//go to end of this frame + aPos->mPreferLeft = PR_TRUE; } + aPos->mContentOffsetEnd = aPos->mContentOffset; + //result frame is the result frames parent. + aPos->mResultFrame = resultFrame->GetParent(); + return NS_POSITION_BEFORE_TABLE; } } } @@ -3776,8 +3770,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) if we hit a header or footer thats ok just go into them, */ PRBool searchTableBool = PR_FALSE; - nsIAtom *resultFrameType; - if(NS_SUCCEEDED(aPos->mResultFrame->GetFrameType(&resultFrameType)) && resultFrameType == nsLayoutAtoms::tableOuterFrame) + if (aPos->mResultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { nsIFrame *frame = aPos->mResultFrame; result = frame->FirstChild(aPresContext, nsnull,&frame); @@ -4128,9 +4121,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct //in the case of a text node since that does not mean we are stuck. it could mean a change in style for //the text node. in the case of a hruleframe with generated before and after content, we do not //want the splittable generated frame to get us stuck on an HR - nsCOMPtr frameType; - newFrame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::textFrame != frameType.get() ) + if (nsLayoutAtoms::textFrame != newFrame->GetType()) continue; //we should NOT be getting stuck on the same piece of content on the same line. skip to next line. } isBidiGhostFrame = (newFrame->GetRect().IsEmpty() && @@ -5260,10 +5251,7 @@ void DR_State::InitFrameTypeTable() void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, PRInt32 aIndent) { - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - - DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(fType); + DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->GetType()); if (frameTypeInfo) { for (PRInt32 i = 0; i < aIndent; i++) { printf(" "); @@ -5297,9 +5285,7 @@ PRBool DR_State::RuleMatches(DR_Rule& aRule, rulePart = rulePart->mNext, parentNode = parentNode->mParent) { if (rulePart->mFrameType) { if (parentNode->mFrame) { - nsCOMPtr fNodeType; - parentNode->mFrame->GetFrameType(getter_AddRefs(fNodeType)); - if (rulePart->mFrameType != fNodeType) { + if (rulePart->mFrameType != parentNode->mFrame->GetType()) { return PR_FALSE; } } @@ -5319,9 +5305,7 @@ void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode) PRBool matchingRule = PR_FALSE; - nsCOMPtr fType; - aNode.mFrame->GetFrameType(getter_AddRefs(fType)); - DR_FrameTypeInfo* info = GetFrameTypeInfo(fType.get()); + DR_FrameTypeInfo* info = GetFrameTypeInfo(aNode.mFrame->GetType()); NS_ASSERTION(info, "program error"); PRInt32 numRules = info->mRules.Count(); for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) { diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 48b612d6e49..bea1d53dba8 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -240,7 +240,7 @@ public: NS_IMETHOD SetNextInFlow(nsIFrame*); NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; NS_IMETHOD GetOriginToViewOffset(nsIPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const; - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; #ifdef NS_DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 4c36b696ed7..c89bfad6f48 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -145,7 +145,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; } NS_IMETHOD_(nsrefcnt) Release(void) { return 1; } - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, @@ -213,7 +213,7 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); @@ -498,13 +498,10 @@ NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsHTMLFrameOuterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsHTMLFrameOuterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::htmlFrameOuterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::htmlFrameOuterFrame; } NS_IMETHODIMP @@ -859,13 +856,10 @@ NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsHTMLFrameInnerFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::htmlFrameInnerFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::htmlFrameInnerFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsFrameList.cpp b/mozilla/layout/generic/nsFrameList.cpp index 356696a0a45..b461d1819cf 100644 --- a/mozilla/layout/generic/nsFrameList.cpp +++ b/mozilla/layout/generic/nsFrameList.cpp @@ -472,10 +472,8 @@ nsFrameList::GetPrevVisualFor(nsIFrame* aFrame) const { NS_PRECONDITION(nsnull != aFrame, "null ptr"); nsILineIterator* iter; - nsCOMPtratom; - aFrame->GetFrameType(getter_AddRefs(atom)); - if (atom.get() == nsLayoutAtoms::blockFrame) + if (aFrame->GetType() == nsLayoutAtoms::blockFrame) return GetPrevSiblingFor(aFrame); nsIFrame* frame; @@ -537,10 +535,8 @@ nsFrameList::GetNextVisualFor(nsIFrame* aFrame) const { NS_PRECONDITION(nsnull != aFrame, "null ptr"); nsILineIterator* iter; - nsCOMPtratom; - aFrame->GetFrameType(getter_AddRefs(atom)); - if (atom.get() == nsLayoutAtoms::blockFrame) { + if (aFrame->GetType() == nsLayoutAtoms::blockFrame) { return aFrame->GetNextSibling(); } diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 801d433fd1e..39b82b77d45 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -352,10 +352,7 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // allow scrollbars if this is the child of the viewport, because // we must be the scrollbars for the print preview window nsIFrame* parent = GetParent(); - nsCOMPtr parentType; - if (parent) - parent->GetFrameType(getter_AddRefs(parentType)); - if (parentType != nsLayoutAtoms::viewportFrame) { + if (!parent || parent->GetType() != nsLayoutAtoms::viewportFrame) { SetScrollbarVisibility(aPresContext, PR_FALSE, PR_FALSE); return NS_OK; } @@ -461,9 +458,7 @@ void nsGfxScrollFrame::ReloadChildFrames(nsIPresContext* aPresContext) nsIBox* box = nsnull; frame->QueryInterface(NS_GET_IID(nsIBox), (void**)&box); if (box) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::scrollFrame) { + if (frame->GetType() == nsLayoutAtoms::scrollFrame) { NS_ASSERTION(!mInner->mScrollAreaBox, "Found multiple scroll areas?"); mInner->mScrollAreaBox = box; understood = PR_TRUE; @@ -632,13 +627,10 @@ nsGfxScrollFrame::GetSkipSides() const return 0; } -NS_IMETHODIMP -nsGfxScrollFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsGfxScrollFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::scrollFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::scrollFrame; } NS_IMETHODIMP @@ -1567,9 +1559,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType.get() == nsLayoutAtoms::viewportFrame) { + if (parentFrame->GetType() == nsLayoutAtoms::viewportFrame) { // Usually there are no fixed children, so don't do anything unless there's // at least one fixed child nsIFrame* child; diff --git a/mozilla/layout/generic/nsGfxScrollFrame.h b/mozilla/layout/generic/nsGfxScrollFrame.h index 072fc0fc648..0873fb2feb0 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.h +++ b/mozilla/layout/generic/nsGfxScrollFrame.h @@ -174,7 +174,7 @@ public: * * @see nsLayoutAtoms::scrollFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index c13a4136923..b1b993a59db 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -231,13 +231,11 @@ static PRBool HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) { nsIFrame* kid = nsnull; - nsCOMPtr frameType; - for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; + for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; kid = kid->GetNextSibling()) { - kid->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::textFrame) { + if (kid->GetType() == nsLayoutAtoms::textFrame) { // This is only a candidate. We need to determine if this text // frame is empty, as in containing only (non-pre) whitespace. // See bug 20163. diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 7631050469c..6cf463af7e3 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -147,7 +147,7 @@ public: * * @see nsLayoutAtoms::canvasFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -679,13 +679,10 @@ CanvasFrame::GetFrameForPoint(nsIPresContext* aPresContext, return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); } -NS_IMETHODIMP -CanvasFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +CanvasFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::canvasFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::canvasFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 93a6179e3e0..60eeed79edf 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -56,9 +56,6 @@ #include "nsBidiUtils.h" #endif -#define IS_TABLE_CELL(frameType)\ -((nsLayoutAtoms::tableCellFrame == frameType) || (nsLayoutAtoms::bcTableCellFrame == frameType)) - #ifdef NS_DEBUG #undef NOISY_VERTICAL_ALIGN #else @@ -348,9 +345,7 @@ void nsHTMLReflowState::InitCBReflowState() if (NS_SUCCEEDED(rv) && isContainingBlock) { // a block inside a table cell needs to use the table cell if (parentReflowState) { - nsCOMPtr fType; - parentReflowState->frame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType.get())) { + if (IS_TABLE_CELL(parentReflowState->frame->GetType())) { mCBReflowState = parentReflowState; // Set mFlags.mTableDerivedComputedWidth to true for a cell block. Its default // value was set to what the parent reflow state has. @@ -591,13 +586,10 @@ GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) { aFrame = aFrame->GetParent(); while (aFrame) { - nsIAtom* frameType; - PRBool isBlock; - - aFrame->GetFrameType(&frameType); - isBlock = (frameType == nsLayoutAtoms::blockFrame) || - (frameType == nsLayoutAtoms::areaFrame); - NS_IF_RELEASE(frameType); + nsIAtom* frameType = aFrame->GetType(); + PRBool isBlock = + (frameType == nsLayoutAtoms::blockFrame) || + (frameType == nsLayoutAtoms::areaFrame); if (isBlock) { break; @@ -650,22 +642,18 @@ static PRBool GetIntrinsicSizeFor(nsIFrame* aFrame, nsSize& aIntrinsicSize) { // See if it is an image frame - nsIAtom* frameType; PRBool result = PR_FALSE; // Currently the only type of replaced frame that we can get the intrinsic // size for is an image frame // XXX We should add back the GetReflowMetrics() function and one of the // things should be the intrinsic size... - aFrame->GetFrameType(&frameType); - if (frameType == nsLayoutAtoms::imageFrame) { + if (aFrame->GetType() == nsLayoutAtoms::imageFrame) { nsImageFrame* imageFrame = (nsImageFrame*)aFrame; imageFrame->GetIntrinsicImageSize(aIntrinsicSize); result = (aIntrinsicSize != nsSize(0, 0)); } - - NS_IF_RELEASE(frameType); return result; } @@ -1405,8 +1393,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) const nsHTMLReflowState* rs = &aReflowState; for (; rs && rs->frame; rs = (nsHTMLReflowState *)(rs->parentReflowState)) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = rs->frame->GetType(); // if the ancestor is auto height then skip it and continue up if it // is the first block/area frame and possibly the body/html if (nsLayoutAtoms::blockFrame == frameType || @@ -1440,9 +1427,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) // Use scroll frames' computed height if we have one, this will // allow us to get viewport height for native scrollbars. nsHTMLReflowState* scrollState = (nsHTMLReflowState *)rs->parentReflowState; - nsCOMPtr scrollFrameType; - scrollState->frame->GetFrameType(getter_AddRefs(scrollFrameType)); - if (nsLayoutAtoms::scrollFrame == scrollFrameType.get()) { + if (nsLayoutAtoms::scrollFrame == scrollState->frame->GetType()) { rs = scrollState; } } @@ -1497,9 +1482,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) // margin/border/padding for the BODY element else if (nsLayoutAtoms::areaFrame == frameType) { // make sure it is the body - nsCOMPtr fType; - rs->parentReflowState->frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::canvasFrame == fType) { + if (nsLayoutAtoms::canvasFrame == rs->parentReflowState->frame->GetType()) { result -= GetVerticalMarginBorderPadding(secondAncestorRS); } } @@ -1659,9 +1642,7 @@ CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState, if (eStyleUnit_Percent == aWidthUnit) { // If the parent isn't a table cell and has a style width reset the flag if (aState.parentReflowState) { - nsCOMPtr parentType; - aState.parentReflowState->frame->GetFrameType(getter_AddRefs(parentType)); - if (!IS_TABLE_CELL(parentType)) { + if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) { nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit(); if ((eStyleUnit_Inherit != parentUnit) && (eStyleUnit_Auto != parentUnit)) { @@ -1725,7 +1706,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, // See if the containing block height is based on the size of its // content - nsCOMPtr fType; + nsIAtom* fType; if (NS_AUTOHEIGHT == aContainingBlockHeight) { // See if the containing block is (1) a scrolled frame, i.e. its // parent is a scroll frame. The presence of the intervening @@ -1734,15 +1715,15 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, // to use the mComputedHeight of the cell instead of what the cell block passed in. if (cbrs->parentReflowState) { nsIFrame* f = cbrs->parentReflowState->frame; - f->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + fType = f->GetType(); + if (nsLayoutAtoms::scrollFrame == fType) { // Use the scroll frame's computed height instead aContainingBlockHeight = ((nsHTMLReflowState*)cbrs->parentReflowState)->mComputedHeight; } else { - cbrs->frame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType.get())) { + fType = cbrs->frame->GetType(); + if (IS_TABLE_CELL(fType)) { // use the cell's computed height aContainingBlockHeight = ((nsHTMLReflowState*)cbrs)->mComputedHeight; @@ -1782,9 +1763,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit(); nsStyleUnit heightUnit = mStylePosition->mHeight.GetUnit(); - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - // Check for a percentage based width and an unconstrained containing // block width if (eStyleUnit_Percent == widthUnit) { @@ -1982,13 +1960,10 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) { // XXX not sure if this belongs here or somewhere else - cwk // an nsHTMLFrameInnerFrame doesn't get a placeholder frame, the nsHTMLFrameOuterFrame does - nsIAtom* targetFrameType; - frame->GetFrameType(&targetFrameType); - if (nsLayoutAtoms::htmlFrameInnerFrame != targetFrameType) { + if (nsLayoutAtoms::htmlFrameInnerFrame != frame->GetType()) { InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth, aContainingBlockHeight); } - NS_IF_RELEASE(targetFrameType); } else if (NS_CSS_FRAME_TYPE_INLINE == mFrameType) { // Inline non-replaced elements do not have computed widths or heights // XXX add this check to HaveFixedContentHeight/Width too @@ -2056,12 +2031,11 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext, } else { // tables act like replaced elements regarding mComputedWidth - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableOuterFrame == fType.get()) { + nsIAtom* fType = frame->GetType(); + if (nsLayoutAtoms::tableOuterFrame == fType) { mComputedWidth = 0; // XXX temp fix for trees - } else if ((nsLayoutAtoms::tableFrame == fType.get()) || - (nsLayoutAtoms::tableCaptionFrame == fType.get())) { + } else if ((nsLayoutAtoms::tableFrame == fType) || + (nsLayoutAtoms::tableCaptionFrame == fType)) { mComputedWidth = NS_SHRINKWRAPWIDTH; if (eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) { mComputedMargin.left = NS_AUTOMARGIN; @@ -2599,12 +2573,11 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth, } // a table row/col group, row/col doesn't have padding if (frame) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if ((nsLayoutAtoms::tableRowGroupFrame == frameType.get()) || - (nsLayoutAtoms::tableColGroupFrame == frameType.get()) || - (nsLayoutAtoms::tableRowFrame == frameType.get()) || - (nsLayoutAtoms::tableColFrame == frameType.get())) { + nsIAtom* frameType = frame->GetType(); + if ((nsLayoutAtoms::tableRowGroupFrame == frameType) || + (nsLayoutAtoms::tableColGroupFrame == frameType) || + (nsLayoutAtoms::tableRowFrame == frameType) || + (nsLayoutAtoms::tableColFrame == frameType)) { mComputedPadding.top = 0; mComputedPadding.right = 0; mComputedPadding.bottom = 0; diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 83fb6c0b81d..51a34378304 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -1013,7 +1013,7 @@ public: * * @see nsLayoutAtoms */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const = 0; + virtual nsIAtom* GetType() const = 0; /** * Is this frame a "containing block"? diff --git a/mozilla/layout/generic/nsIFrameDebug.h b/mozilla/layout/generic/nsIFrameDebug.h index 591d94247da..3ff296729dc 100644 --- a/mozilla/layout/generic/nsIFrameDebug.h +++ b/mozilla/layout/generic/nsIFrameDebug.h @@ -63,7 +63,7 @@ public: static void RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent); /** * Get a printable from of the name of the frame type. - * XXX This should be eliminated and we use GetFrameType() instead... + * XXX This should be eliminated and we use GetType() instead... */ NS_IMETHOD GetFrameName(nsAString& aResult) const = 0; /** diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 054c2a1cbcc..d940c957d1d 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -938,10 +938,8 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext, ((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) && NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight && aMetrics.height > aReflowState.availableHeight) { - nsCOMPtr fType; - GetFrameType(getter_AddRefs(fType)); // split an image frame but not an image control frame - if (nsLayoutAtoms::imageFrame == fType) { + if (nsLayoutAtoms::imageFrame == GetType()) { float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); // our desired height was greater than 0, so to avoid infinite splitting, use 1 pixel as the min @@ -1788,13 +1786,10 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsImageFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsImageFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::imageFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::imageFrame; } #ifdef DEBUG diff --git a/mozilla/layout/generic/nsImageFrame.h b/mozilla/layout/generic/nsImageFrame.h index 8fd80e661a4..ff24a560efd 100644 --- a/mozilla/layout/generic/nsImageFrame.h +++ b/mozilla/layout/generic/nsImageFrame.h @@ -128,7 +128,7 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - NS_IMETHOD GetFrameType(nsIAtom** aResult) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #endif diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 5f55b6b857f..ea7a55a6bf5 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -107,13 +107,10 @@ nsInlineFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsInlineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsInlineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::inlineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::inlineFrame; } inline PRBool @@ -244,15 +241,11 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext, if (aOldFrame) { // Loop and destroy the frame and all of its continuations. - PRBool generateReflowCommand = PR_FALSE; - // If the frame we are removing is a brFrame, we need a reflow so // the line the brFrame was on can attempt to pull up any frames // that can fit from lines below it. - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::brFrame) - generateReflowCommand = PR_TRUE; + PRBool generateReflowCommand = + aOldFrame->GetType() == nsLayoutAtoms::brFrame; nsInlineFrame* parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent()); while (aOldFrame) { @@ -786,9 +779,7 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext, } } else if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) { nsBlockReflowState* blockRS = lineLayout->mBlockRS; blockRS->mBlock->SplitPlaceholder(*aPresContext, *aFrame); } @@ -958,13 +949,10 @@ nsFirstLineFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsFirstLineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFirstLineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::lineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::lineFrame; } void @@ -1232,13 +1220,10 @@ nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext, return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild); } -NS_IMETHODIMP -nsPositionedInlineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPositionedInlineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::positionedInlineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::positionedInlineFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsInlineFrame.h b/mozilla/layout/generic/nsInlineFrame.h index bd42309f82d..792c29ca8d3 100644 --- a/mozilla/layout/generic/nsInlineFrame.h +++ b/mozilla/layout/generic/nsInlineFrame.h @@ -106,7 +106,7 @@ public: #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre, @@ -180,7 +180,7 @@ public: #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -247,7 +247,7 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: nsAbsoluteContainingBlock mAbsoluteContainer; diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 5f71cceedc0..2ec773badfc 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -94,9 +94,7 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra nscoord sizes = 0; // see if aFrame is an image frame first - nsCOMPtr type; - aFrame.GetFrameType(getter_AddRefs(type)); - if(type.get() == nsLayoutAtoms::imageFrame) { + if (aFrame.GetType() == nsLayoutAtoms::imageFrame) { sizes += aFrame.GetSize().width; } else { // see if there are children to process @@ -429,9 +427,8 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, mPlacedFloats |= (aPlacedLeftFloat ? PLACED_LEFT : PLACED_RIGHT); SetFlag(LL_IMPACTEDBYFLOATS, PR_TRUE); - nsCOMPtr frameType; - aFloatFrame->GetFrameType(getter_AddRefs(frameType)); - SetFlag(LL_LASTFLOATWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get())); + SetFlag(LL_LASTFLOATWASLETTERFRAME, + nsLayoutAtoms::letterFrame == aFloatFrame->GetType()); // Now update all of the open spans... mRootSpan->mContainsFloat = PR_TRUE; // make sure mRootSpan gets updated too @@ -1011,8 +1008,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } #endif // IBMBIDI - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); rv = aFrame->Reflow(mPresContext, metrics, reflowState, aReflowStatus); if (NS_FAILED(rv)) { @@ -1025,7 +1021,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // This only shows up in textareas, so do a quick check to see if we're inside one if (eReflowReason_Initial == reflowState.reason) { - if (frameType && nsLayoutAtoms::textFrame == frameType.get()) + if (nsLayoutAtoms::textFrame == frameType) { // aFrame is a text frame, see if it's inside a text control // although this is a bit slow, the frame tree shouldn't be too deep, it's only called // for the text frame's initial reflow (once in the text frame's lifetime) @@ -1035,15 +1031,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame; parentFrame = parentFrame->GetParent()) { - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType) + if (nsLayoutAtoms::textInputFrame == parentFrame->GetType()) { - if (nsLayoutAtoms::textInputFrame == parentFrameType.get()) - { - inTextControl = PR_TRUE; // found it - break; - } + inTextControl = PR_TRUE; // found it + break; } } if (inTextControl) @@ -1065,7 +1056,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // XXX See if the frame is a placeholderFrame and if it is process // the float. if (frameType) { - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == frameType) { nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame(); if (outOfFlowFrame) { // Make sure it's floated and not absolutely positioned @@ -1077,23 +1068,18 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, else { AddFloat((nsPlaceholderFrame*)aFrame, aReflowStatus); } - nsIAtom* oofft; - outOfFlowFrame->GetFrameType(&oofft); - if (oofft) { - if (oofft == nsLayoutAtoms::letterFrame) { - SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); - // An incomplete reflow status means we should split the - // float if the height is constrained (bug 145305). We - // never split floating first letters. - if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus)) - aReflowStatus = NS_FRAME_COMPLETE; - } - NS_RELEASE(oofft); + if (outOfFlowFrame->GetType() == nsLayoutAtoms::letterFrame) { + SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); + // An incomplete reflow status means we should split the + // float if the height is constrained (bug 145305). We + // never split floating first letters. + if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus)) + aReflowStatus = NS_FRAME_COMPLETE; } } } } - else if (nsLayoutAtoms::textFrame == frameType.get()) { + else if (nsLayoutAtoms::textFrame == frameType) { // Note non-empty text-frames for inline frame compatability hackery pfd->SetFlag(PFD_ISTEXTFRAME, PR_TRUE); // XXX An empty text frame at the end of the line seems not @@ -1130,7 +1116,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } } } - else if (nsLayoutAtoms::letterFrame==frameType.get()) { + else if (nsLayoutAtoms::letterFrame==frameType) { pfd->SetFlag(PFD_ISLETTERFRAME, PR_TRUE); } } @@ -1406,9 +1392,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, #ifdef FIX_BUG_50257 // another special case: always place a BR - nsCOMPtr frameType; - pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame == frameType.get()) { + if (nsLayoutAtoms::brFrame == pfd->mFrame->GetType()) { #ifdef NOISY_CAN_PLACE_FRAME printf(" ==> BR frame fits\n"); #endif @@ -1640,10 +1624,9 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext, { if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame != frameType.get() && - nsLayoutAtoms::textFrame != frameType.get()) + nsIAtom* frameType = aFrame->GetType(); + if (nsLayoutAtoms::brFrame != frameType && + nsLayoutAtoms::textFrame != frameType) { const nsStyleMargin* margin = aFrame->GetStyleMargin(); if (IsPercentageUnitSides(&margin->mMargin)) { @@ -2439,9 +2422,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // Check if it's a BR frame that is not alone on its line (it // is given a height of zero to indicate this), and if so reset // yTop and yBottom so that BR frames don't influence the line. - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame == frameType.get()) { + if (nsLayoutAtoms::brFrame == frame->GetType()) { yTop = VERTICAL_ALIGN_FRAMES_NO_MINIMUM; yBottom = VERTICAL_ALIGN_FRAMES_NO_MAXIMUM; } @@ -3235,9 +3216,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame) continue; // If this is a text frame, return it. - nsCOMPtr frameType; - next->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::textFrame == frameType.get()) + if (nsLayoutAtoms::textFrame == next->GetType()) return next; } diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index b8c6336d7ee..a0adcf95402 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -771,13 +771,10 @@ nsObjectFrame::Destroy(nsIPresContext* aPresContext) return nsObjectFrameSuper::Destroy(aPresContext); } -NS_IMETHODIMP -nsObjectFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsObjectFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::objectFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::objectFrame; } #ifdef DEBUG diff --git a/mozilla/layout/generic/nsObjectFrame.h b/mozilla/layout/generic/nsObjectFrame.h index 5b94072c9b1..4a7a87a212e 100644 --- a/mozilla/layout/generic/nsObjectFrame.h +++ b/mozilla/layout/generic/nsObjectFrame.h @@ -84,8 +84,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; - + virtual nsIAtom* GetType() const; virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; } #ifdef DEBUG diff --git a/mozilla/layout/generic/nsPageContentFrame.cpp b/mozilla/layout/generic/nsPageContentFrame.cpp index 13f9699d6ff..d5bcb6a54ca 100644 --- a/mozilla/layout/generic/nsPageContentFrame.cpp +++ b/mozilla/layout/generic/nsPageContentFrame.cpp @@ -156,13 +156,10 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPageContentFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageContentFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageContentFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageContentFrame; } #ifdef DEBUG diff --git a/mozilla/layout/generic/nsPageContentFrame.h b/mozilla/layout/generic/nsPageContentFrame.h index 9a05c95b889..592643d347c 100644 --- a/mozilla/layout/generic/nsPageContentFrame.h +++ b/mozilla/layout/generic/nsPageContentFrame.h @@ -71,7 +71,7 @@ public: * * @see nsLayoutAtoms::pageFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG // Debugging diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index b27aec3d302..92edb33ebfd 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -154,12 +154,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, nsIFrame* firstFrame = mFrames.FirstChild(); nsPageContentFrame* contentPage = NS_STATIC_CAST(nsPageContentFrame*, firstFrame); NS_ASSERTION(contentPage, "There should always be a content page"); - -#ifdef NS_DEBUG - nsCOMPtr type; - firstFrame->GetFrameType(getter_AddRefs(type)); - NS_ASSERTION(nsLayoutAtoms::pageContentFrame == type, "This frame isn't a pageContentFrame"); -#endif + NS_ASSERTION(nsLayoutAtoms::pageContentFrame == firstFrame->GetType(), + "This frame isn't a pageContentFrame"); if (contentPage && mPrevInFlow) { nsPageFrame* prevPage = NS_STATIC_CAST(nsPageFrame*, mPrevInFlow); @@ -270,13 +266,10 @@ void nsPageFrame::SetClipRect(nsRect* aClipRect) } -NS_IMETHODIMP -nsPageFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageFrame; } #ifdef DEBUG @@ -837,13 +830,10 @@ nsPageBreakFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPageBreakFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageBreakFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageBreakFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageBreakFrame; } diff --git a/mozilla/layout/generic/nsPageFrame.h b/mozilla/layout/generic/nsPageFrame.h index 0470a4d4fe8..57a5d13d601 100644 --- a/mozilla/layout/generic/nsPageFrame.h +++ b/mozilla/layout/generic/nsPageFrame.h @@ -72,7 +72,7 @@ public: * * @see nsLayoutAtoms::pageFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -163,7 +163,7 @@ class nsPageBreakFrame : public nsLeafFrame { const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index 793c6dd354f..a7c6b05a2cb 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -86,13 +86,10 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPlaceholderFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::placeholderFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::placeholderFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsPlaceholderFrame.h b/mozilla/layout/generic/nsPlaceholderFrame.h index e12b8f3269d..5d30749a773 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.h +++ b/mozilla/layout/generic/nsPlaceholderFrame.h @@ -79,7 +79,7 @@ public: * * @see nsLayoutAtoms::placeholderFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 5e0645da33e..34400d27531 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -1051,13 +1051,10 @@ nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsSimplePageSequenceFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsSimplePageSequenceFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::sequenceFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::sequenceFrame; } //------------------------------------------------------------------------------ diff --git a/mozilla/layout/generic/nsSimplePageSequence.h b/mozilla/layout/generic/nsSimplePageSequence.h index f87cbe7867f..07180d271cf 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.h +++ b/mozilla/layout/generic/nsSimplePageSequence.h @@ -127,7 +127,7 @@ public: * * @see nsLayoutAtoms::sequenceFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index d1301cfed6e..6cfb93b7d06 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -425,7 +425,7 @@ public: * * @see nsLayoutAtoms::textFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; @@ -5884,13 +5884,10 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const } } -NS_IMETHODIMP -nsTextFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTextFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::textFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::textFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index 92c764133b6..a7092510bc2 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -336,13 +336,10 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -ViewportFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +ViewportFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::viewportFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::viewportFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/generic/nsViewportFrame.h b/mozilla/layout/generic/nsViewportFrame.h index 21d33b50f39..c6a9d4f47f5 100644 --- a/mozilla/layout/generic/nsViewportFrame.h +++ b/mozilla/layout/generic/nsViewportFrame.h @@ -111,7 +111,7 @@ public: * * @see nsLayoutAtoms::viewportFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index 86b1157f951..cd3f2c0559e 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -186,13 +186,10 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext, } #endif -NS_IMETHODIMP -nsAreaFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsAreaFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::areaFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::areaFrame; } ///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/layout/html/base/src/nsAreaFrame.h b/mozilla/layout/html/base/src/nsAreaFrame.h index 15e58c41887..37d07620068 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.h +++ b/mozilla/layout/html/base/src/nsAreaFrame.h @@ -79,7 +79,7 @@ public: * * @see nsLayoutAtoms::areaFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/base/src/nsBRFrame.cpp b/mozilla/layout/html/base/src/nsBRFrame.cpp index e71bcbb2ce2..5504769315a 100644 --- a/mozilla/layout/html/base/src/nsBRFrame.cpp +++ b/mozilla/layout/html/base/src/nsBRFrame.cpp @@ -74,7 +74,7 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: virtual ~BRFrame(); }; @@ -210,13 +210,10 @@ BRFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -BRFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +BRFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::brFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::brFrame; } NS_IMETHODIMP BRFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, diff --git a/mozilla/layout/html/base/src/nsBidiFrames.cpp b/mozilla/layout/html/base/src/nsBidiFrames.cpp index d345b06b503..4da6f82bad7 100644 --- a/mozilla/layout/html/base/src/nsBidiFrames.cpp +++ b/mozilla/layout/html/base/src/nsBidiFrames.cpp @@ -49,13 +49,10 @@ nsDirectionalFrame::GetChar(void) const * * @see nsLayoutAtoms::directionalFrame */ -NS_IMETHODIMP -nsDirectionalFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsDirectionalFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::directionalFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::directionalFrame; } const nsIID& diff --git a/mozilla/layout/html/base/src/nsBidiFrames.h b/mozilla/layout/html/base/src/nsBidiFrames.h index d2b9d663916..f1be66c45bd 100644 --- a/mozilla/layout/html/base/src/nsBidiFrames.h +++ b/mozilla/layout/html/base/src/nsBidiFrames.h @@ -50,7 +50,7 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; PRUnichar GetChar(void) const; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 14ba42ee2da..ae41ac77ed1 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -445,13 +445,10 @@ nsBlockFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsBlockFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBlockFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::blockFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::blockFrame; } ///////////////////////////////////////////////////////////////////////////// @@ -834,8 +831,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, ancestorRS; ancestorRS = ancestorRS->parentReflowState) { nsIFrame* ancestor = ancestorRS->frame; - nsCOMPtr fType; - ancestor->GetFrameType(getter_AddRefs(fType)); + nsIAtom* fType = ancestor->GetType(); if ((nsLayoutAtoms::blockFrame == fType) || (nsLayoutAtoms::areaFrame == fType)) { if (aReflowState.mSpaceManager == ancestorRS->mSpaceManager) { // Put the continued floats in ancestor since it uses the same space manager @@ -3793,8 +3789,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, else if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) { // Frame is not-complete, no special breaking status - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); // Create a continuation for the incomplete frame. Note that the // frame may already have a continuation. @@ -3813,8 +3808,8 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool splitLine = !reflowingFirstLetter && (nsLayoutAtoms::placeholderFrame != frameType); if (reflowingFirstLetter) { - if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { splitLine = PR_TRUE; } } @@ -3838,9 +3833,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, else if (NS_FRAME_IS_TRUNCATED(frameReflowStatus)) { // if the frame is a placeholder and was complete but truncated (and not at the top // of page), the entire line will be pushed to give it another chance to not truncate. - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) { *aLineReflowStatus = LINE_REFLOW_TRUNCATED; } } @@ -4382,10 +4375,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) // Note: A floating table (example: style="position: relative; float: right") // is an example of an out-of-flow frame with a view - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == frame->GetType()) { nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame(); if (outOfFlowFrame) { const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay(); @@ -4795,16 +4785,11 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext, // find the containing block, this is either the parent or the grandparent // if the parent is an inline frame nsIFrame* parent = aFrame->GetParent(); - nsCOMPtr parentType; - parent->GetFrameType(getter_AddRefs(parentType)); - while (parent && (nsLayoutAtoms::blockFrame != parentType) && - (nsLayoutAtoms::areaFrame != parentType)) { + nsIAtom* parentType = parent->GetType(); + while ((nsLayoutAtoms::blockFrame != parentType) && + (nsLayoutAtoms::areaFrame != parentType)) { parent = parent->GetParent(); - parent->GetFrameType(getter_AddRefs(parentType)); - } - if (!parent) { - NS_ASSERTION(PR_FALSE, "null parent"); - return; + parentType = parent->GetType(); } nsBlockFrame* block = (nsBlockFrame*)parent; @@ -5197,9 +5182,7 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState, PRBool lastPlaceholder = PR_TRUE; nsIFrame* next = aPlaceholder->GetNextSibling(); if (next) { - nsCOMPtr nextType; - next->GetFrameType(getter_AddRefs(nextType)); - if (nsLayoutAtoms::placeholderFrame == nextType) { + if (nsLayoutAtoms::placeholderFrame == next->GetType()) { lastPlaceholder = PR_FALSE; } } @@ -5969,10 +5952,8 @@ nsBlockFrame::IsChild(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetPrevInFlow(&prevInFlow); if (prevInFlow) { nsFrameState state = aFrame->GetStateBits(); - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); skipLineList = (state & NS_FRAME_OUT_OF_FLOW); - skipSiblingList = (nsLayoutAtoms::placeholderFrame == frameType) || + skipSiblingList = (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) || (state & NS_FRAME_OUT_OF_FLOW); } @@ -6191,9 +6172,7 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext, nsIFrame* kid = aKid; // if the frame is a placeholder, then get the out of flow frame - nsCOMPtr frameType; - aKid->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == aKid->GetType()) { kid = NS_STATIC_CAST(nsPlaceholderFrame*, aKid)->GetOutOfFlowFrame(); NS_ASSERTION(kid, "no out-of-flow frame"); } diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index ed9d15e4922..9f0424076c0 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -132,7 +132,7 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 45776944ca7..37498bc0b17 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -232,15 +232,10 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, /* bug 18445: treat elements mapped to display: block such as text controls * just like normal blocks */ - PRBool treatAsNotSplittable=PR_FALSE; - nsCOMPtrframeType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType) { - // text controls are not splittable, so make a special case here - // XXXldb Why not just set the frame state bit? - if (nsLayoutAtoms::textInputFrame == frameType.get()) - treatAsNotSplittable = PR_TRUE; - } + // text controls are not splittable, so make a special case here + // XXXldb Why not just set the frame state bit? + PRBool treatAsNotSplittable = + nsLayoutAtoms::textInputFrame == aFrame->GetType(); if (NS_FRAME_SPLITTABLE_NON_RECTANGULAR == aSplitType || // normal blocks NS_FRAME_NOT_SPLITTABLE == aSplitType || // things like images mapped to display: block @@ -927,9 +922,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache, if(prevFrame) { //get the frame type - nsIAtom* atom; - prevFrame->GetFrameType(&atom); - if(nsLayoutAtoms::tableOuterFrame == atom) { + if (nsLayoutAtoms::tableOuterFrame == prevFrame->GetType()) { //see if it has "align=" // IE makes a difference between align and he float property nsIContent* content = prevFrame->GetContent(); diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index d0ea772ea7f..23e4ab19a52 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -168,13 +168,10 @@ nsBulletFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsBulletFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBulletFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::bulletFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::bulletFrame; } #include "nsIDOMNode.h" diff --git a/mozilla/layout/html/base/src/nsBulletFrame.h b/mozilla/layout/html/base/src/nsBulletFrame.h index cd3b44e073e..a9362a12864 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.h +++ b/mozilla/layout/html/base/src/nsBulletFrame.h @@ -65,7 +65,7 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 01f22d7acdc..1c7787fdf01 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -899,9 +899,7 @@ nsContainerFrame::FrameNeedsView(nsIFrame* aFrame) // XXX Check for the frame being a block frame and only force a view // in that case, because adding a view for box frames seems to cause // problems for XUL... - nsCOMPtr frameType; - - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); if ((frameType == nsLayoutAtoms::blockFrame) || (frameType == nsLayoutAtoms::areaFrame)) { return PR_TRUE; diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index 27b25f84e01..b164aa66848 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -61,7 +61,7 @@ public: #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, @@ -115,13 +115,10 @@ nsFirstLetterFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsFirstLetterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFirstLetterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::letterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::letterFrame; } PRIntn diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index d661ecdffc2..7d7a905f054 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -2523,12 +2523,10 @@ nsIWidget* nsIFrame::GetWindow() const return window; } -NS_IMETHODIMP -nsFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsnull; - return NS_OK; + return nsnull; } void @@ -3267,32 +3265,28 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL; if ( isEditor ) { - nsIAtom *resultFrameType; - if(NS_SUCCEEDED(resultFrame->GetFrameType(&resultFrameType)) && resultFrameType) + if (resultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { - if (resultFrameType == nsLayoutAtoms::tableOuterFrame) + if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side { - if (((point.x - offset.x + tempRect.x)<0) || ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side + nsIContent* content = resultFrame->GetContent(); + if (content) { - nsIContent* content = resultFrame->GetContent(); - if (content) + nsIContent* parent = content->GetParent(); + if (parent) { - nsIContent* parent = content->GetParent(); - if (parent) + aPos->mResultContent = parent; + aPos->mContentOffset = parent->IndexOf(content); + aPos->mPreferLeft = PR_FALSE; + if ((point.x - offset.x+ tempRect.x)>tempRect.width) { - aPos->mResultContent = parent; - aPos->mContentOffset = parent->IndexOf(content); - aPos->mPreferLeft = PR_FALSE; - if ((point.x - offset.x+ tempRect.x)>tempRect.width) - { - aPos->mContentOffset++;//go to end of this frame - aPos->mPreferLeft = PR_TRUE; - } - aPos->mContentOffsetEnd = aPos->mContentOffset; - //result frame is the result frames parent. - aPos->mResultFrame = resultFrame->GetParent(); - return NS_POSITION_BEFORE_TABLE; + aPos->mContentOffset++;//go to end of this frame + aPos->mPreferLeft = PR_TRUE; } + aPos->mContentOffsetEnd = aPos->mContentOffset; + //result frame is the result frames parent. + aPos->mResultFrame = resultFrame->GetParent(); + return NS_POSITION_BEFORE_TABLE; } } } @@ -3776,8 +3770,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) if we hit a header or footer thats ok just go into them, */ PRBool searchTableBool = PR_FALSE; - nsIAtom *resultFrameType; - if(NS_SUCCEEDED(aPos->mResultFrame->GetFrameType(&resultFrameType)) && resultFrameType == nsLayoutAtoms::tableOuterFrame) + if (aPos->mResultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { nsIFrame *frame = aPos->mResultFrame; result = frame->FirstChild(aPresContext, nsnull,&frame); @@ -4128,9 +4121,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct //in the case of a text node since that does not mean we are stuck. it could mean a change in style for //the text node. in the case of a hruleframe with generated before and after content, we do not //want the splittable generated frame to get us stuck on an HR - nsCOMPtr frameType; - newFrame->GetFrameType(getter_AddRefs(frameType) ); - if (nsLayoutAtoms::textFrame != frameType.get() ) + if (nsLayoutAtoms::textFrame != newFrame->GetType()) continue; //we should NOT be getting stuck on the same piece of content on the same line. skip to next line. } isBidiGhostFrame = (newFrame->GetRect().IsEmpty() && @@ -5260,10 +5251,7 @@ void DR_State::InitFrameTypeTable() void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame, PRInt32 aIndent) { - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - - DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(fType); + DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->GetType()); if (frameTypeInfo) { for (PRInt32 i = 0; i < aIndent; i++) { printf(" "); @@ -5297,9 +5285,7 @@ PRBool DR_State::RuleMatches(DR_Rule& aRule, rulePart = rulePart->mNext, parentNode = parentNode->mParent) { if (rulePart->mFrameType) { if (parentNode->mFrame) { - nsCOMPtr fNodeType; - parentNode->mFrame->GetFrameType(getter_AddRefs(fNodeType)); - if (rulePart->mFrameType != fNodeType) { + if (rulePart->mFrameType != parentNode->mFrame->GetType()) { return PR_FALSE; } } @@ -5319,9 +5305,7 @@ void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode) PRBool matchingRule = PR_FALSE; - nsCOMPtr fType; - aNode.mFrame->GetFrameType(getter_AddRefs(fType)); - DR_FrameTypeInfo* info = GetFrameTypeInfo(fType.get()); + DR_FrameTypeInfo* info = GetFrameTypeInfo(aNode.mFrame->GetType()); NS_ASSERTION(info, "program error"); PRInt32 numRules = info->mRules.Count(); for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) { diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 48b612d6e49..bea1d53dba8 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -240,7 +240,7 @@ public: NS_IMETHOD SetNextInFlow(nsIFrame*); NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; NS_IMETHOD GetOriginToViewOffset(nsIPresContext *aPresContext, nsPoint& aOffset, nsIView **aView) const; - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; #ifdef NS_DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 8d7b49392eb..040d072b009 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -547,9 +547,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const // get each sibling of the child and check them, startig at the child nsIFrame *siblingFrame = childFrame; while (siblingFrame) { - nsCOMPtr frameType; - siblingFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::canvasFrame) { + if (siblingFrame->GetType() == nsLayoutAtoms::canvasFrame) { // this is it: set the out-arg and stop looking *aCanvasFrame = siblingFrame; break; @@ -734,12 +732,8 @@ FrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame) { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aPlaceholderFrame, "null param unexpected"); -#ifdef DEBUG - nsCOMPtr frameType; - aPlaceholderFrame->GetFrameType(getter_AddRefs(frameType)); - NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == frameType, + NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == aPlaceholderFrame->GetType(), "unexpected frame type"); -#endif if (!mPlaceholderMap.ops) { if (!PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps, nsnull, sizeof(PlaceholderMapEntry), 16)) { @@ -764,12 +758,8 @@ FrameManager::UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame) { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aPlaceholderFrame, "null param unexpected"); -#ifdef DEBUG - nsCOMPtr frameType; - aPlaceholderFrame->GetFrameType(getter_AddRefs(frameType)); - NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == frameType, + NS_PRECONDITION(nsLayoutAtoms::placeholderFrame == aPlaceholderFrame->GetType(), "unexpected frame type"); -#endif /* * nsCSSFrameConstructor::ReconstructDocElementHierarchy calls @@ -1172,9 +1162,7 @@ CantRenderReplacedElementEvent::CantRenderReplacedElementEvent(FrameManager* aFr (PLDestroyEventProc)&FrameManager::DestroyPLEvent); mFrame = aFrame; - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::objectFrame == frameType) { + if (nsLayoutAtoms::objectFrame == aFrame->GetType()) { AddLoadGroupRequest(aPresShell); } } @@ -1410,7 +1398,6 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* PRInt32 listIndex = 0; nsIAtom* childList = nsnull; nsIFrame* child; - nsIAtom* frameType; do { child = nsnull; @@ -1418,8 +1405,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* while ((NS_SUCCEEDED(result)) && child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder: first recirse and verify the out of flow frame, // then verify the placeholder's context nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); @@ -1435,7 +1421,6 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* else { // regular frame VerifyStyleTree(aPresContext, child, nsnull); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); } @@ -1494,7 +1479,6 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, PRInt32 listIndex = 0; nsIAtom* childList = nsnull; nsIFrame* child; - nsIAtom* frameType; do { child = nsnull; @@ -1502,8 +1486,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, while ((NS_SUCCEEDED(result)) && child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // get out of flow frame and recurse there nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -1517,7 +1500,6 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, else { // regular frame result = ReParentStyleContext(child, newContext); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); @@ -1914,9 +1896,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, while (NS_SUCCEEDED(result) && child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - nsCOMPtr frameType; - child->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder // get out of flow frame and recur there nsIFrame* outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*,child)->GetOutOfFlowFrame(); diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index 801d433fd1e..39b82b77d45 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -352,10 +352,7 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // allow scrollbars if this is the child of the viewport, because // we must be the scrollbars for the print preview window nsIFrame* parent = GetParent(); - nsCOMPtr parentType; - if (parent) - parent->GetFrameType(getter_AddRefs(parentType)); - if (parentType != nsLayoutAtoms::viewportFrame) { + if (!parent || parent->GetType() != nsLayoutAtoms::viewportFrame) { SetScrollbarVisibility(aPresContext, PR_FALSE, PR_FALSE); return NS_OK; } @@ -461,9 +458,7 @@ void nsGfxScrollFrame::ReloadChildFrames(nsIPresContext* aPresContext) nsIBox* box = nsnull; frame->QueryInterface(NS_GET_IID(nsIBox), (void**)&box); if (box) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::scrollFrame) { + if (frame->GetType() == nsLayoutAtoms::scrollFrame) { NS_ASSERTION(!mInner->mScrollAreaBox, "Found multiple scroll areas?"); mInner->mScrollAreaBox = box; understood = PR_TRUE; @@ -632,13 +627,10 @@ nsGfxScrollFrame::GetSkipSides() const return 0; } -NS_IMETHODIMP -nsGfxScrollFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsGfxScrollFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::scrollFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::scrollFrame; } NS_IMETHODIMP @@ -1567,9 +1559,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) && nsBoxLayoutState::Dirty == aState.GetLayoutReason()) { nsIFrame* parentFrame = mOuter->GetParent(); if (parentFrame) { - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType.get() == nsLayoutAtoms::viewportFrame) { + if (parentFrame->GetType() == nsLayoutAtoms::viewportFrame) { // Usually there are no fixed children, so don't do anything unless there's // at least one fixed child nsIFrame* child; diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.h b/mozilla/layout/html/base/src/nsGfxScrollFrame.h index 072fc0fc648..0873fb2feb0 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.h +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.h @@ -174,7 +174,7 @@ public: * * @see nsLayoutAtoms::scrollFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index c13a4136923..b1b993a59db 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -231,13 +231,11 @@ static PRBool HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) { nsIFrame* kid = nsnull; - nsCOMPtr frameType; - for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; + for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; kid = kid->GetNextSibling()) { - kid->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::textFrame) { + if (kid->GetType() == nsLayoutAtoms::textFrame) { // This is only a candidate. We need to determine if this text // frame is empty, as in containing only (non-pre) whitespace. // See bug 20163. diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 7631050469c..6cf463af7e3 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -147,7 +147,7 @@ public: * * @see nsLayoutAtoms::canvasFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -679,13 +679,10 @@ CanvasFrame::GetFrameForPoint(nsIPresContext* aPresContext, return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); } -NS_IMETHODIMP -CanvasFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +CanvasFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::canvasFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::canvasFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 93a6179e3e0..60eeed79edf 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -56,9 +56,6 @@ #include "nsBidiUtils.h" #endif -#define IS_TABLE_CELL(frameType)\ -((nsLayoutAtoms::tableCellFrame == frameType) || (nsLayoutAtoms::bcTableCellFrame == frameType)) - #ifdef NS_DEBUG #undef NOISY_VERTICAL_ALIGN #else @@ -348,9 +345,7 @@ void nsHTMLReflowState::InitCBReflowState() if (NS_SUCCEEDED(rv) && isContainingBlock) { // a block inside a table cell needs to use the table cell if (parentReflowState) { - nsCOMPtr fType; - parentReflowState->frame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType.get())) { + if (IS_TABLE_CELL(parentReflowState->frame->GetType())) { mCBReflowState = parentReflowState; // Set mFlags.mTableDerivedComputedWidth to true for a cell block. Its default // value was set to what the parent reflow state has. @@ -591,13 +586,10 @@ GetNearestContainingBlock(nsIFrame* aFrame, nsMargin& aContentArea) { aFrame = aFrame->GetParent(); while (aFrame) { - nsIAtom* frameType; - PRBool isBlock; - - aFrame->GetFrameType(&frameType); - isBlock = (frameType == nsLayoutAtoms::blockFrame) || - (frameType == nsLayoutAtoms::areaFrame); - NS_IF_RELEASE(frameType); + nsIAtom* frameType = aFrame->GetType(); + PRBool isBlock = + (frameType == nsLayoutAtoms::blockFrame) || + (frameType == nsLayoutAtoms::areaFrame); if (isBlock) { break; @@ -650,22 +642,18 @@ static PRBool GetIntrinsicSizeFor(nsIFrame* aFrame, nsSize& aIntrinsicSize) { // See if it is an image frame - nsIAtom* frameType; PRBool result = PR_FALSE; // Currently the only type of replaced frame that we can get the intrinsic // size for is an image frame // XXX We should add back the GetReflowMetrics() function and one of the // things should be the intrinsic size... - aFrame->GetFrameType(&frameType); - if (frameType == nsLayoutAtoms::imageFrame) { + if (aFrame->GetType() == nsLayoutAtoms::imageFrame) { nsImageFrame* imageFrame = (nsImageFrame*)aFrame; imageFrame->GetIntrinsicImageSize(aIntrinsicSize); result = (aIntrinsicSize != nsSize(0, 0)); } - - NS_IF_RELEASE(frameType); return result; } @@ -1405,8 +1393,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) const nsHTMLReflowState* rs = &aReflowState; for (; rs && rs->frame; rs = (nsHTMLReflowState *)(rs->parentReflowState)) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = rs->frame->GetType(); // if the ancestor is auto height then skip it and continue up if it // is the first block/area frame and possibly the body/html if (nsLayoutAtoms::blockFrame == frameType || @@ -1440,9 +1427,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) // Use scroll frames' computed height if we have one, this will // allow us to get viewport height for native scrollbars. nsHTMLReflowState* scrollState = (nsHTMLReflowState *)rs->parentReflowState; - nsCOMPtr scrollFrameType; - scrollState->frame->GetFrameType(getter_AddRefs(scrollFrameType)); - if (nsLayoutAtoms::scrollFrame == scrollFrameType.get()) { + if (nsLayoutAtoms::scrollFrame == scrollState->frame->GetType()) { rs = scrollState; } } @@ -1497,9 +1482,7 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState) // margin/border/padding for the BODY element else if (nsLayoutAtoms::areaFrame == frameType) { // make sure it is the body - nsCOMPtr fType; - rs->parentReflowState->frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::canvasFrame == fType) { + if (nsLayoutAtoms::canvasFrame == rs->parentReflowState->frame->GetType()) { result -= GetVerticalMarginBorderPadding(secondAncestorRS); } } @@ -1659,9 +1642,7 @@ CheckResetTableDerivedComputedWidth(nsHTMLReflowState& aState, if (eStyleUnit_Percent == aWidthUnit) { // If the parent isn't a table cell and has a style width reset the flag if (aState.parentReflowState) { - nsCOMPtr parentType; - aState.parentReflowState->frame->GetFrameType(getter_AddRefs(parentType)); - if (!IS_TABLE_CELL(parentType)) { + if (!IS_TABLE_CELL(aState.parentReflowState->frame->GetType())) { nsStyleUnit parentUnit = aState.parentReflowState->mStylePosition->mWidth.GetUnit(); if ((eStyleUnit_Inherit != parentUnit) && (eStyleUnit_Auto != parentUnit)) { @@ -1725,7 +1706,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, // See if the containing block height is based on the size of its // content - nsCOMPtr fType; + nsIAtom* fType; if (NS_AUTOHEIGHT == aContainingBlockHeight) { // See if the containing block is (1) a scrolled frame, i.e. its // parent is a scroll frame. The presence of the intervening @@ -1734,15 +1715,15 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, // to use the mComputedHeight of the cell instead of what the cell block passed in. if (cbrs->parentReflowState) { nsIFrame* f = cbrs->parentReflowState->frame; - f->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + fType = f->GetType(); + if (nsLayoutAtoms::scrollFrame == fType) { // Use the scroll frame's computed height instead aContainingBlockHeight = ((nsHTMLReflowState*)cbrs->parentReflowState)->mComputedHeight; } else { - cbrs->frame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType.get())) { + fType = cbrs->frame->GetType(); + if (IS_TABLE_CELL(fType)) { // use the cell's computed height aContainingBlockHeight = ((nsHTMLReflowState*)cbrs)->mComputedHeight; @@ -1782,9 +1763,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit(); nsStyleUnit heightUnit = mStylePosition->mHeight.GetUnit(); - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - // Check for a percentage based width and an unconstrained containing // block width if (eStyleUnit_Percent == widthUnit) { @@ -1982,13 +1960,10 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } else if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) { // XXX not sure if this belongs here or somewhere else - cwk // an nsHTMLFrameInnerFrame doesn't get a placeholder frame, the nsHTMLFrameOuterFrame does - nsIAtom* targetFrameType; - frame->GetFrameType(&targetFrameType); - if (nsLayoutAtoms::htmlFrameInnerFrame != targetFrameType) { + if (nsLayoutAtoms::htmlFrameInnerFrame != frame->GetType()) { InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth, aContainingBlockHeight); } - NS_IF_RELEASE(targetFrameType); } else if (NS_CSS_FRAME_TYPE_INLINE == mFrameType) { // Inline non-replaced elements do not have computed widths or heights // XXX add this check to HaveFixedContentHeight/Width too @@ -2056,12 +2031,11 @@ nsHTMLReflowState::ComputeBlockBoxData(nsIPresContext* aPresContext, } else { // tables act like replaced elements regarding mComputedWidth - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableOuterFrame == fType.get()) { + nsIAtom* fType = frame->GetType(); + if (nsLayoutAtoms::tableOuterFrame == fType) { mComputedWidth = 0; // XXX temp fix for trees - } else if ((nsLayoutAtoms::tableFrame == fType.get()) || - (nsLayoutAtoms::tableCaptionFrame == fType.get())) { + } else if ((nsLayoutAtoms::tableFrame == fType) || + (nsLayoutAtoms::tableCaptionFrame == fType)) { mComputedWidth = NS_SHRINKWRAPWIDTH; if (eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit()) { mComputedMargin.left = NS_AUTOMARGIN; @@ -2599,12 +2573,11 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth, } // a table row/col group, row/col doesn't have padding if (frame) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if ((nsLayoutAtoms::tableRowGroupFrame == frameType.get()) || - (nsLayoutAtoms::tableColGroupFrame == frameType.get()) || - (nsLayoutAtoms::tableRowFrame == frameType.get()) || - (nsLayoutAtoms::tableColFrame == frameType.get())) { + nsIAtom* frameType = frame->GetType(); + if ((nsLayoutAtoms::tableRowGroupFrame == frameType) || + (nsLayoutAtoms::tableColGroupFrame == frameType) || + (nsLayoutAtoms::tableRowFrame == frameType) || + (nsLayoutAtoms::tableColFrame == frameType)) { mComputedPadding.top = 0; mComputedPadding.right = 0; mComputedPadding.bottom = 0; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 054c2a1cbcc..d940c957d1d 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -938,10 +938,8 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext, ((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) && NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight && aMetrics.height > aReflowState.availableHeight) { - nsCOMPtr fType; - GetFrameType(getter_AddRefs(fType)); // split an image frame but not an image control frame - if (nsLayoutAtoms::imageFrame == fType) { + if (nsLayoutAtoms::imageFrame == GetType()) { float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); // our desired height was greater than 0, so to avoid infinite splitting, use 1 pixel as the min @@ -1788,13 +1786,10 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsImageFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsImageFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::imageFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::imageFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/base/src/nsImageFrame.h b/mozilla/layout/html/base/src/nsImageFrame.h index 8fd80e661a4..ff24a560efd 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.h +++ b/mozilla/layout/html/base/src/nsImageFrame.h @@ -128,7 +128,7 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - NS_IMETHOD GetFrameType(nsIAtom** aResult) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #endif diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 5f55b6b857f..ea7a55a6bf5 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -107,13 +107,10 @@ nsInlineFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsInlineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsInlineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::inlineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::inlineFrame; } inline PRBool @@ -244,15 +241,11 @@ nsInlineFrame::RemoveFrame(nsIPresContext* aPresContext, if (aOldFrame) { // Loop and destroy the frame and all of its continuations. - PRBool generateReflowCommand = PR_FALSE; - // If the frame we are removing is a brFrame, we need a reflow so // the line the brFrame was on can attempt to pull up any frames // that can fit from lines below it. - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::brFrame) - generateReflowCommand = PR_TRUE; + PRBool generateReflowCommand = + aOldFrame->GetType() == nsLayoutAtoms::brFrame; nsInlineFrame* parent = NS_STATIC_CAST(nsInlineFrame*, aOldFrame->GetParent()); while (aOldFrame) { @@ -786,9 +779,7 @@ nsInlineFrame::ReflowInlineFrame(nsIPresContext* aPresContext, } } else if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType) { + if (nsLayoutAtoms::placeholderFrame == aFrame->GetType()) { nsBlockReflowState* blockRS = lineLayout->mBlockRS; blockRS->mBlock->SplitPlaceholder(*aPresContext, *aFrame); } @@ -958,13 +949,10 @@ nsFirstLineFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsFirstLineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFirstLineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::lineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::lineFrame; } void @@ -1232,13 +1220,10 @@ nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext, return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild); } -NS_IMETHODIMP -nsPositionedInlineFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPositionedInlineFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::positionedInlineFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::positionedInlineFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/base/src/nsInlineFrame.h b/mozilla/layout/html/base/src/nsInlineFrame.h index bd42309f82d..792c29ca8d3 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.h +++ b/mozilla/layout/html/base/src/nsInlineFrame.h @@ -106,7 +106,7 @@ public: #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre, @@ -180,7 +180,7 @@ public: #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -247,7 +247,7 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: nsAbsoluteContainingBlock mAbsoluteContainer; diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 5f71cceedc0..2ec773badfc 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -94,9 +94,7 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra nscoord sizes = 0; // see if aFrame is an image frame first - nsCOMPtr type; - aFrame.GetFrameType(getter_AddRefs(type)); - if(type.get() == nsLayoutAtoms::imageFrame) { + if (aFrame.GetType() == nsLayoutAtoms::imageFrame) { sizes += aFrame.GetSize().width; } else { // see if there are children to process @@ -429,9 +427,8 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, mPlacedFloats |= (aPlacedLeftFloat ? PLACED_LEFT : PLACED_RIGHT); SetFlag(LL_IMPACTEDBYFLOATS, PR_TRUE); - nsCOMPtr frameType; - aFloatFrame->GetFrameType(getter_AddRefs(frameType)); - SetFlag(LL_LASTFLOATWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get())); + SetFlag(LL_LASTFLOATWASLETTERFRAME, + nsLayoutAtoms::letterFrame == aFloatFrame->GetType()); // Now update all of the open spans... mRootSpan->mContainsFloat = PR_TRUE; // make sure mRootSpan gets updated too @@ -1011,8 +1008,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } #endif // IBMBIDI - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); rv = aFrame->Reflow(mPresContext, metrics, reflowState, aReflowStatus); if (NS_FAILED(rv)) { @@ -1025,7 +1021,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // This only shows up in textareas, so do a quick check to see if we're inside one if (eReflowReason_Initial == reflowState.reason) { - if (frameType && nsLayoutAtoms::textFrame == frameType.get()) + if (nsLayoutAtoms::textFrame == frameType) { // aFrame is a text frame, see if it's inside a text control // although this is a bit slow, the frame tree shouldn't be too deep, it's only called // for the text frame's initial reflow (once in the text frame's lifetime) @@ -1035,15 +1031,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, for (nsIFrame *parentFrame = aFrame->GetParent(); parentFrame; parentFrame = parentFrame->GetParent()) { - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType) + if (nsLayoutAtoms::textInputFrame == parentFrame->GetType()) { - if (nsLayoutAtoms::textInputFrame == parentFrameType.get()) - { - inTextControl = PR_TRUE; // found it - break; - } + inTextControl = PR_TRUE; // found it + break; } } if (inTextControl) @@ -1065,7 +1056,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // XXX See if the frame is a placeholderFrame and if it is process // the float. if (frameType) { - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == frameType) { nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame(); if (outOfFlowFrame) { // Make sure it's floated and not absolutely positioned @@ -1077,23 +1068,18 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, else { AddFloat((nsPlaceholderFrame*)aFrame, aReflowStatus); } - nsIAtom* oofft; - outOfFlowFrame->GetFrameType(&oofft); - if (oofft) { - if (oofft == nsLayoutAtoms::letterFrame) { - SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); - // An incomplete reflow status means we should split the - // float if the height is constrained (bug 145305). We - // never split floating first letters. - if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus)) - aReflowStatus = NS_FRAME_COMPLETE; - } - NS_RELEASE(oofft); + if (outOfFlowFrame->GetType() == nsLayoutAtoms::letterFrame) { + SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE); + // An incomplete reflow status means we should split the + // float if the height is constrained (bug 145305). We + // never split floating first letters. + if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus)) + aReflowStatus = NS_FRAME_COMPLETE; } } } } - else if (nsLayoutAtoms::textFrame == frameType.get()) { + else if (nsLayoutAtoms::textFrame == frameType) { // Note non-empty text-frames for inline frame compatability hackery pfd->SetFlag(PFD_ISTEXTFRAME, PR_TRUE); // XXX An empty text frame at the end of the line seems not @@ -1130,7 +1116,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } } } - else if (nsLayoutAtoms::letterFrame==frameType.get()) { + else if (nsLayoutAtoms::letterFrame==frameType) { pfd->SetFlag(PFD_ISLETTERFRAME, PR_TRUE); } } @@ -1406,9 +1392,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, #ifdef FIX_BUG_50257 // another special case: always place a BR - nsCOMPtr frameType; - pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame == frameType.get()) { + if (nsLayoutAtoms::brFrame == pfd->mFrame->GetType()) { #ifdef NOISY_CAN_PLACE_FRAME printf(" ==> BR frame fits\n"); #endif @@ -1640,10 +1624,9 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext, { if (aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame != frameType.get() && - nsLayoutAtoms::textFrame != frameType.get()) + nsIAtom* frameType = aFrame->GetType(); + if (nsLayoutAtoms::brFrame != frameType && + nsLayoutAtoms::textFrame != frameType) { const nsStyleMargin* margin = aFrame->GetStyleMargin(); if (IsPercentageUnitSides(&margin->mMargin)) { @@ -2439,9 +2422,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // Check if it's a BR frame that is not alone on its line (it // is given a height of zero to indicate this), and if so reset // yTop and yBottom so that BR frames don't influence the line. - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::brFrame == frameType.get()) { + if (nsLayoutAtoms::brFrame == frame->GetType()) { yTop = VERTICAL_ALIGN_FRAMES_NO_MINIMUM; yBottom = VERTICAL_ALIGN_FRAMES_NO_MAXIMUM; } @@ -3235,9 +3216,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame) continue; // If this is a text frame, return it. - nsCOMPtr frameType; - next->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::textFrame == frameType.get()) + if (nsLayoutAtoms::textFrame == next->GetType()) return next; } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index b8c6336d7ee..a0adcf95402 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -771,13 +771,10 @@ nsObjectFrame::Destroy(nsIPresContext* aPresContext) return nsObjectFrameSuper::Destroy(aPresContext); } -NS_IMETHODIMP -nsObjectFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsObjectFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::objectFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::objectFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/base/src/nsObjectFrame.h b/mozilla/layout/html/base/src/nsObjectFrame.h index 5b94072c9b1..4a7a87a212e 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.h +++ b/mozilla/layout/html/base/src/nsObjectFrame.h @@ -84,8 +84,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; - + virtual nsIAtom* GetType() const; virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; } #ifdef DEBUG diff --git a/mozilla/layout/html/base/src/nsPageContentFrame.cpp b/mozilla/layout/html/base/src/nsPageContentFrame.cpp index 13f9699d6ff..d5bcb6a54ca 100644 --- a/mozilla/layout/html/base/src/nsPageContentFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageContentFrame.cpp @@ -156,13 +156,10 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPageContentFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageContentFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageContentFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageContentFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/base/src/nsPageContentFrame.h b/mozilla/layout/html/base/src/nsPageContentFrame.h index 9a05c95b889..592643d347c 100644 --- a/mozilla/layout/html/base/src/nsPageContentFrame.h +++ b/mozilla/layout/html/base/src/nsPageContentFrame.h @@ -71,7 +71,7 @@ public: * * @see nsLayoutAtoms::pageFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG // Debugging diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index b27aec3d302..92edb33ebfd 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -154,12 +154,8 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, nsIFrame* firstFrame = mFrames.FirstChild(); nsPageContentFrame* contentPage = NS_STATIC_CAST(nsPageContentFrame*, firstFrame); NS_ASSERTION(contentPage, "There should always be a content page"); - -#ifdef NS_DEBUG - nsCOMPtr type; - firstFrame->GetFrameType(getter_AddRefs(type)); - NS_ASSERTION(nsLayoutAtoms::pageContentFrame == type, "This frame isn't a pageContentFrame"); -#endif + NS_ASSERTION(nsLayoutAtoms::pageContentFrame == firstFrame->GetType(), + "This frame isn't a pageContentFrame"); if (contentPage && mPrevInFlow) { nsPageFrame* prevPage = NS_STATIC_CAST(nsPageFrame*, mPrevInFlow); @@ -270,13 +266,10 @@ void nsPageFrame::SetClipRect(nsRect* aClipRect) } -NS_IMETHODIMP -nsPageFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageFrame; } #ifdef DEBUG @@ -837,13 +830,10 @@ nsPageBreakFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPageBreakFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPageBreakFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::pageBreakFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::pageBreakFrame; } diff --git a/mozilla/layout/html/base/src/nsPageFrame.h b/mozilla/layout/html/base/src/nsPageFrame.h index 0470a4d4fe8..57a5d13d601 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.h +++ b/mozilla/layout/html/base/src/nsPageFrame.h @@ -72,7 +72,7 @@ public: * * @see nsLayoutAtoms::pageFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -163,7 +163,7 @@ class nsPageBreakFrame : public nsLeafFrame { const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; protected: diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index 793c6dd354f..a7c6b05a2cb 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -86,13 +86,10 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext, return NS_OK; } -NS_IMETHODIMP -nsPlaceholderFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsPlaceholderFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::placeholderFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::placeholderFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.h b/mozilla/layout/html/base/src/nsPlaceholderFrame.h index e12b8f3269d..5d30749a773 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.h +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.h @@ -79,7 +79,7 @@ public: * * @see nsLayoutAtoms::placeholderFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 5e855f197ea..c778f57ed46 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -2697,22 +2697,18 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* *aScrollFrame = nsnull; nsIFrame* theFrame = nsnull; if (aRootFrame) { - nsCOMPtr fType; - aRootFrame->GetFrameType(getter_AddRefs(fType)); - if (fType && (nsLayoutAtoms::viewportFrame == fType.get())) { + if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { // If child is scrollframe keep it (native) aRootFrame->FirstChild(aPresContext, nsnull, &theFrame); if (theFrame) { - theFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; // If the first child of that is scrollframe, use it instead (gfx) theFrame->FirstChild(aPresContext, nsnull, &theFrame); if (theFrame) { - theFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::scrollFrame == fType.get()) { + if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; } } @@ -3356,10 +3352,10 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) if (!frame) return NS_ERROR_FAILURE; //we need to get to the area frame. - nsCOMPtr frameType; + nsIAtom* frameType; do { - frame->GetFrameType(getter_AddRefs(frameType)); + frameType = frame->GetType(); if (frameType != nsLayoutAtoms::areaFrame) { result = frame->FirstChild(mPresContext, nsnull, &frame); @@ -4345,12 +4341,12 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // layout model) or aVPercent is not NS_PRESSHELL_SCROLL_ANYWHERE, we need to // change the top of the bounds to include the whole line. if (frameBounds.height == 0 || aVPercent != NS_PRESSHELL_SCROLL_ANYWHERE) { - nsCOMPtr frameType; + nsIAtom* frameType; nsIFrame *prevFrame = aFrame; nsIFrame *frame = aFrame; - while (frame && (frame->GetFrameType(getter_AddRefs(frameType)), - frameType == nsLayoutAtoms::inlineFrame)) { + while (frame && + (frameType = frame->GetType()) == nsLayoutAtoms::inlineFrame) { prevFrame = frame; frame = prevFrame->GetParent(); } @@ -6619,9 +6615,8 @@ PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC) nsIFrame* target; aRC->GetTarget(target); - nsCOMPtr type; - target->GetFrameType(getter_AddRefs(type)); - NS_ASSERTION(type, "frame didn't override GetFrameType()"); + nsIAtom* type = target->GetType(); + NS_ASSERTION(type, "frame didn't override GetType()"); nsAutoString typeStr(NS_LITERAL_STRING("unknown")); if (type) diff --git a/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp b/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp index 08493bed16d..e0ced89b76f 100644 --- a/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp @@ -143,9 +143,7 @@ nsSelectsAreaFrame::Paint(nsIPresContext* aPresContext, nsIFrame* frame = this; while (frame) { frame = frame->GetParent(); - nsCOMPtr type; - frame->GetFrameType(getter_AddRefs(type)); - if (type == nsLayoutAtoms::listControlFrame) { + if (frame->GetType() == nsLayoutAtoms::listControlFrame) { nsListControlFrame* listFrame = NS_STATIC_CAST(nsListControlFrame*, frame); listFrame->PaintFocus(aRenderingContext, aWhichLayer); return NS_OK; diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 5e0645da33e..34400d27531 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -1051,13 +1051,10 @@ nsSimplePageSequenceFrame::Paint(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsSimplePageSequenceFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsSimplePageSequenceFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::sequenceFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::sequenceFrame; } //------------------------------------------------------------------------------ diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.h b/mozilla/layout/html/base/src/nsSimplePageSequence.h index f87cbe7867f..07180d271cf 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.h +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.h @@ -127,7 +127,7 @@ public: * * @see nsLayoutAtoms::sequenceFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index d1301cfed6e..6cfb93b7d06 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -425,7 +425,7 @@ public: * * @see nsLayoutAtoms::textFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; @@ -5884,13 +5884,10 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const } } -NS_IMETHODIMP -nsTextFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTextFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::textFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::textFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index 92c764133b6..a7092510bc2 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -336,13 +336,10 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -ViewportFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +ViewportFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::viewportFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::viewportFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/base/src/nsViewportFrame.h b/mozilla/layout/html/base/src/nsViewportFrame.h index 21d33b50f39..c6a9d4f47f5 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.h +++ b/mozilla/layout/html/base/src/nsViewportFrame.h @@ -111,7 +111,7 @@ public: * * @see nsLayoutAtoms::viewportFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 4c36b696ed7..c89bfad6f48 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -145,7 +145,7 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; } NS_IMETHOD_(nsrefcnt) Release(void) { return 1; } - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, @@ -213,7 +213,7 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); @@ -498,13 +498,10 @@ NS_IMETHODIMP nsHTMLFrameOuterFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsHTMLFrameOuterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsHTMLFrameOuterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::htmlFrameOuterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::htmlFrameOuterFrame; } NS_IMETHODIMP @@ -859,13 +856,10 @@ NS_IMETHODIMP nsHTMLFrameInnerFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsHTMLFrameInnerFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::htmlFrameInnerFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::htmlFrameInnerFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/public/nsIFormControlFrame.h b/mozilla/layout/html/forms/public/nsIFormControlFrame.h index 5c116d8dc75..9b4e770cf34 100644 --- a/mozilla/layout/html/forms/public/nsIFormControlFrame.h +++ b/mozilla/layout/html/forms/public/nsIFormControlFrame.h @@ -61,7 +61,7 @@ class nsIFormControlFrame : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORMCONTROLFRAME_IID) - NS_IMETHOD_(PRInt32) GetType() const = 0; + NS_IMETHOD_(PRInt32) GetFormControlType() const = 0; NS_IMETHOD GetName(nsAString* aName) = 0; diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 385003e6204..6bda6ffbdbb 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -430,7 +430,7 @@ nsComboboxControlFrame::InitializeControl(nsIPresContext* aPresContext) //-------------------------------------------------------------- NS_IMETHODIMP_(PRInt32) -nsComboboxControlFrame::GetType() const +nsComboboxControlFrame::GetFormControlType() const { return NS_FORM_SELECT; } @@ -2301,7 +2301,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext, nsIFormControlFrame* fcFrame = nsnull; CallQueryInterface(child, &fcFrame); if (fcFrame) { - if (fcFrame->GetType() == NS_FORM_INPUT_BUTTON) { + if (fcFrame->GetFormControlType() == NS_FORM_INPUT_BUTTON) { mButtonFrame = child; } } else { diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 77ff778b16e..cb6b7aeddf2 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -145,7 +145,7 @@ public: // nsIFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsAString* aName); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsAString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index 097170802cd..2f7e8d0da08 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -107,7 +107,7 @@ public: const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); @@ -157,13 +157,10 @@ nsFieldSetFrame::nsFieldSetFrame() } -NS_IMETHODIMP -nsFieldSetFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsFieldSetFrame::GetType() const { - NS_PRECONDITION(aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::fieldSetFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::fieldSetFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 59c958501fd..49588bbc77b 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -212,7 +212,7 @@ nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) } NS_IMETHODIMP_(PRInt32) -nsFileControlFrame::GetType() const +nsFileControlFrame::GetFormControlType() const { return NS_FORM_INPUT_FILE; } diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.h b/mozilla/layout/html/forms/src/nsFileControlFrame.h index ecf3464188d..36d98115cac 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.h @@ -103,7 +103,7 @@ public: PRInt32 aModType); NS_IMETHOD GetName(nsAString* aName); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 54d072df9b9..45b8389fc94 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -696,7 +696,7 @@ nsFormControlFrame::GetSizeFromContent(PRInt32* aSize) const } NS_IMETHODIMP_(PRInt32) -nsFormControlFrame::GetType() const +nsFormControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index d82d058d0f7..c846df7aed9 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -152,7 +152,7 @@ public: */ virtual const nsIID& GetIID(); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD GetValue(nsAString* aName); diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp index 9b6403728a9..6d8bd17d8bb 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -83,13 +83,10 @@ NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) return NS_OK; } -NS_IMETHODIMP -nsGfxButtonControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsGfxButtonControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::gfxButtonControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::gfxButtonControlFrame; } // Special check for the browse button of a file input. @@ -314,7 +311,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) { const char * propname = nsFormControlHelper::GetHTMLPropertiesFileName(); nsresult rv = NS_OK; - PRInt32 type = GetType(); + PRInt32 type = GetFormControlType(); if (type == NS_FORM_INPUT_RESET) { rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Reset").get(), aString); } diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h index 050bef2fd2e..d743c9f17f2 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h @@ -78,7 +78,7 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; // nsFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 11a6b8b892d..31f25d5eced 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -201,7 +201,7 @@ NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessibl NS_IMETHODIMP_(PRInt32) -nsHTMLButtonControlFrame::GetType() const +nsHTMLButtonControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h index 99b8a530246..80710fad0a3 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -127,7 +127,7 @@ public: virtual nsresult RequiresWidget(PRBool &aRequiresWidget); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD GetValue(nsAString* aName); virtual void MouseClicked(nsIPresContext* aPresContext); diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index 5bb7e35e4c2..4e21fdfcd1a 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -103,7 +103,7 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); @@ -121,7 +121,7 @@ public: virtual void MouseClicked(nsIPresContext* aPresContext); - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); @@ -247,13 +247,10 @@ nsrefcnt nsImageControlFrame::Release(void) return 1; } -NS_IMETHODIMP -nsImageControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsImageControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::imageControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::imageControlFrame; } NS_IMETHODIMP @@ -384,7 +381,7 @@ nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRe } NS_IMETHODIMP_(PRInt32) -nsImageControlFrame::GetType() const +nsImageControlFrame::GetFormControlType() const { return NS_FORM_INPUT_IMAGE; } diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.cpp b/mozilla/layout/html/forms/src/nsLegendFrame.cpp index 2e97acaa4ed..9d4917c53af 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLegendFrame.cpp @@ -80,13 +80,10 @@ nsLegendFrame::~nsLegendFrame() { } -NS_IMETHODIMP -nsLegendFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsLegendFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::legendFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::legendFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.h b/mozilla/layout/html/forms/src/nsLegendFrame.h index 87e81f69c91..5eb5da598c3 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.h +++ b/mozilla/layout/html/forms/src/nsLegendFrame.h @@ -73,7 +73,7 @@ public: nsFramePaintLayer aWhichLayer, PRUint32 aFlags = 0); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index cc7f76b55d1..41a5cb2aa8f 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -2034,7 +2034,7 @@ nsListControlFrame::GetSkipSides() const //--------------------------------------------------------- NS_IMETHODIMP_(PRInt32) -nsListControlFrame::GetType() const +nsListControlFrame::GetFormControlType() const { return NS_FORM_SELECT; } @@ -2637,13 +2637,10 @@ nsListControlFrame::DidReflow(nsIPresContext* aPresContext, } } -NS_IMETHODIMP -nsListControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsListControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::listControlFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::listControlFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.h b/mozilla/layout/html/forms/src/nsListControlFrame.h index 9f15d1d2fbd..95d9627a892 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.h +++ b/mozilla/layout/html/forms/src/nsListControlFrame.h @@ -222,7 +222,7 @@ public: * * @see nsLayoutAtoms::scrollFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG // nsIFrameDebug @@ -230,7 +230,7 @@ public: #endif // nsIFormControlFrame - NS_IMETHOD_(PRInt32) GetType() const; + NS_IMETHOD_(PRInt32) GetFormControlType() const; NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsAString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsAString& aValue); diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 98baa4e6b0a..74d34d557db 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -1314,19 +1314,16 @@ nsTextControlFrame::RemovedAsPrimaryFrame(nsIPresContext* aPresContext) else NS_ASSERTION(PR_FALSE, "RemovedAsPrimaryFrame called after PreDestroy"); } -NS_IMETHODIMP -nsTextControlFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTextControlFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::textInputFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::textInputFrame; } // XXX: wouldn't it be nice to get this from the style context! PRBool nsTextControlFrame::IsSingleLineTextControl() const { - PRInt32 type = GetType(); + PRInt32 type = GetFormControlType(); return (type == NS_FORM_INPUT_TEXT) || (type == NS_FORM_INPUT_PASSWORD); } @@ -1353,7 +1350,7 @@ PRBool nsTextControlFrame::IsPlainTextControl() const PRBool nsTextControlFrame::IsPasswordTextControl() const { - return GetType() == NS_FORM_INPUT_PASSWORD; + return GetFormControlType() == NS_FORM_INPUT_PASSWORD; } @@ -2098,7 +2095,7 @@ nsTextControlFrame::GetName(nsAString* aResult) } NS_IMETHODIMP_(PRInt32) -nsTextControlFrame::GetType() const +nsTextControlFrame::GetFormControlType() const { return nsFormControlHelper::GetType(mContent); } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.h b/mozilla/layout/html/forms/src/nsTextControlFrame.h index 11e1b5a7c74..93ba772a3ae 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.h @@ -134,7 +134,7 @@ public: nsIFrame* aChildList); //==== BEGIN NSIFORMCONTROLFRAME - NS_IMETHOD_(PRInt32) GetType() const; //* + NS_IMETHOD_(PRInt32) GetFormControlType() const; //* NS_IMETHOD GetName(nsAString* aName);//* virtual void SetFocus(PRBool aOn , PRBool aRepaint); virtual void ScrollIntoView(nsIPresContext* aPresContext); @@ -176,7 +176,7 @@ public: //==== END NSIGFXTEXTCONTROLFRAME2 //==== OVERLOAD of nsIFrame - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; /** handler for attribute changes to mContent */ NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 12339417fdc..e1b2464337c 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -815,9 +815,7 @@ AdjustAbsoluteContainingBlock(nsIPresContext* aPresContext, PRBool paginated; aPresContext->IsPaginated(&paginated); if (!paginated) { - nsCOMPtr fType; - containingBlock->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::positionedInlineFrame == fType) { + if (nsLayoutAtoms::positionedInlineFrame == containingBlock->GetType()) { containingBlock = ((nsPositionedInlineFrame*)containingBlock)->GetFirstInFlow(); } } @@ -877,9 +875,7 @@ static PRBool IsBorderCollapse(nsIFrame* aFrame) { for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) { - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == frame->GetType()) { return ((nsTableFrame*)frame)->IsBorderCollapse(); } } @@ -894,11 +890,8 @@ GetRealFrame(nsIFrame* aFrame) nsIFrame* result = aFrame; // We may be a placeholder. If we are, go to the real frame. - nsCOMPtr frameType; - // See if it's a placeholder frame for a float. - aFrame->GetFrameType(getter_AddRefs(frameType)); - PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get()); + PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == aFrame->GetType()); if (isPlaceholder) { // Get the out-of-flow frame that the placeholder points to. // This is the real float that we should examine. @@ -1182,14 +1175,10 @@ GetCaptionAdjustedParent(nsIFrame* aParentFrame, { *aAdjParentFrame = aParentFrame; PRBool haveCaption = PR_FALSE; - nsCOMPtr childFrameType; - aChildFrame->GetFrameType(getter_AddRefs(childFrameType)); - if (nsLayoutAtoms::tableCaptionFrame == childFrameType.get()) { + if (nsLayoutAtoms::tableCaptionFrame == aChildFrame->GetType()) { haveCaption = PR_TRUE; - nsCOMPtr parentFrameType; - aParentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (nsLayoutAtoms::tableFrame == parentFrameType.get()) { + if (nsLayoutAtoms::tableFrame == aParentFrame->GetType()) { *aAdjParentFrame = aParentFrame->GetParent(); } } @@ -1768,16 +1757,10 @@ IsTableRelated(nsIAtom* aParentType, static nsIFrame* GetOuterTableFrame(nsIFrame* aParentFrame) { - nsIFrame* parent; - nsCOMPtr frameType; - aParentFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableOuterFrame == frameType.get()) { - parent = aParentFrame; + if (nsLayoutAtoms::tableOuterFrame == aParentFrame->GetType()) { + return aParentFrame; } - else { - parent = aParentFrame->GetParent(); - } - return parent; + return aParentFrame->GetParent(); } static nsresult @@ -2079,7 +2062,7 @@ nsCSSFrameConstructor::CreatePseudoColGroupFrame(nsIPresShell* aPresS parentFrame, childStyle, aTableCreator, PR_TRUE, items, pseudo.mFrame, pseudoParent); if (NS_FAILED(rv)) return rv; - ((nsTableColGroupFrame*)pseudo.mFrame)->SetType(eColGroupAnonymousCol); + ((nsTableColGroupFrame*)pseudo.mFrame)->SetColType(eColGroupAnonymousCol); // set pseudo data for the parent if (aState.mPseudoFrames.mTableInner.mFrame) { @@ -2192,17 +2175,16 @@ nsCSSFrameConstructor::GetPseudoTableFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get()) { // row group parent + if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); if (NS_FAILED(rv)) return rv; created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType.get())) { // row parent + if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType)) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); if (NS_FAILED(rv)) return rv; } @@ -2236,21 +2218,20 @@ nsCSSFrameConstructor::GetPseudoColGroupFrame(nsIPresShell* aPresShel if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get()) { // row group parent + if (nsLayoutAtoms::tableRowGroupFrame == parentFrameType) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType.get())) { // row parent + if (created || (nsLayoutAtoms::tableRowFrame == parentFrameType)) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (created || IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoColGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2284,17 +2265,16 @@ nsCSSFrameConstructor::GetPseudoRowGroupFrame(nsIPresShell* aPresShel if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableRowFrame == parentFrameType.get()) { // row parent + if (nsLayoutAtoms::tableRowFrame == parentFrameType) { // row parent rv = CreatePseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (created || IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2325,17 +2305,16 @@ nsCSSFrameConstructor::GetPseudoRowFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (IS_TABLE_CELL(parentFrameType.get()) || // cell parent - !IsTableRelated(parentFrameType.get(), PR_TRUE)) { // block parent + if (IS_TABLE_CELL(parentFrameType) || // cell parent + !IsTableRelated(parentFrameType, PR_TRUE)) { // block parent rv = CreatePseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableFrame == parentFrameType.get())) { // table parent + if (created || (nsLayoutAtoms::tableFrame == parentFrameType)) { // table parent rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); } rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); @@ -2366,16 +2345,15 @@ nsCSSFrameConstructor::GetPseudoCellFrame(nsIPresShell* aPresShell, if (!aPresShell || !aPresContext) return rv; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); if (pseudoFrames.IsEmpty()) { PRBool created = PR_FALSE; - if (nsLayoutAtoms::tableFrame == parentFrameType.get()) { // table parent + if (nsLayoutAtoms::tableFrame == parentFrameType) { // table parent rv = CreatePseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } - if (created || (nsLayoutAtoms::tableRowGroupFrame == parentFrameType.get())) { // row group parent + if (created || (nsLayoutAtoms::tableRowGroupFrame == parentFrameType)) { // row group parent rv = CreatePseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, &aParentFrameIn); created = PR_TRUE; } @@ -2406,37 +2384,36 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, nsresult rv = NS_OK; if (!aPresShell || !aPresContext) return rv; - nsCOMPtr parentFrameType; - aParentFrameIn.GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrameIn.GetType(); nsIFrame* pseudoParentFrame = nsnull; nsPseudoFrames& pseudoFrames = aState.mPseudoFrames; aParentFrame = &aParentFrameIn; aIsPseudoParent = PR_FALSE; if (nsLayoutAtoms::tableOuterFrame == aChildFrameType) { // table child - if (IsTableRelated(parentFrameType.get(), PR_TRUE) && - (nsLayoutAtoms::tableCaptionFrame != parentFrameType.get()) ) { // need pseudo cell parent + if (IsTableRelated(parentFrameType, PR_TRUE) && + (nsLayoutAtoms::tableCaptionFrame != parentFrameType) ) { // need pseudo cell parent rv = GetPseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mCellInner.mFrame; } } else if (nsLayoutAtoms::tableCaptionFrame == aChildFrameType) { // caption child - if (nsLayoutAtoms::tableOuterFrame != parentFrameType.get()) { // need pseudo table parent + if (nsLayoutAtoms::tableOuterFrame != parentFrameType) { // need pseudo table parent rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mTableOuter.mFrame; } } else if (nsLayoutAtoms::tableColGroupFrame == aChildFrameType) { // col group child - if (nsLayoutAtoms::tableFrame != parentFrameType.get()) { // need pseudo table parent + if (nsLayoutAtoms::tableFrame != parentFrameType) { // need pseudo table parent rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mTableInner.mFrame; } } else if (nsLayoutAtoms::tableColFrame == aChildFrameType) { // col child - if (nsLayoutAtoms::tableColGroupFrame != parentFrameType.get()) { // need pseudo col group parent + if (nsLayoutAtoms::tableColGroupFrame != parentFrameType) { // need pseudo col group parent rv = GetPseudoColGroupFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mColGroup.mFrame; @@ -2444,7 +2421,7 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, } else if (nsLayoutAtoms::tableRowGroupFrame == aChildFrameType) { // row group child // XXX can this go away? - if (nsLayoutAtoms::tableFrame != parentFrameType.get()) { + if (nsLayoutAtoms::tableFrame != parentFrameType) { // trees allow row groups to contain row groups, so don't create pseudo frames rv = GetPseudoTableFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; @@ -2452,14 +2429,14 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, } } else if (nsLayoutAtoms::tableRowFrame == aChildFrameType) { // row child - if (nsLayoutAtoms::tableRowGroupFrame != parentFrameType.get()) { // need pseudo row group parent + if (nsLayoutAtoms::tableRowGroupFrame != parentFrameType) { // need pseudo row group parent rv = GetPseudoRowGroupFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mRowGroup.mFrame; } } else if (IS_TABLE_CELL(aChildFrameType)) { // cell child - if (nsLayoutAtoms::tableRowFrame != parentFrameType.get()) { // need pseudo row parent + if (nsLayoutAtoms::tableRowFrame != parentFrameType) { // need pseudo row parent rv = GetPseudoRowFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mRow.mFrame; @@ -2469,7 +2446,7 @@ nsCSSFrameConstructor::GetParentFrame(nsIPresShell* aPresShell, NS_ASSERTION(PR_FALSE, "GetParentFrame called on nsLayoutAtoms::tableFrame child"); } else { // foreign frame - if (IsTableRelated(parentFrameType.get(), PR_FALSE)) { // need pseudo cell parent + if (IsTableRelated(parentFrameType, PR_FALSE)) { // need pseudo cell parent rv = GetPseudoCellFrame(aPresShell, aPresContext, aTableCreator, aState, aParentFrameIn); if (NS_FAILED(rv)) return rv; pseudoParentFrame = pseudoFrames.mCellInner.mFrame; @@ -2845,7 +2822,7 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel rv = aTableCreator.CreateTableColFrame(&newCol); if (NS_FAILED(rv)) return rv; InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, styleContext, nsnull, newCol); - ((nsTableColFrame*)newCol)->SetType(eColAnonymousCol); + ((nsTableColFrame*)newCol)->SetColType(eColAnonymousCol); lastCol->SetNextSibling(newCol); lastCol = newCol; } @@ -3073,8 +3050,7 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresShell* aPresShell, nsPseudoFrames priorPseudoFrames; aState.mPseudoFrames.Reset(&priorPseudoFrames); - nsCOMPtr parentFrameType; - aParentFrame->GetFrameType(getter_AddRefs(parentFrameType)); + nsIAtom* parentFrameType = aParentFrame->GetType(); nsStyleContext* parentStyleContext = aParentFrame->GetStyleContext(); ChildIterator iter, last; @@ -5701,10 +5677,9 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, // if not then we are in a box so do what boxes like. On example is boxes // do not support the absolute positioning of their children. While html blocks // thats why we call different things here. - nsCOMPtr frameType; - geometricParent->GetFrameType(getter_AddRefs(frameType)); - if ((frameType.get() == nsLayoutAtoms::blockFrame) || - (frameType.get() == nsLayoutAtoms::areaFrame)) { + nsIAtom* frameType = geometricParent->GetType(); + if ((frameType == nsLayoutAtoms::blockFrame) || + (frameType == nsLayoutAtoms::areaFrame)) { */ // See if we need to create a view, e.g. the frame is absolutely positioned nsHTMLContainerFrame::CreateViewForFrame(newFrame, aParentFrame, PR_FALSE); @@ -5840,9 +5815,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh PRBool noScalingOfTwips = PR_FALSE; nsCOMPtr printPreviewContext(do_QueryInterface(aPresContext)); if (printPreviewContext) { - nsCOMPtr typeAtom; - aParentFrame->GetFrameType(getter_AddRefs(typeAtom)); - noScalingOfTwips = typeAtom == nsLayoutAtoms::viewportFrame; + noScalingOfTwips = aParentFrame->GetType() == nsLayoutAtoms::viewportFrame; if (noScalingOfTwips) { printPreviewContext->SetScalingOfTwips(PR_FALSE); } @@ -5999,9 +5972,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsIPresShell* aPresShell, PRBool noScalingOfTwips = PR_FALSE; nsCOMPtr printPreviewContext(do_QueryInterface(aPresContext)); if (printPreviewContext) { - nsCOMPtr typeAtom; - aParentFrame->GetFrameType(getter_AddRefs(typeAtom)); - noScalingOfTwips = typeAtom == nsLayoutAtoms::viewportFrame; + noScalingOfTwips = aParentFrame->GetType() == nsLayoutAtoms::viewportFrame; if (noScalingOfTwips) { printPreviewContext->SetScalingOfTwips(PR_FALSE); } @@ -6114,10 +6085,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre // if the new frame is not table related and the parent is a table, row group, or row, // then we need to get or create the pseudo table cell frame and use it as the parent. if (adjParentFrame) { - nsCOMPtr parentType; - adjParentFrame->GetFrameType(getter_AddRefs(parentType)); if (!IsTableRelated(aDisplay->mDisplay, PR_TRUE) && - IsTableRelated(parentType.get(), PR_FALSE) && + IsTableRelated(adjParentFrame->GetType(), PR_FALSE) && aTag != nsHTMLAtoms::form) { GetPseudoCellFrame(aPresShell, aPresContext, tableCreator, aState, *adjParentFrame); if (aState.mPseudoFrames.mCellInner.mFrame) { @@ -6419,10 +6388,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre // In this case we need to get the outer frame. nsIFrame* parentFrame = adjParentFrame; nsIFrame* outerFrame = adjParentFrame->GetParent(); - nsCOMPtr frameType; if (outerFrame) { - outerFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableOuterFrame == frameType.get()) { + if (nsLayoutAtoms::tableOuterFrame == outerFrame->GetType()) { parentFrame = outerFrame; } } @@ -7242,9 +7209,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe inline PRBool IsRootBoxFrame(nsIFrame *aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - return (frameType == nsLayoutAtoms::rootFrame); + return (aFrame->GetType() == nsLayoutAtoms::rootFrame); } NS_IMETHODIMP @@ -7445,30 +7410,26 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, const nsStyleDisplay* disp = frame->GetStyleDisplay(); if (disp->IsPositioned() && disp->mDisplay != NS_STYLE_DISPLAY_TABLE) { - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - + nsIAtom* frameType = frame->GetType(); if (nsLayoutAtoms::scrollFrame == frameType) { // We want the scrolled frame, not either of the two scroll frames nsIFrame* scrolledFrame; frame->FirstChild(aPresContext, nsnull, &scrolledFrame); if (scrolledFrame) { - scrolledFrame->GetFrameType(getter_AddRefs(frameType)); + frameType = scrolledFrame->GetType(); if (nsLayoutAtoms::areaFrame == frameType) { containingBlock = scrolledFrame; break; } else if (nsLayoutAtoms::scrollFrame == frameType) { scrolledFrame->FirstChild(aPresContext, nsnull, &scrolledFrame); if (scrolledFrame) { - scrolledFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::areaFrame == frameType) { + if (nsLayoutAtoms::areaFrame == scrolledFrame->GetType()) { containingBlock = scrolledFrame; break; } } } } - } else if ((nsLayoutAtoms::areaFrame == frameType) || (nsLayoutAtoms::positionedInlineFrame == frameType)) { containingBlock = frame; @@ -7511,9 +7472,7 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext, if ((NS_STYLE_FLOAT_NONE != display->mFloats) || (display->IsAbsolutelyPositioned())) { if (NS_STYLE_FLOAT_NONE != display->mFloats) { - nsCOMPtr frameType; - containingBlock->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame != frameType.get()) { + if (nsLayoutAtoms::letterFrame != containingBlock->GetType()) { break; } } @@ -7572,13 +7531,10 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext, nsresult rv = NS_OK; // a col group or col appended to a table may result in an insert rather than an append - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (nsLayoutAtoms::tableFrame == parentType.get()) { + if (nsLayoutAtoms::tableFrame == aParentFrame->GetType()) { nsTableFrame* tableFrame = NS_REINTERPRET_CAST(nsTableFrame*, aParentFrame); - nsCOMPtr childType; - aFrameList->GetFrameType(getter_AddRefs(childType)); - if (nsLayoutAtoms::tableColFrame == childType.get()) { + nsIAtom* childType = aFrameList->GetType(); + if (nsLayoutAtoms::tableColFrame == childType) { // table column nsIFrame* parentFrame = aFrameList->GetParent(); rv = aFrameManager->AppendFrames(parentFrame, @@ -7831,12 +7787,9 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell, return PR_FALSE; } else { - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (nsLayoutAtoms::fieldSetFrame == parentType) { + if (nsLayoutAtoms::fieldSetFrame == aParentFrame->GetType()) { // Legends can be sibling of legends but not of other content in the fieldset - nsCOMPtr sibType; - aSibling.GetFrameType(getter_AddRefs(sibType)); + nsIAtom* sibType = aSibling.GetType(); nsCOMPtr legendContent(do_QueryInterface(&aContent)); if ((legendContent && (nsLayoutAtoms::legendFrame != sibType)) || @@ -8303,9 +8256,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // If we didn't process children when we originally created the frame, // then don't do any processing now - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::objectFrame) { + nsIAtom* frameType = parentFrame->GetType(); + if (frameType == nsLayoutAtoms::objectFrame) { // This handles APPLET, EMBED, and OBJECT return NS_OK; } @@ -8348,13 +8300,11 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // moving it into the appropriate list. This is more efficient than checking the display // type of childContent. During the construction of a caption frame, the outer // table frame will be used as its parent. - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == frameType) { nsFrameItems tempItems; ConstructFrame(shell, aPresContext, state, childContent, parentFrame, tempItems); if (tempItems.childList) { - nsCOMPtr childFrameType; - tempItems.childList->GetFrameType(getter_AddRefs(childFrameType)); - if (nsLayoutAtoms::tableCaptionFrame == childFrameType.get()) { + if (nsLayoutAtoms::tableCaptionFrame == tempItems.childList->GetType()) { PRBool abortCaption = PR_FALSE; // check if a caption already exists in captionItems, and if so, abort the caption if (captionItems.childList) { @@ -8385,7 +8335,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, } // Don't create child frames for iframes/frames, they should not // display any content that they contain. - else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType.get()) { + else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType) { // Construct a child frame (that does not have a table as parent) ConstructFrame(shell, aPresContext, state, childContent, parentFrame, frameItems); } @@ -8431,7 +8381,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, } // Append the flowed frames to the principal child list, tables need special treatment - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == frameType) { if (captionItems.childList) { // append the caption to the outer table nsIFrame* outerTable = parentFrame->GetParent(); if (outerTable) { @@ -8915,9 +8865,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // If we didn't process children when we originally created the frame, // then don't do any processing now - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::objectFrame) { + nsIAtom* frameType = parentFrame->GetType(); + if (frameType == nsLayoutAtoms::objectFrame) { // This handles APPLET, EMBED, and OBJECT return NS_OK; } @@ -8985,9 +8934,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, if (haveFirstLetterStyle) { // Get the correct parentFrame and prevSibling - if a // letter-frame is present, use its parent. - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (parentFrameType.get() == nsLayoutAtoms::letterFrame) { + if (parentFrame->GetType() == nsLayoutAtoms::letterFrame) { if (prevSibling) prevSibling = parentFrame; @@ -9207,10 +9154,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, nsIFrame* subtree = childFrame; // See if it's a placeholder frame - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == childFrame->GetType()) { // Get the out-of-flow frame nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)childFrame)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -9692,7 +9636,6 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, // now do children of frame PRInt32 listIndex = 0; nsIAtom* childList = nsnull; - nsIAtom* frameType = nsnull; do { nsIFrame* child = nsnull; @@ -9700,8 +9643,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow - child->GetFrameType(&frameType); - if (nsLayoutAtoms::placeholderFrame == frameType) { // placeholder + if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder // get out of flow frame and start over there nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)child)->GetOutOfFlowFrame(); NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame"); @@ -9714,7 +9656,6 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, UpdateViewsForTree(aPresContext, child, aViewManager, aFrameManager, childBounds, aChange); bounds.UnionRect(bounds, childBounds); } - NS_IF_RELEASE(frameType); } child = child->GetNextSibling(); } @@ -10437,13 +10378,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell, static PRBool IsPlaceholderFrame(nsIFrame* aFrame) { - nsIAtom* frameType; - PRBool result; - - aFrame->GetFrameType(&frameType); - result = frameType == nsLayoutAtoms::placeholderFrame; - NS_IF_RELEASE(frameType); - return result; + return aFrame->GetType() == nsLayoutAtoms::placeholderFrame; } #endif @@ -10462,9 +10397,7 @@ HasDisplayableChildren(nsIPresContext* aPresContext, nsIFrame* aContainerFrame) while (frame) { // If it's not a text frame, then assume that it's displayable. - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::textFrame) + if (frame->GetType() != nsLayoutAtoms::textFrame) return PR_TRUE; nsCOMPtr text = do_QueryInterface(frame->GetContent()); @@ -10736,11 +10669,8 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, aFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* tableType; - // See if it's the inner table frame - childFrame->GetFrameType(&tableType); - if (nsLayoutAtoms::tableFrame == tableType) { + if (nsLayoutAtoms::tableFrame == childFrame->GetType()) { nsIFrame* continuingTableFrame; // It's the inner table frame, so create a continuing frame @@ -10778,7 +10708,6 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, } newChildFrames.AddChild(captionFrame); } - NS_IF_RELEASE(tableType); childFrame = childFrame->GetNextSibling(); } @@ -10873,13 +10802,12 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, nsIFrame* aParentFrame, nsIFrame** aContinuingFrame) { - nsCOMPtr frameType; nsStyleContext* styleContext = aFrame->GetStyleContext(); nsIFrame* newFrame = nsnull; nsresult rv = NS_OK; // Use the frame type to determine what type of frame to create - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); nsIContent* content = aFrame->GetContent(); if (nsLayoutAtoms::textFrame == frameType) { @@ -10956,18 +10884,13 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, aFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* tableType; - // See if it's a table cell frame - cellFrame->GetFrameType(&tableType); - if (IS_TABLE_CELL(tableType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { nsIFrame* continuingCellFrame; CreateContinuingFrame(aPresShell, aPresContext, cellFrame, newFrame, &continuingCellFrame); newChildList.AddChild(continuingCellFrame); } - - NS_IF_RELEASE(tableType); cellFrame = cellFrame->GetNextSibling(); } @@ -11047,9 +10970,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell, return NS_OK; } - nsCOMPtr parentType; - aParentFrame->GetFrameType(getter_AddRefs(parentType)); - if (parentType != nsLayoutAtoms::pageContentFrame) { + if (aParentFrame->GetType() != nsLayoutAtoms::pageContentFrame) { return NS_OK; } @@ -11185,9 +11106,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, if (kidContent == aContent) { // We found a match. See if it's a placeholder frame - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == kidFrame->GetType()) { // Ignore the placeholder and return the out-of-flow frame instead return ((nsPlaceholderFrame*)kidFrame)->GetOutOfFlowFrame(); } @@ -11865,9 +11784,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames( nsresult rv = NS_OK; nsFrameList blockFrames(blockKid); nsIFrame* lastBlockKid = blockFrames.LastChild(); - nsCOMPtr frameType; - lastBlockKid->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::lineFrame) { + if (lastBlockKid->GetType() != nsLayoutAtoms::lineFrame) { // No first-line frame at the end of the list, therefore there is // an interveening block between any first-line frame the frames // we are appending. Therefore, we don't need any special @@ -11944,9 +11861,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( // already have a first-line frame or we don't. nsIFrame* firstBlockKid; aBlockFrame->FirstChild(nsnull, &firstBlockKid); - nsCOMPtr frameType; - firstBlockKid->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::lineFrame) { + if (firstBlockKid->GetType() == nsLayoutAtoms::lineFrame) { // We already have a first-line frame nsIFrame* lineFrame = firstBlockKid; nsStyleContext* firstLineStyle = lineFrame->GetStyleContext(); @@ -12363,9 +12278,8 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( while (frame) { nsIFrame* nextFrame = frame->GetNextSibling(); - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::textFrame == frameType.get()) { + nsIAtom* frameType = frame->GetType(); + if (nsLayoutAtoms::textFrame == frameType) { // Wrap up first-letter content in a letter frame nsIContent* textContent = frame->GetContent(); if (IsFirstLetterContent(textContent)) { @@ -12384,8 +12298,8 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( return NS_OK; } } - else if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + else if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { nsIFrame* kids; frame->FirstChild(aPresContext, nsnull, &kids); WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids, @@ -12426,9 +12340,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame); while (floatFrame) { // See if we found a floating letter frame - nsCOMPtr frameType; - floatFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame == frameType.get()) { + if (nsLayoutAtoms::letterFrame == floatFrame->GetType()) { break; } floatFrame = floatFrame->GetNextSibling(); @@ -12544,9 +12456,8 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, aFrame->FirstChild(aPresContext, nsnull, &kid); while (kid) { - nsCOMPtr frameType; - kid->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::letterFrame == frameType.get()) { + nsIAtom* frameType = kid->GetType(); + if (nsLayoutAtoms::letterFrame == frameType) { // Bingo. Found it. First steal away the text frame. nsIFrame* textFrame; kid->FirstChild(aPresContext, nsnull, &textFrame); @@ -12583,8 +12494,8 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, *aStopLooking = PR_TRUE; break; } - else if ((nsLayoutAtoms::inlineFrame == frameType.get()) || - (nsLayoutAtoms::lineFrame == frameType.get())) { + else if ((nsLayoutAtoms::inlineFrame == frameType) || + (nsLayoutAtoms::lineFrame == frameType)) { // Look inside child inline frame for the letter frame RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, kid, aStopLooking); @@ -13131,9 +13042,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext, nsIFrame* frame = aFrameIn; // if the frame is a placeholder use the out of flow frame - nsCOMPtr frameType; - aFrameIn->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::placeholderFrame == frameType.get()) { + if (nsLayoutAtoms::placeholderFrame == aFrameIn->GetType()) { frame = ((nsPlaceholderFrame*)frame)->GetOutOfFlowFrame(); NS_ASSERTION(frame, "program error - null of of flow frame in placeholder"); } diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index ad32828e716..ffcd59b6a6b 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -1619,9 +1619,7 @@ nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFra // the frame is the body frame, so we provide the canvas frame nsIFrame *pCanvasFrame = aFrame->GetParent(); while (pCanvasFrame) { - nsCOMPtr parentType; - pCanvasFrame->GetFrameType(getter_AddRefs(parentType)); - if (parentType.get() == nsLayoutAtoms::canvasFrame) { + if (pCanvasFrame->GetType() == nsLayoutAtoms::canvasFrame) { *aBGFrame = pCanvasFrame; break; } @@ -2516,11 +2514,8 @@ static nsIFrame* GetNearestScrollFrame(nsIFrame* aFrame) { for (nsIFrame* f = aFrame; f; f = f->GetParent()) { - nsCOMPtr frameType; - // Is it a scroll frame? - f->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::scrollFrame == frameType) { + if (nsLayoutAtoms::scrollFrame == f->GetType()) { return f; } } @@ -2535,17 +2530,12 @@ GetRootScrollableFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame) { nsIScrollableFrame* scrollableFrame = nsnull; - nsCOMPtr frameType; - aRootFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::viewportFrame == frameType) { + if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { nsIFrame* childFrame; aRootFrame->FirstChild(aPresContext, nsnull, &childFrame); if (childFrame) { - childFrame->GetFrameType(getter_AddRefs(frameType)); - - if (nsLayoutAtoms::scrollFrame == frameType) { + if (nsLayoutAtoms::scrollFrame == childFrame->GetType()) { // Use this frame, even if we are using GFX frames for the // viewport, which contains another scroll frame below this // frame, since the GFX scrollport frame does not implement @@ -2632,8 +2622,7 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext, inline nsIFrame* IsCanvasFrame(nsIPresContext* aPresContext, nsIFrame *aFrame) { - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aFrame->GetType(); if (frameType == nsLayoutAtoms::canvasFrame || frameType == nsLayoutAtoms::rootFrame || frameType == nsLayoutAtoms::pageFrame) { @@ -2662,11 +2651,9 @@ FindCanvasBackground(nsIPresContext* aPresContext, const nsStyleBackground* result = firstChild->GetStyleBackground(); // for printing and print preview.. this should be a pageContentFrame - nsCOMPtr frameType; nsStyleContext* parentContext; - firstChild->GetFrameType(getter_AddRefs(frameType)); - if ( (frameType == nsLayoutAtoms::pageContentFrame) ){ + if (firstChild->GetType() == nsLayoutAtoms::pageContentFrame) { // we have to find the background style ourselves.. since the // pageContentframe does not have content while(firstChild){ @@ -2978,8 +2965,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext, nsRect bgOriginArea; - nsCOMPtr frameType; - aForFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = aForFrame->GetType(); if (frameType == nsLayoutAtoms::inlineFrame) { switch (aColor.mBackgroundInlinePolicy) { case NS_STYLE_BG_INLINE_POLICY_EACH_BOX: diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index c4583653046..2328e8618a3 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -1345,17 +1345,13 @@ PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, nsIFrame* cellFrame = nsnull; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* frameType; - cellFrame->GetFrameType(&frameType); - if (IS_TABLE_CELL(frameType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { PRBool zeroSpan; PRInt32 rowSpan = GetRowSpanForNewCell((nsTableCellFrame &)*cellFrame, rowX, zeroSpan); if (rowX + rowSpan > numNewRows) { - NS_RELEASE(frameType); return PR_TRUE; } } - NS_IF_RELEASE(frameType); cellFrame = cellFrame->GetNextSibling(); } } @@ -1490,12 +1486,9 @@ nsCellMap::ExpandWithRows(nsIPresContext* aPresContext, rFrame->FirstChild(aPresContext, nsnull, &cFrame); PRInt32 colIndex = 0; while (cFrame) { - nsIAtom* cFrameType; - cFrame->GetFrameType(&cFrameType); - if (IS_TABLE_CELL(cFrameType)) { + if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea, &colIndex); } - NS_IF_RELEASE(cFrameType); cFrame = cFrame->GetNextSibling(); } newRowIndex++; @@ -1901,12 +1894,9 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext, nsIFrame* cFrame = nsnull; rFrame->FirstChild(aPresContext, nsnull, &cFrame); while (cFrame) { - nsIAtom* cFrameType; - cFrame->GetFrameType(&cFrameType); - if (IS_TABLE_CELL(cFrameType)) { + if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea); } - NS_IF_RELEASE(cFrameType); cFrame = cFrame->GetNextSibling(); } rowX++; diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 0cb60efc44d..c3c01d2f12b 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -101,9 +101,7 @@ nsTableCellFrame::GetNextCell() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { return (nsTableCellFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -1230,13 +1228,10 @@ nsTableCellFrame::GetBorderWidth(float aPixelsToTwips, return &aBorder; } -NS_IMETHODIMP -nsTableCellFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableCellFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableCellFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableCellFrame; } #ifdef DEBUG @@ -1294,13 +1289,10 @@ nsBCTableCellFrame::~nsBCTableCellFrame() { } -NS_IMETHODIMP -nsBCTableCellFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBCTableCellFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::bcTableCellFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::bcTableCellFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h index 9a0e96a05b1..6d5ffbcdd05 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.h +++ b/mozilla/layout/html/table/src/nsTableCellFrame.h @@ -157,7 +157,7 @@ public: * * @see nsLayoutAtoms::tableCellFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -453,7 +453,7 @@ public: ~nsBCTableCellFrame(); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; virtual nsMargin* GetBorderWidth(float aPixelsToTwips, nsMargin& aBorder) const; @@ -486,9 +486,6 @@ private: PRUint32 mLeftBorder: 8; }; -#define IS_TABLE_CELL(frameType)\ -((nsLayoutAtoms::tableCellFrame == frameType) || (nsLayoutAtoms::bcTableCellFrame == frameType)) - #endif diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp index 80f5438d5f1..eb37e64d23e 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp @@ -57,7 +57,7 @@ nsTableColFrame::nsTableColFrame() : nsFrame() { SetIsAnonymous(PR_FALSE); - SetType(eColContent); + SetColType(eColContent); ResetSizingInfo(); } @@ -66,13 +66,13 @@ nsTableColFrame::~nsTableColFrame() } nsTableColType -nsTableColFrame::GetType() const +nsTableColFrame::GetColType() const { return (nsTableColType)((mState & COL_TYPE_BITS) >> COL_TYPE_OFFSET); } void -nsTableColFrame::SetType(nsTableColType aType) +nsTableColFrame::SetColType(nsTableColType aType) { PRUint32 type = aType - eColContent; mState |= (type << COL_TYPE_OFFSET); @@ -281,9 +281,7 @@ nsTableColFrame::GetNextCol() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableColFrame == frameType.get()) { + if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { return (nsTableColFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -291,13 +289,10 @@ nsTableColFrame::GetNextCol() const return nsnull; } -NS_IMETHODIMP -nsTableColFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableColFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableColFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableColFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/table/src/nsTableColFrame.h b/mozilla/layout/html/table/src/nsTableColFrame.h index cdfffd2782c..e676ae891d9 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.h +++ b/mozilla/layout/html/table/src/nsTableColFrame.h @@ -83,8 +83,8 @@ public: eWIDTH_SOURCE_CELL_WITH_SPAN=2 // a cell implicitly specified a width via colspan }; - nsTableColType GetType() const; - void SetType(nsTableColType aType); + nsTableColType GetColType() const; + void SetColType(nsTableColType aType); /** instantiate a new instance of nsTableColFrame. * @param aResult the new object is returned in this out-param @@ -131,7 +131,7 @@ public: * * @see nsLayoutAtoms::tableColFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 9901ea26c5e..8be89bcbf5e 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -55,12 +55,12 @@ #define COL_GROUP_TYPE_OFFSET 30 nsTableColGroupType -nsTableColGroupFrame::GetType() const +nsTableColGroupFrame::GetColType() const { return (nsTableColGroupType)((mState & COL_GROUP_TYPE_BITS) >> COL_GROUP_TYPE_OFFSET); } -void nsTableColGroupFrame::SetType(nsTableColGroupType aType) +void nsTableColGroupFrame::SetColType(nsTableColGroupType aType) { PRUint32 type = aType - eColGroupContent; mState |= (type << COL_GROUP_TYPE_OFFSET); @@ -74,9 +74,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup; PRInt32 colIndex = aFirstColIndex; while (colGroupFrame) { - nsCOMPtr cgType; - colGroupFrame->GetFrameType(getter_AddRefs(cgType)); - if (nsLayoutAtoms::tableColGroupFrame == cgType.get()) { + if (nsLayoutAtoms::tableColGroupFrame == colGroupFrame->GetType()) { // reset the starting col index for the first cg only if // aFirstColIndex is smaller than the existing starting col index if ((colIndex != aFirstColIndex) || @@ -88,9 +86,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); } while (colFrame) { - nsCOMPtr colType; - colFrame->GetFrameType(getter_AddRefs(colType)); - if (nsLayoutAtoms::tableColFrame == colType.get()) { + if (nsLayoutAtoms::tableColFrame == colFrame->GetType()) { ((nsTableColFrame*)colFrame)->SetColIndex(colIndex); colIndex++; } @@ -120,9 +116,7 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext, nsIFrame* kidFrame = aFirstFrame; PRBool foundLastFrame = PR_FALSE; while (kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColFrame == kidType) { + if (nsLayoutAtoms::tableColFrame == kidFrame->GetType()) { ((nsTableColFrame*)kidFrame)->SetColIndex(colIndex); if (!foundLastFrame) { mColCount++; @@ -130,7 +124,6 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext, } colIndex++; } - NS_IF_RELEASE(kidType); if (kidFrame == aLastFrame) { foundLastFrame = PR_TRUE; } @@ -159,7 +152,7 @@ nsTableColGroupFrame::FindParentForAppendedCol(nsTableFrame* aTableFrame, nsTableColGroupFrame* relevantColGroup = NS_STATIC_CAST(nsTableColGroupFrame *, lastColGroup); - nsTableColGroupType relevantColGroupType = relevantColGroup->GetType(); + nsTableColGroupType relevantColGroupType = relevantColGroup->GetColType(); if (eColGroupAnonymousCell == relevantColGroupType) { if (eColAnonymousCell == aColType) { return relevantColGroup; @@ -170,7 +163,7 @@ nsTableColGroupFrame::FindParentForAppendedCol(nsTableFrame* aTableFrame, nsTableColFrame* colFrame = (nsTableColFrame*)cols.ElementAt(colX); nsTableColGroupFrame* colGroupFrame = NS_STATIC_CAST(nsTableColGroupFrame*, colFrame->GetParent()); - nsTableColGroupType cgType = colGroupFrame->GetType(); + nsTableColGroupType cgType = colGroupFrame->GetColType(); if (cgType != relevantColGroupType) { relevantColGroup = colGroupFrame; relevantColGroupType = cgType; @@ -214,7 +207,8 @@ nsTableColGroupFrame::GetLastRealColGroup(nsTableFrame* aTableFrame, if (!lastColGroup) return PR_TRUE; // there are no col group frames - nsTableColGroupType lastColGroupType = ((nsTableColGroupFrame *)lastColGroup)->GetType(); + nsTableColGroupType lastColGroupType = + ((nsTableColGroupFrame *)lastColGroup)->GetColType(); if (eColGroupAnonymousCell == lastColGroupType) { *aLastColGroup = nextToLastColGroup; return PR_FALSE; @@ -342,19 +336,15 @@ nsTableColGroupFrame::RemoveChildrenAtEnd(nsIPresContext& aPresContext, PRInt32 offsetX = 0; nsIFrame* kidFrame = mFrames.FirstChild(); while(kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColFrame == kidType) { + if (nsLayoutAtoms::tableColFrame == kidFrame->GetType()) { offsetX++; if (offsetX > offsetOfFirstRemoval) { nsIFrame* byebye = kidFrame; kidFrame = kidFrame->GetNextSibling(); mFrames.DestroyFrame(&aPresContext, byebye); - NS_RELEASE(kidType); continue; } } - NS_IF_RELEASE(kidType); kidFrame = kidFrame->GetNextSibling(); } } @@ -368,9 +358,7 @@ nsTableColGroupFrame::RemoveFrame(nsIPresContext* aPresContext, { if (!aOldFrame) return NS_OK; - nsIAtom* frameType = nsnull; - aOldFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColFrame == frameType) { + if (nsLayoutAtoms::tableColFrame == aOldFrame->GetType()) { nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame; PRInt32 colIndex = colFrame->GetColIndex(); RemoveChild(*aPresContext, *colFrame, PR_TRUE); @@ -389,7 +377,6 @@ nsTableColGroupFrame::RemoveFrame(nsIPresContext* aPresContext, else { mFrames.DestroyFrame(aPresContext, aOldFrame); } - NS_IF_RELEASE(frameType); return NS_OK; } @@ -666,20 +653,16 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext, { nsIFrame* childFrame = aColGroupList.FirstChild(); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColGroupFrame == frameType) { + if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { nsTableColFrame* colFrame = nsnull; childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame); while (colFrame) { if (colFrame == &aColFrame) { - NS_RELEASE(frameType); return (nsTableColGroupFrame *)childFrame; } colFrame = NS_STATIC_CAST(nsTableColFrame*, colFrame->GetNextSibling()); } } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } return nsnull; @@ -726,13 +709,10 @@ nsTableColGroupFrame::Init(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableColGroupFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableColGroupFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableColGroupFrame; } #ifdef DEBUG diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.h b/mozilla/layout/html/table/src/nsTableColGroupFrame.h index 6959263b5d9..93a43a35b2c 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.h @@ -80,9 +80,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - nsTableColGroupType GetType() const; + nsTableColGroupType GetColType() const; - void SetType(nsTableColGroupType aType); + void SetColType(nsTableColGroupType aType); static PRBool GetLastRealColGroup(nsTableFrame* aTableFrame, nsIFrame** aLastColGroup); @@ -138,7 +138,7 @@ public: * * @see nsLayoutAtoms::tableColGroupFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD AddColsToTable(nsIPresContext& aPresContext, PRInt32 aFirstColIndex, @@ -232,7 +232,7 @@ protected: inline nsTableColGroupFrame::nsTableColGroupFrame() : mColCount(0), mStartColIndex(0) { - SetType(eColGroupContent); + SetColType(eColGroupContent); } inline PRInt32 nsTableColGroupFrame::GetStartColumnIndex() diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 55dbeefbc36..445f72e99fa 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -185,13 +185,10 @@ nsTableFrame::GetParentStyleContextFrame(nsIPresContext* aPresContext, } -NS_IMETHODIMP -nsTableFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableFrame; } @@ -476,9 +473,7 @@ void nsTableFrame::AttributeChangedFor(nsIPresContext* aPresContext, nsIContent* aContent, nsIAtom* aAttribute) { - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); - if (IS_TABLE_CELL(frameType)) { + if (IS_TABLE_CELL(aFrame->GetType())) { if ((nsHTMLAtoms::rowspan == aAttribute) || (nsHTMLAtoms::colspan == aAttribute)) { nsTableCellMap* cellMap = GetCellMap(); @@ -499,7 +494,6 @@ void nsTableFrame::AttributeChangedFor(nsIPresContext* aPresContext, } } } - NS_IF_RELEASE(frameType); } @@ -559,7 +553,7 @@ PRInt32 nsTableFrame::GetIndexOfLastRealCol() for (PRInt32 colX = numCols; colX >= 0; colX--) { nsTableColFrame* colFrame = GetColFrame(colX); if (colFrame) { - if (eColAnonymousCell != colFrame->GetType()) { + if (eColAnonymousCell != colFrame->GetColType()) { return colX; } } @@ -691,9 +685,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, nsIFrame* kidFrame = aFirstFrame; PRBool didLastFrame = PR_FALSE; while (kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColGroupFrame == kidType) { + if (nsLayoutAtoms::tableColGroupFrame == kidFrame->GetType()) { if (didLastFrame) { firstColGroupToReset = (nsTableColGroupFrame*)kidFrame; break; @@ -708,7 +700,6 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, colIndex += numCols; } } - NS_IF_RELEASE(kidType); if (kidFrame == aLastFrame) { didLastFrame = PR_TRUE; } @@ -725,7 +716,7 @@ void nsTableFrame::InsertCol(nsIPresContext& aPresContext, PRInt32 aColIndex) { mColFrames.InsertElementAt(&aColFrame, aColIndex); - nsTableColType insertedColType = aColFrame.GetType(); + nsTableColType insertedColType = aColFrame.GetColType(); PRInt32 numCacheCols = mColFrames.Count(); nsTableCellMap* cellMap = GetCellMap(); if (cellMap) { @@ -735,7 +726,7 @@ void nsTableFrame::InsertCol(nsIPresContext& aPresContext, if (eColAnonymousCell != insertedColType) { nsTableColFrame* lastCol = (nsTableColFrame *)mColFrames.ElementAt(numCacheCols - 1); if (lastCol) { - nsTableColType lastColType = lastCol->GetType(); + nsTableColType lastColType = lastCol->GetColType(); if (eColAnonymousCell == lastColType) { // remove the col from the cache mColFrames.RemoveElementAt(numCacheCols - 1); @@ -850,7 +841,7 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsIPresContext& aPresContext, aPresContext.GetShell(getter_AddRefs(presShell)); nsresult result = NS_NewTableColGroupFrame(presShell, &newFrame); if (NS_SUCCEEDED(result) && newFrame) { - ((nsTableColGroupFrame *)newFrame)->SetType(aColGroupType); + ((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType); newFrame->Init(&aPresContext, colGroupContent, this, colGroupStyle, nsnull); } return (nsTableColGroupFrame *)newFrame; @@ -867,19 +858,16 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, nsTableColGroupFrame* colGroupFrame = nsnull; nsIFrame* childFrame = mColGroups.FirstChild(); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColGroupFrame == frameType) { + if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { colGroupFrame = (nsTableColGroupFrame *)childFrame; } childFrame = childFrame->GetNextSibling(); - NS_IF_RELEASE(frameType); } nsTableColGroupType lastColGroupType = eColGroupContent; nsTableColGroupType newColGroupType = eColGroupContent; if (colGroupFrame) { - lastColGroupType = colGroupFrame->GetType(); + lastColGroupType = colGroupFrame->GetColType(); } if (eColAnonymousCell == aColType) { if (eColGroupAnonymousCell != lastColGroupType) { @@ -932,12 +920,9 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, // Get the last col frame aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColFrame == frameType) { + if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { lastColFrame = (nsTableColGroupFrame *)childFrame; } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } @@ -971,7 +956,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, nsCOMPtr presShell; aPresContext.GetShell(getter_AddRefs(presShell)); NS_NewTableColFrame(presShell, &colFrame); - ((nsTableColFrame *) colFrame)->SetType(aColType); + ((nsTableColFrame *) colFrame)->SetColType(aColType); colFrame->Init(&aPresContext, iContent, &aColGroupFrame, styleContext, nsnull); colFrame->SetInitialChildList(&aPresContext, nsnull, nsnull); @@ -1062,7 +1047,7 @@ nsTableFrame::DestroyAnonymousColFrames(nsIPresContext& aPresContext, PRInt32 numColsRemoved = 0; for (PRInt32 colX = endIndex; colX >= startIndex; colX--) { nsTableColFrame* colFrame = GetColFrame(colX); - if (colFrame && (eColAnonymousCell == colFrame->GetType())) { + if (colFrame && (eColAnonymousCell == colFrame->GetColType())) { nsTableColGroupFrame* cgFrame = NS_STATIC_CAST(nsTableColGroupFrame*, colFrame->GetParent()); // remove the frame from the colgroup @@ -1209,9 +1194,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, PRBool stopTelling = PR_FALSE; for (nsIFrame* kidFrame = aFirstFrame.FirstChild(); (kidFrame && !stopAsking); kidFrame = kidFrame->GetNextSibling()) { - nsCOMPtr kidType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(kidType.get())) { + if (IS_TABLE_CELL(kidFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame; stopTelling = tableFrame->CellChangedWidth(*cellFrame, cellFrame->GetPass1MaxElementWidth(), cellFrame->GetMaximumWidth(), PR_TRUE); @@ -1266,7 +1249,7 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame, nsIFrame* rgFrame = nsnull; nsIAtom* frameType = aFrameTypeIn; if (!aFrameTypeIn) { - aFrame->GetFrameType(&frameType); + frameType = aFrame->GetType(); } if (nsLayoutAtoms::tableRowGroupFrame == frameType) { rgFrame = aFrame; @@ -1278,18 +1261,12 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame, nsIFrame* scrolledFrame; scrollable->GetScrolledFrame(nsnull, scrolledFrame); if (scrolledFrame) { - nsIAtom* scrolledType; - scrolledFrame->GetFrameType(&scrolledType); - if (nsLayoutAtoms::tableRowGroupFrame == scrolledType) { + if (nsLayoutAtoms::tableRowGroupFrame == scrolledFrame->GetType()) { rgFrame = scrolledFrame; } - NS_IF_RELEASE(scrolledType); } } } - if (!aFrameTypeIn) { - NS_IF_RELEASE(frameType); - } return (nsTableRowGroupFrame*)rgFrame; } @@ -1306,16 +1283,13 @@ nsTableFrame::CollectRows(nsIPresContext* aPresContext, nsIFrame* childFrame = nsnull; rgFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* childType; - childFrame->GetFrameType(&childType); - if (nsLayoutAtoms::tableRowFrame == childType) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { aCollection.AppendElement(childFrame); numRows++; } else { numRows += CollectRows(aPresContext, childFrame, aCollection); } - NS_IF_RELEASE(childType); childFrame = childFrame->GetNextSibling(); } } @@ -1703,9 +1677,7 @@ ProcessRowInserted(nsIPresContext* aPresContext, rgFrame->FirstChild(aPresContext, nsnull, &childFrame); // find the row that was inserted first while (childFrame) { - nsCOMPtr childType; - childFrame->GetFrameType(getter_AddRefs(childType)); - if (nsLayoutAtoms::tableRowFrame == childType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { nsTableRowFrame* rowFrame = (nsTableRowFrame*)childFrame; if (rowFrame->IsFirstInserted()) { rowFrame->SetFirstInserted(PR_FALSE); @@ -1751,16 +1723,15 @@ AncestorsHaveStyleHeight(const nsHTMLReflowState& aReflowState) for (const nsHTMLReflowState* parentRS = aReflowState.parentReflowState; parentRS && parentRS->frame; parentRS = parentRS->parentReflowState) { - nsCOMPtr frameType; - parentRS->frame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get()) || - (nsLayoutAtoms::tableRowFrame == frameType.get()) || - (nsLayoutAtoms::tableRowGroupFrame == frameType.get())) { + nsIAtom* frameType = parentRS->frame->GetType(); + if (IS_TABLE_CELL(frameType) || + (nsLayoutAtoms::tableRowFrame == frameType) || + (nsLayoutAtoms::tableRowGroupFrame == frameType)) { if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) { return PR_TRUE; } } - else if (nsLayoutAtoms::tableFrame == frameType.get()) { + else if (nsLayoutAtoms::tableFrame == frameType) { // we reached the containing table, so always return if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) { return PR_TRUE; @@ -1800,18 +1771,17 @@ nsTableFrame::RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState) { // notify the frame and its ancestors of the special reflow, stopping at the containing table for (const nsHTMLReflowState* rs = &aReflowState; rs && rs->frame; rs = rs->parentReflowState) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + nsIAtom* frameType = rs->frame->GetType(); + if (IS_TABLE_CELL(frameType)) { ((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + else if (nsLayoutAtoms::tableRowFrame == frameType) { ((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) { + else if (nsLayoutAtoms::tableRowGroupFrame == frameType) { ((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableFrame == frameType.get()) { + else if (nsLayoutAtoms::tableFrame == frameType) { if (rs == &aReflowState) { // don't stop because we started with this table ((nsTableFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); @@ -4043,9 +4013,7 @@ nsTableFrame::GetBorderPadding(const nsHTMLReflowState& aReflowState, const nsHTMLReflowState* parentRS = aReflowState.parentReflowState; while (parentRS) { if (parentRS->frame) { - nsCOMPtr frameType; - parentRS->frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == parentRS->frame->GetType()) { nsSize basis(parentRS->mComputedWidth, parentRS->mComputedHeight); GetPaddingFor(basis, *paddingData, padding); break; @@ -4129,9 +4097,7 @@ nsTableFrame::GetTableFrame(nsIFrame* aSourceFrame, // "result" is the result of intermediate calls, not the result we return from this method for (nsIFrame* parentFrame = aSourceFrame->GetParent(); parentFrame; parentFrame = parentFrame->GetParent()) { - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == parentFrame->GetType()) { aTableFrame = (nsTableFrame*)parentFrame; rv = NS_OK; // only set if we found the table frame break; @@ -4326,13 +4292,9 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, if (!aPriorChildFrame) { return result; } - nsIAtom* frameType; - aPriorChildFrame->GetFrameType(&frameType); - if (aChildType == frameType) { - NS_RELEASE(frameType); + if (aChildType == aPriorChildFrame->GetType()) { return (nsTableCellFrame*)aPriorChildFrame; } - NS_IF_RELEASE(frameType); // aPriorChildFrame is not of type aChildType, so we need start from // the beginnng and find the closest one @@ -4340,11 +4302,9 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, nsIFrame* lastMatchingFrame = nsnull; aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame && (childFrame != aPriorChildFrame)) { - childFrame->GetFrameType(&frameType); - if (aChildType == frameType) { + if (aChildType == childFrame->GetType()) { lastMatchingFrame = childFrame; } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } return (nsTableCellFrame*)lastMatchingFrame; @@ -4359,21 +4319,16 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) nsIFrame* rowFrame; rgFrame->FirstChild(aPresContext, nsnull, &rowFrame); while (rowFrame) { - nsIAtom* rowType; - rowFrame->GetFrameType(&rowType); - if (nsLayoutAtoms::tableRowFrame == rowType) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); nsIFrame* cellFrame; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* cellType; - cellFrame->GetFrameType(&cellType); - if (IS_TABLE_CELL(cellType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { PRInt32 colIndex; ((nsTableCellFrame*)cellFrame)->GetColIndex(colIndex); printf("cell(%d)=%p ", colIndex, cellFrame); } - NS_IF_RELEASE(cellType); cellFrame = cellFrame->GetNextSibling(); } printf("\n"); @@ -4381,7 +4336,6 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) else { DumpRowGroup(aPresContext, rowFrame); } - NS_IF_RELEASE(rowType); rowFrame = rowFrame->GetNextSibling(); } } @@ -7054,9 +7008,7 @@ nsReflowTimer* GetFrameTimer(nsIFrame* aFrame, return ((nsTableCellFrame*)aFrame)->mTimer; else if (nsLayoutAtoms::blockFrame == aFrameType) { nsIFrame* parentFrame = aFrame->GetParent(); - nsCOMPtr fType; - parentFrame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType)) { + if (IS_TABLE_CELL(parentFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)parentFrame; // fix up the block timer, which may be referring to the cell if (cellFrame->mBlockTimer->mFrame == parentFrame) { @@ -7176,16 +7128,15 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame, } #endif // get the the frame summary timer - nsCOMPtr frameType = nsnull; - aFrame->GetFrameType(getter_AddRefs(frameType)); - nsReflowTimer* frameTimer = GetFrameTimer(aFrame, frameType.get()); + nsIAtom* frameType = aFrame->GetType(); + nsReflowTimer* frameTimer = GetFrameTimer(aFrame, frameType); if (!frameTimer) {NS_ASSERTION(PR_FALSE, "no frame timer");return;} if (!aMetrics) { // start #ifdef DEBUG_TABLE_REFLOW_TIMING_DETAIL // create the reflow timer nsReflowTimer* timer = new nsReflowTimer(aFrame); // create the aux table timers if they don't exist - if ((nsLayoutAtoms::tableFrame == frameType.get()) && !timer->mNextSibling) { + if ((nsLayoutAtoms::tableFrame == frameType) && !timer->mNextSibling) { timer->mNextSibling = new nsReflowTimer(aFrame); timer->mNextSibling->mNextSibling = new nsReflowTimer(aFrame); timer->mNextSibling->mNextSibling->mNextSibling = new nsReflowTimer(aFrame); @@ -7282,25 +7233,19 @@ void nsTableFrame::DebugTimeMethod(nsMethod aMethod, void nsTableFrame::DebugReflowDone(nsIFrame* aFrame) { // get the timer of aFrame - nsCOMPtr frameType = nsnull; - aFrame->GetFrameType(getter_AddRefs(frameType)); - nsReflowTimer* thisTimer = GetFrameTimer(aFrame, frameType.get()); + nsReflowTimer* thisTimer = GetFrameTimer(aFrame, aFrame->GetType()); // get the nearest ancestor frame with a timer nsReflowTimer* ancestorTimer; nsIFrame* ancestorFrame = aFrame->GetParent(); while (ancestorFrame) { - nsCOMPtr frameType = nsnull; - ancestorFrame->GetFrameType(getter_AddRefs(frameType)); - ancestorTimer = GetFrameTimer(ancestorFrame, frameType.get()); + ancestorTimer = GetFrameTimer(ancestorFrame, ancestorFrame->GetType()); if (ancestorTimer) break; ancestorFrame = ancestorFrame->GetParent(); } if (ancestorTimer) { // add this timer to its parent ancestorTimer->mChildren.AppendElement(thisTimer); - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType)) { + if (IS_TABLE_CELL(aFrame->GetType())) { // add the cell block timer as a child of the cell timer nsTableCellFrame* cellFrame = (nsTableCellFrame*)aFrame; cellFrame->mTimer->mChildren.AppendElement(cellFrame->mBlockTimer); @@ -7452,8 +7397,7 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, indent[aIndent + MIN_INDENT] = 0; char fName[MAX_SIZE]; - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); + nsIAtom* fType = aFrame->GetType(); GetFrameTypeName(fType, fName); printf("%s%s %p", indent, fName, aFrame); @@ -7468,10 +7412,10 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, } printf("\n"); - if (nsLayoutAtoms::tableFrame == fType.get() || - nsLayoutAtoms::tableRowGroupFrame == fType.get() || - nsLayoutAtoms::tableRowFrame == fType.get() || - IS_TABLE_CELL(fType.get())) { + if (nsLayoutAtoms::tableFrame == fType || + nsLayoutAtoms::tableRowGroupFrame == fType || + nsLayoutAtoms::tableRowFrame == fType || + IS_TABLE_CELL(fType)) { nsIFrame* child; aFrame->FirstChild(aPresContext, nsnull, &child); while(child) { @@ -7486,10 +7430,8 @@ nsTableFrame::DumpTableFrames(nsIPresContext* aPresContext, nsIFrame* aFrame) { nsTableFrame* tableFrame = nsnull; - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == aFrame->GetType()) { tableFrame = (nsTableFrame*)aFrame; } else { diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 3cb6546e133..22c13c33d52 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -76,7 +76,8 @@ public: nsReflowTimer(nsIFrame* aFrame) { mFrame = aFrame; mNextSibling = nsnull; - aFrame->GetFrameType(&mFrameType); + mFrameType = aFrame->GetType(); + NS_IF_ADDREF(mFrameType); mReflowType = -1; Reset(); } @@ -407,7 +408,7 @@ public: * * @see nsLayoutAtoms::tableFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG /** @see nsIFrame::GetFrameName */ diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index de3846ff88e..acdbd22df92 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -82,13 +82,10 @@ nsTableOuterFrame::Destroy(nsIPresContext* aPresContext) return nsHTMLContainerFrame::Destroy(aPresContext); } -NS_IMETHODIMP -nsTableCaptionFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableCaptionFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableCaptionFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableCaptionFrame; } nsresult @@ -221,9 +218,7 @@ nsTableOuterFrame::SetInitialChildList(nsIPresContext* aPresContext, mFrames.SetFrames(aChildList); mInnerTableFrame = nsnull; if (aChildList) { - nsCOMPtr fType; - aChildList->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == aChildList->GetType()) { mInnerTableFrame = (nsTableFrame*)aChildList; } } @@ -1203,19 +1198,15 @@ nsTableOuterFrame::GetInnerOrigin(nsIPresContext* aPresContext, PRBool nsTableOuterFrame::IsNested(const nsHTMLReflowState& aReflowState) const { - PRBool result = PR_FALSE; // Walk up the reflow state chain until we find a cell or the root const nsHTMLReflowState* rs = aReflowState.parentReflowState; while (rs) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { - result = PR_TRUE; - break; + if (nsLayoutAtoms::tableFrame == rs->frame->GetType()) { + return PR_TRUE; } rs = rs->parentReflowState; } - return result; + return PR_FALSE; } PRBool @@ -2145,13 +2136,10 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, #endif } -NS_IMETHODIMP -nsTableOuterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableOuterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableOuterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableOuterFrame; } /* ----- global methods ----- */ diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h index dcceb619c5c..7bad67c2129 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.h +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h @@ -53,7 +53,7 @@ class nsTableCaptionFrame : public nsBlockFrame { public: // nsISupports - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; friend nsresult NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); protected: @@ -157,7 +157,7 @@ public: * * @see nsLayoutAtoms::tableOuterFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index d30a70947d6..03e6faa8a7a 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -227,9 +227,7 @@ nsTableRowFrame::AppendFrames(nsIPresContext* aPresContext, nsTableFrame::GetTableFrame(this, tableFrame); for (nsIFrame* childFrame = aFrameList; childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { // Add the cell to the cell map tableFrame->AppendCell(*aPresContext, (nsTableCellFrame&)*childFrame, GetRowIndex()); // XXX this could be optimized with some effort @@ -262,9 +260,7 @@ nsTableRowFrame::InsertFrames(nsIPresContext* aPresContext, nsVoidArray cellChildren; for (nsIFrame* childFrame = aFrameList; childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { cellChildren.AppendElement(childFrame); // XXX this could be optimized with some effort tableFrame->SetNeedStrategyInit(PR_TRUE); @@ -297,9 +293,7 @@ nsTableRowFrame::RemoveFrame(nsIPresContext* aPresContext, nsTableFrame* tableFrame=nsnull; nsTableFrame::GetTableFrame(this, tableFrame); if (tableFrame) { - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(aOldFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)aOldFrame; PRInt32 colIndex; cellFrame->GetColIndex(colIndex); @@ -333,9 +327,7 @@ GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame, // add in height of rows spanned beyond the 1st one nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling(); for (PRInt32 rowX = 1; ((rowX < rowSpan) && nextRow);) { - nsCOMPtr frameType; - nextRow->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == nextRow->GetType()) { height += nextRow->GetSize().height; rowX++; } @@ -350,9 +342,7 @@ nsTableRowFrame::GetFirstCell() { nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { return (nsTableCellFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -382,9 +372,7 @@ nsTableRowFrame::DidResize(nsIPresContext* aPresContext, desiredSize.height); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)childFrame; nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame); @@ -518,9 +506,7 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState) for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) { - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(kidFrame->GetType())) { nscoord availWidth = ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth(); nsSize desSize = ((nsTableCellFrame *)kidFrame)->GetDesiredSize(); if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !mPrevInFlow) { @@ -864,8 +850,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, // Reflow each of our existing cell frames nsIFrame* kidFrame = iter.First(); while (kidFrame) { - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = kidFrame->GetType(); // See if we should only reflow the dirty child frames PRBool doReflowChild = PR_TRUE; @@ -880,7 +865,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, } } if (aReflowState.mFlags.mSpecialHeightReflow) { - if (!isPaginated && (IS_TABLE_CELL(frameType.get()) && + if (!isPaginated && (IS_TABLE_CELL(frameType) && !((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) { kidFrame = iter.Next(); continue; @@ -889,7 +874,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, // Reflow the child frame if (doReflowChild) { - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(frameType)) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame; PRInt32 cellColIndex; cellFrame->GetColIndex(cellColIndex); @@ -1054,7 +1039,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } - else if (IS_TABLE_CELL(frameType.get())) { + else if (IS_TABLE_CELL(frameType)) { // we need to account for the cell's width even if it isn't reflowed x += kidFrame->GetSize().width; } @@ -1505,9 +1490,7 @@ nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame, nsTableCellFrame* priorCell = nsnull; for (nsIFrame* child = mFrames.FirstChild(); child; child = child->GetNextSibling()) { - nsCOMPtr frameType; - child->GetFrameType(getter_AddRefs(frameType)); - if (!IS_TABLE_CELL(frameType.get())) { + if (!IS_TABLE_CELL(child->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)child; PRInt32 colIndex; cellFrame->GetColIndex(colIndex); @@ -1527,13 +1510,10 @@ nsTableRowFrame::RemoveCellFrame(nsTableCellFrame* aFrame) NS_ASSERTION(PR_FALSE, "frame not in list"); } -NS_IMETHODIMP -nsTableRowFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableRowFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableRowFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableRowFrame; } nsTableRowFrame* @@ -1541,9 +1521,7 @@ nsTableRowFrame::GetNextRow() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { return (nsTableRowFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.h b/mozilla/layout/html/table/src/nsTableRowFrame.h index 14fd196ef1a..4f0411ff34e 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowFrame.h @@ -136,7 +136,7 @@ public: * * @see nsLayoutAtoms::tableRowFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 4679910b738..2a4a8fb73aa 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -311,9 +311,7 @@ nsTableRowGroupFrame::InitChildReflowState(nsIPresContext& aPresContext, nsMargin* pCollapseBorder = nsnull; if (aBorderCollapse) { if (aReflowState.frame) { - nsCOMPtr fType; - aReflowState.frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableRowFrame == fType.get()) { + if (nsLayoutAtoms::tableRowFrame == aReflowState.frame->GetType()) { nsTableRowFrame* rowFrame = (nsTableRowFrame*)aReflowState.frame; pCollapseBorder = rowFrame->GetBCBorderWidth(aPixelsToTwips, collapseBorder); } @@ -356,17 +354,14 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, nsIFrame* kidFrame = (aStartFrame) ? aStartFrame : mFrames.FirstChild(); for ( ; kidFrame; kidFrame = kidFrame->GetNextSibling()) { - // Get the frame state bits - nsCOMPtr kidType; - kidFrame->GetFrameType(getter_AddRefs(kidType)); - // See if we should only reflow the dirty child frames PRBool doReflowChild = PR_TRUE; if (aDirtyOnly && ((kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } + nsIAtom* kidType = kidFrame->GetType(); if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) { - if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType.get() && + if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType && !((nsTableRowFrame*)kidFrame)->NeedSpecialReflow())) { doReflowChild = PR_FALSE; } @@ -420,12 +415,12 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, lastReflowedRow = kidFrame; if (aFirstRowReflowed && !*aFirstRowReflowed) { - if (nsLayoutAtoms::tableRowFrame == kidType.get()) { + if (nsLayoutAtoms::tableRowFrame == kidType) { *aFirstRowReflowed = (nsTableRowFrame*)kidFrame; } } if (isPaginated && aPageBreakBeforeEnd && !*aPageBreakBeforeEnd && - (nsLayoutAtoms::tableRowFrame == kidType.get())) { + (nsLayoutAtoms::tableRowFrame == kidType)) { nsTableRowFrame* nextRow = ((nsTableRowFrame*)kidFrame)->GetNextRow(); if (nextRow) { *aPageBreakBeforeEnd = nsTableFrame::PageBreakAfter(*kidFrame, nextRow); @@ -468,9 +463,7 @@ nsTableRowGroupFrame::GetFirstRow() { for (nsIFrame* childFrame = GetFirstFrame(); childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { return (nsTableRowFrame*)childFrame; } } @@ -1378,9 +1371,7 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext* aPresContext, nsAutoVoidArray rows; for (nsIFrame* rowFrame = aFrameList; rowFrame; rowFrame = rowFrame->GetNextSibling()) { - nsCOMPtr frameType; - rowFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { rows.AppendElement(rowFrame); } } @@ -1433,9 +1424,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext, PRBool gotFirstRow = PR_FALSE; for (nsIFrame* rowFrame = aFrameList; rowFrame; rowFrame = rowFrame->GetNextSibling()) { - nsCOMPtr frameType; - rowFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { rows.AppendElement(rowFrame); if (!gotFirstRow) { ((nsTableRowFrame*)rowFrame)->SetFirstInserted(PR_TRUE); @@ -1484,9 +1473,7 @@ nsTableRowGroupFrame::RemoveFrame(nsIPresContext* aPresContext, nsTableFrame* tableFrame = nsnull; nsTableFrame::GetTableFrame(this, tableFrame); if (tableFrame) { - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == aOldFrame->GetType()) { // remove the rows from the table (and flag a rebalance) tableFrame->RemoveRows(*aPresContext, (nsTableRowFrame &)*aOldFrame, 1, PR_TRUE); @@ -1612,9 +1599,7 @@ nsTableRowGroupFrame::RecoverState(nsRowGroupReflowState& aReflowState, // Walk the list of children up to aKidFrame for (nsIFrame* frame = mFrames.FirstChild(); frame && (frame != aKidFrame); frame = frame->GetNextSibling()) { - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (fType.get() == nsLayoutAtoms::tableRowFrame) { + if (frame->GetType() == nsLayoutAtoms::tableRowFrame) { // Update the running y-offset nsSize kidSize = frame->GetSize(); aReflowState.y += kidSize.height + cellSpacingY; @@ -1634,10 +1619,7 @@ nsTableRowGroupFrame::IsSimpleRowFrame(nsTableFrame* aTableFrame, nsIFrame* aFrame) { // Make sure it's a row frame and not a row group frame - nsCOMPtr frameType; - - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::tableRowFrame) { + if (aFrame->GetType() == nsLayoutAtoms::tableRowFrame) { PRInt32 rowIndex = ((nsTableRowFrame*)aFrame)->GetRowIndex(); // It's a simple row frame if there are no cells that span into or @@ -1657,9 +1639,7 @@ GetLastRowSibling(nsIFrame* aRowFrame) nsIFrame* lastRowFrame = nsnull; for (nsIFrame* lastFrame = aRowFrame; lastFrame; lastFrame = lastFrame->GetNextSibling()) { - nsCOMPtr fType; - lastFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableRowFrame == fType.get()) { + if (nsLayoutAtoms::tableRowFrame == lastFrame->GetType()) { lastRowFrame = lastFrame; } } @@ -1802,13 +1782,10 @@ nsTableRowGroupFrame::IR_StyleChanged(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableRowGroupFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableRowGroupFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableRowGroupFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableRowGroupFrame; } @@ -1947,9 +1924,7 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame, // make sure it is a rowFrame in the RowGroup // - it should be, but we do not validate in every case (see bug 88849) - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::tableRowFrame) { + if (aFrame->GetType() != nsLayoutAtoms::tableRowFrame) { NS_WARNING("RowGroup contains a frame that is not a row"); *aLineNumberResult = 0; return NS_ERROR_FAILURE; diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h index 8489b9d2f57..2403b42572f 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h @@ -178,7 +178,7 @@ public: * * @see nsLayoutAtoms::tableRowGroupFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 34bd6d33242..6ed8b7ce239 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -1162,20 +1162,17 @@ printf("\n"); // For MathML, the 'type' will be used to determine the spacing between frames // Subclasses can override this method to return a 'type' that will give // them a particular spacing -NS_IMETHODIMP -nsMathMLContainerFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsMathMLContainerFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); // see if this is an embellished operator (mapped to 'Op' in TeX) if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags) && mEmbellishData.coreFrame) { - return mEmbellishData.coreFrame->GetFrameType(aType); + return mEmbellishData.coreFrame->GetType(); } // everything else is a schematta element (mapped to 'Inner' in TeX) - *aType = nsMathMLAtoms::schemataMathMLFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsMathMLAtoms::schemataMathMLFrame; } enum eMathMLFrameType { @@ -1303,12 +1300,11 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext, nsHTMLReflowMetrics childSize (nsnull); nsBoundingMetrics bmChild; nscoord leftCorrection = 0, italicCorrection = 0; - nsCOMPtr prevFrameType; + nsIAtom* prevFrameType = nsnull; nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { - nsCOMPtr childFrameType; - childFrame->GetFrameType(getter_AddRefs(childFrameType)); + nsIAtom* childFrameType = childFrame->GetType(); GetReflowAndBoundingMetricsFor(childFrame, childSize, bmChild); GetItalicCorrection(bmChild, leftCorrection, italicCorrection); if (0 == count) { @@ -1368,8 +1364,7 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext, fromFrameType = eMathMLFrameType_UNKNOWN; childFrame = mFrames.FirstChild(); while (childFrame) { - nsCOMPtr childFrameType; - childFrame->GetFrameType(getter_AddRefs(childFrameType)); + nsIAtom* childFrameType = childFrame->GetType(); GetReflowAndBoundingMetricsFor(childFrame, childSize, bmChild); GetItalicCorrection(bmChild, leftCorrection, italicCorrection); dy = aDesiredSize.ascent - childSize.ascent; @@ -1416,13 +1411,12 @@ GetInterFrameSpacingFor(nsIPresContext* aPresContext, PRInt32 carrySpace = 0; eMathMLFrameType fromFrameType = eMathMLFrameType_UNKNOWN; - nsCOMPtr childFrameType; - nsCOMPtr prevFrameType; - childFrame->GetFrameType(getter_AddRefs(childFrameType)); + nsIAtom* childFrameType = childFrame->GetType(); + nsIAtom* prevFrameType = nsnull; childFrame = childFrame->GetNextSibling(); while (childFrame) { prevFrameType = childFrameType; - childFrame->GetFrameType(getter_AddRefs(childFrameType)); + childFrameType = childFrame->GetType(); nscoord space = GetInterFrameSpacing(aScriptLevel, prevFrameType, childFrameType, &fromFrameType, &carrySpace); if (aChildFrame == childFrame) { diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h index d7ac9b1d268..6b5cf2492a3 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.h @@ -103,8 +103,7 @@ public: // -------------------------------------------------------------------------- // Overloaded nsHTMLContainerFrame methods -- see documentation in nsIFrame.h - NS_IMETHOD - GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Init(nsIPresContext* aPresContext, diff --git a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp index 7e69e761496..9953d501e30 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -60,12 +60,10 @@ nsMathMLTokenFrame::~nsMathMLTokenFrame() { } -NS_IMETHODIMP -nsMathMLTokenFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsMathMLTokenFrame::GetType() const { - *aType = nsMathMLAtoms::ordinaryMathMLFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsMathMLAtoms::ordinaryMathMLFrame; } static void @@ -372,9 +370,7 @@ SetQuote(nsIPresContext* aPresContext, // walk down the hierarchy of first children because they could be wrapped aFrame->FirstChild(aPresContext, nsnull, &textFrame); if (textFrame) { - nsCOMPtr frameType; - textFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::textFrame) + if (textFrame->GetType() == nsLayoutAtoms::textFrame) break; } aFrame = textFrame; diff --git a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.h b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.h index 7058d62f04c..3bf0c275b16 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.h @@ -33,8 +33,7 @@ class nsMathMLTokenFrame : public nsMathMLContainerFrame { public: friend nsresult NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); - NS_IMETHOD - GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD Init(nsIPresContext* aPresContext, diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp index f263d896f91..ceeb423eae7 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -70,13 +70,11 @@ static const PRUnichar kApplyFunction = PRUnichar(0x2061); static const PRUnichar kInvisibleTimes = PRUnichar(0x2062); static const PRUnichar kNullCh = PRUnichar('\0'); -NS_IMETHODIMP -nsMathMLmoFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsMathMLmoFrame::GetType() const { if (mFrames.GetLength() > 1) { - *aType = nsMathMLAtoms::operatorVisibleMathMLFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsMathMLAtoms::operatorVisibleMathMLFrame; } nsAutoString data; @@ -84,17 +82,15 @@ nsMathMLmoFrame::GetFrameType(nsIAtom** aType) const PRInt32 length = data.Length(); PRUnichar ch = (length == 0) ? kNullCh : data[0]; if (length > 1) - *aType = nsMathMLAtoms::operatorVisibleMathMLFrame; - else if (ch == kInvisibleComma || - ch == kApplyFunction || - ch == kInvisibleTimes || - ch == kNullCh) - *aType = nsMathMLAtoms::operatorInvisibleMathMLFrame; - else - *aType = nsMathMLAtoms::operatorVisibleMathMLFrame; + return nsMathMLAtoms::operatorVisibleMathMLFrame; + + if (ch == kInvisibleComma || + ch == kApplyFunction || + ch == kInvisibleTimes || + ch == kNullCh) + return nsMathMLAtoms::operatorInvisibleMathMLFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsMathMLAtoms::operatorVisibleMathMLFrame; } // since a mouse click implies selection, we cannot just rely on the diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.h b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.h index 30e13f5c69e..c8b1ebcc14b 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.h @@ -35,8 +35,7 @@ class nsMathMLmoFrame : public nsMathMLTokenFrame { public: friend nsresult NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); - NS_IMETHOD - GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; virtual void SetAdditionalStyleContext(PRInt32 aIndex, diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index 8c8dfeb7495..9284c7000ee 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -3067,9 +3067,7 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY) nsPoint pt = frame->GetPosition(); aX += pt.x; aY += pt.y; - nsCOMPtr frameType; - frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::pageContentFrame == frameType.get()) { + if (nsLayoutAtoms::pageContentFrame == frame->GetType()) { break; } frame = frame->GetParent(); diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index 0d728a9a73b..39430a63fa3 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -2697,9 +2697,7 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame, nsRect rect = aFrame->GetRect(); nsRect containerRect = container->GetRect(); - nsCOMPtr typeAtom; - container->GetFrameType(getter_AddRefs(typeAtom)); - if (typeAtom == nsLayoutAtoms::viewportFrame) { + if (container->GetType() == nsLayoutAtoms::viewportFrame) { // For absolutely positioned frames scrollbars are taken into // account by virtue of getting a containing block that does // _not_ include the scrollbars. For fixed positioned frames, diff --git a/mozilla/layout/style/nsInspectorCSSUtils.cpp b/mozilla/layout/style/nsInspectorCSSUtils.cpp index 35640942941..5b1f4e79ce8 100644 --- a/mozilla/layout/style/nsInspectorCSSUtils.cpp +++ b/mozilla/layout/style/nsInspectorCSSUtils.cpp @@ -128,9 +128,7 @@ nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame) * frame" actually inherits style from the "inner frame" so we can * just move one level up in the style context hierarchy.... */ - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::tableOuterFrame) + if (aFrame->GetType() == nsLayoutAtoms::tableOuterFrame) return styleContext->GetParent(); return styleContext; diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index c4583653046..2328e8618a3 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -1345,17 +1345,13 @@ PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, nsIFrame* cellFrame = nsnull; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* frameType; - cellFrame->GetFrameType(&frameType); - if (IS_TABLE_CELL(frameType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { PRBool zeroSpan; PRInt32 rowSpan = GetRowSpanForNewCell((nsTableCellFrame &)*cellFrame, rowX, zeroSpan); if (rowX + rowSpan > numNewRows) { - NS_RELEASE(frameType); return PR_TRUE; } } - NS_IF_RELEASE(frameType); cellFrame = cellFrame->GetNextSibling(); } } @@ -1490,12 +1486,9 @@ nsCellMap::ExpandWithRows(nsIPresContext* aPresContext, rFrame->FirstChild(aPresContext, nsnull, &cFrame); PRInt32 colIndex = 0; while (cFrame) { - nsIAtom* cFrameType; - cFrame->GetFrameType(&cFrameType); - if (IS_TABLE_CELL(cFrameType)) { + if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea, &colIndex); } - NS_IF_RELEASE(cFrameType); cFrame = cFrame->GetNextSibling(); } newRowIndex++; @@ -1901,12 +1894,9 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext, nsIFrame* cFrame = nsnull; rFrame->FirstChild(aPresContext, nsnull, &cFrame); while (cFrame) { - nsIAtom* cFrameType; - cFrame->GetFrameType(&cFrameType); - if (IS_TABLE_CELL(cFrameType)) { + if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea); } - NS_IF_RELEASE(cFrameType); cFrame = cFrame->GetNextSibling(); } rowX++; diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 0cb60efc44d..c3c01d2f12b 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -101,9 +101,7 @@ nsTableCellFrame::GetNextCell() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { return (nsTableCellFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -1230,13 +1228,10 @@ nsTableCellFrame::GetBorderWidth(float aPixelsToTwips, return &aBorder; } -NS_IMETHODIMP -nsTableCellFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableCellFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableCellFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableCellFrame; } #ifdef DEBUG @@ -1294,13 +1289,10 @@ nsBCTableCellFrame::~nsBCTableCellFrame() { } -NS_IMETHODIMP -nsBCTableCellFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBCTableCellFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::bcTableCellFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::bcTableCellFrame; } #ifdef DEBUG diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h index 9a0e96a05b1..6d5ffbcdd05 100644 --- a/mozilla/layout/tables/nsTableCellFrame.h +++ b/mozilla/layout/tables/nsTableCellFrame.h @@ -157,7 +157,7 @@ public: * * @see nsLayoutAtoms::tableCellFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; @@ -453,7 +453,7 @@ public: ~nsBCTableCellFrame(); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; virtual nsMargin* GetBorderWidth(float aPixelsToTwips, nsMargin& aBorder) const; @@ -486,9 +486,6 @@ private: PRUint32 mLeftBorder: 8; }; -#define IS_TABLE_CELL(frameType)\ -((nsLayoutAtoms::tableCellFrame == frameType) || (nsLayoutAtoms::bcTableCellFrame == frameType)) - #endif diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index 80f5438d5f1..eb37e64d23e 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -57,7 +57,7 @@ nsTableColFrame::nsTableColFrame() : nsFrame() { SetIsAnonymous(PR_FALSE); - SetType(eColContent); + SetColType(eColContent); ResetSizingInfo(); } @@ -66,13 +66,13 @@ nsTableColFrame::~nsTableColFrame() } nsTableColType -nsTableColFrame::GetType() const +nsTableColFrame::GetColType() const { return (nsTableColType)((mState & COL_TYPE_BITS) >> COL_TYPE_OFFSET); } void -nsTableColFrame::SetType(nsTableColType aType) +nsTableColFrame::SetColType(nsTableColType aType) { PRUint32 type = aType - eColContent; mState |= (type << COL_TYPE_OFFSET); @@ -281,9 +281,7 @@ nsTableColFrame::GetNextCol() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableColFrame == frameType.get()) { + if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { return (nsTableColFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -291,13 +289,10 @@ nsTableColFrame::GetNextCol() const return nsnull; } -NS_IMETHODIMP -nsTableColFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableColFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableColFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableColFrame; } #ifdef DEBUG diff --git a/mozilla/layout/tables/nsTableColFrame.h b/mozilla/layout/tables/nsTableColFrame.h index cdfffd2782c..e676ae891d9 100644 --- a/mozilla/layout/tables/nsTableColFrame.h +++ b/mozilla/layout/tables/nsTableColFrame.h @@ -83,8 +83,8 @@ public: eWIDTH_SOURCE_CELL_WITH_SPAN=2 // a cell implicitly specified a width via colspan }; - nsTableColType GetType() const; - void SetType(nsTableColType aType); + nsTableColType GetColType() const; + void SetColType(nsTableColType aType); /** instantiate a new instance of nsTableColFrame. * @param aResult the new object is returned in this out-param @@ -131,7 +131,7 @@ public: * * @see nsLayoutAtoms::tableColFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 9901ea26c5e..8be89bcbf5e 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -55,12 +55,12 @@ #define COL_GROUP_TYPE_OFFSET 30 nsTableColGroupType -nsTableColGroupFrame::GetType() const +nsTableColGroupFrame::GetColType() const { return (nsTableColGroupType)((mState & COL_GROUP_TYPE_BITS) >> COL_GROUP_TYPE_OFFSET); } -void nsTableColGroupFrame::SetType(nsTableColGroupType aType) +void nsTableColGroupFrame::SetColType(nsTableColGroupType aType) { PRUint32 type = aType - eColGroupContent; mState |= (type << COL_GROUP_TYPE_OFFSET); @@ -74,9 +74,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup; PRInt32 colIndex = aFirstColIndex; while (colGroupFrame) { - nsCOMPtr cgType; - colGroupFrame->GetFrameType(getter_AddRefs(cgType)); - if (nsLayoutAtoms::tableColGroupFrame == cgType.get()) { + if (nsLayoutAtoms::tableColGroupFrame == colGroupFrame->GetType()) { // reset the starting col index for the first cg only if // aFirstColIndex is smaller than the existing starting col index if ((colIndex != aFirstColIndex) || @@ -88,9 +86,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); } while (colFrame) { - nsCOMPtr colType; - colFrame->GetFrameType(getter_AddRefs(colType)); - if (nsLayoutAtoms::tableColFrame == colType.get()) { + if (nsLayoutAtoms::tableColFrame == colFrame->GetType()) { ((nsTableColFrame*)colFrame)->SetColIndex(colIndex); colIndex++; } @@ -120,9 +116,7 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext, nsIFrame* kidFrame = aFirstFrame; PRBool foundLastFrame = PR_FALSE; while (kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColFrame == kidType) { + if (nsLayoutAtoms::tableColFrame == kidFrame->GetType()) { ((nsTableColFrame*)kidFrame)->SetColIndex(colIndex); if (!foundLastFrame) { mColCount++; @@ -130,7 +124,6 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext, } colIndex++; } - NS_IF_RELEASE(kidType); if (kidFrame == aLastFrame) { foundLastFrame = PR_TRUE; } @@ -159,7 +152,7 @@ nsTableColGroupFrame::FindParentForAppendedCol(nsTableFrame* aTableFrame, nsTableColGroupFrame* relevantColGroup = NS_STATIC_CAST(nsTableColGroupFrame *, lastColGroup); - nsTableColGroupType relevantColGroupType = relevantColGroup->GetType(); + nsTableColGroupType relevantColGroupType = relevantColGroup->GetColType(); if (eColGroupAnonymousCell == relevantColGroupType) { if (eColAnonymousCell == aColType) { return relevantColGroup; @@ -170,7 +163,7 @@ nsTableColGroupFrame::FindParentForAppendedCol(nsTableFrame* aTableFrame, nsTableColFrame* colFrame = (nsTableColFrame*)cols.ElementAt(colX); nsTableColGroupFrame* colGroupFrame = NS_STATIC_CAST(nsTableColGroupFrame*, colFrame->GetParent()); - nsTableColGroupType cgType = colGroupFrame->GetType(); + nsTableColGroupType cgType = colGroupFrame->GetColType(); if (cgType != relevantColGroupType) { relevantColGroup = colGroupFrame; relevantColGroupType = cgType; @@ -214,7 +207,8 @@ nsTableColGroupFrame::GetLastRealColGroup(nsTableFrame* aTableFrame, if (!lastColGroup) return PR_TRUE; // there are no col group frames - nsTableColGroupType lastColGroupType = ((nsTableColGroupFrame *)lastColGroup)->GetType(); + nsTableColGroupType lastColGroupType = + ((nsTableColGroupFrame *)lastColGroup)->GetColType(); if (eColGroupAnonymousCell == lastColGroupType) { *aLastColGroup = nextToLastColGroup; return PR_FALSE; @@ -342,19 +336,15 @@ nsTableColGroupFrame::RemoveChildrenAtEnd(nsIPresContext& aPresContext, PRInt32 offsetX = 0; nsIFrame* kidFrame = mFrames.FirstChild(); while(kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColFrame == kidType) { + if (nsLayoutAtoms::tableColFrame == kidFrame->GetType()) { offsetX++; if (offsetX > offsetOfFirstRemoval) { nsIFrame* byebye = kidFrame; kidFrame = kidFrame->GetNextSibling(); mFrames.DestroyFrame(&aPresContext, byebye); - NS_RELEASE(kidType); continue; } } - NS_IF_RELEASE(kidType); kidFrame = kidFrame->GetNextSibling(); } } @@ -368,9 +358,7 @@ nsTableColGroupFrame::RemoveFrame(nsIPresContext* aPresContext, { if (!aOldFrame) return NS_OK; - nsIAtom* frameType = nsnull; - aOldFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColFrame == frameType) { + if (nsLayoutAtoms::tableColFrame == aOldFrame->GetType()) { nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame; PRInt32 colIndex = colFrame->GetColIndex(); RemoveChild(*aPresContext, *colFrame, PR_TRUE); @@ -389,7 +377,6 @@ nsTableColGroupFrame::RemoveFrame(nsIPresContext* aPresContext, else { mFrames.DestroyFrame(aPresContext, aOldFrame); } - NS_IF_RELEASE(frameType); return NS_OK; } @@ -666,20 +653,16 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext, { nsIFrame* childFrame = aColGroupList.FirstChild(); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColGroupFrame == frameType) { + if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { nsTableColFrame* colFrame = nsnull; childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame); while (colFrame) { if (colFrame == &aColFrame) { - NS_RELEASE(frameType); return (nsTableColGroupFrame *)childFrame; } colFrame = NS_STATIC_CAST(nsTableColFrame*, colFrame->GetNextSibling()); } } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } return nsnull; @@ -726,13 +709,10 @@ nsTableColGroupFrame::Init(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableColGroupFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableColGroupFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableColGroupFrame; } #ifdef DEBUG diff --git a/mozilla/layout/tables/nsTableColGroupFrame.h b/mozilla/layout/tables/nsTableColGroupFrame.h index 6959263b5d9..93a43a35b2c 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.h +++ b/mozilla/layout/tables/nsTableColGroupFrame.h @@ -80,9 +80,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - nsTableColGroupType GetType() const; + nsTableColGroupType GetColType() const; - void SetType(nsTableColGroupType aType); + void SetColType(nsTableColGroupType aType); static PRBool GetLastRealColGroup(nsTableFrame* aTableFrame, nsIFrame** aLastColGroup); @@ -138,7 +138,7 @@ public: * * @see nsLayoutAtoms::tableColGroupFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD AddColsToTable(nsIPresContext& aPresContext, PRInt32 aFirstColIndex, @@ -232,7 +232,7 @@ protected: inline nsTableColGroupFrame::nsTableColGroupFrame() : mColCount(0), mStartColIndex(0) { - SetType(eColGroupContent); + SetColType(eColGroupContent); } inline PRInt32 nsTableColGroupFrame::GetStartColumnIndex() diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 55dbeefbc36..445f72e99fa 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -185,13 +185,10 @@ nsTableFrame::GetParentStyleContextFrame(nsIPresContext* aPresContext, } -NS_IMETHODIMP -nsTableFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableFrame; } @@ -476,9 +473,7 @@ void nsTableFrame::AttributeChangedFor(nsIPresContext* aPresContext, nsIContent* aContent, nsIAtom* aAttribute) { - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); - if (IS_TABLE_CELL(frameType)) { + if (IS_TABLE_CELL(aFrame->GetType())) { if ((nsHTMLAtoms::rowspan == aAttribute) || (nsHTMLAtoms::colspan == aAttribute)) { nsTableCellMap* cellMap = GetCellMap(); @@ -499,7 +494,6 @@ void nsTableFrame::AttributeChangedFor(nsIPresContext* aPresContext, } } } - NS_IF_RELEASE(frameType); } @@ -559,7 +553,7 @@ PRInt32 nsTableFrame::GetIndexOfLastRealCol() for (PRInt32 colX = numCols; colX >= 0; colX--) { nsTableColFrame* colFrame = GetColFrame(colX); if (colFrame) { - if (eColAnonymousCell != colFrame->GetType()) { + if (eColAnonymousCell != colFrame->GetColType()) { return colX; } } @@ -691,9 +685,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, nsIFrame* kidFrame = aFirstFrame; PRBool didLastFrame = PR_FALSE; while (kidFrame) { - nsIAtom* kidType; - kidFrame->GetFrameType(&kidType); - if (nsLayoutAtoms::tableColGroupFrame == kidType) { + if (nsLayoutAtoms::tableColGroupFrame == kidFrame->GetType()) { if (didLastFrame) { firstColGroupToReset = (nsTableColGroupFrame*)kidFrame; break; @@ -708,7 +700,6 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, colIndex += numCols; } } - NS_IF_RELEASE(kidType); if (kidFrame == aLastFrame) { didLastFrame = PR_TRUE; } @@ -725,7 +716,7 @@ void nsTableFrame::InsertCol(nsIPresContext& aPresContext, PRInt32 aColIndex) { mColFrames.InsertElementAt(&aColFrame, aColIndex); - nsTableColType insertedColType = aColFrame.GetType(); + nsTableColType insertedColType = aColFrame.GetColType(); PRInt32 numCacheCols = mColFrames.Count(); nsTableCellMap* cellMap = GetCellMap(); if (cellMap) { @@ -735,7 +726,7 @@ void nsTableFrame::InsertCol(nsIPresContext& aPresContext, if (eColAnonymousCell != insertedColType) { nsTableColFrame* lastCol = (nsTableColFrame *)mColFrames.ElementAt(numCacheCols - 1); if (lastCol) { - nsTableColType lastColType = lastCol->GetType(); + nsTableColType lastColType = lastCol->GetColType(); if (eColAnonymousCell == lastColType) { // remove the col from the cache mColFrames.RemoveElementAt(numCacheCols - 1); @@ -850,7 +841,7 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsIPresContext& aPresContext, aPresContext.GetShell(getter_AddRefs(presShell)); nsresult result = NS_NewTableColGroupFrame(presShell, &newFrame); if (NS_SUCCEEDED(result) && newFrame) { - ((nsTableColGroupFrame *)newFrame)->SetType(aColGroupType); + ((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType); newFrame->Init(&aPresContext, colGroupContent, this, colGroupStyle, nsnull); } return (nsTableColGroupFrame *)newFrame; @@ -867,19 +858,16 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, nsTableColGroupFrame* colGroupFrame = nsnull; nsIFrame* childFrame = mColGroups.FirstChild(); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColGroupFrame == frameType) { + if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { colGroupFrame = (nsTableColGroupFrame *)childFrame; } childFrame = childFrame->GetNextSibling(); - NS_IF_RELEASE(frameType); } nsTableColGroupType lastColGroupType = eColGroupContent; nsTableColGroupType newColGroupType = eColGroupContent; if (colGroupFrame) { - lastColGroupType = colGroupFrame->GetType(); + lastColGroupType = colGroupFrame->GetColType(); } if (eColAnonymousCell == aColType) { if (eColGroupAnonymousCell != lastColGroupType) { @@ -932,12 +920,9 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, // Get the last col frame aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* frameType = nsnull; - childFrame->GetFrameType(&frameType); - if (nsLayoutAtoms::tableColFrame == frameType) { + if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { lastColFrame = (nsTableColGroupFrame *)childFrame; } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } @@ -971,7 +956,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, nsCOMPtr presShell; aPresContext.GetShell(getter_AddRefs(presShell)); NS_NewTableColFrame(presShell, &colFrame); - ((nsTableColFrame *) colFrame)->SetType(aColType); + ((nsTableColFrame *) colFrame)->SetColType(aColType); colFrame->Init(&aPresContext, iContent, &aColGroupFrame, styleContext, nsnull); colFrame->SetInitialChildList(&aPresContext, nsnull, nsnull); @@ -1062,7 +1047,7 @@ nsTableFrame::DestroyAnonymousColFrames(nsIPresContext& aPresContext, PRInt32 numColsRemoved = 0; for (PRInt32 colX = endIndex; colX >= startIndex; colX--) { nsTableColFrame* colFrame = GetColFrame(colX); - if (colFrame && (eColAnonymousCell == colFrame->GetType())) { + if (colFrame && (eColAnonymousCell == colFrame->GetColType())) { nsTableColGroupFrame* cgFrame = NS_STATIC_CAST(nsTableColGroupFrame*, colFrame->GetParent()); // remove the frame from the colgroup @@ -1209,9 +1194,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, PRBool stopTelling = PR_FALSE; for (nsIFrame* kidFrame = aFirstFrame.FirstChild(); (kidFrame && !stopAsking); kidFrame = kidFrame->GetNextSibling()) { - nsCOMPtr kidType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(kidType.get())) { + if (IS_TABLE_CELL(kidFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame; stopTelling = tableFrame->CellChangedWidth(*cellFrame, cellFrame->GetPass1MaxElementWidth(), cellFrame->GetMaximumWidth(), PR_TRUE); @@ -1266,7 +1249,7 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame, nsIFrame* rgFrame = nsnull; nsIAtom* frameType = aFrameTypeIn; if (!aFrameTypeIn) { - aFrame->GetFrameType(&frameType); + frameType = aFrame->GetType(); } if (nsLayoutAtoms::tableRowGroupFrame == frameType) { rgFrame = aFrame; @@ -1278,18 +1261,12 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame, nsIFrame* scrolledFrame; scrollable->GetScrolledFrame(nsnull, scrolledFrame); if (scrolledFrame) { - nsIAtom* scrolledType; - scrolledFrame->GetFrameType(&scrolledType); - if (nsLayoutAtoms::tableRowGroupFrame == scrolledType) { + if (nsLayoutAtoms::tableRowGroupFrame == scrolledFrame->GetType()) { rgFrame = scrolledFrame; } - NS_IF_RELEASE(scrolledType); } } } - if (!aFrameTypeIn) { - NS_IF_RELEASE(frameType); - } return (nsTableRowGroupFrame*)rgFrame; } @@ -1306,16 +1283,13 @@ nsTableFrame::CollectRows(nsIPresContext* aPresContext, nsIFrame* childFrame = nsnull; rgFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame) { - nsIAtom* childType; - childFrame->GetFrameType(&childType); - if (nsLayoutAtoms::tableRowFrame == childType) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { aCollection.AppendElement(childFrame); numRows++; } else { numRows += CollectRows(aPresContext, childFrame, aCollection); } - NS_IF_RELEASE(childType); childFrame = childFrame->GetNextSibling(); } } @@ -1703,9 +1677,7 @@ ProcessRowInserted(nsIPresContext* aPresContext, rgFrame->FirstChild(aPresContext, nsnull, &childFrame); // find the row that was inserted first while (childFrame) { - nsCOMPtr childType; - childFrame->GetFrameType(getter_AddRefs(childType)); - if (nsLayoutAtoms::tableRowFrame == childType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { nsTableRowFrame* rowFrame = (nsTableRowFrame*)childFrame; if (rowFrame->IsFirstInserted()) { rowFrame->SetFirstInserted(PR_FALSE); @@ -1751,16 +1723,15 @@ AncestorsHaveStyleHeight(const nsHTMLReflowState& aReflowState) for (const nsHTMLReflowState* parentRS = aReflowState.parentReflowState; parentRS && parentRS->frame; parentRS = parentRS->parentReflowState) { - nsCOMPtr frameType; - parentRS->frame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get()) || - (nsLayoutAtoms::tableRowFrame == frameType.get()) || - (nsLayoutAtoms::tableRowGroupFrame == frameType.get())) { + nsIAtom* frameType = parentRS->frame->GetType(); + if (IS_TABLE_CELL(frameType) || + (nsLayoutAtoms::tableRowFrame == frameType) || + (nsLayoutAtoms::tableRowGroupFrame == frameType)) { if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) { return PR_TRUE; } } - else if (nsLayoutAtoms::tableFrame == frameType.get()) { + else if (nsLayoutAtoms::tableFrame == frameType) { // we reached the containing table, so always return if (::IsPctStyleHeight(parentRS->mStylePosition) || ::IsFixedStyleHeight(parentRS->mStylePosition)) { return PR_TRUE; @@ -1800,18 +1771,17 @@ nsTableFrame::RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState) { // notify the frame and its ancestors of the special reflow, stopping at the containing table for (const nsHTMLReflowState* rs = &aReflowState; rs && rs->frame; rs = rs->parentReflowState) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + nsIAtom* frameType = rs->frame->GetType(); + if (IS_TABLE_CELL(frameType)) { ((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + else if (nsLayoutAtoms::tableRowFrame == frameType) { ((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) { + else if (nsLayoutAtoms::tableRowGroupFrame == frameType) { ((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); } - else if (nsLayoutAtoms::tableFrame == frameType.get()) { + else if (nsLayoutAtoms::tableFrame == frameType) { if (rs == &aReflowState) { // don't stop because we started with this table ((nsTableFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE); @@ -4043,9 +4013,7 @@ nsTableFrame::GetBorderPadding(const nsHTMLReflowState& aReflowState, const nsHTMLReflowState* parentRS = aReflowState.parentReflowState; while (parentRS) { if (parentRS->frame) { - nsCOMPtr frameType; - parentRS->frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == parentRS->frame->GetType()) { nsSize basis(parentRS->mComputedWidth, parentRS->mComputedHeight); GetPaddingFor(basis, *paddingData, padding); break; @@ -4129,9 +4097,7 @@ nsTableFrame::GetTableFrame(nsIFrame* aSourceFrame, // "result" is the result of intermediate calls, not the result we return from this method for (nsIFrame* parentFrame = aSourceFrame->GetParent(); parentFrame; parentFrame = parentFrame->GetParent()) { - nsCOMPtr frameType; - parentFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { + if (nsLayoutAtoms::tableFrame == parentFrame->GetType()) { aTableFrame = (nsTableFrame*)parentFrame; rv = NS_OK; // only set if we found the table frame break; @@ -4326,13 +4292,9 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, if (!aPriorChildFrame) { return result; } - nsIAtom* frameType; - aPriorChildFrame->GetFrameType(&frameType); - if (aChildType == frameType) { - NS_RELEASE(frameType); + if (aChildType == aPriorChildFrame->GetType()) { return (nsTableCellFrame*)aPriorChildFrame; } - NS_IF_RELEASE(frameType); // aPriorChildFrame is not of type aChildType, so we need start from // the beginnng and find the closest one @@ -4340,11 +4302,9 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, nsIFrame* lastMatchingFrame = nsnull; aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); while (childFrame && (childFrame != aPriorChildFrame)) { - childFrame->GetFrameType(&frameType); - if (aChildType == frameType) { + if (aChildType == childFrame->GetType()) { lastMatchingFrame = childFrame; } - NS_IF_RELEASE(frameType); childFrame = childFrame->GetNextSibling(); } return (nsTableCellFrame*)lastMatchingFrame; @@ -4359,21 +4319,16 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) nsIFrame* rowFrame; rgFrame->FirstChild(aPresContext, nsnull, &rowFrame); while (rowFrame) { - nsIAtom* rowType; - rowFrame->GetFrameType(&rowType); - if (nsLayoutAtoms::tableRowFrame == rowType) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); nsIFrame* cellFrame; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { - nsIAtom* cellType; - cellFrame->GetFrameType(&cellType); - if (IS_TABLE_CELL(cellType)) { + if (IS_TABLE_CELL(cellFrame->GetType())) { PRInt32 colIndex; ((nsTableCellFrame*)cellFrame)->GetColIndex(colIndex); printf("cell(%d)=%p ", colIndex, cellFrame); } - NS_IF_RELEASE(cellType); cellFrame = cellFrame->GetNextSibling(); } printf("\n"); @@ -4381,7 +4336,6 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) else { DumpRowGroup(aPresContext, rowFrame); } - NS_IF_RELEASE(rowType); rowFrame = rowFrame->GetNextSibling(); } } @@ -7054,9 +7008,7 @@ nsReflowTimer* GetFrameTimer(nsIFrame* aFrame, return ((nsTableCellFrame*)aFrame)->mTimer; else if (nsLayoutAtoms::blockFrame == aFrameType) { nsIFrame* parentFrame = aFrame->GetParent(); - nsCOMPtr fType; - parentFrame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType)) { + if (IS_TABLE_CELL(parentFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)parentFrame; // fix up the block timer, which may be referring to the cell if (cellFrame->mBlockTimer->mFrame == parentFrame) { @@ -7176,16 +7128,15 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame, } #endif // get the the frame summary timer - nsCOMPtr frameType = nsnull; - aFrame->GetFrameType(getter_AddRefs(frameType)); - nsReflowTimer* frameTimer = GetFrameTimer(aFrame, frameType.get()); + nsIAtom* frameType = aFrame->GetType(); + nsReflowTimer* frameTimer = GetFrameTimer(aFrame, frameType); if (!frameTimer) {NS_ASSERTION(PR_FALSE, "no frame timer");return;} if (!aMetrics) { // start #ifdef DEBUG_TABLE_REFLOW_TIMING_DETAIL // create the reflow timer nsReflowTimer* timer = new nsReflowTimer(aFrame); // create the aux table timers if they don't exist - if ((nsLayoutAtoms::tableFrame == frameType.get()) && !timer->mNextSibling) { + if ((nsLayoutAtoms::tableFrame == frameType) && !timer->mNextSibling) { timer->mNextSibling = new nsReflowTimer(aFrame); timer->mNextSibling->mNextSibling = new nsReflowTimer(aFrame); timer->mNextSibling->mNextSibling->mNextSibling = new nsReflowTimer(aFrame); @@ -7282,25 +7233,19 @@ void nsTableFrame::DebugTimeMethod(nsMethod aMethod, void nsTableFrame::DebugReflowDone(nsIFrame* aFrame) { // get the timer of aFrame - nsCOMPtr frameType = nsnull; - aFrame->GetFrameType(getter_AddRefs(frameType)); - nsReflowTimer* thisTimer = GetFrameTimer(aFrame, frameType.get()); + nsReflowTimer* thisTimer = GetFrameTimer(aFrame, aFrame->GetType()); // get the nearest ancestor frame with a timer nsReflowTimer* ancestorTimer; nsIFrame* ancestorFrame = aFrame->GetParent(); while (ancestorFrame) { - nsCOMPtr frameType = nsnull; - ancestorFrame->GetFrameType(getter_AddRefs(frameType)); - ancestorTimer = GetFrameTimer(ancestorFrame, frameType.get()); + ancestorTimer = GetFrameTimer(ancestorFrame, ancestorFrame->GetType()); if (ancestorTimer) break; ancestorFrame = ancestorFrame->GetParent(); } if (ancestorTimer) { // add this timer to its parent ancestorTimer->mChildren.AppendElement(thisTimer); - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - if (IS_TABLE_CELL(fType)) { + if (IS_TABLE_CELL(aFrame->GetType())) { // add the cell block timer as a child of the cell timer nsTableCellFrame* cellFrame = (nsTableCellFrame*)aFrame; cellFrame->mTimer->mChildren.AppendElement(cellFrame->mBlockTimer); @@ -7452,8 +7397,7 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, indent[aIndent + MIN_INDENT] = 0; char fName[MAX_SIZE]; - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); + nsIAtom* fType = aFrame->GetType(); GetFrameTypeName(fType, fName); printf("%s%s %p", indent, fName, aFrame); @@ -7468,10 +7412,10 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, } printf("\n"); - if (nsLayoutAtoms::tableFrame == fType.get() || - nsLayoutAtoms::tableRowGroupFrame == fType.get() || - nsLayoutAtoms::tableRowFrame == fType.get() || - IS_TABLE_CELL(fType.get())) { + if (nsLayoutAtoms::tableFrame == fType || + nsLayoutAtoms::tableRowGroupFrame == fType || + nsLayoutAtoms::tableRowFrame == fType || + IS_TABLE_CELL(fType)) { nsIFrame* child; aFrame->FirstChild(aPresContext, nsnull, &child); while(child) { @@ -7486,10 +7430,8 @@ nsTableFrame::DumpTableFrames(nsIPresContext* aPresContext, nsIFrame* aFrame) { nsTableFrame* tableFrame = nsnull; - nsCOMPtr fType; - aFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == aFrame->GetType()) { tableFrame = (nsTableFrame*)aFrame; } else { diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 3cb6546e133..22c13c33d52 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -76,7 +76,8 @@ public: nsReflowTimer(nsIFrame* aFrame) { mFrame = aFrame; mNextSibling = nsnull; - aFrame->GetFrameType(&mFrameType); + mFrameType = aFrame->GetType(); + NS_IF_ADDREF(mFrameType); mReflowType = -1; Reset(); } @@ -407,7 +408,7 @@ public: * * @see nsLayoutAtoms::tableFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG /** @see nsIFrame::GetFrameName */ diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index de3846ff88e..acdbd22df92 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -82,13 +82,10 @@ nsTableOuterFrame::Destroy(nsIPresContext* aPresContext) return nsHTMLContainerFrame::Destroy(aPresContext); } -NS_IMETHODIMP -nsTableCaptionFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableCaptionFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableCaptionFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableCaptionFrame; } nsresult @@ -221,9 +218,7 @@ nsTableOuterFrame::SetInitialChildList(nsIPresContext* aPresContext, mFrames.SetFrames(aChildList); mInnerTableFrame = nsnull; if (aChildList) { - nsCOMPtr fType; - aChildList->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableFrame == fType.get()) { + if (nsLayoutAtoms::tableFrame == aChildList->GetType()) { mInnerTableFrame = (nsTableFrame*)aChildList; } } @@ -1203,19 +1198,15 @@ nsTableOuterFrame::GetInnerOrigin(nsIPresContext* aPresContext, PRBool nsTableOuterFrame::IsNested(const nsHTMLReflowState& aReflowState) const { - PRBool result = PR_FALSE; // Walk up the reflow state chain until we find a cell or the root const nsHTMLReflowState* rs = aReflowState.parentReflowState; while (rs) { - nsCOMPtr frameType; - rs->frame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableFrame == frameType.get()) { - result = PR_TRUE; - break; + if (nsLayoutAtoms::tableFrame == rs->frame->GetType()) { + return PR_TRUE; } rs = rs->parentReflowState; } - return result; + return PR_FALSE; } PRBool @@ -2145,13 +2136,10 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, #endif } -NS_IMETHODIMP -nsTableOuterFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableOuterFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableOuterFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableOuterFrame; } /* ----- global methods ----- */ diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h index dcceb619c5c..7bad67c2129 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.h +++ b/mozilla/layout/tables/nsTableOuterFrame.h @@ -53,7 +53,7 @@ class nsTableCaptionFrame : public nsBlockFrame { public: // nsISupports - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; friend nsresult NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); protected: @@ -157,7 +157,7 @@ public: * * @see nsLayoutAtoms::tableOuterFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index d30a70947d6..03e6faa8a7a 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -227,9 +227,7 @@ nsTableRowFrame::AppendFrames(nsIPresContext* aPresContext, nsTableFrame::GetTableFrame(this, tableFrame); for (nsIFrame* childFrame = aFrameList; childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { // Add the cell to the cell map tableFrame->AppendCell(*aPresContext, (nsTableCellFrame&)*childFrame, GetRowIndex()); // XXX this could be optimized with some effort @@ -262,9 +260,7 @@ nsTableRowFrame::InsertFrames(nsIPresContext* aPresContext, nsVoidArray cellChildren; for (nsIFrame* childFrame = aFrameList; childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { cellChildren.AppendElement(childFrame); // XXX this could be optimized with some effort tableFrame->SetNeedStrategyInit(PR_TRUE); @@ -297,9 +293,7 @@ nsTableRowFrame::RemoveFrame(nsIPresContext* aPresContext, nsTableFrame* tableFrame=nsnull; nsTableFrame::GetTableFrame(this, tableFrame); if (tableFrame) { - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(aOldFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)aOldFrame; PRInt32 colIndex; cellFrame->GetColIndex(colIndex); @@ -333,9 +327,7 @@ GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame, // add in height of rows spanned beyond the 1st one nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling(); for (PRInt32 rowX = 1; ((rowX < rowSpan) && nextRow);) { - nsCOMPtr frameType; - nextRow->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == nextRow->GetType()) { height += nextRow->GetSize().height; rowX++; } @@ -350,9 +342,7 @@ nsTableRowFrame::GetFirstCell() { nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { return (nsTableCellFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); @@ -382,9 +372,7 @@ nsTableRowFrame::DidResize(nsIPresContext* aPresContext, desiredSize.height); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(childFrame->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)childFrame; nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame); @@ -518,9 +506,7 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState) for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) { - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(kidFrame->GetType())) { nscoord availWidth = ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth(); nsSize desSize = ((nsTableCellFrame *)kidFrame)->GetDesiredSize(); if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !mPrevInFlow) { @@ -864,8 +850,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, // Reflow each of our existing cell frames nsIFrame* kidFrame = iter.First(); while (kidFrame) { - nsCOMPtr frameType; - kidFrame->GetFrameType(getter_AddRefs(frameType)); + nsIAtom* frameType = kidFrame->GetType(); // See if we should only reflow the dirty child frames PRBool doReflowChild = PR_TRUE; @@ -880,7 +865,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, } } if (aReflowState.mFlags.mSpecialHeightReflow) { - if (!isPaginated && (IS_TABLE_CELL(frameType.get()) && + if (!isPaginated && (IS_TABLE_CELL(frameType) && !((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) { kidFrame = iter.Next(); continue; @@ -889,7 +874,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, // Reflow the child frame if (doReflowChild) { - if (IS_TABLE_CELL(frameType.get())) { + if (IS_TABLE_CELL(frameType)) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame; PRInt32 cellColIndex; cellFrame->GetColIndex(cellColIndex); @@ -1054,7 +1039,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext, kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED); } } - else if (IS_TABLE_CELL(frameType.get())) { + else if (IS_TABLE_CELL(frameType)) { // we need to account for the cell's width even if it isn't reflowed x += kidFrame->GetSize().width; } @@ -1505,9 +1490,7 @@ nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame, nsTableCellFrame* priorCell = nsnull; for (nsIFrame* child = mFrames.FirstChild(); child; child = child->GetNextSibling()) { - nsCOMPtr frameType; - child->GetFrameType(getter_AddRefs(frameType)); - if (!IS_TABLE_CELL(frameType.get())) { + if (!IS_TABLE_CELL(child->GetType())) { nsTableCellFrame* cellFrame = (nsTableCellFrame*)child; PRInt32 colIndex; cellFrame->GetColIndex(colIndex); @@ -1527,13 +1510,10 @@ nsTableRowFrame::RemoveCellFrame(nsTableCellFrame* aFrame) NS_ASSERTION(PR_FALSE, "frame not in list"); } -NS_IMETHODIMP -nsTableRowFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableRowFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableRowFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableRowFrame; } nsTableRowFrame* @@ -1541,9 +1521,7 @@ nsTableRowFrame::GetNextRow() const { nsIFrame* childFrame = GetNextSibling(); while (childFrame) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { return (nsTableRowFrame*)childFrame; } childFrame = childFrame->GetNextSibling(); diff --git a/mozilla/layout/tables/nsTableRowFrame.h b/mozilla/layout/tables/nsTableRowFrame.h index 14fd196ef1a..4f0411ff34e 100644 --- a/mozilla/layout/tables/nsTableRowFrame.h +++ b/mozilla/layout/tables/nsTableRowFrame.h @@ -136,7 +136,7 @@ public: * * @see nsLayoutAtoms::tableRowFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 4679910b738..2a4a8fb73aa 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -311,9 +311,7 @@ nsTableRowGroupFrame::InitChildReflowState(nsIPresContext& aPresContext, nsMargin* pCollapseBorder = nsnull; if (aBorderCollapse) { if (aReflowState.frame) { - nsCOMPtr fType; - aReflowState.frame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableRowFrame == fType.get()) { + if (nsLayoutAtoms::tableRowFrame == aReflowState.frame->GetType()) { nsTableRowFrame* rowFrame = (nsTableRowFrame*)aReflowState.frame; pCollapseBorder = rowFrame->GetBCBorderWidth(aPixelsToTwips, collapseBorder); } @@ -356,17 +354,14 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, nsIFrame* kidFrame = (aStartFrame) ? aStartFrame : mFrames.FirstChild(); for ( ; kidFrame; kidFrame = kidFrame->GetNextSibling()) { - // Get the frame state bits - nsCOMPtr kidType; - kidFrame->GetFrameType(getter_AddRefs(kidType)); - // See if we should only reflow the dirty child frames PRBool doReflowChild = PR_TRUE; if (aDirtyOnly && ((kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) == 0)) { doReflowChild = PR_FALSE; } + nsIAtom* kidType = kidFrame->GetType(); if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) { - if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType.get() && + if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType && !((nsTableRowFrame*)kidFrame)->NeedSpecialReflow())) { doReflowChild = PR_FALSE; } @@ -420,12 +415,12 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext, lastReflowedRow = kidFrame; if (aFirstRowReflowed && !*aFirstRowReflowed) { - if (nsLayoutAtoms::tableRowFrame == kidType.get()) { + if (nsLayoutAtoms::tableRowFrame == kidType) { *aFirstRowReflowed = (nsTableRowFrame*)kidFrame; } } if (isPaginated && aPageBreakBeforeEnd && !*aPageBreakBeforeEnd && - (nsLayoutAtoms::tableRowFrame == kidType.get())) { + (nsLayoutAtoms::tableRowFrame == kidType)) { nsTableRowFrame* nextRow = ((nsTableRowFrame*)kidFrame)->GetNextRow(); if (nextRow) { *aPageBreakBeforeEnd = nsTableFrame::PageBreakAfter(*kidFrame, nextRow); @@ -468,9 +463,7 @@ nsTableRowGroupFrame::GetFirstRow() { for (nsIFrame* childFrame = GetFirstFrame(); childFrame; childFrame = childFrame->GetNextSibling()) { - nsCOMPtr frameType; - childFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { return (nsTableRowFrame*)childFrame; } } @@ -1378,9 +1371,7 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext* aPresContext, nsAutoVoidArray rows; for (nsIFrame* rowFrame = aFrameList; rowFrame; rowFrame = rowFrame->GetNextSibling()) { - nsCOMPtr frameType; - rowFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { rows.AppendElement(rowFrame); } } @@ -1433,9 +1424,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext, PRBool gotFirstRow = PR_FALSE; for (nsIFrame* rowFrame = aFrameList; rowFrame; rowFrame = rowFrame->GetNextSibling()) { - nsCOMPtr frameType; - rowFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { rows.AppendElement(rowFrame); if (!gotFirstRow) { ((nsTableRowFrame*)rowFrame)->SetFirstInserted(PR_TRUE); @@ -1484,9 +1473,7 @@ nsTableRowGroupFrame::RemoveFrame(nsIPresContext* aPresContext, nsTableFrame* tableFrame = nsnull; nsTableFrame::GetTableFrame(this, tableFrame); if (tableFrame) { - nsCOMPtr frameType; - aOldFrame->GetFrameType(getter_AddRefs(frameType)); - if (nsLayoutAtoms::tableRowFrame == frameType.get()) { + if (nsLayoutAtoms::tableRowFrame == aOldFrame->GetType()) { // remove the rows from the table (and flag a rebalance) tableFrame->RemoveRows(*aPresContext, (nsTableRowFrame &)*aOldFrame, 1, PR_TRUE); @@ -1612,9 +1599,7 @@ nsTableRowGroupFrame::RecoverState(nsRowGroupReflowState& aReflowState, // Walk the list of children up to aKidFrame for (nsIFrame* frame = mFrames.FirstChild(); frame && (frame != aKidFrame); frame = frame->GetNextSibling()) { - nsCOMPtr fType; - frame->GetFrameType(getter_AddRefs(fType)); - if (fType.get() == nsLayoutAtoms::tableRowFrame) { + if (frame->GetType() == nsLayoutAtoms::tableRowFrame) { // Update the running y-offset nsSize kidSize = frame->GetSize(); aReflowState.y += kidSize.height + cellSpacingY; @@ -1634,10 +1619,7 @@ nsTableRowGroupFrame::IsSimpleRowFrame(nsTableFrame* aTableFrame, nsIFrame* aFrame) { // Make sure it's a row frame and not a row group frame - nsCOMPtr frameType; - - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() == nsLayoutAtoms::tableRowFrame) { + if (aFrame->GetType() == nsLayoutAtoms::tableRowFrame) { PRInt32 rowIndex = ((nsTableRowFrame*)aFrame)->GetRowIndex(); // It's a simple row frame if there are no cells that span into or @@ -1657,9 +1639,7 @@ GetLastRowSibling(nsIFrame* aRowFrame) nsIFrame* lastRowFrame = nsnull; for (nsIFrame* lastFrame = aRowFrame; lastFrame; lastFrame = lastFrame->GetNextSibling()) { - nsCOMPtr fType; - lastFrame->GetFrameType(getter_AddRefs(fType)); - if (nsLayoutAtoms::tableRowFrame == fType.get()) { + if (nsLayoutAtoms::tableRowFrame == lastFrame->GetType()) { lastRowFrame = lastFrame; } } @@ -1802,13 +1782,10 @@ nsTableRowGroupFrame::IR_StyleChanged(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableRowGroupFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsTableRowGroupFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::tableRowGroupFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::tableRowGroupFrame; } @@ -1947,9 +1924,7 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame, // make sure it is a rowFrame in the RowGroup // - it should be, but we do not validate in every case (see bug 88849) - nsCOMPtr frameType; - aFrame->GetFrameType(getter_AddRefs(frameType)); - if (frameType.get() != nsLayoutAtoms::tableRowFrame) { + if (aFrame->GetType() != nsLayoutAtoms::tableRowFrame) { NS_WARNING("RowGroup contains a frame that is not a row"); *aLineNumberResult = 0; return NS_ERROR_FAILURE; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h index 8489b9d2f57..2403b42572f 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.h +++ b/mozilla/layout/tables/nsTableRowGroupFrame.h @@ -178,7 +178,7 @@ public: * * @see nsLayoutAtoms::tableRowGroupFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 473f9fba688..aaed641581e 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -1436,9 +1436,7 @@ nsBoxFrame::Paint(nsIPresContext* aPresContext, PaintSelf(aPresContext, aRenderingContext, aDirtyRect, 0, PR_FALSE); } - nsCOMPtr frameType; - GetFrameType(getter_AddRefs(frameType)); - if (frameType == nsLayoutAtoms::rootFrame) { + if (GetType() == nsLayoutAtoms::rootFrame) { // We are wrapping the root frame of a XUL document. We // need to check the pres shell to find out if painting is locked // down (because we're still in the early stages of document @@ -1778,13 +1776,10 @@ nsBoxFrame::GetFrameName(nsAString& aResult) const } #endif -NS_IMETHODIMP -nsBoxFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsBoxFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::boxFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::boxFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h index 9a565a6639d..00420172151 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsBoxFrame.h @@ -171,7 +171,7 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif diff --git a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp index 071db44581d..7d4cb1daa89 100644 --- a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp +++ b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp @@ -289,9 +289,7 @@ UseHTMLReflowConstraints(nsBoxToBlockAdaptor* aAdaptor, nsBoxLayoutState& aState if (!parentFrame) { return PR_FALSE; } - nsCOMPtr parentFrameType; - parentFrame->GetFrameType(getter_AddRefs(parentFrameType)); - if (!parentFrameType || parentFrameType != nsLayoutAtoms::scrollFrame) { + if (parentFrame->GetType() != nsLayoutAtoms::scrollFrame) { return PR_FALSE; } diff --git a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp index a655caa6139..3ad1b6340c4 100644 --- a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp @@ -112,7 +112,7 @@ public: * * @see nsLayoutAtoms::rootFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const; @@ -268,13 +268,10 @@ nsRootBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext, return nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame); } -NS_IMETHODIMP -nsRootBoxFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsRootBoxFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::rootFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::rootFrame; } NS_IMETHODIMP diff --git a/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp b/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp index 4b85d14977f..45d8ad34acc 100644 --- a/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp @@ -605,13 +605,10 @@ nsScrollBoxFrame::GetContentOf(nsIContent** aContent) return NS_OK; } -NS_IMETHODIMP -nsScrollBoxFrame::GetFrameType(nsIAtom** aType) const +nsIAtom* +nsScrollBoxFrame::GetType() const { - NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); - *aType = nsLayoutAtoms::scrollFrame; - NS_ADDREF(*aType); - return NS_OK; + return nsLayoutAtoms::scrollFrame; } #ifdef NS_DEBUG diff --git a/mozilla/layout/xul/base/src/nsScrollBoxFrame.h b/mozilla/layout/xul/base/src/nsScrollBoxFrame.h index d75d6f35d0b..e961d926f58 100644 --- a/mozilla/layout/xul/base/src/nsScrollBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsScrollBoxFrame.h @@ -97,7 +97,7 @@ public: * * @see nsLayoutAtoms::scrollFrame */ - NS_IMETHOD GetFrameType(nsIAtom** aType) const; + virtual nsIAtom* GetType() const; #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const;