From 35c266025d036029e06c8be543070f256f4dea2d Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Fri, 9 Jan 2004 14:20:53 +0000 Subject: [PATCH] Bug 190735. deCOMtaminate nsIFrame::FirstChild and nsIFrame::GetAdditionalChildListName. r+sr=bz git-svn-id: svn://10.0.0.236/trunk@151077 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/base/nsAccessibilityService.cpp | 12 +- mozilla/accessible/src/base/nsAccessible.cpp | 20 +-- .../src/html/nsHTMLSelectAccessible.cpp | 21 +-- mozilla/content/base/src/nsDocumentViewer.cpp | 17 +- mozilla/content/base/src/nsPrintEngine.cpp | 35 ++--- mozilla/content/base/src/nsSelection.cpp | 11 +- .../html/content/src/nsGenericHTMLElement.cpp | 2 +- .../html/style/src/nsComputedDOMStyle.cpp | 3 +- mozilla/layout/base/nsBidiPresUtils.cpp | 6 +- mozilla/layout/base/nsCSSFrameConstructor.cpp | 146 ++++++------------ mozilla/layout/base/nsCSSRendering.cpp | 17 +- mozilla/layout/base/nsDocumentViewer.cpp | 17 +- .../layout/base/nsFrameContentIterator.cpp | 18 +-- mozilla/layout/base/nsFrameManager.cpp | 40 ++--- mozilla/layout/base/nsFrameTraversal.cpp | 70 ++++----- mozilla/layout/base/nsLayoutUtils.cpp | 7 +- mozilla/layout/base/nsPresShell.cpp | 37 ++--- mozilla/layout/base/public/nsIFrame.h | 11 +- mozilla/layout/base/src/nsBidiPresUtils.cpp | 6 +- mozilla/layout/base/src/nsFrameTraversal.cpp | 70 ++++----- mozilla/layout/base/src/nsLayoutUtils.cpp | 7 +- .../layout/forms/nsComboboxControlFrame.cpp | 29 ++-- mozilla/layout/forms/nsComboboxControlFrame.h | 7 +- mozilla/layout/forms/nsFileControlFrame.cpp | 6 +- mozilla/layout/forms/nsListControlFrame.cpp | 6 +- mozilla/layout/forms/nsTextControlFrame.cpp | 5 +- mozilla/layout/generic/nsBlockFrame.cpp | 72 +++------ mozilla/layout/generic/nsBlockFrame.h | 7 +- mozilla/layout/generic/nsBulletFrame.cpp | 3 +- mozilla/layout/generic/nsContainerFrame.cpp | 51 ++---- mozilla/layout/generic/nsContainerFrame.h | 7 +- mozilla/layout/generic/nsFirstLetterFrame.cpp | 5 +- mozilla/layout/generic/nsFrame.cpp | 73 ++++----- mozilla/layout/generic/nsFrame.h | 6 +- mozilla/layout/generic/nsGfxScrollFrame.cpp | 8 +- .../layout/generic/nsHTMLContainerFrame.cpp | 17 +- mozilla/layout/generic/nsHTMLFrame.cpp | 10 +- mozilla/layout/generic/nsIFrame.h | 11 +- mozilla/layout/generic/nsInlineFrame.cpp | 29 ++-- mozilla/layout/generic/nsInlineFrame.h | 7 +- mozilla/layout/generic/nsLineLayout.cpp | 9 +- mozilla/layout/generic/nsObjectFrame.cpp | 3 +- mozilla/layout/generic/nsSelection.cpp | 11 +- .../layout/generic/nsSimplePageSequence.cpp | 3 +- mozilla/layout/generic/nsTextFrame.cpp | 7 +- mozilla/layout/generic/nsViewportFrame.cpp | 31 ++-- mozilla/layout/generic/nsViewportFrame.h | 7 +- mozilla/layout/html/base/src/nsBlockFrame.cpp | 72 +++------ mozilla/layout/html/base/src/nsBlockFrame.h | 7 +- .../layout/html/base/src/nsBulletFrame.cpp | 3 +- .../layout/html/base/src/nsContainerFrame.cpp | 51 ++---- .../layout/html/base/src/nsContainerFrame.h | 7 +- .../html/base/src/nsFirstLetterFrame.cpp | 5 +- mozilla/layout/html/base/src/nsFrame.cpp | 73 ++++----- mozilla/layout/html/base/src/nsFrame.h | 6 +- .../layout/html/base/src/nsFrameManager.cpp | 40 ++--- .../layout/html/base/src/nsGfxScrollFrame.cpp | 8 +- .../html/base/src/nsHTMLContainerFrame.cpp | 17 +- mozilla/layout/html/base/src/nsHTMLFrame.cpp | 10 +- .../layout/html/base/src/nsInlineFrame.cpp | 29 ++-- mozilla/layout/html/base/src/nsInlineFrame.h | 7 +- mozilla/layout/html/base/src/nsLineLayout.cpp | 9 +- .../layout/html/base/src/nsObjectFrame.cpp | 3 +- mozilla/layout/html/base/src/nsPresShell.cpp | 37 ++--- .../html/base/src/nsSimplePageSequence.cpp | 3 +- mozilla/layout/html/base/src/nsTextFrame.cpp | 7 +- .../layout/html/base/src/nsViewportFrame.cpp | 31 ++-- .../layout/html/base/src/nsViewportFrame.h | 7 +- .../html/forms/src/nsComboboxControlFrame.cpp | 29 ++-- .../html/forms/src/nsComboboxControlFrame.h | 7 +- .../html/forms/src/nsFileControlFrame.cpp | 6 +- .../html/forms/src/nsListControlFrame.cpp | 6 +- .../html/forms/src/nsTextControlFrame.cpp | 5 +- .../html/style/src/nsCSSFrameConstructor.cpp | 146 ++++++------------ .../layout/html/style/src/nsCSSRendering.cpp | 17 +- .../html/style/src/nsFrameContentIterator.cpp | 18 +-- mozilla/layout/html/table/src/nsCellMap.cpp | 9 +- .../html/table/src/nsTableCellFrame.cpp | 3 +- .../html/table/src/nsTableColGroupFrame.cpp | 6 +- .../layout/html/table/src/nsTableFrame.cpp | 81 ++++------ mozilla/layout/html/table/src/nsTableFrame.h | 9 +- .../html/table/src/nsTableOuterFrame.cpp | 36 ++--- .../layout/html/table/src/nsTableOuterFrame.h | 7 +- .../layout/html/table/src/nsTableRowFrame.cpp | 13 +- .../html/table/src/nsTableRowGroupFrame.cpp | 5 +- mozilla/layout/html/tests/TestInlineFrame.cpp | 4 +- .../base/src/nsMathMLContainerFrame.cpp | 21 +-- .../mathml/base/src/nsMathMLTokenFrame.cpp | 8 +- .../mathml/base/src/nsMathMLmfencedFrame.cpp | 3 +- .../mathml/base/src/nsMathMLmoFrame.cpp | 4 +- .../mathml/base/src/nsMathMLmsubFrame.cpp | 3 +- .../mathml/base/src/nsMathMLmsubsupFrame.cpp | 3 +- .../mathml/base/src/nsMathMLmsupFrame.cpp | 3 +- mozilla/layout/printing/nsPrintEngine.cpp | 35 ++--- mozilla/layout/style/nsComputedDOMStyle.cpp | 3 +- mozilla/layout/tables/nsCellMap.cpp | 9 +- mozilla/layout/tables/nsTableCellFrame.cpp | 3 +- .../layout/tables/nsTableColGroupFrame.cpp | 6 +- mozilla/layout/tables/nsTableFrame.cpp | 81 ++++------ mozilla/layout/tables/nsTableFrame.h | 9 +- mozilla/layout/tables/nsTableOuterFrame.cpp | 36 ++--- mozilla/layout/tables/nsTableOuterFrame.h | 7 +- mozilla/layout/tables/nsTableRowFrame.cpp | 13 +- .../layout/tables/nsTableRowGroupFrame.cpp | 5 +- mozilla/layout/xul/base/src/nsBox.cpp | 3 +- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 4 +- mozilla/layout/xul/base/src/nsBoxObject.cpp | 12 +- mozilla/layout/xul/base/src/nsGrippyFrame.cpp | 9 +- .../layout/xul/base/src/nsListBoxObject.cpp | 6 +- .../layout/xul/base/src/nsMenuBarFrame.cpp | 16 +- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 34 ++-- mozilla/layout/xul/base/src/nsMenuFrame.h | 7 +- .../layout/xul/base/src/nsMenuPopupFrame.cpp | 23 +-- .../layout/xul/base/src/nsPopupBoxObject.cpp | 8 +- .../xul/base/src/nsProgressMeterFrame.cpp | 3 +- .../xul/base/src/nsScrollbarButtonFrame.cpp | 3 +- .../layout/xul/base/src/nsSplitterFrame.cpp | 3 +- .../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 3 +- .../xul/base/src/tree/src/nsTreeColFrame.cpp | 4 +- 119 files changed, 797 insertions(+), 1435 deletions(-) diff --git a/mozilla/accessible/src/base/nsAccessibilityService.cpp b/mozilla/accessible/src/base/nsAccessibilityService.cpp index 8e8ea7265ce..871f62e6090 100644 --- a/mozilla/accessible/src/base/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/base/nsAccessibilityService.cpp @@ -586,15 +586,8 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame, #endif // 3) for images and imagemaps, or anything else with a child frame - nsCOMPtr shell(do_QueryReferent(weakShell)); - if (!shell) - return NS_ERROR_FAILURE; - nsCOMPtr context; - shell->GetPresContext(getter_AddRefs(context)); - if (!context) - return NS_ERROR_FAILURE; // we have the object frame, get the image frame - aFrame->FirstChild(context, nsnull, &frame); + frame = aFrame->GetFirstChild(nsnull); if (frame) { return frame->GetAccessible(aAccessible); } @@ -792,8 +785,7 @@ nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessi nsCOMPtr presShell(do_QueryReferent(weakShell)); nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); - nsIFrame* childFrame = nsnull; - parentFrame->FirstChild(presContext, nsnull, &childFrame); + nsIFrame* childFrame = parentFrame->GetFirstChild(nsnull); PRInt32 index = 0; nsIFrame* firstTextFrame = nsnull; PRBool ret = nsAccessible::FindTextFrame(index, presContext, childFrame, &firstTextFrame, frame); diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index da29e798bb8..2e19b7d32a4 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -783,8 +783,7 @@ void nsAccessible::GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame if (IsCorrectFrameType(iterFrame, nsAccessibilityAtoms::inlineFrame)) { // Only do deeper bounds search if we're on an inline frame // Inline frames can contain larger frames inside of them - iterFrame->FirstChild(nsCOMPtr(GetPresContext()), - nsnull, &iterNextFrame); + iterNextFrame = iterFrame->GetFirstChild(nsnull); } if (iterNextFrame) @@ -1459,19 +1458,17 @@ nsresult nsAccessible::GetParentBlockNode(nsIPresShell *aPresShell, nsIDOMNode * nsCOMPtr presContext; aPresShell->GetPresContext(getter_AddRefs(presContext)); - nsIFrame* childFrame = nsnull; - nsCOMPtr frameType; - while (frame && frame->GetType() != nsAccessibilityAtoms::textFrame) { - frame->FirstChild(presContext, nsnull, &childFrame); - frame = childFrame; + nsIAtom* frameType = nsnull; + while (frame && (frameType = frame->GetType()) != nsAccessibilityAtoms::textFrame) { + frame = frame->GetFirstChild(nsnull); } if (! frame || frameType != nsAccessibilityAtoms::textFrame) return NS_ERROR_FAILURE; - parentFrame->FirstChild(presContext, nsnull, &childFrame); PRInt32 index = 0; nsIFrame *firstTextFrame = nsnull; - FindTextFrame(index, presContext, childFrame, &firstTextFrame, frame); + FindTextFrame(index, presContext, parentFrame->GetFirstChild(nsnull), + &firstTextFrame, frame); if (firstTextFrame) { nsIContent *content = firstTextFrame->GetContent(); @@ -1540,9 +1537,8 @@ PRBool nsAccessible::FindTextFrame(PRInt32 &index, nsIPresContext *aPresContext, } // we won't expand the tree under a block frame. - nsIFrame* childFrame = nsnull; - aCurFrame->FirstChild(aPresContext, nsnull, &childFrame); - if (FindTextFrame(index, aPresContext, childFrame, aFirstTextFrame, aTextFrame)) + if (FindTextFrame(index, aPresContext, aCurFrame->GetFirstChild(nsnull), + aFirstTextFrame, aTextFrame)) return PR_TRUE; } diff --git a/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp b/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp index 6174291cc82..898d602b004 100644 --- a/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -984,13 +984,10 @@ NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetNextSibling(nsIAccessible ** NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetValue(nsAString& _retval) { nsIFrame* frame = nsAccessible::GetBoundsFrame(); - nsCOMPtr context(GetPresContext()); - if (!frame || !context) + if (!frame) return NS_ERROR_FAILURE; - frame->FirstChild(context, nsnull, &frame); - frame->FirstChild(context, nsnull, &frame); - + frame = frame->GetFirstChild(nsnull)->GetFirstChild(nsnull); nsIContent* content = frame->GetContent(); if (!content) @@ -1016,12 +1013,11 @@ void nsHTMLComboboxTextFieldAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame* { // get our first child's frame nsIFrame* frame = nsAccessible::GetBoundsFrame(); - nsCOMPtr context(GetPresContext()); - if (!frame || !context) + if (!frame) return; - frame->FirstChild(context, nsnull, aBoundingFrame); - frame->FirstChild(context, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); + *aBoundingFrame = frame; aBounds = frame->GetRect(); } @@ -1102,8 +1098,7 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::DoAction(PRUint8 aIndex) if (!frame || !context) return NS_ERROR_FAILURE; - frame->FirstChild(context, nsnull, &frame); - frame = frame->GetNextSibling(); + frame = frame->GetFirstChild(nsnull)->GetNextSibling(); // We only have one action, click. Any other index is meaningless(wrong) if (aIndex == eAction_Click) { @@ -1163,8 +1158,8 @@ void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** a if (!frame || !context) return; - frame->FirstChild(context, nsnull, &frame); // first frame is for the textfield - aBounds = frame->GetNextSibling()->GetRect(); // sibling frame is for the button + aBounds = frame->GetFirstChild(nsnull)->GetNextSibling()->GetRect(); + // sibling frame is for the button } /** We are a button. */ diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index ec28baeaf64..585bde62383 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -194,6 +194,10 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset #include "nsBidiUtils.h" +//paint forcing +#include "prenv.h" +#include + static NS_DEFINE_CID(kGalleyContextCID, NS_GALLEYCONTEXT_CID); #ifdef NS_DEBUG @@ -938,6 +942,16 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus) mPresShell->UnsuppressPainting(); } + static PRBool forcePaint + = PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull; + if (forcePaint) { + if (mPresShell) { + mPresShell->FlushPendingNotifications(PR_TRUE); + } + printf("GECKO: PAINT FORCED AFTER ONLOAD\n"); + fflush(stdout); + } + #ifdef NS_PRINTING // Check to see if someone tried to print during the load if (mPrintIsPending) { @@ -3184,8 +3198,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) // Now, locate the current page we are on and // and the page of the page number nscoord gap = 0; - nsIFrame * pageFrame; - seqFrame->FirstChild(mPresContext, nsnull, &pageFrame); + nsIFrame* pageFrame = seqFrame->GetFirstChild(nsnull); while (pageFrame != nsnull) { nsRect pageRect = pageFrame->GetRect(); if (pageNum == 1) { diff --git a/mozilla/content/base/src/nsPrintEngine.cpp b/mozilla/content/base/src/nsPrintEngine.cpp index a4c8dc21387..9255fabba7d 100644 --- a/mozilla/content/base/src/nsPrintEngine.cpp +++ b/mozilla/content/base/src/nsPrintEngine.cpp @@ -514,14 +514,13 @@ nsPrintEngine::GetSeqFrameAndCountPagesInternal(nsPrintObject* aPO, aSeqFrame = curFrame; break; } - curFrame->FirstChild(aPO->mPresContext, nsnull, &curFrame); + curFrame = curFrame->GetFirstChild(nsnull); } if (aSeqFrame == nsnull) return NS_ERROR_FAILURE; // first count the total number of pages aCount = 0; - nsIFrame * pageFrame; - aSeqFrame->FirstChild(aPO->mPresContext, nsnull, &pageFrame); + nsIFrame* pageFrame = aSeqFrame->GetFirstChild(nsnull); while (pageFrame != nsnull) { aCount++; pageFrame = pageFrame->GetNextSibling(); @@ -2688,7 +2687,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink) nsIFrame* frame; frameMan->GetPrimaryFrameFor(aPO->mContent, &frame); if (frame && (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame)) { - frame->FirstChild(aPO->mParent->mPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); } if (frame) { @@ -2957,8 +2956,7 @@ nsPrintEngine::CalcPageFrameLocation(nsIPresShell * aPresShell, // Calc the Page No it is on PRInt32 pageNum = 1; - nsIFrame * child; - seqFrame->FirstChild(aPO->mPresContext, nsnull, &child); + nsIFrame* child = seqFrame->GetFirstChild(nsnull); while (child != nsnull) { if (pageFrame == child) { aPO->mPageNum = pageNum; @@ -2992,8 +2990,7 @@ nsPrintEngine::CalcNumPrintableDocsAndPages(PRInt32& aNumDocs, PRInt32& aNumPage po->mPresShell->GetPageSequenceFrame(&pageSequence); nsIFrame * seqFrame; if (NS_SUCCEEDED(CallQueryInterface(pageSequence, &seqFrame))) { - nsIFrame* frame; - seqFrame->FirstChild(po->mPresContext, nsnull, &frame); + nsIFrame* frame = seqFrame->GetFirstChild(nsnull); while (frame) { aNumPages++; frame = frame->GetNextSibling(); @@ -3060,7 +3057,7 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY) if (frame) { // This gets the "inner" frame, // and then traverse out ot the pageContentFrame - frame->FirstChild(aPO->mParent->mPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); while (frame) { nsPoint pt = frame->GetPosition(); aX += pt.x; @@ -3655,9 +3652,8 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext, NS_ASSERTION(aParentFrame, "Pointer is null!"); NS_ASSERTION(aType, "Pointer is null!"); - nsIFrame * child; aRect += aParentFrame->GetPosition(); - aParentFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aParentFrame->GetFirstChild(nsnull); while (child) { nsIContent* content = child->GetContent(); if (content && content->Tag() == aType) { @@ -3693,8 +3689,7 @@ nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext, NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!"); - nsIFrame * child; - aParentFrame->FirstChild(aPresContext, aList, &child); + nsIFrame* child = aParentFrame->GetFirstChild(aList); aRect += aParentFrame->GetPosition(); while (child) { // only leaf frames have this bit flipped @@ -3744,9 +3739,8 @@ nsPrintEngine::FindSelectionBounds(nsIPresContext* aPresContext, PRInt32 childListIndex = 0; do { nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childListName, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect); - NS_IF_RELEASE(childListName); NS_ENSURE_SUCCESS(rv, rv); - aParentFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aParentFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return NS_OK; } @@ -3835,8 +3829,7 @@ nsPrintEngine::GetPageRangeForSelection(nsIPresShell * aPresShell, // dump all the pages and their pointers { PRInt32 pageNum = 1; - nsIFrame * child; - seqFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = seqFrame->GetFirstChild(nsnull); while (child != nsnull) { printf("Page: %d - %p\n", pageNum, child); pageNum++; @@ -3848,8 +3841,7 @@ nsPrintEngine::GetPageRangeForSelection(nsIPresShell * aPresShell, // Now that we have the page frames // find out what the page numbers are for each frame PRInt32 pageNum = 1; - nsIFrame * page; - seqFrame->FirstChild(aPresContext, nsnull, &page); + nsIFrame* page = seqFrame->GetFirstChild(nsnull); while (page != nsnull) { if (page == startPageFrame) { aStartPageNum = pageNum; @@ -4715,8 +4707,7 @@ static void DumpFrames(FILE* out, NS_ASSERTION(aRendContext, "Pointer is null!"); NS_ASSERTION(aFrame, "Pointer is null!"); - nsIFrame * child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aFrame->GetFirstChild(nsnull); while (child != nsnull) { for (PRInt32 i=0;iFirstChild(po->mPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); } } diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index d45ba7817ec..49750ab488a 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -2209,19 +2209,18 @@ nsSelection::GetPrevNextBidiLevels(nsIPresContext *aPresContext, } // GetFirstLeaf - nsIFrame *lookahead = nsnull; + nsIFrame *lookahead; while (1) { - result = firstFrame->FirstChild(aPresContext, nsnull, &lookahead); - if (NS_FAILED(result) || !lookahead) + lookahead = firstFrame->GetFirstChild(nsnull); + if (!lookahead) break; //nothing to do firstFrame = lookahead; } // GetLastLeaf - lookahead = nsnull; while (1) { - result = lastFrame->FirstChild(aPresContext, nsnull, &lookahead); - if (NS_FAILED(result) || !lookahead) + lookahead = lastFrame->GetFirstChild(nsnull); + if (!lookahead) break; //nothing to do lastFrame = lookahead; while ((lookahead = lastFrame->GetNextSibling()) != nsnull) diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 0339006545a..27e568adb9e 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -2682,7 +2682,7 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent, // If we have generated content, the primary frame will be a // wrapper frame.. out real frame will be in its child list. - for (frame->FirstChild(frame->GetPresContext(), nsnull, &frame); + for (frame = frame->GetFirstChild(nsnull); frame; frame = frame->GetNextSibling()) { CallQueryInterface(frame, &form_frame); diff --git a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp index c4c9b5b082a..96fd8454598 100644 --- a/mozilla/content/html/style/src/nsComputedDOMStyle.cpp +++ b/mozilla/content/html/style/src/nsComputedDOMStyle.cpp @@ -2675,13 +2675,12 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame, // _not_ include the scrollbars. For fixed positioned frames, // the containing block is the viewport, which _does_ include // scrollbars. We have to do some extra work. - nsIFrame* scrollingChild; nsCOMPtr presShell = do_QueryReferent(mPresShellWeak); NS_ASSERTION(presShell, "Must have a presshell!"); nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); // the first child in the default frame list is what we want - container->FirstChild(presContext, nsnull, &scrollingChild); + nsIFrame* scrollingChild = container->GetFirstChild(nsnull); nsCOMPtr scrollFrame = do_QueryInterface(scrollingChild); if (scrollFrame) { diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 1ffb868e971..105315cf71a 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -367,7 +367,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, { nsIFrame* frame; nsIFrame* directionalFrame; - nsIFrame* kid; nsresult rv; nsresult res = NS_OK; @@ -412,7 +411,7 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, || (nsLayoutAtoms::positionedInlineFrame == frameType) || (nsLayoutAtoms::letterFrame == frameType) || (nsLayoutAtoms::blockFrame == frameType) ) ) { - frame->FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = frame->GetFirstChild(nsnull); res = InitLogicalArray(aPresContext, kid, aNextInFlow, aAddMarkers); } else { @@ -702,11 +701,10 @@ nsBidiPresUtils::RepositionContainerFrame(nsIPresContext* aPresContext, PRInt32& aMaxX) const { nsIFrame* frame; - nsIFrame* firstChild; PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; - aContainer->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aContainer->GetFirstChild(nsnull); for (frame = firstChild; frame; frame = frame->GetNextSibling()) { nsIAtom* frameType = frame->GetType(); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 4cf42fa2e60..788f4eeb686 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -975,8 +975,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext, // Dive down into children to see if any of their // placeholders need adjusting. - nsIFrame *childFrame = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame *childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { @@ -1214,13 +1213,8 @@ GetChildListNameFor(nsIPresContext* aPresContext, } // Verify that the frame is actually in that child list -#ifdef NS_DEBUG - nsIFrame* firstChild; - aParentFrame->FirstChild(aPresContext, listName, &firstChild); - - nsFrameList frameList(firstChild); - NS_ASSERTION(frameList.ContainsFrame(aChildFrame), "not in child list"); -#endif + NS_ASSERTION(nsFrameList(aParentFrame->GetFirstChild(listName)) + .ContainsFrame(aChildFrame), "not in child list"); NS_IF_ADDREF(listName); *aListName = listName; @@ -3284,8 +3278,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, // Gfx scrollframes were created in the root frame but the primary frame map may have been destroyed if a // new style sheet was loaded so lets reattach the frames to their content. if (mGfxScrollFrame) { - nsIFrame* scrollPort = nsnull; - mGfxScrollFrame->FirstChild(aPresContext, nsnull, &scrollPort); + nsIFrame* scrollPort = mGfxScrollFrame->GetFirstChild(nsnull); nsIFrame* gfxScrollbarFrame1 = nsnull; nsIFrame* gfxScrollbarFrame2 = nsnull; @@ -4949,8 +4942,7 @@ LocateAnonymousFrame(nsIPresContext* aPresContext, } // Check our kids. - nsIFrame* currFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &currFrame); + nsIFrame* currFrame = aParentFrame->GetFirstChild(nsnull); while (currFrame) { LocateAnonymousFrame(aPresContext, currFrame, aTargetContent, aResult); if (*aResult) @@ -5600,7 +5592,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame = nsnull; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) rootBox->SetDefaultTooltip(aContent); @@ -5710,7 +5702,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); NS_ASSERTION(rootBox, "unexpected null pointer"); if (rootBox) { @@ -5747,7 +5739,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame = nsnull; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) rootBox->AddTooltipSupport(aContent); @@ -7354,7 +7346,7 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell, // if we get a table cell frame use its 1st child which is an area frame else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { - frame->FirstChild(aPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); } } } @@ -7381,15 +7373,14 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, 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); + nsIFrame* scrolledFrame = frame->GetFirstChild(nsnull); if (scrolledFrame) { frameType = scrolledFrame->GetType(); if (nsLayoutAtoms::areaFrame == frameType) { containingBlock = scrolledFrame; break; } else if (nsLayoutAtoms::scrollFrame == frameType) { - scrolledFrame->FirstChild(aPresContext, nsnull, &scrolledFrame); + scrolledFrame = scrolledFrame->GetFirstChild(nsnull); if (scrolledFrame) { if (nsLayoutAtoms::areaFrame == scrolledFrame->GetType()) { containingBlock = scrolledFrame; @@ -7404,7 +7395,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, break; } else if (nsLayoutAtoms::fieldSetFrame == frameType) { // If the positioned frame is a fieldset, use the area frame inside it - frame->FirstChild(aPresContext, nsnull, &containingBlock); + containingBlock = frame->GetFirstChild(nsnull); break; } #ifdef DEBUG @@ -7485,9 +7476,7 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext, nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(aParentFrame, aPresContext); if (afterFrame) { - nsIFrame* firstChild; - aParentFrame->FirstChild(aPresContext, nsnull, &firstChild); - nsFrameList frames(firstChild); + nsFrameList frames(aParentFrame->GetFirstChild(nsnull)); // Insert the frames before the :after pseudo-element. return aFrameManager->InsertFrames(aParentFrame, @@ -7949,14 +7938,14 @@ GetAdjustedParentFrame(nsIPresContext* aPresContext, // If the parent frame is an outer table, use the innner table // as the parent unless the new content is a caption. if (!captionContent) - aParentFrame->FirstChild(aPresContext, nsnull, &newParent); + newParent = aParentFrame->GetFirstChild(nsnull); } else if (nsLayoutAtoms::fieldSetFrame == aParentFrameType) { // If the parent is a fieldSet, use the fieldSet's area frame as the // parent unless the new content is a legend. nsCOMPtr legendContent(do_QueryInterface(childContent)); if (!legendContent) - aParentFrame->FirstChild(aPresContext, nsnull, &newParent); + newParent = aParentFrame->GetFirstChild(nsnull); } return (newParent) ? newParent : aParentFrame; } @@ -7968,8 +7957,7 @@ static nsresult InsertOutOfFlow(nsIPresContext* aPresContext, return NS_OK; } - nsIFrame* firstChild; - aFrameItems.containingBlock->FirstChild(aPresContext, aChildListName, &firstChild); + nsIFrame* firstChild = aFrameItems.containingBlock->GetFirstChild(aChildListName); // Note that whether the frame construction context is doing an append or // not is not helpful here, since it could be appending to some frame in @@ -8281,8 +8269,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // check for a caption already appended to the outer table nsIFrame* outerTable = parentFrame->GetParent(); if (outerTable) { - nsIFrame* existingCaption = nsnull; - outerTable->FirstChild(aPresContext, nsLayoutAtoms::captionList, &existingCaption); + nsIFrame* existingCaption = + outerTable->GetFirstChild(nsLayoutAtoms::captionList); if (existingCaption) { abortCaption = PR_TRUE; } @@ -8989,8 +8977,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, if (!prevSibling) { // We're inserting the new frame as the first child. See if the // parent has a :before pseudo-element - nsIFrame* firstChild; - parentFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = parentFrame->GetFirstChild(nsnull); if (firstChild && nsLayoutUtils::IsGeneratedContentFor(aContainer, firstChild, @@ -9106,13 +9093,12 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, } // Walk aFrame's child frames - nsCOMPtr childListName; + nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { // Walk aFrame's child frames looking for placeholder frames - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { // The subtree we need to follow to get to the children; by // default, the childFrame. @@ -9152,7 +9138,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, childFrame = childFrame->GetNextSibling(); } - aFrame->GetAdditionalChildListName(childListIndex++, getter_AddRefs(childListName)); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return NS_OK; @@ -9210,7 +9196,7 @@ DeletingFrameSubtree(nsIPresContext* aPresContext, nsIFrame* rootFrame; aFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); NS_ASSERTION(rootBox, "unexpected null pointer"); if (rootBox) { @@ -9441,7 +9427,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, nsIFrame* rootFrame; frameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); #ifdef MOZ_XUL nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) { @@ -9601,8 +9587,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIAtom* childList = nsnull; do { - nsIFrame* child = nsnull; - aFrame->FirstChild(aPresContext, childList, &child); + nsIFrame* child = aFrame->GetFirstChild(childList); while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow @@ -9622,10 +9607,8 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, } child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); - NS_IF_RELEASE(childList); aBoundsRect = bounds; aBoundsRect += parentOffset; } @@ -10138,7 +10121,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsIFrame* rootFrame = nsnull; shell->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) { if (aModType == nsIDOMMutationEvent::REMOVAL) @@ -10339,8 +10322,7 @@ HasDisplayableChildren(nsIPresContext* aPresContext, nsIFrame* aContainerFrame) if (! aContainerFrame) return PR_FALSE; - nsIFrame* frame; - aContainerFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = aContainerFrame->GetFirstChild(nsnull); while (frame) { // If it's not a text frame, then assume that it's displayable. @@ -10404,9 +10386,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell, } // Get the previous sibling frame - nsIFrame* firstChild; - parentFrame->FirstChild(aPresContext, listName, &firstChild); - nsFrameList frameList(firstChild); + nsFrameList frameList(parentFrame->GetFirstChild(listName)); // See whether it's an IMG or an INPUT element (for image buttons) // or if it is an applet with no displayable children @@ -10610,10 +10590,9 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShe // Create a continuing inner table frame, and if there's a caption then // replicate the caption - nsIFrame* childFrame; nsFrameItems newChildFrames; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { // See if it's the inner table frame if (nsLayoutAtoms::tableFrame == childFrame->GetType()) { @@ -10684,10 +10663,8 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Replicate any header/footer frames - nsIFrame* rowGroupFrame; nsFrameItems childFrames; - - aFrame->FirstChild(aPresContext, nsnull, &rowGroupFrame); + nsIFrame* rowGroupFrame = aFrame->GetFirstChild(nsnull); while (rowGroupFrame) { // See if it's a header/footer nsStyleContext* rowGroupStyle = rowGroupFrame->GetStyleContext(); @@ -10825,10 +10802,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Create a continuing frame for each table cell frame - nsIFrame* cellFrame; nsFrameItems newChildList; - - aFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = aFrame->GetFirstChild(nsnull); while (cellFrame) { // See if it's a table cell frame if (IS_TABLE_CELL(cellFrame->GetType())) { @@ -10852,9 +10827,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Create a continuing area frame - nsIFrame* areaFrame; nsIFrame* continuingAreaFrame; - aFrame->FirstChild(aPresContext, nsnull, &areaFrame); + nsIFrame* areaFrame = aFrame->GetFirstChild(nsnull); CreateContinuingFrame(aPresContext, areaFrame, newFrame, &continuingAreaFrame); // Set the table cell's initial child list @@ -10936,18 +10910,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, // OK. now we need to do this fixed-pos game. // Get prevPage's page content frame - nsIFrame* prevPageContentFrame; - prevPage->FirstChild(aPresContext, nsnull, &prevPageContentFrame); + nsIFrame* prevPageContentFrame = prevPage->GetFirstChild(nsnull); if (!prevPageContentFrame) { return NS_ERROR_UNEXPECTED; } nsFrameItems fixedPlaceholders; - nsIFrame* firstFixed; - prevPageContentFrame->FirstChild(aPresContext, nsLayoutAtoms::fixedList, - &firstFixed); - + nsIFrame* firstFixed = prevPageContentFrame->GetFirstChild(nsLayoutAtoms::fixedList); if (!firstFixed) { return NS_OK; } @@ -11029,7 +10999,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, } if (parentFrame) { // if we found the next-in-flow for the parent of the hint frame, start with it's first child - parentFrame->FirstChild(aPresContext, listName, &kidFrame); + kidFrame = parentFrame->GetFirstChild(listName); // Leave |aParentFrame| as-is, since the only time we'll // reuse it is if the hint fails. NS_ASSERTION(!kidFrame || parentFrame->GetContent() == aParentContent, @@ -11043,7 +11013,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, } } if (!kidFrame) { // we didn't have enough info to prune, start searching from the beginning - aParentFrame->FirstChild(aPresContext, listName, &kidFrame); + kidFrame = aParentFrame->GetFirstChild(listName); } while (kidFrame) { // See if the child frame points to the content object we're @@ -11105,8 +11075,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, // using the null child list again. aHint = nsnull; } else { - NS_IF_RELEASE(listName); - aParentFrame->GetAdditionalChildListName(listIndex++, &listName); + listName = aParentFrame->GetAdditionalChildListName(listIndex++); } } while(listName); @@ -11707,8 +11676,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames( { // It's possible that aBlockFrame needs to have a first-line frame // created because it doesn't currently have any children. - nsIFrame* blockKid; - aBlockFrame->FirstChild(aPresContext, nsnull, &blockKid); + nsIFrame* blockKid = aBlockFrame->GetFirstChild(nsnull); if (!blockKid) { return WrapFramesInFirstLineFrame(aPresShell, aPresContext, aState, aContent, aBlockFrame, aFrameItems); @@ -11794,8 +11762,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( if (!aPrevSibling) { // Insertion will become the first frame. Two cases: we either // already have a first-line frame or we don't. - nsIFrame* firstBlockKid; - aBlockFrame->FirstChild(nsnull, &firstBlockKid); + nsIFrame* firstBlockKid = aBlockFrame->GetFirstChild(nsnull); if (firstBlockKid->GetType() == nsLayoutAtoms::lineFrame) { // We already have a first-line frame nsIFrame* lineFrame = firstBlockKid; @@ -11896,8 +11863,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( if (!nextLineFrame) { break; } - nsIFrame* kids; - nextLineFrame->FirstChild(nsnull, &kids); + nsIFrame* kids = nextLineFrame->GetFirstChild(nsnull); } } else { @@ -12235,8 +12201,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( } else if ((nsLayoutAtoms::inlineFrame == frameType) || (nsLayoutAtoms::lineFrame == frameType)) { - nsIFrame* kids; - frame->FirstChild(aPresContext, nsnull, &kids); + nsIFrame* kids = frame->GetFirstChild(nsnull); WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids, aModifiedParent, aTextFrame, aPrevFrame, aLetterFrames, aStopLooking); @@ -12271,8 +12236,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( PRBool* aStopLooking) { // First look for the float frame that is a letter frame - nsIFrame* floatFrame; - aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame); + nsIFrame* floatFrame = aBlockFrame->GetFirstChild(nsLayoutAtoms::floatList); while (floatFrame) { // See if we found a floating letter frame if (nsLayoutAtoms::letterFrame == floatFrame->GetType()) { @@ -12287,8 +12251,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Take the text frame away from the letter frame (so it isn't // destroyed when we destroy the letter frame). - nsIFrame* textFrame; - floatFrame->FirstChild(aPresContext, nsnull, &textFrame); + nsIFrame* textFrame = floatFrame->GetFirstChild(nsnull); if (!textFrame) { return NS_OK; } @@ -12386,16 +12349,14 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, nsIFrame* aFrame, PRBool* aStopLooking) { - nsIFrame* kid; nsIFrame* prevSibling = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = aFrame->GetFirstChild(nsnull); while (kid) { nsIAtom* frameType = kid->GetType(); if (nsLayoutAtoms::letterFrame == frameType) { // Bingo. Found it. First steal away the text frame. - nsIFrame* textFrame; - kid->FirstChild(aPresContext, nsnull, &textFrame); + nsIFrame* textFrame = kid->GetFirstChild(nsnull); if (!textFrame) { break; } @@ -12470,8 +12431,7 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont { nsresult rv = NS_OK; - nsIFrame* blockKids; - aBlockFrame->FirstChild(aPresContext, nsnull, &blockKids); + nsIFrame* blockKids = aBlockFrame->GetFirstChild(nsnull); nsIFrame* parentFrame = nsnull; nsIFrame* textFrame = nsnull; nsIFrame* prevFrame = nsnull; @@ -12982,8 +12942,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext, // Recursively walk the child frames. // Note: we only need to look at the principal child list - nsIFrame* childFrame; - frame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = frame->GetFirstChild(nsnull); while (childFrame) { DoCleanupFrameReferences(aPresContext, aFrameManager, childFrame); @@ -13212,8 +13171,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext, // be sure the left inlines, the block and the right inlines all have a view nsHTMLContainerFrame::CreateViewForFrame(aBlockChildFrame, nsnull, PR_TRUE); - nsIFrame* frame; - aBlockChildFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = aBlockChildFrame->GetFirstChild(nsnull); nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, frame, aLeftInlineChildFrame, aBlockChildFrame); if (aRightInlineChildFrame) { @@ -13221,7 +13179,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext, // XXXbz should we be passing in a non-null aContentParentFrame? nsHTMLContainerFrame::CreateViewForFrame(aRightInlineChildFrame, nsnull, PR_TRUE); - aRightInlineChildFrame->FirstChild(aPresContext, nsnull, &frame); + frame = aRightInlineChildFrame->GetFirstChild(nsnull); nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, frame, aLeftInlineChildFrame, aRightInlineChildFrame); } } @@ -13412,9 +13370,7 @@ nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext, if (mFixedContainingBlock) { nsIFrame *fixedChild = nsnull; do { - mFixedContainingBlock->FirstChild(aPresContext, - nsLayoutAtoms::fixedList, - &fixedChild); + fixedChild = mFixedContainingBlock->GetFirstChild(nsLayoutAtoms::fixedList); if (fixedChild) { DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, fixedChild); diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index b9dcee2ef64..cdc06cb1bcb 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -2519,8 +2519,7 @@ GetRootScrollableFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame) nsIScrollableFrame* scrollableFrame = nsnull; if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { - nsIFrame* childFrame; - aRootFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aRootFrame->GetFirstChild(nsnull); if (childFrame) { if (nsLayoutAtoms::scrollFrame == childFrame->GetType()) { @@ -2616,8 +2615,7 @@ IsCanvasFrame(nsIPresContext* aPresContext, nsIFrame *aFrame) frameType == nsLayoutAtoms::pageFrame) { return aFrame; } else if (frameType == nsLayoutAtoms::viewportFrame) { - nsIFrame* firstChild; - aFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aFrame->GetFirstChild(nsnull); if (firstChild) { return firstChild; } @@ -2633,8 +2631,7 @@ FindCanvasBackground(nsIPresContext* aPresContext, { // XXXldb What if the root element is positioned, etc.? (We don't // allow that yet, do we?) - nsIFrame *firstChild; - aForFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame *firstChild = aForFrame->GetFirstChild(nsnull); if (firstChild) { const nsStyleBackground* result = firstChild->GetStyleBackground(); @@ -2655,7 +2652,7 @@ FindCanvasBackground(nsIPresContext* aPresContext, kidFrame = kidFrame->GetNextSibling(); } } - firstChild->FirstChild(aPresContext, nsnull, &firstChild); + firstChild = firstChild->GetFirstChild(nsnull); } return PR_FALSE; // nothing found for this } @@ -2716,8 +2713,7 @@ FindElementBackground(nsIPresContext* aPresContext, // XXXldb We shouldn't have to null-check |parentFrame| here. if (parentFrame && IsCanvasFrame(aPresContext, parentFrame) == parentFrame) { // Check that we're really the root (rather than in another child list). - nsIFrame *childFrame; - parentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame *childFrame = parentFrame->GetFirstChild(nsnull); if (childFrame == aForFrame) return PR_FALSE; // Background was already drawn for the canvas. } @@ -3141,8 +3137,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext, // If the frame is the canvas, the image is placed relative to // the root element's (first) frame (see bug 46446) nsRect firstRootElementFrameArea; - nsIFrame* firstRootElementFrame; - aForFrame->FirstChild(aPresContext, nsnull, &firstRootElementFrame); + nsIFrame* firstRootElementFrame = aForFrame->GetFirstChild(nsnull); NS_ASSERTION(firstRootElementFrame, "A canvas with a background " "image had no child frame, which is impossible according to CSS. " "Make sure there isn't a background image specified on the " diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index ec28baeaf64..585bde62383 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -194,6 +194,10 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset #include "nsBidiUtils.h" +//paint forcing +#include "prenv.h" +#include + static NS_DEFINE_CID(kGalleyContextCID, NS_GALLEYCONTEXT_CID); #ifdef NS_DEBUG @@ -938,6 +942,16 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus) mPresShell->UnsuppressPainting(); } + static PRBool forcePaint + = PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull; + if (forcePaint) { + if (mPresShell) { + mPresShell->FlushPendingNotifications(PR_TRUE); + } + printf("GECKO: PAINT FORCED AFTER ONLOAD\n"); + fflush(stdout); + } + #ifdef NS_PRINTING // Check to see if someone tried to print during the load if (mPrintIsPending) { @@ -3184,8 +3198,7 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum) // Now, locate the current page we are on and // and the page of the page number nscoord gap = 0; - nsIFrame * pageFrame; - seqFrame->FirstChild(mPresContext, nsnull, &pageFrame); + nsIFrame* pageFrame = seqFrame->GetFirstChild(nsnull); while (pageFrame != nsnull) { nsRect pageRect = pageFrame->GetRect(); if (pageNum == 1) { diff --git a/mozilla/layout/base/nsFrameContentIterator.cpp b/mozilla/layout/base/nsFrameContentIterator.cpp index 4471b2deeda..6f30861d8fc 100644 --- a/mozilla/layout/base/nsFrameContentIterator.cpp +++ b/mozilla/layout/base/nsFrameContentIterator.cpp @@ -82,7 +82,7 @@ NS_IMETHODIMP nsFrameContentIterator::First() { // Get the first child frame and make it the current node - mParentFrame->FirstChild(mPresContext, nsnull, &mCurrentChild); + mCurrentChild = mParentFrame->GetFirstChild(nsnull); if (!mCurrentChild) { return NS_ERROR_FAILURE; } @@ -109,7 +109,7 @@ GetNextChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent()->GetNextInFlow(&parent); if (parent) { - parent->FirstChild(aPresContext, nsnull, &nextSibling); + nextSibling = parent->GetFirstChild(nsnull); } } @@ -119,11 +119,9 @@ GetNextChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) NS_IMETHODIMP nsFrameContentIterator::Last() { - nsIFrame* nextChild; - // Starting with the first child walk and find the last child mCurrentChild = nsnull; - mParentFrame->FirstChild(mPresContext, nsnull, &nextChild); + nsIFrame* nextChild = mParentFrame->GetFirstChild(nsnull); while (nextChild) { mCurrentChild = nextChild; nextChild = ::GetNextChildFrame(mPresContext, nextChild); @@ -161,10 +159,8 @@ GetPrevChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) // Get its previous sibling. Because we have a singly linked list we // need to search from the first child nsIFrame* parent = aFrame->GetParent(); - nsIFrame* firstChild; nsIFrame* prevSibling; - - parent->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = parent->GetFirstChild(nsnull); NS_ASSERTION(firstChild, "parent has no first child"); nsFrameList frameList(firstChild); @@ -176,7 +172,7 @@ GetPrevChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) parent->GetPrevInFlow(&parent); if (parent) { - parent->FirstChild(aPresContext, nsnull, &firstChild); + firstChild = parent->GetFirstChild(nsnull); frameList.SetFrames(firstChild); prevSibling = frameList.LastChild(); } @@ -235,11 +231,9 @@ nsFrameContentIterator::IsDone() NS_IMETHODIMP nsFrameContentIterator::PositionAt(nsIContent* aCurNode) { - nsIFrame* child; - // Starting with the first child frame search for the child frame // with the matching content object - mParentFrame->FirstChild(mPresContext, nsnull, &child); + nsIFrame* child = mParentFrame->GetFirstChild(nsnull); while (child) { if (child->GetContent() == aCurNode) { break; diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 2909f6d4d7f..30795557666 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -536,7 +536,6 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aCanvasFrame, "aCanvasFrame argument cannot be null"); - nsIPresContext *presContext = GetPresContext(); *aCanvasFrame = nsnull; if (mRootFrame) { @@ -556,7 +555,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const } } // move on to the child's child - childFrame->FirstChild(presContext, nsnull, &childFrame); + childFrame = childFrame->GetFirstChild(nsnull); } } return NS_OK; @@ -1400,9 +1399,8 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* nsIFrame* child; do { - child = nsnull; - nsresult result = aFrame->FirstChild(aPresContext, childList, &child); - while ((NS_SUCCEEDED(result)) && child) { + child = aFrame->GetFirstChild(childList); + while (child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { @@ -1425,8 +1423,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // do additional contexts @@ -1481,9 +1478,8 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, aFrame->SetStyleContext(presContext, newContext); do { - child = nsnull; - result = aFrame->FirstChild(presContext, childList, &child); - while ((NS_SUCCEEDED(result)) && child) { + child = aFrame->GetFirstChild(childList); + while (child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { @@ -1505,8 +1501,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // do additional contexts @@ -1610,7 +1605,6 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, // that the frame has the last reference to it, so AddRef it here. nsStyleContext* oldContext = aFrame->GetStyleContext(); - nsresult result = NS_OK; if (oldContext) { oldContext->AddRef(); @@ -1889,9 +1883,8 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, nsChangeHint childChange; do { - nsIFrame* child = nsnull; - result = aFrame->FirstChild(aPresContext, childList, &child); - while (NS_SUCCEEDED(result) && child) { + nsIFrame* child = aFrame->GetFirstChild(childList); + while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder @@ -1927,8 +1920,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // XXX need to do overflow frames??? } @@ -2071,15 +2063,13 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { - nsIFrame* childFrame; - aFrame->FirstChild(GetPresContext(), childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { rv = CaptureFrameState(childFrame, aState); // Get the next sibling child frame childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return rv; @@ -2144,15 +2134,13 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { - nsIFrame* childFrame; - aFrame->FirstChild(GetPresContext(), childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { rv = RestoreFrameState(childFrame, aState); // Get the next sibling child frame childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return rv; diff --git a/mozilla/layout/base/nsFrameTraversal.cpp b/mozilla/layout/base/nsFrameTraversal.cpp index 9d28c0e8198..2a688f6f1c5 100644 --- a/mozilla/layout/base/nsFrameTraversal.cpp +++ b/mozilla/layout/base/nsFrameTraversal.cpp @@ -350,7 +350,7 @@ nsLeafIterator::Next() parent = getLast(); if (!mExtensive) { - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -364,7 +364,7 @@ nsLeafIterator::Next() result = parent->GetNextSibling(); if (result) { parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -433,36 +433,33 @@ nsLeafIterator::Prev() if ( atom == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; } - if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) + result = grandParent->GetFirstChild(nsnull); + nsFrameList list(result); + result = list.GetPrevSiblingFor(parent); + if (result) { - - nsFrameList list(result); - result = list.GetPrevSiblingFor(parent); - if (result) + parent = result; + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while ((result = parent->GetNextSibling()) != nsnull) { parent = result; - while ((result = parent->GetNextSibling()) != nsnull) - { - parent = result; - } } - result = parent; + } + result = parent; + break; + } + else if (!(result = parent->GetParent())) + { + result = nsnull; + break; + } + else + { + parent = result; + if (mExtensive) break; - } - else if (!(result = parent->GetParent())) - { - result = nsnull; - break; - } - else - { - parent = result; - if (mExtensive) - break; - } } } else @@ -550,8 +547,7 @@ nsFocusIterator::GetParentFrame(nsIFrame* aFrame) nsIFrame* nsFocusIterator::GetFirstChild(nsIFrame* aFrame) { - nsIFrame* result = 0; - aFrame->FirstChild(mPresContext, nsnull, &result); + nsIFrame* result = aFrame->GetFirstChild(nsnull); if (result) result = GetRealFrame(result); @@ -586,9 +582,7 @@ nsFocusIterator::GetPrevSibling(nsIFrame* aFrame) if (placeholder) { nsIFrame* parent = GetParentFrame(placeholder); if (parent) { - nsIFrame* child = 0; - parent->FirstChild(mPresContext, nsnull, &child); - nsFrameList list(child); + nsFrameList list(parent->GetFirstChild(nsnull)); result = list.GetPrevSiblingFor(placeholder); result = GetRealFrame(result); } @@ -703,7 +697,7 @@ NS_IMETHODIMP nsIFrame *parent = getCurrent(); if (!parent) parent = getLast(); - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -714,13 +708,12 @@ NS_IMETHODIMP else { while(parent && !IsRootFrame(parent)) { nsIFrame *grandParent = parent->GetParent(); - if (grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); + if (grandParent) { + nsFrameList list(grandParent->GetFirstChild(nsnull)); result = list.GetNextVisualFor(parent); if (result){ parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) { + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } result = parent; @@ -759,13 +752,12 @@ NS_IMETHODIMP parent = getLast(); while(parent){ nsIFrame *grandParent = parent->GetParent(); - if (grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); + if (grandParent) { + nsFrameList list(grandParent->GetFirstChild(nsnull)); result = list.GetPrevVisualFor(parent); if (result){ parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){ + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; while ((result = parent->GetNextSibling()) != nsnull) { parent = result; diff --git a/mozilla/layout/base/nsLayoutUtils.cpp b/mozilla/layout/base/nsLayoutUtils.cpp index 6ac9e9a3afd..65dc2f6cdc3 100644 --- a/mozilla/layout/base/nsLayoutUtils.cpp +++ b/mozilla/layout/base/nsLayoutUtils.cpp @@ -64,10 +64,8 @@ GetFirstChildFrame(nsIPresContext* aPresContext, { NS_PRECONDITION(aFrame, "NULL frame pointer"); - nsIFrame* childFrame; - // Get the first child frame - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); // If the child frame is a pseudo-frame, then return its first child. // Note that the frame we create for the generated content is also a @@ -100,8 +98,7 @@ GetLastChildFrame(nsIPresContext* aPresContext, nsIFrame* lastInFlow = aFrame->GetLastInFlow(); // Get the last child frame - nsIFrame* firstChildFrame; - lastInFlow->FirstChild(aPresContext, nsnull, &firstChildFrame); + nsIFrame* firstChildFrame = lastInFlow->GetFirstChild(nsnull); if (firstChildFrame) { nsFrameList frameList(firstChildFrame); nsIFrame* lastChildFrame = frameList.LastChild(); diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 3c9eed64950..8ee706d3ae0 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -2647,18 +2647,17 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* // Ensure root frame is a viewport frame *aScrollFrame = nsnull; - nsIFrame* theFrame = nsnull; if (aRootFrame) { if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { // If child is scrollframe keep it (native) - aRootFrame->FirstChild(aPresContext, nsnull, &theFrame); + nsIFrame* theFrame = aRootFrame->GetFirstChild(nsnull); if (theFrame) { if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; // If the first child of that is scrollframe, use it instead (gfx) - theFrame->FirstChild(aPresContext, nsnull, &theFrame); + theFrame = theFrame->GetFirstChild(nsnull); if (theFrame) { if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; @@ -3306,8 +3305,8 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) frameType = frame->GetType(); if (frameType != nsLayoutAtoms::areaFrame) { - result = frame->FirstChild(mPresContext, nsnull, &frame); - if (NS_FAILED(result) || !frame) + frame = frame->GetFirstChild(nsnull); + if (!frame) break; } }while(frameType != nsLayoutAtoms::areaFrame); @@ -3496,12 +3495,11 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const } nsIFrame* rootFrame; - nsIFrame* child; nsIPageSequenceFrame* pageSequence = nsnull; // The page sequence frame is the child of the rootFrame mFrameManager->GetRootFrame(&rootFrame); - rootFrame->FirstChild(mPresContext, nsnull, &child); + nsIFrame* child = rootFrame->GetFirstChild(nsnull); if (nsnull != child) { @@ -3515,7 +3513,7 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const } else { nsCOMPtr ppContext = do_QueryInterface(mPresContext); if (ppContext) { - child->FirstChild(mPresContext, nsnull, &child); + child = child->GetFirstChild(nsnull); } } @@ -5129,7 +5127,7 @@ PresShell::FlushPendingNotifications(PRBool aUpdateViews) ProcessReflowCommands(PR_FALSE); if (aUpdateViews && mViewManager) { - mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); + mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); } } @@ -6708,9 +6706,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, nsIAtom* listName = nsnull; PRInt32 listIndex = 0; do { - nsIFrame* k1, *k2; - aFirstFrame->FirstChild(aFirstPresContext, listName, &k1); - aSecondFrame->FirstChild(aSecondPresContext, listName, &k2); + nsIFrame* k1 = aFirstFrame->GetFirstChild(listName); + nsIFrame* k2 = aSecondFrame->GetFirstChild(listName); PRInt32 l1 = nsContainerFrame::LengthOf(k1); PRInt32 l2 = nsContainerFrame::LengthOf(k2); if (l1 != l2) { @@ -6897,12 +6894,9 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!ok && (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags))) { break; } - NS_IF_RELEASE(listName); - nsIAtom* listName1; - nsIAtom* listName2; - aFirstFrame->GetAdditionalChildListName(listIndex, &listName1); - aSecondFrame->GetAdditionalChildListName(listIndex, &listName2); + nsIAtom* listName1 = aFirstFrame->GetAdditionalChildListName(listIndex); + nsIAtom* listName2 = aSecondFrame->GetAdditionalChildListName(listIndex); listIndex++; if (listName1 != listName2) { if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { @@ -6924,11 +6918,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, else fputs("(null)", stdout); printf("\n"); - NS_IF_RELEASE(listName1); - NS_IF_RELEASE(listName2); break; } - NS_IF_RELEASE(listName2); listName = listName1; } while (ok && (listName != nsnull)); @@ -6952,8 +6943,7 @@ FindTopFrame(nsIFrame* aRoot) } // Try one of the children - nsIFrame* kid; - aRoot->FirstChild(nsnull, &kid); + nsIFrame* kid = aRoot->GetFirstChild(nsnull); while (nsnull != kid) { nsIFrame* result = FindTopFrame(kid); if (nsnull != result) { @@ -7698,8 +7688,7 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext, nsMemory::Free(name); } - nsIFrame * child; - aParentFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aParentFrame->GetFirstChild(nsnull); while (child) { RecurseIndiTotals(aPresContext, aHT, child, aLevel+1); child = child->GetNextSibling(); diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 314c1812301..73b0c2d9302 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -669,23 +669,18 @@ public: * * Note that the list is only the additional named child lists and does not * include the unnamed principal child list. - * - * @return NS_ERROR_INVALID_ARG if the index is < 0 and NS_OK otherwise */ - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const = 0; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const = 0; /** * Get the first child frame from the specified child list. * * @param aListName the name of the child list. A NULL pointer for the atom * name means the unnamed principal child list - * @return NS_ERROR_INVALID_ARG if there is no child list with the specified name + * @return the child frame, or NULL if there is no such child * @see #GetAdditionalListName() */ - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const = 0; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const = 0; /** * Child frames are linked together in a singly-linked list diff --git a/mozilla/layout/base/src/nsBidiPresUtils.cpp b/mozilla/layout/base/src/nsBidiPresUtils.cpp index 1ffb868e971..105315cf71a 100644 --- a/mozilla/layout/base/src/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/src/nsBidiPresUtils.cpp @@ -367,7 +367,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, { nsIFrame* frame; nsIFrame* directionalFrame; - nsIFrame* kid; nsresult rv; nsresult res = NS_OK; @@ -412,7 +411,7 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext, || (nsLayoutAtoms::positionedInlineFrame == frameType) || (nsLayoutAtoms::letterFrame == frameType) || (nsLayoutAtoms::blockFrame == frameType) ) ) { - frame->FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = frame->GetFirstChild(nsnull); res = InitLogicalArray(aPresContext, kid, aNextInFlow, aAddMarkers); } else { @@ -702,11 +701,10 @@ nsBidiPresUtils::RepositionContainerFrame(nsIPresContext* aPresContext, PRInt32& aMaxX) const { nsIFrame* frame; - nsIFrame* firstChild; PRInt32 minX = 0x7FFFFFFF; PRInt32 maxX = 0; - aContainer->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aContainer->GetFirstChild(nsnull); for (frame = firstChild; frame; frame = frame->GetNextSibling()) { nsIAtom* frameType = frame->GetType(); diff --git a/mozilla/layout/base/src/nsFrameTraversal.cpp b/mozilla/layout/base/src/nsFrameTraversal.cpp index 9d28c0e8198..2a688f6f1c5 100644 --- a/mozilla/layout/base/src/nsFrameTraversal.cpp +++ b/mozilla/layout/base/src/nsFrameTraversal.cpp @@ -350,7 +350,7 @@ nsLeafIterator::Next() parent = getLast(); if (!mExtensive) { - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -364,7 +364,7 @@ nsLeafIterator::Next() result = parent->GetNextSibling(); if (result) { parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -433,36 +433,33 @@ nsLeafIterator::Prev() if ( atom == nsLayoutAtoms::scrollFrame ) return NS_ERROR_FAILURE; } - if (NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))) + result = grandParent->GetFirstChild(nsnull); + nsFrameList list(result); + result = list.GetPrevSiblingFor(parent); + if (result) { - - nsFrameList list(result); - result = list.GetPrevSiblingFor(parent); - if (result) + parent = result; + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while ((result = parent->GetNextSibling()) != nsnull) { parent = result; - while ((result = parent->GetNextSibling()) != nsnull) - { - parent = result; - } } - result = parent; + } + result = parent; + break; + } + else if (!(result = parent->GetParent())) + { + result = nsnull; + break; + } + else + { + parent = result; + if (mExtensive) break; - } - else if (!(result = parent->GetParent())) - { - result = nsnull; - break; - } - else - { - parent = result; - if (mExtensive) - break; - } } } else @@ -550,8 +547,7 @@ nsFocusIterator::GetParentFrame(nsIFrame* aFrame) nsIFrame* nsFocusIterator::GetFirstChild(nsIFrame* aFrame) { - nsIFrame* result = 0; - aFrame->FirstChild(mPresContext, nsnull, &result); + nsIFrame* result = aFrame->GetFirstChild(nsnull); if (result) result = GetRealFrame(result); @@ -586,9 +582,7 @@ nsFocusIterator::GetPrevSibling(nsIFrame* aFrame) if (placeholder) { nsIFrame* parent = GetParentFrame(placeholder); if (parent) { - nsIFrame* child = 0; - parent->FirstChild(mPresContext, nsnull, &child); - nsFrameList list(child); + nsFrameList list(parent->GetFirstChild(nsnull)); result = list.GetPrevSiblingFor(placeholder); result = GetRealFrame(result); } @@ -703,7 +697,7 @@ NS_IMETHODIMP nsIFrame *parent = getCurrent(); if (!parent) parent = getLast(); - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } @@ -714,13 +708,12 @@ NS_IMETHODIMP else { while(parent && !IsRootFrame(parent)) { nsIFrame *grandParent = parent->GetParent(); - if (grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); + if (grandParent) { + nsFrameList list(grandParent->GetFirstChild(nsnull)); result = list.GetNextVisualFor(parent); if (result){ parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result) { + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; } result = parent; @@ -759,13 +752,12 @@ NS_IMETHODIMP parent = getLast(); while(parent){ nsIFrame *grandParent = parent->GetParent(); - if (grandParent && - NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){ - nsFrameList list(result); + if (grandParent) { + nsFrameList list(grandParent->GetFirstChild(nsnull)); result = list.GetPrevVisualFor(parent); if (result){ parent = result; - while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){ + while (nsnull != (result = parent->GetFirstChild(nsnull))) { parent = result; while ((result = parent->GetNextSibling()) != nsnull) { parent = result; diff --git a/mozilla/layout/base/src/nsLayoutUtils.cpp b/mozilla/layout/base/src/nsLayoutUtils.cpp index 6ac9e9a3afd..65dc2f6cdc3 100644 --- a/mozilla/layout/base/src/nsLayoutUtils.cpp +++ b/mozilla/layout/base/src/nsLayoutUtils.cpp @@ -64,10 +64,8 @@ GetFirstChildFrame(nsIPresContext* aPresContext, { NS_PRECONDITION(aFrame, "NULL frame pointer"); - nsIFrame* childFrame; - // Get the first child frame - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); // If the child frame is a pseudo-frame, then return its first child. // Note that the frame we create for the generated content is also a @@ -100,8 +98,7 @@ GetLastChildFrame(nsIPresContext* aPresContext, nsIFrame* lastInFlow = aFrame->GetLastInFlow(); // Get the last child frame - nsIFrame* firstChildFrame; - lastInFlow->FirstChild(aPresContext, nsnull, &firstChildFrame); + nsIFrame* firstChildFrame = lastInFlow->GetFirstChild(nsnull); if (firstChildFrame) { nsFrameList frameList(firstChildFrame); nsIFrame* lastChildFrame = frameList.LastChild(); diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 884bb623dbb..63f9aeacd86 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -1364,8 +1364,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, } else { nsIFrame * plainLstFrame; if (NS_SUCCEEDED(mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void**)&plainLstFrame))) { - nsIFrame * frame; - plainLstFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame * frame = plainLstFrame->GetFirstChild(nsnull); nsIScrollableFrame * scrollFrame; if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) { plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); @@ -2257,17 +2256,13 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext) } -NS_IMETHODIMP -nsComboboxControlFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsComboboxControlFrame::GetFirstChild(nsIAtom* aListName) const { if (nsLayoutAtoms::popupList == aListName) { - *aFirstChild = mPopupFrames.FirstChild(); - } else { - nsAreaFrame::FirstChild(aPresContext, aListName, aFirstChild); + return mPopupFrames.FirstChild(); } - return NS_OK; + return nsAreaFrame::GetFirstChild(aListName); } NS_IMETHODIMP @@ -2298,25 +2293,21 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex) const { // Maintain a separate child list for the dropdown list (i.e. popup listbox) // This is necessary because we don't want the listbox to be included in the layout // of the combox's children because it would take up space, when it is suppose to // be floating above the display. - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); if (aIndex <= NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX) { - return nsAreaFrame::GetAdditionalChildListName(aIndex, aListName); + return nsAreaFrame::GetAdditionalChildListName(aIndex); } - *aListName = nsnull; if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) { - *aListName = nsLayoutAtoms::popupList; - NS_ADDREF(*aListName); + return nsLayoutAtoms::popupList; } - return NS_OK; + return nsnull; } PRIntn diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index cb6b7aeddf2..03ccf92bd0d 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -131,14 +131,11 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif NS_IMETHOD Destroy(nsIPresContext* aPresContext); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index c0aae057c64..8ff6c1e7468 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -366,8 +366,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, if (NS_SUCCEEDED(rv) && mTextFrame != nsnull) { const nsStyleVisibility* vis = GetStyleVisibility(); - nsIFrame * child; - FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = GetFirstChild(nsnull); if (child == mTextFrame) { child = child->GetNextSibling(); } @@ -441,8 +440,7 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* nsNewFrame* result = nsnull; #ifndef DEBUG_NEWFRAME // find the text control frame. - nsIFrame* childFrame = nsnull; - aStart->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aStart->GetFirstChild(nsnull); while (childFrame) { // see if the child is a text control diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 4e840a25bc3..c2cde8821c1 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -611,7 +611,8 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer if (!childframe) { // The only way we can get right here is that there are no options // and we need to get the dummy frame so it has the focus ring - result = containerFrame->FirstChild(mPresContext, nsnull, &childframe); + childframe = containerFrame->GetFirstChild(nsnull); + result = NS_OK; } } @@ -853,8 +854,7 @@ static nscoord GetMaxOptionHeight(nsIPresContext *aPresContext, nsIFrame *aContainer) { nscoord result = 0; - nsIFrame *option; - for (aContainer->FirstChild(aPresContext, nsnull, &option); + for (nsIFrame* option = aContainer->GetFirstChild(nsnull); option; option = option->GetNextSibling()) { nscoord optionHeight; if (nsCOMPtr diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 9de0749c6d9..e1e8d2bc195 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -3035,8 +3035,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext, if (mEditor) mEditor->PostCreate(); //look for scroll view below this frame go along first child list - nsIFrame *first; - FirstChild(aPresContext,nsnull, &first); + nsIFrame* first = GetFirstChild(nsnull); // Mark the scroll frame as being a reflow root. This will allow // incremental reflows to be initiated at the scroll frame, rather @@ -3078,7 +3077,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext, break; } } - first->FirstChild(aPresContext,nsnull, &first); + first = first->GetFirstChild(nsnull); } return rv; diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 9d08906c024..e96a7aa7aac 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -403,12 +403,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con nsIAtom* listName = nsnull; PRInt32 listIndex = 0; for (;;) { - nsIFrame* kid; - GetAdditionalChildListName(listIndex++, &listName); + listName = GetAdditionalChildListName(listIndex++); if (nsnull == listName) { break; } - FirstChild(aPresContext, listName, &kid); + nsIFrame* kid = GetFirstChild(listName); if (kid) { IndentBy(out, aIndent); nsAutoString tmp; @@ -428,7 +427,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); } - NS_IF_RELEASE(listName); } aIndent--; @@ -454,71 +452,47 @@ nsBlockFrame::GetType() const ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsBlockFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsBlockFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (mAbsoluteContainer.GetChildListName() == aListName) { - return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild); + nsIFrame* result = nsnull; + mAbsoluteContainer.FirstChild(this, aListName, &result); + return result; } else if (nsnull == aListName) { - *aFirstChild = (mLines.empty()) ? nsnull : mLines.front()->mFirstChild; - return NS_OK; + return (mLines.empty()) ? nsnull : mLines.front()->mFirstChild; } else if (aListName == nsLayoutAtoms::overflowList) { - nsLineList* overflowLines = GetOverflowLines(aPresContext, PR_FALSE); - *aFirstChild = overflowLines - ? overflowLines->front()->mFirstChild - : nsnull; - return NS_OK; + nsLineList* overflowLines = GetOverflowLines(GetPresContext(), PR_FALSE); + return overflowLines ? overflowLines->front()->mFirstChild : nsnull; } else if (aListName == nsLayoutAtoms::floatList) { - *aFirstChild = mFloats.FirstChild(); - return NS_OK; + return mFloats.FirstChild(); } else if (aListName == nsLayoutAtoms::bulletList) { if (HaveOutsideBullet()) { - *aFirstChild = mBullet; + return mBullet; } - else { - *aFirstChild = nsnull; - } - return NS_OK; } - *aFirstChild = nsnull; - return NS_ERROR_INVALID_ARG; + return nsnull; } -NS_IMETHODIMP -nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; - } - *aListName = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOAT_LIST_INDEX: - *aListName = nsLayoutAtoms::floatList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::floatList; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - *aListName = nsLayoutAtoms::bulletList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::bulletList; case NS_BLOCK_FRAME_OVERFLOW_LIST_INDEX: - *aListName = nsLayoutAtoms::overflowList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::overflowList; case NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX: - *aListName = mAbsoluteContainer.GetChildListName(); - NS_ADDREF(*aListName); - break; + return mAbsoluteContainer.GetChildListName(); + default: + return nsnull; } - return NS_OK; } NS_IMETHODIMP @@ -3688,7 +3662,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, // Break-after cases if (breakType == NS_STYLE_CLEAR_LINE) { if (!aLineLayout.GetLineEndsInBR()) { - breakType = NS_STYLE_CLEAR_NONE; +#ifdef DEBUG_roc + // breakType = NS_STYLE_CLEAR_NONE; +#endif } } aLine->SetBreakType(breakType); diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index cab4616aa71..f0d6d070f16 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -119,11 +119,8 @@ public: nsIPresShell& aPresShell, nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index c02c078e9dd..83197b97592 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -1700,8 +1700,7 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest, // The bullet frame is not in a line list so marking it dirty // has no effect. The reflowing of the bullet frame is done // indirectly. - nsIFrame* frame = nsnull; - mParent->FirstChild(mPresContext, nsnull, &frame); + nsIFrame* frame = mParent->GetFirstChild(nsnull); NS_ASSERTION(frame, "No frame to mark dirty for bullet frame."); if (frame) { frame->AddStateBits(NS_FRAME_IS_DIRTY); diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 677fcc78fab..ca46fa52941 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -144,39 +144,28 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext) ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsContainerFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsContainerFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); // We only know about the unnamed principal child list and the overflow // list if (nsnull == aListName) { - *aFirstChild = mFrames.FirstChild(); - return NS_OK; + return mFrames.FirstChild(); } else if (nsLayoutAtoms::overflowList == aListName) { - *aFirstChild = GetOverflowFrames(aPresContext, PR_FALSE); - return NS_OK; + return GetOverflowFrames(GetPresContext(), PR_FALSE); } else { - *aFirstChild = nsnull; - return NS_ERROR_INVALID_ARG; + return nsnull; } } -NS_IMETHODIMP -nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - NS_ENSURE_TRUE(aIndex >= 0, NS_ERROR_INVALID_ARG); if (aIndex == 0) { - *aListName = nsLayoutAtoms::overflowList; - NS_ADDREF(*aListName); + return nsLayoutAtoms::overflowList; } else { - *aListName = nsnull; + return nsnull; } - return NS_OK; } ///////////////////////////////////////////////////////////////////////////// @@ -315,7 +304,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, PRBool aConsiderSelf, nsIFrame** aFrame) { - nsIFrame *kid, *hit; + nsIFrame *hit; nsPoint tmp; PRBool inThisFrame = mRect.Contains(aPoint); @@ -324,7 +313,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; } - FirstChild(aPresContext, aList, &kid); + nsIFrame* kid = GetFirstChild(aList); *aFrame = nsnull; tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); @@ -366,12 +355,10 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext, nsIFrame* aNewFrame) { nsIFrame* prevFrame; - nsIFrame* firstChild; nsresult rv; // Get the old frame's previous sibling frame - FirstChild(aPresContext, aListName, &firstChild); - nsFrameList frames(firstChild); + nsFrameList frames(GetFirstChild(aListName)); NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame"); prevFrame = frames.GetPrevSiblingFor(aOldFrame); @@ -993,8 +980,7 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, do { // Recursively walk aFrame's child frames - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { // Position the frame's view (if it has one) and recursively // process its children @@ -1005,9 +991,8 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); - } while (childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); + } while (childListName); } /** @@ -1304,8 +1289,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) PRInt32 listIndex = 0; PRBool outputOneList = PR_FALSE; do { - nsIFrame* kid; - FirstChild(aPresContext, listName, &kid); + nsIFrame* kid = GetFirstChild(listName); if (nsnull != kid) { if (outputOneList) { IndentBy(out, aIndent); @@ -1331,8 +1315,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) IndentBy(out, aIndent); fputs(">\n", out); } - NS_IF_RELEASE(listName); - GetAdditionalChildListName(listIndex++, &listName); + listName = GetAdditionalChildListName(listIndex++); } while(nsnull != listName); if (!outputOneList) { diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index 0324bf18380..9a23184ca4b 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -62,11 +62,8 @@ public: NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index 5ce2fb60d0a..d1fbfd6e0b1 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -169,10 +169,7 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang { if (aSelected && ParentDisablesSelection()) return NS_OK; - nsIFrame *child; - nsresult result = FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result)) - return NS_OK; + nsIFrame *child = GetFirstChild(nsnull); while (child) { child->SetSelected(aPresContext, aRange, aSelected, aSpread); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index dad87ba4c4c..5e0d88b6329 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -696,21 +696,17 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex, // Child frame enumeration -NS_IMETHODIMP -nsFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const +nsIAtom* +nsFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); NS_PRECONDITION(aIndex >= 0, "invalid index number"); - *aListName = nsnull; - return aIndex < 0 ? NS_ERROR_INVALID_ARG : NS_OK; + return nsnull; } -NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsFrame::GetFirstChild(nsIAtom* aListName) const { - *aFirstChild = nsnull; - return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG; + return nsnull; } PRInt16 @@ -776,7 +772,7 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr ForceDrawFrame(aPresContext, (nsFrame *)aFrame); } - aFrame->FirstChild(aPresContext, nsnull, &aFrame); + aFrame = aFrame->GetFirstChild(nsnull); while (aFrame) { RefreshAllContentFrames(aPresContext, aFrame, aContent); aFrame = aFrame->GetNextSibling(); @@ -1936,22 +1932,17 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, PRInt32& aContentOffsetEnd, PRBool& aBeginFrameContent) { - nsresult result = NS_ERROR_FAILURE; - if (!aNewContent) return NS_ERROR_NULL_POINTER; // Traverse through children and look for the best one to give this // to if it fails the getposition call, make it yourself also only // look at primary list - nsIFrame *kid = nsnull; nsIFrame *closestFrame = nsnull; - nsIView *view = GetClosestView(); + nsIFrame *kid = GetFirstChild(nsnull); - result = FirstChild(aCX, nsnull, &kid); - - if (NS_SUCCEEDED(result) && nsnull != kid) { + if (kid) { #define HUGE_DISTANCE 999999 //some HUGE number that will always fail first comparison PRInt32 closestXDistance = HUGE_DISTANCE; @@ -2102,7 +2093,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, aContentOffsetEnd = aContentOffset; } } - return result; + return NS_OK; } NS_IMETHODIMP @@ -2919,8 +2910,8 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 nsIAtom* list = nsnull; PRInt32 listIndex = 0; do { - nsresult rv = FirstChild(aPresContext, list, &kid); - if (NS_SUCCEEDED(rv) && (nsnull != kid)) { + kid = GetFirstChild(list); + if (kid) { IndentBy(out, aIndent); if (nsnull != list) { nsAutoString listName; @@ -2946,8 +2937,7 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 IndentBy(out, aIndent); fprintf(out, "\n"); } - NS_IF_RELEASE(list); - GetAdditionalChildListName(listIndex++, &list); + list = GetAdditionalChildListName(listIndex++); } while (nsnull != list); } @@ -2975,16 +2965,12 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a if (!selectable) return NS_OK; -/* nsresult rv; - +/* if (eSpreadDown == aSpread){ - nsIFrame* kid; - rv = FirstChild(nsnull, &kid); - if (NS_SUCCEEDED(rv)) { - while (nsnull != kid) { - kid->SetSelected(nsnull,aSelected,aSpread); - kid = kid->GetNextSibling(); - } + nsIFrame* kid = GetFirstChild(nsnull); + while (nsnull != kid) { + kid->SetSelected(nsnull,aSelected,aSpread); + kid = kid->GetNextSibling(); } } */ @@ -3742,12 +3728,12 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) PRBool searchTableBool = PR_FALSE; if (aPos->mResultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { - nsIFrame *frame = aPos->mResultFrame; - result = frame->FirstChild(aPresContext, nsnull,&frame); + nsIFrame *frame = aPos->mResultFrame->GetFirstChild(nsnull); + result = NS_OK; //got the table frame now while(frame) //ok time to drill down to find iterator { - result = frame->FirstChild(aPresContext, nsnull,&frame); + frame = frame->GetFirstChild(nsnull); if (frame && NS_SUCCEEDED(result)) { result = frame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator), @@ -4381,8 +4367,7 @@ GetNextSiblingAcrossLines(nsIPresContext *aPresContext, nsIFrame *aFrame) aFrame->GetParent()->GetNextInFlow(&parent); if (!parent) return nsnull; - parent->FirstChild(aPresContext, nsnull, &result); - return result; + return parent->GetFirstChild(nsnull); } /** @@ -4413,7 +4398,7 @@ GetCorrectedParent(nsIPresContext* aPresContext, nsIFrame* aFrame, // Use the wrapped frame, which is after the |:before|. parent = GetNextSiblingAcrossLines(aPresContext, aFrame); } else if (pseudo == nsCSSPseudoElements::after) { - parent->GetFirstInFlow()->FirstChild(aPresContext, nsnull, &parent); + parent = parent->GetFirstInFlow()->GetFirstChild(nsnull); // Now we have either the wrapped frame or the :before, but we // want the wrapped frame. if (parent->GetStyleContext()->GetPseudoType() == @@ -4499,11 +4484,10 @@ nsFrame::GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame) if (!aFrame || !*aFrame) return; nsIFrame *child = *aFrame; - nsresult result; //if we are a block frame then go for the last line of 'this' while (1){ - result = child->FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result) || !child) + child = child->GetFirstChild(nsnull); + if (!child) return;//nothing to do while (child->GetNextSibling()) child = child->GetNextSibling(); @@ -4518,10 +4502,9 @@ nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame) if (!aFrame || !*aFrame) return; nsIFrame *child = *aFrame; - nsresult result; while (1){ - result = child->FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result) || !child) + child = child->GetFirstChild(nsnull); + if (!child) return;//nothing to do *aFrame = child; } @@ -5323,7 +5306,7 @@ void DR_State::PrettyUC(nscoord aSize, strcpy(aBuf, "UC"); } else { - if(0xdeadbeefU == aSize) + if ((nscoord)0xdeadbeefU == aSize) { strcpy(aBuf, "deadbeef"); } diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index ece5e9ce3a1..cc40f451755 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -186,10 +186,8 @@ public: virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const; virtual void SetAdditionalStyleContext(PRInt32 aIndex, nsStyleContext* aStyleContext); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index d7e669f8014..5602e074c72 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -462,8 +462,7 @@ void nsGfxScrollFrame::ReloadChildFrames(nsIPresContext* aPresContext) mInner->mVScrollbarBox = nsnull; mInner->mScrollCornerBox = nsnull; - nsIFrame* frame = nsnull; - FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = GetFirstChild(nsnull); while (frame) { PRBool understood = PR_FALSE; @@ -1633,10 +1632,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) 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; - if (NS_SUCCEEDED(parentFrame->FirstChild(mOuter->mPresContext, - nsLayoutAtoms::fixedList, &child)) && child) { - + if (parentFrame->GetFirstChild(nsLayoutAtoms::fixedList)) { // force a reflow of the fixed children nsFrame::CreateAndPostReflowCommand(mOuter->mPresContext->PresShell(), parentFrame, diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index cca7fd0369b..c330b08b9ed 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -228,9 +228,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext, static PRBool HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) { - nsIFrame* kid = nsnull; - - for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; + for (nsIFrame* kid = aParent->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) { if (kid->GetType() == nsLayoutAtoms::textFrame) { @@ -364,21 +362,18 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, aViewManager->InsertChild(aNewParentView, view, insertBefore, insertBefore != nsnull); } else { PRInt32 listIndex = 0; - nsCOMPtr listName; + nsIAtom* listName = nsnull; // This loop iterates through every child list name, and also // executes once with listName == nsnull. do { - aFrame->GetAdditionalChildListName(listIndex, getter_AddRefs(listName)); - listIndex++; - // Iterate the child frames, and check each child frame to see if it has // a view - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, listName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(listName); for (; childFrame; childFrame = childFrame->GetNextSibling()) { ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); } + listName = aFrame->GetAdditionalChildListName(listIndex++); } while (listName); } @@ -400,9 +395,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // see if we can trivially detect that no work needs to be done if (!aChildFrame->HasView()) { // Child frame doesn't have a view. See if it has any child frames - nsIFrame* firstChild; - aChildFrame->FirstChild(aPresContext, nsnull, &firstChild); - if (!firstChild) { + if (!aChildFrame->GetFirstChild(nsnull)) { return NS_OK; } } diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index ddc58db8608..153cfa896d8 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -428,11 +428,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, nsresult rv = aPresContext->GetEventStateManager(getter_AddRefs(stateManager)); if (NS_SUCCEEDED(rv)) { nsIFrame * parentFrame = GetParent(); - nsIScrollableFrame* scrollableFrame; - if (NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollableFrame))) { - nscoord width, height; - scrollableFrame->GetClipSize(aPresContext, &width, &height); - } nsIView* parentView = parentFrame->GetView(); nsIScrollableView* scrollableView; @@ -653,12 +648,11 @@ CanvasFrame::HandleEvent(nsIPresContext* aPresContext, aEvent->message == NS_MOUSE_MIDDLE_BUTTON_UP || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_MOVE ) { - nsIFrame *firstChild; - nsresult rv = FirstChild(aPresContext,nsnull,&firstChild); + nsIFrame *firstChild = GetFirstChild(nsnull); //canvas frame needs to pass mouse events to its area frame so that mouse movement //and selection code will work properly. this will still have the necessary effects //that would have happened if nsFrame::HandleEvent was called. - if (NS_SUCCEEDED(rv) && firstChild) + if (firstChild) firstChild->HandleEvent(aPresContext, aEvent, aEventStatus); else nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus); diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 314c1812301..73b0c2d9302 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -669,23 +669,18 @@ public: * * Note that the list is only the additional named child lists and does not * include the unnamed principal child list. - * - * @return NS_ERROR_INVALID_ARG if the index is < 0 and NS_OK otherwise */ - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const = 0; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const = 0; /** * Get the first child frame from the specified child list. * * @param aListName the name of the child list. A NULL pointer for the atom * name means the unnamed principal child list - * @return NS_ERROR_INVALID_ARG if there is no child list with the specified name + * @return the child frame, or NULL if there is no such child * @see #GetAdditionalListName() */ - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const = 0; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const = 0; /** * Child frames are linked together in a singly-linked list diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 9eca9def29b..8f255f8b42c 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -685,9 +685,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext, } else { - nsIFrame *child; - aFrame->FirstChild(aPresContext, nsnull, &child); - if (child) + if (aFrame->GetFirstChild(nsnull)) { // aFrame is an inline container frame, check my frame state if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) { SetContainsPercentAwareChild(aInline); // if a child container is effected, so am I @@ -1189,30 +1187,25 @@ nsPositionedInlineFrame::ReplaceFrame(nsIPresContext* aPresContext, } } -NS_IMETHODIMP -nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - *aListName = nsnull; if (0 == aIndex) { - *aListName = mAbsoluteContainer.GetChildListName(); - NS_ADDREF(*aListName); + return mAbsoluteContainer.GetChildListName(); } - return NS_OK; + return nsnull; } -NS_IMETHODIMP -nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsPositionedInlineFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (mAbsoluteContainer.GetChildListName() == aListName) { - return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild); + nsIFrame* result = nsnull; + mAbsoluteContainer.FirstChild(this, aListName, &result); + return result; } - return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsInlineFrame::GetFirstChild(aListName); } nsIAtom* diff --git a/mozilla/layout/generic/nsInlineFrame.h b/mozilla/layout/generic/nsInlineFrame.h index 0f89726b9e0..486d82527da 100644 --- a/mozilla/layout/generic/nsInlineFrame.h +++ b/mozilla/layout/generic/nsInlineFrame.h @@ -233,12 +233,9 @@ public: nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 7ebcfbff186..343af0d520c 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -98,9 +98,8 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra sizes += aFrame.GetSize().width; } else { // see if there are children to process - nsIFrame* child = nsnull; // XXX: process alternate child lists? - aFrame.FirstChild(&aPresContext,nsnull,&child); + nsIFrame* child = aFrame.GetFirstChild(nsnull); while (child) { // recurse: note that we already know we are in a child frame, so no need to track further sizes += AccumulateImageSizes(aPresContext, *child); @@ -1652,8 +1651,7 @@ PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame) } else { - nsIFrame *child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame *child = aFrame->GetFirstChild(nsnull); if (child) { // aFrame is an inline container frame, check my frame state if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) { @@ -3176,8 +3174,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame) if (! canContinue) return nsnull; - nsIFrame* child; - next->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = next->GetFirstChild(nsnull); if (! child) break; diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index bdc62142425..77ceb103c21 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -2003,8 +2003,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext, { NS_ENSURE_ARG_POINTER(outFrame); - nsIFrame * child; - aRoot->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aRoot->GetFirstChild(nsnull); while (child) { *outFrame = nsnull; diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index d45ba7817ec..49750ab488a 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -2209,19 +2209,18 @@ nsSelection::GetPrevNextBidiLevels(nsIPresContext *aPresContext, } // GetFirstLeaf - nsIFrame *lookahead = nsnull; + nsIFrame *lookahead; while (1) { - result = firstFrame->FirstChild(aPresContext, nsnull, &lookahead); - if (NS_FAILED(result) || !lookahead) + lookahead = firstFrame->GetFirstChild(nsnull); + if (!lookahead) break; //nothing to do firstFrame = lookahead; } // GetLastLeaf - lookahead = nsnull; while (1) { - result = lastFrame->FirstChild(aPresContext, nsnull, &lookahead); - if (NS_FAILED(result) || !lookahead) + lookahead = lastFrame->GetFirstChild(nsnull); + if (!lookahead) break; //nothing to do lastFrame = lookahead; while ((lookahead = lastFrame->GetNextSibling()) != nsnull) diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 15f96995069..04ffe4cb254 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -865,8 +865,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) nsRect containerRect; if (mSelectionHeight > -1) { nsIFrame* childFrame = mFrames.FirstChild(); - nsIFrame* conFrame; - childFrame->FirstChild(aPresContext, nsnull, &conFrame); + nsIFrame* conFrame = childFrame->GetFirstChild(nsnull); containerView = conFrame->GetView(); NS_ASSERTION(containerView, "Container view can't be null!"); containerRect = containerView->GetBounds(); diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 992c16aa1b4..7d3b36d2fbf 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -1964,9 +1964,8 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC nsIFrame *grandParent = parent->GetParent(); if (grandParent) { - nsIFrame *firstParent; - nsresult rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); - if (NS_SUCCEEDED(rv) && firstParent) + nsIFrame *firstParent = grandParent->GetFirstChild(nsnull); + if (firstParent) { *aLength = 0; if (firstParent == parent) //then our parent is the first child of granddad. use BEFORE @@ -1979,7 +1978,7 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC } } else - return rv; + return NS_OK; } } } diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index a7092510bc2..ec91a3d2ca9 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -162,37 +162,28 @@ ViewportFrame::RemoveFrame(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(aListName, "null OUT parameter pointer"); - NS_PRECONDITION(aIndex >= 0, "illegal index"); - - *aListName = nsnull; - - nsresult rv = NS_OK; + NS_PRECONDITION(aIndex >= 0, "illegal index"); if (0 == aIndex) { - *aListName = mFixedContainer.GetChildListName(); - NS_ADDREF(*aListName); + return mFixedContainer.GetChildListName(); } - return rv; + return nsnull; } -NS_IMETHODIMP -ViewportFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +ViewportFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(aFirstChild, "null OUT parameter pointer"); if (mFixedContainer.GetChildListName() == aListName) { - mFixedContainer.FirstChild(this, aListName, aFirstChild); - return NS_OK; + nsIFrame* result = nsnull; + mFixedContainer.FirstChild(this, aListName, &result); + return result; } - return nsContainerFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsContainerFrame::GetFirstChild(aListName); } void diff --git a/mozilla/layout/generic/nsViewportFrame.h b/mozilla/layout/generic/nsViewportFrame.h index c6a9d4f47f5..94685f0f949 100644 --- a/mozilla/layout/generic/nsViewportFrame.h +++ b/mozilla/layout/generic/nsViewportFrame.h @@ -92,12 +92,9 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 9d08906c024..e96a7aa7aac 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -403,12 +403,11 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con nsIAtom* listName = nsnull; PRInt32 listIndex = 0; for (;;) { - nsIFrame* kid; - GetAdditionalChildListName(listIndex++, &listName); + listName = GetAdditionalChildListName(listIndex++); if (nsnull == listName) { break; } - FirstChild(aPresContext, listName, &kid); + nsIFrame* kid = GetFirstChild(listName); if (kid) { IndentBy(out, aIndent); nsAutoString tmp; @@ -428,7 +427,6 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); fputs(">\n", out); } - NS_IF_RELEASE(listName); } aIndent--; @@ -454,71 +452,47 @@ nsBlockFrame::GetType() const ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsBlockFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsBlockFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (mAbsoluteContainer.GetChildListName() == aListName) { - return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild); + nsIFrame* result = nsnull; + mAbsoluteContainer.FirstChild(this, aListName, &result); + return result; } else if (nsnull == aListName) { - *aFirstChild = (mLines.empty()) ? nsnull : mLines.front()->mFirstChild; - return NS_OK; + return (mLines.empty()) ? nsnull : mLines.front()->mFirstChild; } else if (aListName == nsLayoutAtoms::overflowList) { - nsLineList* overflowLines = GetOverflowLines(aPresContext, PR_FALSE); - *aFirstChild = overflowLines - ? overflowLines->front()->mFirstChild - : nsnull; - return NS_OK; + nsLineList* overflowLines = GetOverflowLines(GetPresContext(), PR_FALSE); + return overflowLines ? overflowLines->front()->mFirstChild : nsnull; } else if (aListName == nsLayoutAtoms::floatList) { - *aFirstChild = mFloats.FirstChild(); - return NS_OK; + return mFloats.FirstChild(); } else if (aListName == nsLayoutAtoms::bulletList) { if (HaveOutsideBullet()) { - *aFirstChild = mBullet; + return mBullet; } - else { - *aFirstChild = nsnull; - } - return NS_OK; } - *aFirstChild = nsnull; - return NS_ERROR_INVALID_ARG; + return nsnull; } -NS_IMETHODIMP -nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; - } - *aListName = nsnull; switch (aIndex) { case NS_BLOCK_FRAME_FLOAT_LIST_INDEX: - *aListName = nsLayoutAtoms::floatList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::floatList; case NS_BLOCK_FRAME_BULLET_LIST_INDEX: - *aListName = nsLayoutAtoms::bulletList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::bulletList; case NS_BLOCK_FRAME_OVERFLOW_LIST_INDEX: - *aListName = nsLayoutAtoms::overflowList; - NS_ADDREF(*aListName); - break; + return nsLayoutAtoms::overflowList; case NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX: - *aListName = mAbsoluteContainer.GetChildListName(); - NS_ADDREF(*aListName); - break; + return mAbsoluteContainer.GetChildListName(); + default: + return nsnull; } - return NS_OK; } NS_IMETHODIMP @@ -3688,7 +3662,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, // Break-after cases if (breakType == NS_STYLE_CLEAR_LINE) { if (!aLineLayout.GetLineEndsInBR()) { - breakType = NS_STYLE_CLEAR_NONE; +#ifdef DEBUG_roc + // breakType = NS_STYLE_CLEAR_NONE; +#endif } } aLine->SetBreakType(breakType); diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index cab4616aa71..f0d6d070f16 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -119,11 +119,8 @@ public: nsIPresShell& aPresShell, nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index c02c078e9dd..83197b97592 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -1700,8 +1700,7 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest, // The bullet frame is not in a line list so marking it dirty // has no effect. The reflowing of the bullet frame is done // indirectly. - nsIFrame* frame = nsnull; - mParent->FirstChild(mPresContext, nsnull, &frame); + nsIFrame* frame = mParent->GetFirstChild(nsnull); NS_ASSERTION(frame, "No frame to mark dirty for bullet frame."); if (frame) { frame->AddStateBits(NS_FRAME_IS_DIRTY); diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 677fcc78fab..ca46fa52941 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -144,39 +144,28 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext) ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsContainerFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsContainerFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); // We only know about the unnamed principal child list and the overflow // list if (nsnull == aListName) { - *aFirstChild = mFrames.FirstChild(); - return NS_OK; + return mFrames.FirstChild(); } else if (nsLayoutAtoms::overflowList == aListName) { - *aFirstChild = GetOverflowFrames(aPresContext, PR_FALSE); - return NS_OK; + return GetOverflowFrames(GetPresContext(), PR_FALSE); } else { - *aFirstChild = nsnull; - return NS_ERROR_INVALID_ARG; + return nsnull; } } -NS_IMETHODIMP -nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - NS_ENSURE_TRUE(aIndex >= 0, NS_ERROR_INVALID_ARG); if (aIndex == 0) { - *aListName = nsLayoutAtoms::overflowList; - NS_ADDREF(*aListName); + return nsLayoutAtoms::overflowList; } else { - *aListName = nsnull; + return nsnull; } - return NS_OK; } ///////////////////////////////////////////////////////////////////////////// @@ -315,7 +304,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, PRBool aConsiderSelf, nsIFrame** aFrame) { - nsIFrame *kid, *hit; + nsIFrame *hit; nsPoint tmp; PRBool inThisFrame = mRect.Contains(aPoint); @@ -324,7 +313,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; } - FirstChild(aPresContext, aList, &kid); + nsIFrame* kid = GetFirstChild(aList); *aFrame = nsnull; tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); @@ -366,12 +355,10 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext, nsIFrame* aNewFrame) { nsIFrame* prevFrame; - nsIFrame* firstChild; nsresult rv; // Get the old frame's previous sibling frame - FirstChild(aPresContext, aListName, &firstChild); - nsFrameList frames(firstChild); + nsFrameList frames(GetFirstChild(aListName)); NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame"); prevFrame = frames.GetPrevSiblingFor(aOldFrame); @@ -993,8 +980,7 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, do { // Recursively walk aFrame's child frames - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { // Position the frame's view (if it has one) and recursively // process its children @@ -1005,9 +991,8 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext, childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); - } while (childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); + } while (childListName); } /** @@ -1304,8 +1289,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) PRInt32 listIndex = 0; PRBool outputOneList = PR_FALSE; do { - nsIFrame* kid; - FirstChild(aPresContext, listName, &kid); + nsIFrame* kid = GetFirstChild(listName); if (nsnull != kid) { if (outputOneList) { IndentBy(out, aIndent); @@ -1331,8 +1315,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) IndentBy(out, aIndent); fputs(">\n", out); } - NS_IF_RELEASE(listName); - GetAdditionalChildListName(listIndex++, &listName); + listName = GetAdditionalChildListName(listIndex++); } while(nsnull != listName); if (!outputOneList) { diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index 0324bf18380..9a23184ca4b 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -62,11 +62,8 @@ public: NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index 5ce2fb60d0a..d1fbfd6e0b1 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -169,10 +169,7 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang { if (aSelected && ParentDisablesSelection()) return NS_OK; - nsIFrame *child; - nsresult result = FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result)) - return NS_OK; + nsIFrame *child = GetFirstChild(nsnull); while (child) { child->SetSelected(aPresContext, aRange, aSelected, aSpread); diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index dad87ba4c4c..5e0d88b6329 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -696,21 +696,17 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex, // Child frame enumeration -NS_IMETHODIMP -nsFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const +nsIAtom* +nsFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); NS_PRECONDITION(aIndex >= 0, "invalid index number"); - *aListName = nsnull; - return aIndex < 0 ? NS_ERROR_INVALID_ARG : NS_OK; + return nsnull; } -NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsFrame::GetFirstChild(nsIAtom* aListName) const { - *aFirstChild = nsnull; - return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG; + return nsnull; } PRInt16 @@ -776,7 +772,7 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr ForceDrawFrame(aPresContext, (nsFrame *)aFrame); } - aFrame->FirstChild(aPresContext, nsnull, &aFrame); + aFrame = aFrame->GetFirstChild(nsnull); while (aFrame) { RefreshAllContentFrames(aPresContext, aFrame, aContent); aFrame = aFrame->GetNextSibling(); @@ -1936,22 +1932,17 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, PRInt32& aContentOffsetEnd, PRBool& aBeginFrameContent) { - nsresult result = NS_ERROR_FAILURE; - if (!aNewContent) return NS_ERROR_NULL_POINTER; // Traverse through children and look for the best one to give this // to if it fails the getposition call, make it yourself also only // look at primary list - nsIFrame *kid = nsnull; nsIFrame *closestFrame = nsnull; - nsIView *view = GetClosestView(); + nsIFrame *kid = GetFirstChild(nsnull); - result = FirstChild(aCX, nsnull, &kid); - - if (NS_SUCCEEDED(result) && nsnull != kid) { + if (kid) { #define HUGE_DISTANCE 999999 //some HUGE number that will always fail first comparison PRInt32 closestXDistance = HUGE_DISTANCE; @@ -2102,7 +2093,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, aContentOffsetEnd = aContentOffset; } } - return result; + return NS_OK; } NS_IMETHODIMP @@ -2919,8 +2910,8 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 nsIAtom* list = nsnull; PRInt32 listIndex = 0; do { - nsresult rv = FirstChild(aPresContext, list, &kid); - if (NS_SUCCEEDED(rv) && (nsnull != kid)) { + kid = GetFirstChild(list); + if (kid) { IndentBy(out, aIndent); if (nsnull != list) { nsAutoString listName; @@ -2946,8 +2937,7 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 IndentBy(out, aIndent); fprintf(out, "\n"); } - NS_IF_RELEASE(list); - GetAdditionalChildListName(listIndex++, &list); + list = GetAdditionalChildListName(listIndex++); } while (nsnull != list); } @@ -2975,16 +2965,12 @@ nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool a if (!selectable) return NS_OK; -/* nsresult rv; - +/* if (eSpreadDown == aSpread){ - nsIFrame* kid; - rv = FirstChild(nsnull, &kid); - if (NS_SUCCEEDED(rv)) { - while (nsnull != kid) { - kid->SetSelected(nsnull,aSelected,aSpread); - kid = kid->GetNextSibling(); - } + nsIFrame* kid = GetFirstChild(nsnull); + while (nsnull != kid) { + kid->SetSelected(nsnull,aSelected,aSpread); + kid = kid->GetNextSibling(); } } */ @@ -3742,12 +3728,12 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) PRBool searchTableBool = PR_FALSE; if (aPos->mResultFrame->GetType() == nsLayoutAtoms::tableOuterFrame) { - nsIFrame *frame = aPos->mResultFrame; - result = frame->FirstChild(aPresContext, nsnull,&frame); + nsIFrame *frame = aPos->mResultFrame->GetFirstChild(nsnull); + result = NS_OK; //got the table frame now while(frame) //ok time to drill down to find iterator { - result = frame->FirstChild(aPresContext, nsnull,&frame); + frame = frame->GetFirstChild(nsnull); if (frame && NS_SUCCEEDED(result)) { result = frame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator), @@ -4381,8 +4367,7 @@ GetNextSiblingAcrossLines(nsIPresContext *aPresContext, nsIFrame *aFrame) aFrame->GetParent()->GetNextInFlow(&parent); if (!parent) return nsnull; - parent->FirstChild(aPresContext, nsnull, &result); - return result; + return parent->GetFirstChild(nsnull); } /** @@ -4413,7 +4398,7 @@ GetCorrectedParent(nsIPresContext* aPresContext, nsIFrame* aFrame, // Use the wrapped frame, which is after the |:before|. parent = GetNextSiblingAcrossLines(aPresContext, aFrame); } else if (pseudo == nsCSSPseudoElements::after) { - parent->GetFirstInFlow()->FirstChild(aPresContext, nsnull, &parent); + parent = parent->GetFirstInFlow()->GetFirstChild(nsnull); // Now we have either the wrapped frame or the :before, but we // want the wrapped frame. if (parent->GetStyleContext()->GetPseudoType() == @@ -4499,11 +4484,10 @@ nsFrame::GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame) if (!aFrame || !*aFrame) return; nsIFrame *child = *aFrame; - nsresult result; //if we are a block frame then go for the last line of 'this' while (1){ - result = child->FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result) || !child) + child = child->GetFirstChild(nsnull); + if (!child) return;//nothing to do while (child->GetNextSibling()) child = child->GetNextSibling(); @@ -4518,10 +4502,9 @@ nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame) if (!aFrame || !*aFrame) return; nsIFrame *child = *aFrame; - nsresult result; while (1){ - result = child->FirstChild(aPresContext, nsnull, &child); - if (NS_FAILED(result) || !child) + child = child->GetFirstChild(nsnull); + if (!child) return;//nothing to do *aFrame = child; } @@ -5323,7 +5306,7 @@ void DR_State::PrettyUC(nscoord aSize, strcpy(aBuf, "UC"); } else { - if(0xdeadbeefU == aSize) + if ((nscoord)0xdeadbeefU == aSize) { strcpy(aBuf, "deadbeef"); } diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index ece5e9ce3a1..cc40f451755 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -186,10 +186,8 @@ public: virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const; virtual void SetAdditionalStyleContext(PRInt32 aIndex, nsStyleContext* aStyleContext); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 2909f6d4d7f..30795557666 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -536,7 +536,6 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const { NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE); NS_PRECONDITION(aCanvasFrame, "aCanvasFrame argument cannot be null"); - nsIPresContext *presContext = GetPresContext(); *aCanvasFrame = nsnull; if (mRootFrame) { @@ -556,7 +555,7 @@ FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const } } // move on to the child's child - childFrame->FirstChild(presContext, nsnull, &childFrame); + childFrame = childFrame->GetFirstChild(nsnull); } } return NS_OK; @@ -1400,9 +1399,8 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* nsIFrame* child; do { - child = nsnull; - nsresult result = aFrame->FirstChild(aPresContext, childList, &child); - while ((NS_SUCCEEDED(result)) && child) { + child = aFrame->GetFirstChild(childList); + while (child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { @@ -1425,8 +1423,7 @@ VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsStyleContext* child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // do additional contexts @@ -1481,9 +1478,8 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, aFrame->SetStyleContext(presContext, newContext); do { - child = nsnull; - result = aFrame->FirstChild(presContext, childList, &child); - while ((NS_SUCCEEDED(result)) && child) { + child = aFrame->GetFirstChild(childList); + while (child) { if (NS_FRAME_OUT_OF_FLOW != (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { @@ -1505,8 +1501,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame, child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // do additional contexts @@ -1610,7 +1605,6 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, // that the frame has the last reference to it, so AddRef it here. nsStyleContext* oldContext = aFrame->GetStyleContext(); - nsresult result = NS_OK; if (oldContext) { oldContext->AddRef(); @@ -1889,9 +1883,8 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, nsChangeHint childChange; do { - nsIFrame* child = nsnull; - result = aFrame->FirstChild(aPresContext, childList, &child); - while (NS_SUCCEEDED(result) && child) { + nsIFrame* child = aFrame->GetFirstChild(childList); + while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow if (nsLayoutAtoms::placeholderFrame == child->GetType()) { // placeholder @@ -1927,8 +1920,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext, child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); // XXX need to do overflow frames??? } @@ -2071,15 +2063,13 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { - nsIFrame* childFrame; - aFrame->FirstChild(GetPresContext(), childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { rv = CaptureFrameState(childFrame, aState); // Get the next sibling child frame childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return rv; @@ -2144,15 +2134,13 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { - nsIFrame* childFrame; - aFrame->FirstChild(GetPresContext(), childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { rv = RestoreFrameState(childFrame, aState); // Get the next sibling child frame childFrame = childFrame->GetNextSibling(); } - NS_IF_RELEASE(childListName); - aFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return rv; diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index d7e669f8014..5602e074c72 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -462,8 +462,7 @@ void nsGfxScrollFrame::ReloadChildFrames(nsIPresContext* aPresContext) mInner->mVScrollbarBox = nsnull; mInner->mScrollCornerBox = nsnull; - nsIFrame* frame = nsnull; - FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = GetFirstChild(nsnull); while (frame) { PRBool understood = PR_FALSE; @@ -1633,10 +1632,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) 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; - if (NS_SUCCEEDED(parentFrame->FirstChild(mOuter->mPresContext, - nsLayoutAtoms::fixedList, &child)) && child) { - + if (parentFrame->GetFirstChild(nsLayoutAtoms::fixedList)) { // force a reflow of the fixed children nsFrame::CreateAndPostReflowCommand(mOuter->mPresContext->PresShell(), parentFrame, diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index cca7fd0369b..c330b08b9ed 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -228,9 +228,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext, static PRBool HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent) { - nsIFrame* kid = nsnull; - - for (aParent->FirstChild(aPresContext, nsnull, &kid); kid; + for (nsIFrame* kid = aParent->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) { if (kid->GetType() == nsLayoutAtoms::textFrame) { @@ -364,21 +362,18 @@ ReparentFrameViewTo(nsIPresContext* aPresContext, aViewManager->InsertChild(aNewParentView, view, insertBefore, insertBefore != nsnull); } else { PRInt32 listIndex = 0; - nsCOMPtr listName; + nsIAtom* listName = nsnull; // This loop iterates through every child list name, and also // executes once with listName == nsnull. do { - aFrame->GetAdditionalChildListName(listIndex, getter_AddRefs(listName)); - listIndex++; - // Iterate the child frames, and check each child frame to see if it has // a view - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, listName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(listName); for (; childFrame; childFrame = childFrame->GetNextSibling()) { ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); } + listName = aFrame->GetAdditionalChildListName(listIndex++); } while (listName); } @@ -400,9 +395,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, // see if we can trivially detect that no work needs to be done if (!aChildFrame->HasView()) { // Child frame doesn't have a view. See if it has any child frames - nsIFrame* firstChild; - aChildFrame->FirstChild(aPresContext, nsnull, &firstChild); - if (!firstChild) { + if (!aChildFrame->GetFirstChild(nsnull)) { return NS_OK; } } diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index ddc58db8608..153cfa896d8 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -428,11 +428,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext, nsresult rv = aPresContext->GetEventStateManager(getter_AddRefs(stateManager)); if (NS_SUCCEEDED(rv)) { nsIFrame * parentFrame = GetParent(); - nsIScrollableFrame* scrollableFrame; - if (NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollableFrame))) { - nscoord width, height; - scrollableFrame->GetClipSize(aPresContext, &width, &height); - } nsIView* parentView = parentFrame->GetView(); nsIScrollableView* scrollableView; @@ -653,12 +648,11 @@ CanvasFrame::HandleEvent(nsIPresContext* aPresContext, aEvent->message == NS_MOUSE_MIDDLE_BUTTON_UP || aEvent->message == NS_MOUSE_RIGHT_BUTTON_UP || aEvent->message == NS_MOUSE_MOVE ) { - nsIFrame *firstChild; - nsresult rv = FirstChild(aPresContext,nsnull,&firstChild); + nsIFrame *firstChild = GetFirstChild(nsnull); //canvas frame needs to pass mouse events to its area frame so that mouse movement //and selection code will work properly. this will still have the necessary effects //that would have happened if nsFrame::HandleEvent was called. - if (NS_SUCCEEDED(rv) && firstChild) + if (firstChild) firstChild->HandleEvent(aPresContext, aEvent, aEventStatus); else nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus); diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 9eca9def29b..8f255f8b42c 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -685,9 +685,7 @@ void MarkPercentAwareFrame(nsIPresContext *aPresContext, } else { - nsIFrame *child; - aFrame->FirstChild(aPresContext, nsnull, &child); - if (child) + if (aFrame->GetFirstChild(nsnull)) { // aFrame is an inline container frame, check my frame state if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) { SetContainsPercentAwareChild(aInline); // if a child container is effected, so am I @@ -1189,30 +1187,25 @@ nsPositionedInlineFrame::ReplaceFrame(nsIPresContext* aPresContext, } } -NS_IMETHODIMP -nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - *aListName = nsnull; if (0 == aIndex) { - *aListName = mAbsoluteContainer.GetChildListName(); - NS_ADDREF(*aListName); + return mAbsoluteContainer.GetChildListName(); } - return NS_OK; + return nsnull; } -NS_IMETHODIMP -nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsPositionedInlineFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (mAbsoluteContainer.GetChildListName() == aListName) { - return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild); + nsIFrame* result = nsnull; + mAbsoluteContainer.FirstChild(this, aListName, &result); + return result; } - return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsInlineFrame::GetFirstChild(aListName); } nsIAtom* diff --git a/mozilla/layout/html/base/src/nsInlineFrame.h b/mozilla/layout/html/base/src/nsInlineFrame.h index 0f89726b9e0..486d82527da 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.h +++ b/mozilla/layout/html/base/src/nsInlineFrame.h @@ -233,12 +233,9 @@ public: nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 7ebcfbff186..343af0d520c 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -98,9 +98,8 @@ static nscoord AccumulateImageSizes(nsIPresContext& aPresContext, nsIFrame& aFra sizes += aFrame.GetSize().width; } else { // see if there are children to process - nsIFrame* child = nsnull; // XXX: process alternate child lists? - aFrame.FirstChild(&aPresContext,nsnull,&child); + nsIFrame* child = aFrame.GetFirstChild(nsnull); while (child) { // recurse: note that we already know we are in a child frame, so no need to track further sizes += AccumulateImageSizes(aPresContext, *child); @@ -1652,8 +1651,7 @@ PRBool IsPercentageAwareFrame(nsIPresContext *aPresContext, nsIFrame *aFrame) } else { - nsIFrame *child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame *child = aFrame->GetFirstChild(nsnull); if (child) { // aFrame is an inline container frame, check my frame state if (aFrame->GetStateBits() & NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD) { @@ -3176,8 +3174,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame) if (! canContinue) return nsnull; - nsIFrame* child; - next->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = next->GetFirstChild(nsnull); if (! child) break; diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index bdc62142425..77ceb103c21 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -2003,8 +2003,7 @@ nsObjectFrame::GetNextObjectFrame(nsIPresContext* aPresContext, { NS_ENSURE_ARG_POINTER(outFrame); - nsIFrame * child; - aRoot->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aRoot->GetFirstChild(nsnull); while (child) { *outFrame = nsnull; diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 3c9eed64950..8ee706d3ae0 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -2647,18 +2647,17 @@ GetRootScrollFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame, nsIFrame* // Ensure root frame is a viewport frame *aScrollFrame = nsnull; - nsIFrame* theFrame = nsnull; if (aRootFrame) { if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { // If child is scrollframe keep it (native) - aRootFrame->FirstChild(aPresContext, nsnull, &theFrame); + nsIFrame* theFrame = aRootFrame->GetFirstChild(nsnull); if (theFrame) { if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; // If the first child of that is scrollframe, use it instead (gfx) - theFrame->FirstChild(aPresContext, nsnull, &theFrame); + theFrame = theFrame->GetFirstChild(nsnull); if (theFrame) { if (nsLayoutAtoms::scrollFrame == theFrame->GetType()) { *aScrollFrame = theFrame; @@ -3306,8 +3305,8 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend) frameType = frame->GetType(); if (frameType != nsLayoutAtoms::areaFrame) { - result = frame->FirstChild(mPresContext, nsnull, &frame); - if (NS_FAILED(result) || !frame) + frame = frame->GetFirstChild(nsnull); + if (!frame) break; } }while(frameType != nsLayoutAtoms::areaFrame); @@ -3496,12 +3495,11 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const } nsIFrame* rootFrame; - nsIFrame* child; nsIPageSequenceFrame* pageSequence = nsnull; // The page sequence frame is the child of the rootFrame mFrameManager->GetRootFrame(&rootFrame); - rootFrame->FirstChild(mPresContext, nsnull, &child); + nsIFrame* child = rootFrame->GetFirstChild(nsnull); if (nsnull != child) { @@ -3515,7 +3513,7 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const } else { nsCOMPtr ppContext = do_QueryInterface(mPresContext); if (ppContext) { - child->FirstChild(mPresContext, nsnull, &child); + child = child->GetFirstChild(nsnull); } } @@ -5129,7 +5127,7 @@ PresShell::FlushPendingNotifications(PRBool aUpdateViews) ProcessReflowCommands(PR_FALSE); if (aUpdateViews && mViewManager) { - mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); + mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); } } @@ -6708,9 +6706,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, nsIAtom* listName = nsnull; PRInt32 listIndex = 0; do { - nsIFrame* k1, *k2; - aFirstFrame->FirstChild(aFirstPresContext, listName, &k1); - aSecondFrame->FirstChild(aSecondPresContext, listName, &k2); + nsIFrame* k1 = aFirstFrame->GetFirstChild(listName); + nsIFrame* k2 = aSecondFrame->GetFirstChild(listName); PRInt32 l1 = nsContainerFrame::LengthOf(k1); PRInt32 l2 = nsContainerFrame::LengthOf(k2); if (l1 != l2) { @@ -6897,12 +6894,9 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!ok && (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags))) { break; } - NS_IF_RELEASE(listName); - nsIAtom* listName1; - nsIAtom* listName2; - aFirstFrame->GetAdditionalChildListName(listIndex, &listName1); - aSecondFrame->GetAdditionalChildListName(listIndex, &listName2); + nsIAtom* listName1 = aFirstFrame->GetAdditionalChildListName(listIndex); + nsIAtom* listName2 = aSecondFrame->GetAdditionalChildListName(listIndex); listIndex++; if (listName1 != listName2) { if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { @@ -6924,11 +6918,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, else fputs("(null)", stdout); printf("\n"); - NS_IF_RELEASE(listName1); - NS_IF_RELEASE(listName2); break; } - NS_IF_RELEASE(listName2); listName = listName1; } while (ok && (listName != nsnull)); @@ -6952,8 +6943,7 @@ FindTopFrame(nsIFrame* aRoot) } // Try one of the children - nsIFrame* kid; - aRoot->FirstChild(nsnull, &kid); + nsIFrame* kid = aRoot->GetFirstChild(nsnull); while (nsnull != kid) { nsIFrame* result = FindTopFrame(kid); if (nsnull != result) { @@ -7698,8 +7688,7 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext, nsMemory::Free(name); } - nsIFrame * child; - aParentFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aParentFrame->GetFirstChild(nsnull); while (child) { RecurseIndiTotals(aPresContext, aHT, child, aLevel+1); child = child->GetNextSibling(); diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 15f96995069..04ffe4cb254 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -865,8 +865,7 @@ nsSimplePageSequenceFrame::PrintNextPage(nsIPresContext* aPresContext) nsRect containerRect; if (mSelectionHeight > -1) { nsIFrame* childFrame = mFrames.FirstChild(); - nsIFrame* conFrame; - childFrame->FirstChild(aPresContext, nsnull, &conFrame); + nsIFrame* conFrame = childFrame->GetFirstChild(nsnull); containerView = conFrame->GetView(); NS_ASSERTION(containerView, "Container view can't be null!"); containerRect = containerView->GetBounds(); diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 992c16aa1b4..7d3b36d2fbf 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -1964,9 +1964,8 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC nsIFrame *grandParent = parent->GetParent(); if (grandParent) { - nsIFrame *firstParent; - nsresult rv = grandParent->FirstChild(aPresContext,nsnull, &firstParent); - if (NS_SUCCEEDED(rv) && firstParent) + nsIFrame *firstParent = grandParent->GetFirstChild(nsnull); + if (firstParent) { *aLength = 0; if (firstParent == parent) //then our parent is the first child of granddad. use BEFORE @@ -1979,7 +1978,7 @@ nsTextFrame::GetContentAndOffsetsForSelection(nsIPresContext *aPresContext, nsIC } } else - return rv; + return NS_OK; } } } diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index a7092510bc2..ec91a3d2ca9 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -162,37 +162,28 @@ ViewportFrame::RemoveFrame(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(aListName, "null OUT parameter pointer"); - NS_PRECONDITION(aIndex >= 0, "illegal index"); - - *aListName = nsnull; - - nsresult rv = NS_OK; + NS_PRECONDITION(aIndex >= 0, "illegal index"); if (0 == aIndex) { - *aListName = mFixedContainer.GetChildListName(); - NS_ADDREF(*aListName); + return mFixedContainer.GetChildListName(); } - return rv; + return nsnull; } -NS_IMETHODIMP -ViewportFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +ViewportFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(aFirstChild, "null OUT parameter pointer"); if (mFixedContainer.GetChildListName() == aListName) { - mFixedContainer.FirstChild(this, aListName, aFirstChild); - return NS_OK; + nsIFrame* result = nsnull; + mFixedContainer.FirstChild(this, aListName, &result); + return result; } - return nsContainerFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsContainerFrame::GetFirstChild(aListName); } void diff --git a/mozilla/layout/html/base/src/nsViewportFrame.h b/mozilla/layout/html/base/src/nsViewportFrame.h index c6a9d4f47f5..94685f0f949 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.h +++ b/mozilla/layout/html/base/src/nsViewportFrame.h @@ -92,12 +92,9 @@ public: nsIAtom* aListName, nsIFrame* aOldFrame); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 884bb623dbb..63f9aeacd86 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -1364,8 +1364,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, } else { nsIFrame * plainLstFrame; if (NS_SUCCEEDED(mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void**)&plainLstFrame))) { - nsIFrame * frame; - plainLstFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame * frame = plainLstFrame->GetFirstChild(nsnull); nsIScrollableFrame * scrollFrame; if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) { plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); @@ -2257,17 +2256,13 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext) } -NS_IMETHODIMP -nsComboboxControlFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsComboboxControlFrame::GetFirstChild(nsIAtom* aListName) const { if (nsLayoutAtoms::popupList == aListName) { - *aFirstChild = mPopupFrames.FirstChild(); - } else { - nsAreaFrame::FirstChild(aPresContext, aListName, aFirstChild); + return mPopupFrames.FirstChild(); } - return NS_OK; + return nsAreaFrame::GetFirstChild(aListName); } NS_IMETHODIMP @@ -2298,25 +2293,21 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex) const { // Maintain a separate child list for the dropdown list (i.e. popup listbox) // This is necessary because we don't want the listbox to be included in the layout // of the combox's children because it would take up space, when it is suppose to // be floating above the display. - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); if (aIndex <= NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX) { - return nsAreaFrame::GetAdditionalChildListName(aIndex, aListName); + return nsAreaFrame::GetAdditionalChildListName(aIndex); } - *aListName = nsnull; if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) { - *aListName = nsLayoutAtoms::popupList; - NS_ADDREF(*aListName); + return nsLayoutAtoms::popupList; } - return NS_OK; + return nsnull; } PRIntn diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index cb6b7aeddf2..03ccf92bd0d 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -131,14 +131,11 @@ public: NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif NS_IMETHOD Destroy(nsIPresContext* aPresContext); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index c0aae057c64..8ff6c1e7468 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -366,8 +366,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, if (NS_SUCCEEDED(rv) && mTextFrame != nsnull) { const nsStyleVisibility* vis = GetStyleVisibility(); - nsIFrame * child; - FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = GetFirstChild(nsnull); if (child == mTextFrame) { child = child->GetNextSibling(); } @@ -441,8 +440,7 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* nsNewFrame* result = nsnull; #ifndef DEBUG_NEWFRAME // find the text control frame. - nsIFrame* childFrame = nsnull; - aStart->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aStart->GetFirstChild(nsnull); while (childFrame) { // see if the child is a text control diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 4e840a25bc3..c2cde8821c1 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -611,7 +611,8 @@ void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer if (!childframe) { // The only way we can get right here is that there are no options // and we need to get the dummy frame so it has the focus ring - result = containerFrame->FirstChild(mPresContext, nsnull, &childframe); + childframe = containerFrame->GetFirstChild(nsnull); + result = NS_OK; } } @@ -853,8 +854,7 @@ static nscoord GetMaxOptionHeight(nsIPresContext *aPresContext, nsIFrame *aContainer) { nscoord result = 0; - nsIFrame *option; - for (aContainer->FirstChild(aPresContext, nsnull, &option); + for (nsIFrame* option = aContainer->GetFirstChild(nsnull); option; option = option->GetNextSibling()) { nscoord optionHeight; if (nsCOMPtr diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 9de0749c6d9..e1e8d2bc195 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -3035,8 +3035,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext, if (mEditor) mEditor->PostCreate(); //look for scroll view below this frame go along first child list - nsIFrame *first; - FirstChild(aPresContext,nsnull, &first); + nsIFrame* first = GetFirstChild(nsnull); // Mark the scroll frame as being a reflow root. This will allow // incremental reflows to be initiated at the scroll frame, rather @@ -3078,7 +3077,7 @@ nsTextControlFrame::SetInitialChildList(nsIPresContext* aPresContext, break; } } - first->FirstChild(aPresContext,nsnull, &first); + first = first->GetFirstChild(nsnull); } return rv; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 4cf42fa2e60..788f4eeb686 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -975,8 +975,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext, // Dive down into children to see if any of their // placeholders need adjusting. - nsIFrame *childFrame = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame *childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { @@ -1214,13 +1213,8 @@ GetChildListNameFor(nsIPresContext* aPresContext, } // Verify that the frame is actually in that child list -#ifdef NS_DEBUG - nsIFrame* firstChild; - aParentFrame->FirstChild(aPresContext, listName, &firstChild); - - nsFrameList frameList(firstChild); - NS_ASSERTION(frameList.ContainsFrame(aChildFrame), "not in child list"); -#endif + NS_ASSERTION(nsFrameList(aParentFrame->GetFirstChild(listName)) + .ContainsFrame(aChildFrame), "not in child list"); NS_IF_ADDREF(listName); *aListName = listName; @@ -3284,8 +3278,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, // Gfx scrollframes were created in the root frame but the primary frame map may have been destroyed if a // new style sheet was loaded so lets reattach the frames to their content. if (mGfxScrollFrame) { - nsIFrame* scrollPort = nsnull; - mGfxScrollFrame->FirstChild(aPresContext, nsnull, &scrollPort); + nsIFrame* scrollPort = mGfxScrollFrame->GetFirstChild(nsnull); nsIFrame* gfxScrollbarFrame1 = nsnull; nsIFrame* gfxScrollbarFrame2 = nsnull; @@ -4949,8 +4942,7 @@ LocateAnonymousFrame(nsIPresContext* aPresContext, } // Check our kids. - nsIFrame* currFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &currFrame); + nsIFrame* currFrame = aParentFrame->GetFirstChild(nsnull); while (currFrame) { LocateAnonymousFrame(aPresContext, currFrame, aTargetContent, aResult); if (*aResult) @@ -5600,7 +5592,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame = nsnull; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) rootBox->SetDefaultTooltip(aContent); @@ -5710,7 +5702,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); NS_ASSERTION(rootBox, "unexpected null pointer"); if (rootBox) { @@ -5747,7 +5739,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsIFrame* rootFrame = nsnull; aState.mFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) rootBox->AddTooltipSupport(aContent); @@ -7354,7 +7346,7 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell, // if we get a table cell frame use its 1st child which is an area frame else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { - frame->FirstChild(aPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); } } } @@ -7381,15 +7373,14 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, 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); + nsIFrame* scrolledFrame = frame->GetFirstChild(nsnull); if (scrolledFrame) { frameType = scrolledFrame->GetType(); if (nsLayoutAtoms::areaFrame == frameType) { containingBlock = scrolledFrame; break; } else if (nsLayoutAtoms::scrollFrame == frameType) { - scrolledFrame->FirstChild(aPresContext, nsnull, &scrolledFrame); + scrolledFrame = scrolledFrame->GetFirstChild(nsnull); if (scrolledFrame) { if (nsLayoutAtoms::areaFrame == scrolledFrame->GetType()) { containingBlock = scrolledFrame; @@ -7404,7 +7395,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext, break; } else if (nsLayoutAtoms::fieldSetFrame == frameType) { // If the positioned frame is a fieldset, use the area frame inside it - frame->FirstChild(aPresContext, nsnull, &containingBlock); + containingBlock = frame->GetFirstChild(nsnull); break; } #ifdef DEBUG @@ -7485,9 +7476,7 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext, nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(aParentFrame, aPresContext); if (afterFrame) { - nsIFrame* firstChild; - aParentFrame->FirstChild(aPresContext, nsnull, &firstChild); - nsFrameList frames(firstChild); + nsFrameList frames(aParentFrame->GetFirstChild(nsnull)); // Insert the frames before the :after pseudo-element. return aFrameManager->InsertFrames(aParentFrame, @@ -7949,14 +7938,14 @@ GetAdjustedParentFrame(nsIPresContext* aPresContext, // If the parent frame is an outer table, use the innner table // as the parent unless the new content is a caption. if (!captionContent) - aParentFrame->FirstChild(aPresContext, nsnull, &newParent); + newParent = aParentFrame->GetFirstChild(nsnull); } else if (nsLayoutAtoms::fieldSetFrame == aParentFrameType) { // If the parent is a fieldSet, use the fieldSet's area frame as the // parent unless the new content is a legend. nsCOMPtr legendContent(do_QueryInterface(childContent)); if (!legendContent) - aParentFrame->FirstChild(aPresContext, nsnull, &newParent); + newParent = aParentFrame->GetFirstChild(nsnull); } return (newParent) ? newParent : aParentFrame; } @@ -7968,8 +7957,7 @@ static nsresult InsertOutOfFlow(nsIPresContext* aPresContext, return NS_OK; } - nsIFrame* firstChild; - aFrameItems.containingBlock->FirstChild(aPresContext, aChildListName, &firstChild); + nsIFrame* firstChild = aFrameItems.containingBlock->GetFirstChild(aChildListName); // Note that whether the frame construction context is doing an append or // not is not helpful here, since it could be appending to some frame in @@ -8281,8 +8269,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // check for a caption already appended to the outer table nsIFrame* outerTable = parentFrame->GetParent(); if (outerTable) { - nsIFrame* existingCaption = nsnull; - outerTable->FirstChild(aPresContext, nsLayoutAtoms::captionList, &existingCaption); + nsIFrame* existingCaption = + outerTable->GetFirstChild(nsLayoutAtoms::captionList); if (existingCaption) { abortCaption = PR_TRUE; } @@ -8989,8 +8977,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, if (!prevSibling) { // We're inserting the new frame as the first child. See if the // parent has a :before pseudo-element - nsIFrame* firstChild; - parentFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = parentFrame->GetFirstChild(nsnull); if (firstChild && nsLayoutUtils::IsGeneratedContentFor(aContainer, firstChild, @@ -9106,13 +9093,12 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, } // Walk aFrame's child frames - nsCOMPtr childListName; + nsIAtom* childListName = nsnull; PRInt32 childListIndex = 0; do { // Walk aFrame's child frames looking for placeholder frames - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, childListName, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(childListName); while (childFrame) { // The subtree we need to follow to get to the children; by // default, the childFrame. @@ -9152,7 +9138,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext, childFrame = childFrame->GetNextSibling(); } - aFrame->GetAdditionalChildListName(childListIndex++, getter_AddRefs(childListName)); + childListName = aFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return NS_OK; @@ -9210,7 +9196,7 @@ DeletingFrameSubtree(nsIPresContext* aPresContext, nsIFrame* rootFrame; aFrameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); NS_ASSERTION(rootBox, "unexpected null pointer"); if (rootBox) { @@ -9441,7 +9427,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, nsIFrame* rootFrame; frameManager->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); #ifdef MOZ_XUL nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) { @@ -9601,8 +9587,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIAtom* childList = nsnull; do { - nsIFrame* child = nsnull; - aFrame->FirstChild(aPresContext, childList, &child); + nsIFrame* child = aFrame->GetFirstChild(childList); while (child) { if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { // only do frames that are in flow @@ -9622,10 +9607,8 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame, } child = child->GetNextSibling(); } - NS_IF_RELEASE(childList); - aFrame->GetAdditionalChildListName(listIndex++, &childList); + childList = aFrame->GetAdditionalChildListName(listIndex++); } while (childList); - NS_IF_RELEASE(childList); aBoundsRect = bounds; aBoundsRect += parentOffset; } @@ -10138,7 +10121,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsIFrame* rootFrame = nsnull; shell->GetRootFrame(&rootFrame); if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (rootBox) { if (aModType == nsIDOMMutationEvent::REMOVAL) @@ -10339,8 +10322,7 @@ HasDisplayableChildren(nsIPresContext* aPresContext, nsIFrame* aContainerFrame) if (! aContainerFrame) return PR_FALSE; - nsIFrame* frame; - aContainerFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = aContainerFrame->GetFirstChild(nsnull); while (frame) { // If it's not a text frame, then assume that it's displayable. @@ -10404,9 +10386,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell, } // Get the previous sibling frame - nsIFrame* firstChild; - parentFrame->FirstChild(aPresContext, listName, &firstChild); - nsFrameList frameList(firstChild); + nsFrameList frameList(parentFrame->GetFirstChild(listName)); // See whether it's an IMG or an INPUT element (for image buttons) // or if it is an applet with no displayable children @@ -10610,10 +10590,9 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShe // Create a continuing inner table frame, and if there's a caption then // replicate the caption - nsIFrame* childFrame; nsFrameItems newChildFrames; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { // See if it's the inner table frame if (nsLayoutAtoms::tableFrame == childFrame->GetType()) { @@ -10684,10 +10663,8 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Replicate any header/footer frames - nsIFrame* rowGroupFrame; nsFrameItems childFrames; - - aFrame->FirstChild(aPresContext, nsnull, &rowGroupFrame); + nsIFrame* rowGroupFrame = aFrame->GetFirstChild(nsnull); while (rowGroupFrame) { // See if it's a header/footer nsStyleContext* rowGroupStyle = rowGroupFrame->GetStyleContext(); @@ -10825,10 +10802,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Create a continuing frame for each table cell frame - nsIFrame* cellFrame; nsFrameItems newChildList; - - aFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = aFrame->GetFirstChild(nsnull); while (cellFrame) { // See if it's a table cell frame if (IS_TABLE_CELL(cellFrame->GetType())) { @@ -10852,9 +10827,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, nsHTMLContainerFrame::CreateViewForFrame(newFrame, nsnull, PR_FALSE); // Create a continuing area frame - nsIFrame* areaFrame; nsIFrame* continuingAreaFrame; - aFrame->FirstChild(aPresContext, nsnull, &areaFrame); + nsIFrame* areaFrame = aFrame->GetFirstChild(nsnull); CreateContinuingFrame(aPresContext, areaFrame, newFrame, &continuingAreaFrame); // Set the table cell's initial child list @@ -10936,18 +10910,14 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext, // OK. now we need to do this fixed-pos game. // Get prevPage's page content frame - nsIFrame* prevPageContentFrame; - prevPage->FirstChild(aPresContext, nsnull, &prevPageContentFrame); + nsIFrame* prevPageContentFrame = prevPage->GetFirstChild(nsnull); if (!prevPageContentFrame) { return NS_ERROR_UNEXPECTED; } nsFrameItems fixedPlaceholders; - nsIFrame* firstFixed; - prevPageContentFrame->FirstChild(aPresContext, nsLayoutAtoms::fixedList, - &firstFixed); - + nsIFrame* firstFixed = prevPageContentFrame->GetFirstChild(nsLayoutAtoms::fixedList); if (!firstFixed) { return NS_OK; } @@ -11029,7 +10999,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, } if (parentFrame) { // if we found the next-in-flow for the parent of the hint frame, start with it's first child - parentFrame->FirstChild(aPresContext, listName, &kidFrame); + kidFrame = parentFrame->GetFirstChild(listName); // Leave |aParentFrame| as-is, since the only time we'll // reuse it is if the hint fails. NS_ASSERTION(!kidFrame || parentFrame->GetContent() == aParentContent, @@ -11043,7 +11013,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, } } if (!kidFrame) { // we didn't have enough info to prune, start searching from the beginning - aParentFrame->FirstChild(aPresContext, listName, &kidFrame); + kidFrame = aParentFrame->GetFirstChild(listName); } while (kidFrame) { // See if the child frame points to the content object we're @@ -11105,8 +11075,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext, // using the null child list again. aHint = nsnull; } else { - NS_IF_RELEASE(listName); - aParentFrame->GetAdditionalChildListName(listIndex++, &listName); + listName = aParentFrame->GetAdditionalChildListName(listIndex++); } } while(listName); @@ -11707,8 +11676,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames( { // It's possible that aBlockFrame needs to have a first-line frame // created because it doesn't currently have any children. - nsIFrame* blockKid; - aBlockFrame->FirstChild(aPresContext, nsnull, &blockKid); + nsIFrame* blockKid = aBlockFrame->GetFirstChild(nsnull); if (!blockKid) { return WrapFramesInFirstLineFrame(aPresShell, aPresContext, aState, aContent, aBlockFrame, aFrameItems); @@ -11794,8 +11762,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( if (!aPrevSibling) { // Insertion will become the first frame. Two cases: we either // already have a first-line frame or we don't. - nsIFrame* firstBlockKid; - aBlockFrame->FirstChild(nsnull, &firstBlockKid); + nsIFrame* firstBlockKid = aBlockFrame->GetFirstChild(nsnull); if (firstBlockKid->GetType() == nsLayoutAtoms::lineFrame) { // We already have a first-line frame nsIFrame* lineFrame = firstBlockKid; @@ -11896,8 +11863,7 @@ nsCSSFrameConstructor::InsertFirstLineFrames( if (!nextLineFrame) { break; } - nsIFrame* kids; - nextLineFrame->FirstChild(nsnull, &kids); + nsIFrame* kids = nextLineFrame->GetFirstChild(nsnull); } } else { @@ -12235,8 +12201,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame( } else if ((nsLayoutAtoms::inlineFrame == frameType) || (nsLayoutAtoms::lineFrame == frameType)) { - nsIFrame* kids; - frame->FirstChild(aPresContext, nsnull, &kids); + nsIFrame* kids = frame->GetFirstChild(nsnull); WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids, aModifiedParent, aTextFrame, aPrevFrame, aLetterFrames, aStopLooking); @@ -12271,8 +12236,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( PRBool* aStopLooking) { // First look for the float frame that is a letter frame - nsIFrame* floatFrame; - aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame); + nsIFrame* floatFrame = aBlockFrame->GetFirstChild(nsLayoutAtoms::floatList); while (floatFrame) { // See if we found a floating letter frame if (nsLayoutAtoms::letterFrame == floatFrame->GetType()) { @@ -12287,8 +12251,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Take the text frame away from the letter frame (so it isn't // destroyed when we destroy the letter frame). - nsIFrame* textFrame; - floatFrame->FirstChild(aPresContext, nsnull, &textFrame); + nsIFrame* textFrame = floatFrame->GetFirstChild(nsnull); if (!textFrame) { return NS_OK; } @@ -12386,16 +12349,14 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext, nsIFrame* aFrame, PRBool* aStopLooking) { - nsIFrame* kid; nsIFrame* prevSibling = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = aFrame->GetFirstChild(nsnull); while (kid) { nsIAtom* frameType = kid->GetType(); if (nsLayoutAtoms::letterFrame == frameType) { // Bingo. Found it. First steal away the text frame. - nsIFrame* textFrame; - kid->FirstChild(aPresContext, nsnull, &textFrame); + nsIFrame* textFrame = kid->GetFirstChild(nsnull); if (!textFrame) { break; } @@ -12470,8 +12431,7 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont { nsresult rv = NS_OK; - nsIFrame* blockKids; - aBlockFrame->FirstChild(aPresContext, nsnull, &blockKids); + nsIFrame* blockKids = aBlockFrame->GetFirstChild(nsnull); nsIFrame* parentFrame = nsnull; nsIFrame* textFrame = nsnull; nsIFrame* prevFrame = nsnull; @@ -12982,8 +12942,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext, // Recursively walk the child frames. // Note: we only need to look at the principal child list - nsIFrame* childFrame; - frame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = frame->GetFirstChild(nsnull); while (childFrame) { DoCleanupFrameReferences(aPresContext, aFrameManager, childFrame); @@ -13212,8 +13171,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext, // be sure the left inlines, the block and the right inlines all have a view nsHTMLContainerFrame::CreateViewForFrame(aBlockChildFrame, nsnull, PR_TRUE); - nsIFrame* frame; - aBlockChildFrame->FirstChild(aPresContext, nsnull, &frame); + nsIFrame* frame = aBlockChildFrame->GetFirstChild(nsnull); nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, frame, aLeftInlineChildFrame, aBlockChildFrame); if (aRightInlineChildFrame) { @@ -13221,7 +13179,7 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext, // XXXbz should we be passing in a non-null aContentParentFrame? nsHTMLContainerFrame::CreateViewForFrame(aRightInlineChildFrame, nsnull, PR_TRUE); - aRightInlineChildFrame->FirstChild(aPresContext, nsnull, &frame); + frame = aRightInlineChildFrame->GetFirstChild(nsnull); nsHTMLContainerFrame::ReparentFrameViewList(aPresContext, frame, aLeftInlineChildFrame, aRightInlineChildFrame); } } @@ -13412,9 +13370,7 @@ nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext, if (mFixedContainingBlock) { nsIFrame *fixedChild = nsnull; do { - mFixedContainingBlock->FirstChild(aPresContext, - nsLayoutAtoms::fixedList, - &fixedChild); + fixedChild = mFixedContainingBlock->GetFirstChild(nsLayoutAtoms::fixedList); if (fixedChild) { DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, fixedChild); diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index b9dcee2ef64..cdc06cb1bcb 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -2519,8 +2519,7 @@ GetRootScrollableFrame(nsIPresContext* aPresContext, nsIFrame* aRootFrame) nsIScrollableFrame* scrollableFrame = nsnull; if (nsLayoutAtoms::viewportFrame == aRootFrame->GetType()) { - nsIFrame* childFrame; - aRootFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aRootFrame->GetFirstChild(nsnull); if (childFrame) { if (nsLayoutAtoms::scrollFrame == childFrame->GetType()) { @@ -2616,8 +2615,7 @@ IsCanvasFrame(nsIPresContext* aPresContext, nsIFrame *aFrame) frameType == nsLayoutAtoms::pageFrame) { return aFrame; } else if (frameType == nsLayoutAtoms::viewportFrame) { - nsIFrame* firstChild; - aFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aFrame->GetFirstChild(nsnull); if (firstChild) { return firstChild; } @@ -2633,8 +2631,7 @@ FindCanvasBackground(nsIPresContext* aPresContext, { // XXXldb What if the root element is positioned, etc.? (We don't // allow that yet, do we?) - nsIFrame *firstChild; - aForFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame *firstChild = aForFrame->GetFirstChild(nsnull); if (firstChild) { const nsStyleBackground* result = firstChild->GetStyleBackground(); @@ -2655,7 +2652,7 @@ FindCanvasBackground(nsIPresContext* aPresContext, kidFrame = kidFrame->GetNextSibling(); } } - firstChild->FirstChild(aPresContext, nsnull, &firstChild); + firstChild = firstChild->GetFirstChild(nsnull); } return PR_FALSE; // nothing found for this } @@ -2716,8 +2713,7 @@ FindElementBackground(nsIPresContext* aPresContext, // XXXldb We shouldn't have to null-check |parentFrame| here. if (parentFrame && IsCanvasFrame(aPresContext, parentFrame) == parentFrame) { // Check that we're really the root (rather than in another child list). - nsIFrame *childFrame; - parentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame *childFrame = parentFrame->GetFirstChild(nsnull); if (childFrame == aForFrame) return PR_FALSE; // Background was already drawn for the canvas. } @@ -3141,8 +3137,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext, // If the frame is the canvas, the image is placed relative to // the root element's (first) frame (see bug 46446) nsRect firstRootElementFrameArea; - nsIFrame* firstRootElementFrame; - aForFrame->FirstChild(aPresContext, nsnull, &firstRootElementFrame); + nsIFrame* firstRootElementFrame = aForFrame->GetFirstChild(nsnull); NS_ASSERTION(firstRootElementFrame, "A canvas with a background " "image had no child frame, which is impossible according to CSS. " "Make sure there isn't a background image specified on the " diff --git a/mozilla/layout/html/style/src/nsFrameContentIterator.cpp b/mozilla/layout/html/style/src/nsFrameContentIterator.cpp index 4471b2deeda..6f30861d8fc 100644 --- a/mozilla/layout/html/style/src/nsFrameContentIterator.cpp +++ b/mozilla/layout/html/style/src/nsFrameContentIterator.cpp @@ -82,7 +82,7 @@ NS_IMETHODIMP nsFrameContentIterator::First() { // Get the first child frame and make it the current node - mParentFrame->FirstChild(mPresContext, nsnull, &mCurrentChild); + mCurrentChild = mParentFrame->GetFirstChild(nsnull); if (!mCurrentChild) { return NS_ERROR_FAILURE; } @@ -109,7 +109,7 @@ GetNextChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent()->GetNextInFlow(&parent); if (parent) { - parent->FirstChild(aPresContext, nsnull, &nextSibling); + nextSibling = parent->GetFirstChild(nsnull); } } @@ -119,11 +119,9 @@ GetNextChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) NS_IMETHODIMP nsFrameContentIterator::Last() { - nsIFrame* nextChild; - // Starting with the first child walk and find the last child mCurrentChild = nsnull; - mParentFrame->FirstChild(mPresContext, nsnull, &nextChild); + nsIFrame* nextChild = mParentFrame->GetFirstChild(nsnull); while (nextChild) { mCurrentChild = nextChild; nextChild = ::GetNextChildFrame(mPresContext, nextChild); @@ -161,10 +159,8 @@ GetPrevChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) // Get its previous sibling. Because we have a singly linked list we // need to search from the first child nsIFrame* parent = aFrame->GetParent(); - nsIFrame* firstChild; nsIFrame* prevSibling; - - parent->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = parent->GetFirstChild(nsnull); NS_ASSERTION(firstChild, "parent has no first child"); nsFrameList frameList(firstChild); @@ -176,7 +172,7 @@ GetPrevChildFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) parent->GetPrevInFlow(&parent); if (parent) { - parent->FirstChild(aPresContext, nsnull, &firstChild); + firstChild = parent->GetFirstChild(nsnull); frameList.SetFrames(firstChild); prevSibling = frameList.LastChild(); } @@ -235,11 +231,9 @@ nsFrameContentIterator::IsDone() NS_IMETHODIMP nsFrameContentIterator::PositionAt(nsIContent* aCurNode) { - nsIFrame* child; - // Starting with the first child frame search for the child frame // with the matching content object - mParentFrame->FirstChild(mPresContext, nsnull, &child); + nsIFrame* child = mParentFrame->GetFirstChild(nsnull); while (child) { if (child->GetContent() == aCurNode) { break; diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index fe9c78da6c1..0e1087c44f1 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -1347,8 +1347,7 @@ PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, PRInt32 numNewRows = aRows.Count(); for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) { nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX); - nsIFrame* cellFrame = nsnull; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (cellFrame) { if (IS_TABLE_CELL(cellFrame->GetType())) { PRBool zeroSpan; @@ -1487,8 +1486,7 @@ nsCellMap::ExpandWithRows(nsIPresContext* aPresContext, for (PRInt32 rowX = startRowIndex; rowX <= endRowIndex; rowX++) { nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowFrames.ElementAt(newRowIndex); // append cells - nsIFrame* cFrame = nsnull; - rFrame->FirstChild(aPresContext, nsnull, &cFrame); + nsIFrame* cFrame = rFrame->GetFirstChild(nsnull); PRInt32 colIndex = 0; while (cFrame) { if (IS_TABLE_CELL(cFrame->GetType())) { @@ -1896,8 +1894,7 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext, rowX = aStartRowIndex; for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) { nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowsToInsert->ElementAt(newRowX); - nsIFrame* cFrame = nsnull; - rFrame->FirstChild(aPresContext, nsnull, &cFrame); + nsIFrame* cFrame = rFrame->GetFirstChild(nsnull); while (cFrame) { if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea); diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 788e0688270..8d763c1d7bf 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -519,8 +519,7 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext, //traverse through children unselect tables #if 0 if ((aSpread == eSpreadDown)){ - nsIFrame* kid; - FirstChild(nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); while (nsnull != kid) { kid->SetSelected(nsnull, aSelected, eSpreadDown); kid = kid->GetNextSibling(); diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 48b366bf175..4fd71aaa028 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -83,7 +83,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, } nsIFrame* colFrame = aStartColFrame; if (!colFrame || (colIndex != aFirstColIndex)) { - colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); + colFrame = colGroupFrame->GetFirstChild(nsnull); } while (colFrame) { if (nsLayoutAtoms::tableColFrame == colFrame->GetType()) { @@ -654,8 +654,8 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext, nsIFrame* childFrame = aColGroupList.FirstChild(); while (childFrame) { if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { - nsTableColFrame* colFrame = nsnull; - childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame); + nsTableColFrame* colFrame = + NS_STATIC_CAST(nsTableColFrame*, childFrame->GetFirstChild(nsnull)); while (colFrame) { if (colFrame == &aColFrame) { return (nsTableColGroupFrame *)childFrame; diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 22e14b92b28..d4e5cc3d46a 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -650,8 +650,7 @@ NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext, PRInt32 anAdjustment) { nsresult rv = NS_OK; - nsIFrame* rowFrame; - aRowGroup->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = aRowGroup->GetFirstChild(nsnull); for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) { if (NS_STYLE_DISPLAY_TABLE_ROW==rowFrame->GetStyleDisplay()->mDisplay) { PRInt32 index = ((nsTableRowFrame*)rowFrame)->GetRowIndex(); @@ -681,8 +680,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, else { nsTableColGroupFrame* cgFrame = (nsTableColGroupFrame*)kidFrame; cgFrame->SetStartColumnIndex(colIndex); - nsIFrame* firstCol; - kidFrame->FirstChild(&aPresContext, nsnull, &firstCol); + nsIFrame* firstCol = kidFrame->GetFirstChild(nsnull); cgFrame->AddColsToTable(aPresContext, colIndex, PR_FALSE, firstCol); PRInt32 numCols = cgFrame->GetColCount(); colIndex += numCols; @@ -902,10 +900,9 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, { *aFirstNewFrame = nsnull; nsIFrame* lastColFrame = nsnull; - nsIFrame* childFrame; // Get the last col frame - aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aColGroupFrame.GetFirstChild(nsnull); while (childFrame) { if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { lastColFrame = (nsTableColGroupFrame *)childFrame; @@ -1265,8 +1262,7 @@ nsTableFrame::CollectRows(nsIPresContext* aPresContext, PRInt32 numRows = 0; nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aFrame); if (rgFrame) { - nsIFrame* childFrame = nsnull; - rgFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull); while (childFrame) { if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { aCollection.AppendElement(childFrame); @@ -1332,36 +1328,23 @@ nsTableFrame::InsertRowGroups(nsIPresContext& aPresContext, ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsTableFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsTableFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (aListName == nsLayoutAtoms::colGroupList) { - *aFirstChild = mColGroups.FirstChild(); - return NS_OK; + return mColGroups.FirstChild(); } - return nsHTMLContainerFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsHTMLContainerFrame::GetFirstChild(aListName); } -NS_IMETHODIMP -nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; + if (aIndex == NS_TABLE_FRAME_COLGROUP_LIST_INDEX) { + return nsLayoutAtoms::colGroupList; } - *aListName = nsnull; - switch (aIndex) { - case NS_TABLE_FRAME_COLGROUP_LIST_INDEX: - *aListName = nsLayoutAtoms::colGroupList; - NS_ADDREF(*aListName); - break; - } - return NS_OK; + return nsnull; } void @@ -1475,13 +1458,10 @@ nsTableFrame::SetSelected(nsIPresContext* aPresContext, #if 0 //traverse through children unselect tables if ((aSpread == eSpreadDown)){ - nsIFrame* kid; - nsresult rv = FirstChild(nsnull, &kid); - if (NS_SUCCEEDED(rv)) { - while (kid) { - kid->SetSelected(nsnull, aSelected, eSpreadDown); - kid = kid->GetNextSibling(); - } + nsIFrame* kid = GetFirstChild(nsnull); + while (kid) { + kid->SetSelected(nsnull, aSelected, eSpreadDown); + kid = kid->GetNextSibling(); } } #endif @@ -1615,8 +1595,7 @@ nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, PRInt32 numCols = GetColCount(); while (nsnull != colGroupFrame) { nscoord colGroupWidth = 0; - nsIFrame* colFrame = nsnull; - colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); + nsIFrame* colFrame = colGroupFrame->GetFirstChild(nsnull); nsPoint colOrigin(0,0); while (nsnull != colFrame) { if (NS_STYLE_DISPLAY_TABLE_COLUMN == @@ -1660,8 +1639,7 @@ ProcessRowInserted(nsIPresContext* aPresContext, for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) { nsTableRowGroupFrame* rgFrame = (nsTableRowGroupFrame*)rowGroups.ElementAt(rgX); if (!rgFrame) continue; // should never happen - nsIFrame* childFrame = nsnull; - rgFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull); // find the row that was inserted first while (childFrame) { if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { @@ -2286,8 +2264,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext, const nsStyleVisibility* groupVis = aRowGroupFrame->GetStyleVisibility(); PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible); - nsIFrame* rowFrame; - aRowGroupFrame->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = aRowGroupFrame->GetFirstChild(nsnull); while (nsnull != rowFrame) { const nsStyleDisplay* rowDisplay = rowFrame->GetStyleDisplay(); @@ -2298,8 +2275,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext, aYGroupOffset += rowRect.height; rowRect.height = 0; rowFrame->SetRect(rowRect); - nsIFrame* cellFrame; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (nsnull != cellFrame) { const nsStyleDisplay* cellDisplay = cellFrame->GetStyleDisplay(); if (NS_STYLE_DISPLAY_TABLE_CELL == cellDisplay->mDisplay) { @@ -4269,9 +4245,8 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, // aPriorChildFrame is not of type aChildType, so we need start from // the beginnng and find the closest one - nsIFrame* childFrame; nsIFrame* lastMatchingFrame = nsnull; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame && (childFrame != aPriorChildFrame)) { if (aChildType == childFrame->GetType()) { lastMatchingFrame = childFrame; @@ -4287,13 +4262,11 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) { nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aKidFrame); if (rgFrame) { - nsIFrame* rowFrame; - rgFrame->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = rgFrame->GetFirstChild(nsnull); while (rowFrame) { if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); - nsIFrame* cellFrame; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (cellFrame) { if (IS_TABLE_CELL(cellFrame->GetType())) { PRInt32 colIndex; @@ -4364,8 +4337,7 @@ nsTableIterator::nsTableIterator(nsIPresContext* aPresContext, nsIFrame& aSource, nsTableIteration aType) { - nsIFrame* firstChild; - aSource.FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aSource.GetFirstChild(nsnull); Init(firstChild, aType); } @@ -7387,8 +7359,7 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, nsLayoutAtoms::tableRowGroupFrame == fType || nsLayoutAtoms::tableRowFrame == fType || IS_TABLE_CELL(fType)) { - nsIFrame* child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aFrame->GetFirstChild(nsnull); while(child) { DumpTableFramesRecur(aPresContext, child, aIndent+1); child = child->GetNextSibling(); diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index c449f091e44..61743916093 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -306,15 +306,12 @@ public: nsIFrame* aChildList); /** return the first child belonging to the list aListName. - * @see nsIFrame::FirstChild + * @see nsIFrame::GetFirstChild */ - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; /** @see nsIFrame::GetAdditionalChildListName */ - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index bb593f3b7b2..4120a71d675 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -176,33 +176,25 @@ nsTableOuterFrame::Init(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableOuterFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsTableOuterFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); - *aFirstChild = (nsLayoutAtoms::captionList == aListName) - ? mCaptionFrame : mFrames.FirstChild(); - return NS_OK; + if (nsLayoutAtoms::captionList == aListName) { + return mCaptionFrame; + } + if (!aListName) { + return mFrames.FirstChild(); + } + return nsnull; } -NS_IMETHODIMP -nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; + if (aIndex == NS_TABLE_FRAME_CAPTION_LIST_INDEX) { + return nsLayoutAtoms::captionList; } - *aListName = nsnull; - switch (aIndex) { - case NS_TABLE_FRAME_CAPTION_LIST_INDEX: - *aListName = nsLayoutAtoms::captionList; - NS_ADDREF(*aListName); - break; - } - return NS_OK; + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h index f043904537d..a9f72709fc1 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.h +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h @@ -102,12 +102,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, nsIPresShell& aPresShell, diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 7165085851d..1f9009d9138 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -527,12 +527,10 @@ PRBool IsFirstRow(nsIPresContext* aPresContext, nsTableFrame& aTable, nsTableRowFrame& aRow) { - nsIFrame* firstRowGroup = nsnull; - aTable.FirstChild(aPresContext, nsnull, &firstRowGroup); + nsIFrame* firstRowGroup = aTable.GetFirstChild(nsnull); nsIFrame* rowGroupFrame = aRow.GetParent(); if (rowGroupFrame == firstRowGroup) { - nsIFrame* firstRow; - rowGroupFrame->FirstChild(aPresContext, nsnull, &firstRow); + nsIFrame* firstRow = rowGroupFrame->GetFirstChild(nsnull); return (&aRow == firstRow); } return PR_FALSE; @@ -612,10 +610,10 @@ nsTableRowFrame::GetFrameForPoint(nsIPresContext* aPresContext, // This is basically copied from nsContainerFrame::GetFrameForPointUsing, // except for one bit removed - nsIFrame *kid, *hit; + nsIFrame *hit; nsPoint tmp; - FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); *aFrame = nsnull; tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); while (nsnull != kid) { @@ -1420,8 +1418,7 @@ nsTableRowFrame::Contains(nsIPresContext* aPresContext, } // if that fails, check the cells, they might span outside the row rect else { - nsIFrame* kid; - FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); while (nsnull != kid) { nsPoint point(aPoint); point.MoveBy(-mRect.x, -mRect.y); // offset the point to check by the row container diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 3bc59e5068a..21e864de16a 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -1564,10 +1564,9 @@ nsTableRowGroupFrame::GetHeightOfRows(nsIPresContext* aPresContext) nscoord height = 0; // enumerate the rows and total their heights - nsIFrame* rowFrame = nsnull; - rv = FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = GetFirstChild(nsnull); PRInt32 numRows = 0; - while ((NS_SUCCEEDED(rv)) && rowFrame) { + while (rowFrame) { if (NS_STYLE_DISPLAY_TABLE_ROW == rowFrame->GetStyleDisplay()->mDisplay) { height += rowFrame->GetSize().height; numRows++; diff --git a/mozilla/layout/html/tests/TestInlineFrame.cpp b/mozilla/layout/html/tests/TestInlineFrame.cpp index affd69a2266..36d388b9262 100644 --- a/mozilla/layout/html/tests/TestInlineFrame.cpp +++ b/mozilla/layout/html/tests/TestInlineFrame.cpp @@ -226,7 +226,7 @@ PRInt32 InlineFrame::MaxChildWidth() PRInt32 maxWidth = 0; nsIFrame* f; - for (FirstChild(f); nsnull != f; f->GetNextSibling(f)) { + for (f = GetFirstChild(); nsnull != f; f->GetNextSibling(f)) { if (f->GetWidth() > maxWidth) { maxWidth = f->GetWidth(); } @@ -239,7 +239,7 @@ PRInt32 InlineFrame::MaxChildHeight() { PRInt32 maxHeight = 0; - for (nsIFrame* f = FirstChild(); nsnull != f; f = f->GetNextSibling()) { + for (nsIFrame* f = GetFirstChild(); nsnull != f; f = f->GetNextSibling()) { if (f->GetHeight() > maxHeight) { maxHeight = f->GetHeight(); } diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 4e719e82bb2..7ac770b0c65 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -201,9 +201,8 @@ nsMathMLContainerFrame::GetPreferredStretchSize(nsIPresContext* aPresContex "invalid call to GetPreferredStretchSize"); PRBool firstTime = PR_TRUE; nsBoundingMetrics bm, bmChild; - nsIFrame* childFrame; // XXXrbs need overloaded FirstChild() and clean integration of throughout - FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = GetFirstChild(nsnull); while (childFrame) { // initializations in case this child happens not to be a MathML frame nsRect rect = childFrame->GetRect(); @@ -528,8 +527,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFor(nsIPresContext* aPresContex } else { // propagate down the subtrees - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { PropagatePresentationDataFor(aPresContext, childFrame, aScriptLevelIncrement, aFlagsValues, aFlagsToUpdate); @@ -550,8 +548,7 @@ nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsIPresContext* aPr if (!aFlagsToUpdate && !aScriptLevelIncrement) return; PRInt32 index = 0; - nsIFrame* childFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame) { if ((index >= aFirstChildIndex) && ((aLastChildIndex <= 0) || ((aLastChildIndex > 0) && @@ -672,8 +669,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext, } // recurse down the subtrees for changes that may arise deep down - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); while (childFrame) { childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); if (mathMLFrame) { @@ -835,8 +831,7 @@ nsMathMLContainerFrame::RebuildAutomaticDataForChildren(nsIPresContext* aPresCon // the parent // 2. As we ascend the tree, transmit any specific change that we want // down the subtrees - nsIFrame* childFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame) { nsIMathMLFrame* childMathMLFrame; childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&childMathMLFrame); @@ -905,8 +900,7 @@ nsMathMLContainerFrame::ReLayoutChildren(nsIPresContext* aPresContext, #endif // re-resolve the style data to sync any change of script sizes - nsIFrame* childFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame) { nsIMathMLFrame* mathMLFrame; childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathMLFrame); @@ -1395,8 +1389,7 @@ GetInterFrameSpacingFor(nsIPresContext* aPresContext, nsIFrame* aParentFrame, nsIFrame* aChildFrame) { - nsIFrame* childFrame; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); if (!childFrame || aChildFrame == childFrame) return 0; diff --git a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp index 0f2311c927f..9ae19a0b598 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -149,8 +149,7 @@ printf("\n"); aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); PRInt32 count = 0; - nsIFrame* childFrame; - FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = GetFirstChild(nsnull); while (childFrame) { nsHTMLReflowState childReflowState(aPresContext, aReflowState, childFrame, availSize); @@ -208,8 +207,7 @@ nsMathMLTokenFrame::Place(nsIPresContext* aPresContext, if (aPlaceOrigin) { nscoord dy, dx = 0; - nsIFrame* childFrame; - FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = GetFirstChild(nsnull); while (childFrame) { nsRect rect = childFrame->GetRect(); nsHTMLReflowMetrics childSize(nsnull); @@ -365,7 +363,7 @@ SetQuote(nsIPresContext* aPresContext, nsIFrame* textFrame; do { // walk down the hierarchy of first children because they could be wrapped - aFrame->FirstChild(aPresContext, nsnull, &textFrame); + textFrame = aFrame->GetFirstChild(nsnull); if (textFrame) { if (textFrame->GetType() == nsLayoutAtoms::textFrame) break; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 370780a0686..bbe5ba6402d 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -298,8 +298,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext, nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); nsHTMLReflowMetrics childDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); - nsIFrame* firstChild; - aForFrame->FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aForFrame->GetFirstChild(nsnull); nsIFrame* childFrame = firstChild; if (firstChild || aOpenChar || aCloseChar || aSeparatorsCount > 0) { // We use the ASCII metrics to get our minimum height. This way, if we have diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp index ae9df29908b..8f9afc6c18c 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -375,9 +375,7 @@ nsMathMLmoFrame::ProcessOperatorData(nsIPresContext* aPresContext) // find the position of our outermost embellished container w.r.t // its siblings (frames are singly-linked together). - nsIFrame* firstChild; - parentAncestor->FirstChild(aPresContext, nsnull, &firstChild); - nsFrameList frameList(firstChild); + nsFrameList frameList(parentAncestor->GetFirstChild(nsnull)); nsIFrame* nextSibling = embellishAncestor->GetNextSibling(); nsIFrame* prevSibling = frameList.GetPrevSiblingFor(embellishAncestor); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp index 26ed1161931..e736b1c9938 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp @@ -136,8 +136,7 @@ nsMathMLmsubFrame::PlaceSubScript (nsIPresContext* aPresContext, nsBoundingMetrics bmBase, bmSubScript; nsHTMLReflowMetrics baseSize(nsnull); nsHTMLReflowMetrics subScriptSize(nsnull); - nsIFrame* baseFrame; - aFrame->FirstChild(aPresContext, nsnull, &baseFrame); + nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull); nsIFrame* subScriptFrame = nsnull; if (baseFrame) subScriptFrame = baseFrame->GetNextSibling(); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp index 2c9332f5ea4..211c7882e01 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp @@ -154,10 +154,9 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsIPresContext* aPresContext, nsHTMLReflowMetrics subScriptSize (nsnull); nsHTMLReflowMetrics supScriptSize (nsnull); nsBoundingMetrics bmBase, bmSubScript, bmSupScript; - nsIFrame* baseFrame = nsnull; nsIFrame* subScriptFrame = nsnull; nsIFrame* supScriptFrame = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &baseFrame); + nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull); if (baseFrame) subScriptFrame = baseFrame->GetNextSibling(); if (subScriptFrame) diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp index 296a6a2fe2f..23b0c61754b 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp @@ -137,9 +137,8 @@ nsMathMLmsupFrame::PlaceSuperScript(nsIPresContext* aPresContext, nsHTMLReflowMetrics baseSize (nsnull); nsHTMLReflowMetrics supScriptSize (nsnull); nsBoundingMetrics bmBase, bmSupScript; - nsIFrame* baseFrame = nsnull; nsIFrame* supScriptFrame = nsnull; - aFrame->FirstChild(aPresContext, nsnull, &baseFrame); + nsIFrame* baseFrame = aFrame->GetFirstChild(nsnull); if (baseFrame) supScriptFrame = baseFrame->GetNextSibling(); if (!baseFrame || !supScriptFrame || supScriptFrame->GetNextSibling()) { diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index a4c8dc21387..9255fabba7d 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -514,14 +514,13 @@ nsPrintEngine::GetSeqFrameAndCountPagesInternal(nsPrintObject* aPO, aSeqFrame = curFrame; break; } - curFrame->FirstChild(aPO->mPresContext, nsnull, &curFrame); + curFrame = curFrame->GetFirstChild(nsnull); } if (aSeqFrame == nsnull) return NS_ERROR_FAILURE; // first count the total number of pages aCount = 0; - nsIFrame * pageFrame; - aSeqFrame->FirstChild(aPO->mPresContext, nsnull, &pageFrame); + nsIFrame* pageFrame = aSeqFrame->GetFirstChild(nsnull); while (pageFrame != nsnull) { aCount++; pageFrame = pageFrame->GetNextSibling(); @@ -2688,7 +2687,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink) nsIFrame* frame; frameMan->GetPrimaryFrameFor(aPO->mContent, &frame); if (frame && (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame)) { - frame->FirstChild(aPO->mParent->mPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); } if (frame) { @@ -2957,8 +2956,7 @@ nsPrintEngine::CalcPageFrameLocation(nsIPresShell * aPresShell, // Calc the Page No it is on PRInt32 pageNum = 1; - nsIFrame * child; - seqFrame->FirstChild(aPO->mPresContext, nsnull, &child); + nsIFrame* child = seqFrame->GetFirstChild(nsnull); while (child != nsnull) { if (pageFrame == child) { aPO->mPageNum = pageNum; @@ -2992,8 +2990,7 @@ nsPrintEngine::CalcNumPrintableDocsAndPages(PRInt32& aNumDocs, PRInt32& aNumPage po->mPresShell->GetPageSequenceFrame(&pageSequence); nsIFrame * seqFrame; if (NS_SUCCEEDED(CallQueryInterface(pageSequence, &seqFrame))) { - nsIFrame* frame; - seqFrame->FirstChild(po->mPresContext, nsnull, &frame); + nsIFrame* frame = seqFrame->GetFirstChild(nsnull); while (frame) { aNumPages++; frame = frame->GetNextSibling(); @@ -3060,7 +3057,7 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY) if (frame) { // This gets the "inner" frame, // and then traverse out ot the pageContentFrame - frame->FirstChild(aPO->mParent->mPresContext, nsnull, &frame); + frame = frame->GetFirstChild(nsnull); while (frame) { nsPoint pt = frame->GetPosition(); aX += pt.x; @@ -3655,9 +3652,8 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext, NS_ASSERTION(aParentFrame, "Pointer is null!"); NS_ASSERTION(aType, "Pointer is null!"); - nsIFrame * child; aRect += aParentFrame->GetPosition(); - aParentFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aParentFrame->GetFirstChild(nsnull); while (child) { nsIContent* content = child->GetContent(); if (content && content->Tag() == aType) { @@ -3693,8 +3689,7 @@ nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext, NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!"); - nsIFrame * child; - aParentFrame->FirstChild(aPresContext, aList, &child); + nsIFrame* child = aParentFrame->GetFirstChild(aList); aRect += aParentFrame->GetPosition(); while (child) { // only leaf frames have this bit flipped @@ -3744,9 +3739,8 @@ nsPrintEngine::FindSelectionBounds(nsIPresContext* aPresContext, PRInt32 childListIndex = 0; do { nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childListName, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect); - NS_IF_RELEASE(childListName); NS_ENSURE_SUCCESS(rv, rv); - aParentFrame->GetAdditionalChildListName(childListIndex++, &childListName); + childListName = aParentFrame->GetAdditionalChildListName(childListIndex++); } while (childListName); return NS_OK; } @@ -3835,8 +3829,7 @@ nsPrintEngine::GetPageRangeForSelection(nsIPresShell * aPresShell, // dump all the pages and their pointers { PRInt32 pageNum = 1; - nsIFrame * child; - seqFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = seqFrame->GetFirstChild(nsnull); while (child != nsnull) { printf("Page: %d - %p\n", pageNum, child); pageNum++; @@ -3848,8 +3841,7 @@ nsPrintEngine::GetPageRangeForSelection(nsIPresShell * aPresShell, // Now that we have the page frames // find out what the page numbers are for each frame PRInt32 pageNum = 1; - nsIFrame * page; - seqFrame->FirstChild(aPresContext, nsnull, &page); + nsIFrame* page = seqFrame->GetFirstChild(nsnull); while (page != nsnull) { if (page == startPageFrame) { aStartPageNum = pageNum; @@ -4715,8 +4707,7 @@ static void DumpFrames(FILE* out, NS_ASSERTION(aRendContext, "Pointer is null!"); NS_ASSERTION(aFrame, "Pointer is null!"); - nsIFrame * child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aFrame->GetFirstChild(nsnull); while (child != nsnull) { for (PRInt32 i=0;iFirstChild(po->mPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); } } diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index c4c9b5b082a..96fd8454598 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -2675,13 +2675,12 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame, // _not_ include the scrollbars. For fixed positioned frames, // the containing block is the viewport, which _does_ include // scrollbars. We have to do some extra work. - nsIFrame* scrollingChild; nsCOMPtr presShell = do_QueryReferent(mPresShellWeak); NS_ASSERTION(presShell, "Must have a presshell!"); nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); // the first child in the default frame list is what we want - container->FirstChild(presContext, nsnull, &scrollingChild); + nsIFrame* scrollingChild = container->GetFirstChild(nsnull); nsCOMPtr scrollFrame = do_QueryInterface(scrollingChild); if (scrollFrame) { diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index fe9c78da6c1..0e1087c44f1 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -1347,8 +1347,7 @@ PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, PRInt32 numNewRows = aRows.Count(); for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) { nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX); - nsIFrame* cellFrame = nsnull; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (cellFrame) { if (IS_TABLE_CELL(cellFrame->GetType())) { PRBool zeroSpan; @@ -1487,8 +1486,7 @@ nsCellMap::ExpandWithRows(nsIPresContext* aPresContext, for (PRInt32 rowX = startRowIndex; rowX <= endRowIndex; rowX++) { nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowFrames.ElementAt(newRowIndex); // append cells - nsIFrame* cFrame = nsnull; - rFrame->FirstChild(aPresContext, nsnull, &cFrame); + nsIFrame* cFrame = rFrame->GetFirstChild(nsnull); PRInt32 colIndex = 0; while (cFrame) { if (IS_TABLE_CELL(cFrame->GetType())) { @@ -1896,8 +1894,7 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext, rowX = aStartRowIndex; for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) { nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowsToInsert->ElementAt(newRowX); - nsIFrame* cFrame = nsnull; - rFrame->FirstChild(aPresContext, nsnull, &cFrame); + nsIFrame* cFrame = rFrame->GetFirstChild(nsnull); while (cFrame) { if (IS_TABLE_CELL(cFrame->GetType())) { AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea); diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 788e0688270..8d763c1d7bf 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -519,8 +519,7 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext, //traverse through children unselect tables #if 0 if ((aSpread == eSpreadDown)){ - nsIFrame* kid; - FirstChild(nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); while (nsnull != kid) { kid->SetSelected(nsnull, aSelected, eSpreadDown); kid = kid->GetNextSibling(); diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 48b366bf175..4fd71aaa028 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -83,7 +83,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext, } nsIFrame* colFrame = aStartColFrame; if (!colFrame || (colIndex != aFirstColIndex)) { - colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); + colFrame = colGroupFrame->GetFirstChild(nsnull); } while (colFrame) { if (nsLayoutAtoms::tableColFrame == colFrame->GetType()) { @@ -654,8 +654,8 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext, nsIFrame* childFrame = aColGroupList.FirstChild(); while (childFrame) { if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) { - nsTableColFrame* colFrame = nsnull; - childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame); + nsTableColFrame* colFrame = + NS_STATIC_CAST(nsTableColFrame*, childFrame->GetFirstChild(nsnull)); while (colFrame) { if (colFrame == &aColFrame) { return (nsTableColGroupFrame *)childFrame; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 22e14b92b28..d4e5cc3d46a 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -650,8 +650,7 @@ NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext, PRInt32 anAdjustment) { nsresult rv = NS_OK; - nsIFrame* rowFrame; - aRowGroup->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = aRowGroup->GetFirstChild(nsnull); for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) { if (NS_STYLE_DISPLAY_TABLE_ROW==rowFrame->GetStyleDisplay()->mDisplay) { PRInt32 index = ((nsTableRowFrame*)rowFrame)->GetRowIndex(); @@ -681,8 +680,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext, else { nsTableColGroupFrame* cgFrame = (nsTableColGroupFrame*)kidFrame; cgFrame->SetStartColumnIndex(colIndex); - nsIFrame* firstCol; - kidFrame->FirstChild(&aPresContext, nsnull, &firstCol); + nsIFrame* firstCol = kidFrame->GetFirstChild(nsnull); cgFrame->AddColsToTable(aPresContext, colIndex, PR_FALSE, firstCol); PRInt32 numCols = cgFrame->GetColCount(); colIndex += numCols; @@ -902,10 +900,9 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext, { *aFirstNewFrame = nsnull; nsIFrame* lastColFrame = nsnull; - nsIFrame* childFrame; // Get the last col frame - aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aColGroupFrame.GetFirstChild(nsnull); while (childFrame) { if (nsLayoutAtoms::tableColFrame == childFrame->GetType()) { lastColFrame = (nsTableColGroupFrame *)childFrame; @@ -1265,8 +1262,7 @@ nsTableFrame::CollectRows(nsIPresContext* aPresContext, PRInt32 numRows = 0; nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aFrame); if (rgFrame) { - nsIFrame* childFrame = nsnull; - rgFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull); while (childFrame) { if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { aCollection.AppendElement(childFrame); @@ -1332,36 +1328,23 @@ nsTableFrame::InsertRowGroups(nsIPresContext& aPresContext, ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration -NS_IMETHODIMP -nsTableFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsTableFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); if (aListName == nsLayoutAtoms::colGroupList) { - *aFirstChild = mColGroups.FirstChild(); - return NS_OK; + return mColGroups.FirstChild(); } - return nsHTMLContainerFrame::FirstChild(aPresContext, aListName, aFirstChild); + return nsHTMLContainerFrame::GetFirstChild(aListName); } -NS_IMETHODIMP -nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; + if (aIndex == NS_TABLE_FRAME_COLGROUP_LIST_INDEX) { + return nsLayoutAtoms::colGroupList; } - *aListName = nsnull; - switch (aIndex) { - case NS_TABLE_FRAME_COLGROUP_LIST_INDEX: - *aListName = nsLayoutAtoms::colGroupList; - NS_ADDREF(*aListName); - break; - } - return NS_OK; + return nsnull; } void @@ -1475,13 +1458,10 @@ nsTableFrame::SetSelected(nsIPresContext* aPresContext, #if 0 //traverse through children unselect tables if ((aSpread == eSpreadDown)){ - nsIFrame* kid; - nsresult rv = FirstChild(nsnull, &kid); - if (NS_SUCCEEDED(rv)) { - while (kid) { - kid->SetSelected(nsnull, aSelected, eSpreadDown); - kid = kid->GetNextSibling(); - } + nsIFrame* kid = GetFirstChild(nsnull); + while (kid) { + kid->SetSelected(nsnull, aSelected, eSpreadDown); + kid = kid->GetNextSibling(); } } #endif @@ -1615,8 +1595,7 @@ nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, PRInt32 numCols = GetColCount(); while (nsnull != colGroupFrame) { nscoord colGroupWidth = 0; - nsIFrame* colFrame = nsnull; - colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame); + nsIFrame* colFrame = colGroupFrame->GetFirstChild(nsnull); nsPoint colOrigin(0,0); while (nsnull != colFrame) { if (NS_STYLE_DISPLAY_TABLE_COLUMN == @@ -1660,8 +1639,7 @@ ProcessRowInserted(nsIPresContext* aPresContext, for (PRUint32 rgX = 0; rgX < numRowGroups; rgX++) { nsTableRowGroupFrame* rgFrame = (nsTableRowGroupFrame*)rowGroups.ElementAt(rgX); if (!rgFrame) continue; // should never happen - nsIFrame* childFrame = nsnull; - rgFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull); // find the row that was inserted first while (childFrame) { if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) { @@ -2286,8 +2264,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext, const nsStyleVisibility* groupVis = aRowGroupFrame->GetStyleVisibility(); PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible); - nsIFrame* rowFrame; - aRowGroupFrame->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = aRowGroupFrame->GetFirstChild(nsnull); while (nsnull != rowFrame) { const nsStyleDisplay* rowDisplay = rowFrame->GetStyleDisplay(); @@ -2298,8 +2275,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext, aYGroupOffset += rowRect.height; rowRect.height = 0; rowFrame->SetRect(rowRect); - nsIFrame* cellFrame; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (nsnull != cellFrame) { const nsStyleDisplay* cellDisplay = cellFrame->GetStyleDisplay(); if (NS_STYLE_DISPLAY_TABLE_CELL == cellDisplay->mDisplay) { @@ -4269,9 +4245,8 @@ nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext, // aPriorChildFrame is not of type aChildType, so we need start from // the beginnng and find the closest one - nsIFrame* childFrame; nsIFrame* lastMatchingFrame = nsnull; - aParentFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aParentFrame->GetFirstChild(nsnull); while (childFrame && (childFrame != aPriorChildFrame)) { if (aChildType == childFrame->GetType()) { lastMatchingFrame = childFrame; @@ -4287,13 +4262,11 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) { nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aKidFrame); if (rgFrame) { - nsIFrame* rowFrame; - rgFrame->FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = rgFrame->GetFirstChild(nsnull); while (rowFrame) { if (nsLayoutAtoms::tableRowFrame == rowFrame->GetType()) { printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); - nsIFrame* cellFrame; - rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); + nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull); while (cellFrame) { if (IS_TABLE_CELL(cellFrame->GetType())) { PRInt32 colIndex; @@ -4364,8 +4337,7 @@ nsTableIterator::nsTableIterator(nsIPresContext* aPresContext, nsIFrame& aSource, nsTableIteration aType) { - nsIFrame* firstChild; - aSource.FirstChild(aPresContext, nsnull, &firstChild); + nsIFrame* firstChild = aSource.GetFirstChild(nsnull); Init(firstChild, aType); } @@ -7387,8 +7359,7 @@ void DumpTableFramesRecur(nsIPresContext* aPresContext, nsLayoutAtoms::tableRowGroupFrame == fType || nsLayoutAtoms::tableRowFrame == fType || IS_TABLE_CELL(fType)) { - nsIFrame* child; - aFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aFrame->GetFirstChild(nsnull); while(child) { DumpTableFramesRecur(aPresContext, child, aIndent+1); child = child->GetNextSibling(); diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index c449f091e44..61743916093 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -306,15 +306,12 @@ public: nsIFrame* aChildList); /** return the first child belonging to the list aListName. - * @see nsIFrame::FirstChild + * @see nsIFrame::GetFirstChild */ - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; /** @see nsIFrame::GetAdditionalChildListName */ - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext* aPresContext, diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index bb593f3b7b2..4120a71d675 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -176,33 +176,25 @@ nsTableOuterFrame::Init(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTableOuterFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsTableOuterFrame::GetFirstChild(nsIAtom* aListName) const { - NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer"); - *aFirstChild = (nsLayoutAtoms::captionList == aListName) - ? mCaptionFrame : mFrames.FirstChild(); - return NS_OK; + if (nsLayoutAtoms::captionList == aListName) { + return mCaptionFrame; + } + if (!aListName) { + return mFrames.FirstChild(); + } + return nsnull; } -NS_IMETHODIMP -nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - if (aIndex < 0) { - return NS_ERROR_INVALID_ARG; + if (aIndex == NS_TABLE_FRAME_CAPTION_LIST_INDEX) { + return nsLayoutAtoms::captionList; } - *aListName = nsnull; - switch (aIndex) { - case NS_TABLE_FRAME_CAPTION_LIST_INDEX: - *aListName = nsLayoutAtoms::captionList; - NS_ADDREF(*aListName); - break; - } - return NS_OK; + return nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h index f043904537d..a9f72709fc1 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.h +++ b/mozilla/layout/tables/nsTableOuterFrame.h @@ -102,12 +102,9 @@ public: nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, nsIPresShell& aPresShell, diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 7165085851d..1f9009d9138 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -527,12 +527,10 @@ PRBool IsFirstRow(nsIPresContext* aPresContext, nsTableFrame& aTable, nsTableRowFrame& aRow) { - nsIFrame* firstRowGroup = nsnull; - aTable.FirstChild(aPresContext, nsnull, &firstRowGroup); + nsIFrame* firstRowGroup = aTable.GetFirstChild(nsnull); nsIFrame* rowGroupFrame = aRow.GetParent(); if (rowGroupFrame == firstRowGroup) { - nsIFrame* firstRow; - rowGroupFrame->FirstChild(aPresContext, nsnull, &firstRow); + nsIFrame* firstRow = rowGroupFrame->GetFirstChild(nsnull); return (&aRow == firstRow); } return PR_FALSE; @@ -612,10 +610,10 @@ nsTableRowFrame::GetFrameForPoint(nsIPresContext* aPresContext, // This is basically copied from nsContainerFrame::GetFrameForPointUsing, // except for one bit removed - nsIFrame *kid, *hit; + nsIFrame *hit; nsPoint tmp; - FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); *aFrame = nsnull; tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); while (nsnull != kid) { @@ -1420,8 +1418,7 @@ nsTableRowFrame::Contains(nsIPresContext* aPresContext, } // if that fails, check the cells, they might span outside the row rect else { - nsIFrame* kid; - FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); while (nsnull != kid) { nsPoint point(aPoint); point.MoveBy(-mRect.x, -mRect.y); // offset the point to check by the row container diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 3bc59e5068a..21e864de16a 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -1564,10 +1564,9 @@ nsTableRowGroupFrame::GetHeightOfRows(nsIPresContext* aPresContext) nscoord height = 0; // enumerate the rows and total their heights - nsIFrame* rowFrame = nsnull; - rv = FirstChild(aPresContext, nsnull, &rowFrame); + nsIFrame* rowFrame = GetFirstChild(nsnull); PRInt32 numRows = 0; - while ((NS_SUCCEEDED(rv)) && rowFrame) { + while (rowFrame) { if (NS_STYLE_DISPLAY_TABLE_ROW == rowFrame->GetStyleDisplay()->mDisplay) { height += rowFrame->GetSize().height; numRows++; diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 266fd1f8fc8..bc389645f75 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -828,8 +828,7 @@ nsBox::CollapseChild(nsBoxLayoutState& aState, nsIFrame* aFrame, PRBool aHide) } // collapse the child - nsIFrame* child = nsnull; - aFrame->FirstChild(presContext, nsnull,&child); + nsIFrame* child = aFrame->GetFirstChild(nsnull); while (nsnull != child) { diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 48fd2843f0f..b9db5e8af3f 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -1812,10 +1812,10 @@ nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext, } } - nsIFrame *kid, *hit = nsnull; + nsIFrame *hit = nsnull; nsPoint tmp; - FirstChild(aPresContext, nsnull, &kid); + nsIFrame* kid = GetFirstChild(nsnull); *aFrame = nsnull; tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y); diff --git a/mozilla/layout/xul/base/src/nsBoxObject.cpp b/mozilla/layout/xul/base/src/nsBoxObject.cpp index 98399ca6910..46a2f9aff45 100644 --- a/mozilla/layout/xul/base/src/nsBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsBoxObject.cpp @@ -559,11 +559,7 @@ nsBoxObject::GetPreviousSibling(nsIDOMElement **aPreviousOrdinalSibling) nsIFrame* parentFrame = frame->GetParent(); if (!parentFrame) return NS_OK; - nsCOMPtr presContext; - mPresShell->GetPresContext(getter_AddRefs(presContext)); - - nsIFrame* nextFrame; - parentFrame->FirstChild(presContext, nsnull, &nextFrame); + nsIFrame* nextFrame = parentFrame->GetFirstChild(nsnull); nsIFrame* prevFrame = nsnull; while (nextFrame) { if (nextFrame == frame) @@ -588,12 +584,8 @@ nsBoxObject::GetChildByOrdinalAt(PRUint32 aIndex) nsIFrame* frame = GetFrame(); if (!frame) return nsnull; - nsCOMPtr presContext; - mPresShell->GetPresContext(getter_AddRefs(presContext)); - // get the first child box - nsIFrame* childFrame; - frame->FirstChild(presContext, nsnull, &childFrame); + nsIFrame* childFrame = frame->GetFirstChild(nsnull); PRUint32 i = 0; while (childFrame && i < aIndex) { diff --git a/mozilla/layout/xul/base/src/nsGrippyFrame.cpp b/mozilla/layout/xul/base/src/nsGrippyFrame.cpp index b6af1903a71..5e212871116 100644 --- a/mozilla/layout/xul/base/src/nsGrippyFrame.cpp +++ b/mozilla/layout/xul/base/src/nsGrippyFrame.cpp @@ -195,8 +195,7 @@ nsGrippyFrame::IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame* { PRInt32 count = 0; - nsIFrame* childFrame; - parent->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = parent->GetFirstChild(nsnull); while (nsnull != childFrame) { if (childFrame == child) @@ -214,8 +213,7 @@ nsGrippyFrame::CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame) { PRInt32 count = 0; - nsIFrame* childFrame; - aFrame->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = aFrame->GetFirstChild(nsnull); while (nsnull != childFrame) { childFrame = childFrame->GetNextSibling(); @@ -230,8 +228,7 @@ nsGrippyFrame::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt3 { PRInt32 count = 0; - nsIFrame* childFrame; - parent->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = parent->GetFirstChild(nsnull); while (nsnull != childFrame) { if (count == index) diff --git a/mozilla/layout/xul/base/src/nsListBoxObject.cpp b/mozilla/layout/xul/base/src/nsListBoxObject.cpp index d1a1f5b9635..55f2b00a5cc 100644 --- a/mozilla/layout/xul/base/src/nsListBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsListBoxObject.cpp @@ -229,14 +229,12 @@ nsListBoxObject::GetListBoxBody() return nsnull; // this frame will be a nsListBoxScrollPortFrame - nsIFrame* scrollPort = nsnull; - frame->FirstChild(nsnull, nsnull, &scrollPort); + nsIFrame* scrollPort = frame->GetFirstChild(nsnull); if (!scrollPort) return nsnull; // this frame will be the one we want - nsIFrame* yeahBaby = nsnull; - scrollPort->FirstChild(nsnull, nsnull, &yeahBaby); + nsIFrame* yeahBaby = scrollPort->GetFirstChild(nsnull); if (!yeahBaby) return nsnull; diff --git a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp index 1a71193bf86..c292fce053b 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp @@ -316,8 +316,7 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent) if (!immediateParent) immediateParent = this; - nsIFrame* currFrame; - immediateParent->FirstChild(mPresContext, nsnull, &currFrame); + nsIFrame* currFrame = immediateParent->GetFirstChild(nsnull); while (currFrame) { nsIContent* current = currFrame->GetContent(); @@ -453,9 +452,7 @@ nsMenuBarFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) } } else - immediateParent->FirstChild(mPresContext, - nsnull, - &currFrame); + currFrame = immediateParent->GetFirstChild(nsnull); while (currFrame) { // See if it's a menu item. @@ -468,9 +465,7 @@ nsMenuBarFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) currFrame = currFrame->GetNextSibling(); } - immediateParent->FirstChild(mPresContext, - nsnull, - &currFrame); + currFrame = immediateParent->GetFirstChild(nsnull); // Still don't have anything. Try cycling from the beginning. while (currFrame && currFrame != startFrame) { @@ -498,10 +493,7 @@ nsMenuBarFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult if (!immediateParent) immediateParent = this; - nsIFrame* first; - immediateParent->FirstChild(mPresContext, - nsnull, &first); - nsFrameList frames(first); + nsFrameList frames(immediateParent->GetFirstChild(nsnull)); nsIFrame* currFrame = nsnull; nsIFrame* startFrame = nsnull; diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index e8f823ef519..f220ee9305b 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -258,17 +258,13 @@ nsMenuFrame::~nsMenuFrame() // The following methods are all overridden to ensure that the menupopup frame // is placed in the appropriate list. -NS_IMETHODIMP -nsMenuFrame::FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsIFrame* +nsMenuFrame::GetFirstChild(nsIAtom* aListName) const { if (nsLayoutAtoms::popupList == aListName) { - *aFirstChild = mPopupFrames.FirstChild(); - } else { - nsBoxFrame::FirstChild(aPresContext, aListName, aFirstChild); + return mPopupFrames.FirstChild(); } - return NS_OK; + return nsBoxFrame::GetFirstChild(aListName); } NS_IMETHODIMP @@ -306,23 +302,17 @@ nsMenuFrame::SetInitialChildList(nsIPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsMenuFrame::GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const +nsIAtom* +nsMenuFrame::GetAdditionalChildListName(PRInt32 aIndex) const { - NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); - - *aListName = nsnull; - // don't expose the child frame list, it slows things down #if 0 if (NS_MENU_POPUP_LIST_INDEX == aIndex) { - *aListName = nsLayoutAtoms::popupList; - NS_ADDREF(*aListName); + return nsLayoutAtoms::popupList; } #endif - return NS_OK; + return nsnull; } nsresult @@ -1408,7 +1398,6 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) { */ /* walk siblings, looking for the other checked item with the same name */ - nsIFrame *sib; nsIMenuFrame *sibMenu; nsMenuType sibType; nsAutoString sibGroup; @@ -1417,8 +1406,8 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) { // get the first sibling in this menu popup. This frame may be it, and if we're // being called at creation time, this frame isn't yet in the parent's child list. // All I'm saying is that this may fail, but it's most likely alright. - nsresult rv = GetParent()->FirstChild(aPresContext, NULL, &sib); - if ( NS_FAILED(rv) || !sib ) + nsIFrame* sib = GetParent()->GetFirstChild(nsnull); + if ( !sib ) return; // XXX - egcs 1.1.2 & gcc 2.95.x -Oy builds, where y > 1, @@ -2080,8 +2069,7 @@ nsMenuFrame::GetScrollableView(nsIPresContext* aPresContext, nsIScrollableView** return NS_OK; nsMenuPopupFrame* popup = (nsMenuPopupFrame*) mPopupFrames.FirstChild(); - nsIFrame* childFrame = nsnull; - popup->FirstChild(mPresContext, nsnull, &childFrame); + nsIFrame* childFrame = popup->GetFirstChild(nsnull); if (childFrame) { *aView = popup->GetScrollableView(childFrame); (*aView)->SetLineHeight(childFrame->GetSize().height); diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.h b/mozilla/layout/xul/base/src/nsMenuFrame.h index f72b15900ea..2b13a31a702 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.h +++ b/mozilla/layout/xul/base/src/nsMenuFrame.h @@ -98,14 +98,11 @@ public: // The following four methods are all overridden so that the menu children // can be stored in a separate list (so that they don't impact reflow of the // actual menu item at all). - NS_IMETHOD FirstChild(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame** aFirstChild) const; + virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const; NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame* aChildList); - NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, - nsIAtom** aListName) const; + virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); // Overridden to prevent events from ever going to children of the menu. diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index ae32fb988bc..e86b406abe0 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -92,7 +92,7 @@ GetPopupSetFrame(nsIPresContext* aPresContext) return nsnull; if (rootFrame) - rootFrame->FirstChild(aPresContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); nsCOMPtr rootBox(do_QueryInterface(rootFrame)); if (!rootBox) @@ -1256,10 +1256,7 @@ nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) } } else - immediateParent->FirstChild(mPresContext, - nsnull, - &currFrame); - + currFrame = immediateParent->GetFirstChild(nsnull); while (currFrame) { // See if it's a menu item. @@ -1272,9 +1269,7 @@ nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) currFrame = currFrame->GetNextSibling(); } - immediateParent->FirstChild(mPresContext, - nsnull, - &currFrame); + currFrame = immediateParent->GetFirstChild(nsnull); // Still don't have anything. Try cycling from the beginning. while (currFrame && currFrame != startFrame) { @@ -1302,11 +1297,7 @@ nsMenuPopupFrame::GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResu if (!immediateParent) immediateParent = this; - nsIFrame* first; - immediateParent->FirstChild(mPresContext, - nsnull, &first); - nsFrameList frames(first); - + nsFrameList frames(immediateParent->GetFirstChild(nsnull)); nsIFrame* currFrame = nsnull; nsIFrame* startFrame = nsnull; @@ -1426,7 +1417,7 @@ nsIScrollableView* nsMenuPopupFrame::GetScrollableView(nsIFrame* aStart) nsIFrame* childFrame; currFrame=aStart; do { - currFrame->FirstChild(mPresContext, nsnull, &childFrame); + childFrame = currFrame->GetFirstChild(nsnull); scrollableView=GetScrollableView(childFrame); if ( scrollableView ) return scrollableView; @@ -1442,7 +1433,7 @@ void nsMenuPopupFrame::EnsureMenuItemIsVisible(nsIMenuFrame* aMenuItem) aMenuItem->QueryInterface(NS_GET_IID(nsIFrame), (void**)&frame); if ( frame ) { nsIFrame* childFrame=nsnull; - FirstChild(mPresContext, nsnull, &childFrame); + childFrame = GetFirstChild(nsnull); nsIScrollableView *scrollableView; scrollableView=GetScrollableView(childFrame); if ( scrollableView ) { @@ -1671,7 +1662,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, PRBool& doActi // been destroyed already. One strategy would be to // setTimeout(,0) as detailed in: // - immediateParent->FirstChild(mPresContext, nsnull, &currFrame); + currFrame = immediateParent->GetFirstChild(nsnull); // We start searching from first child. This process is divided into two parts // -- before current and after current -- by the current item diff --git a/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp b/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp index c6dafca31da..6c512c76552 100644 --- a/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp +++ b/mozilla/layout/xul/base/src/nsPopupBoxObject.cpp @@ -109,9 +109,7 @@ nsPopupBoxObject::HidePopup() return NS_OK; if (rootFrame) { - nsCOMPtr presContext; - mPresShell->GetPresContext(getter_AddRefs(presContext)); - rootFrame->FirstChild(presContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); } nsCOMPtr rootBox(do_QueryInterface(rootFrame)); @@ -146,9 +144,7 @@ nsPopupBoxObject::ShowPopup(nsIDOMElement* aSrcContent, return NS_OK; if (rootFrame) { - nsCOMPtr presContext; - mPresShell->GetPresContext(getter_AddRefs(presContext)); - rootFrame->FirstChild(presContext, nsnull, &rootFrame); + rootFrame = rootFrame->GetFirstChild(nsnull); } nsCOMPtr rootBox(do_QueryInterface(rootFrame)); diff --git a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp index a4b59b66175..da05cd90bf5 100644 --- a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp @@ -117,8 +117,7 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext, // did the progress change? if (nsHTMLAtoms::value == aAttribute) { - nsIFrame* barChild = nsnull; - FirstChild(aPresContext, nsnull, &barChild); + nsIFrame* barChild = GetFirstChild(nsnull); if (!barChild) return NS_OK; nsIFrame* remainderChild = barChild->GetNextSibling(); if (!remainderChild) return NS_OK; diff --git a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp index ec4eb1f4f65..14c5f2688ad 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp @@ -216,8 +216,7 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIPresContext* aPresContext, nsIFrame*& result) { // recursively search our children - nsIFrame* childFrame; - start->FirstChild(aPresContext, nsnull, &childFrame); + nsIFrame* childFrame = start->GetFirstChild(nsnull); while (nsnull != childFrame) { // get the content node diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index 38a00cabd0e..f2b297b5f7a 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -649,8 +649,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent void nsSplitterFrameInner::AddListener(nsIPresContext* aPresContext) { - nsIFrame* thumbFrame = nsnull; - mOuter->FirstChild(aPresContext, nsnull,&thumbFrame); + nsIFrame* thumbFrame = mOuter->GetFirstChild(nsnull); nsCOMPtr receiver(do_QueryInterface(mOuter->GetContent())); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index d238bd034d1..98ac9a4890d 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -377,8 +377,7 @@ static nsIFrame* InitScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* aCur return aCurrFrame; } - nsIFrame* child; - aCurrFrame->FirstChild(aPresContext, nsnull, &child); + nsIFrame* child = aCurrFrame->GetFirstChild(nsnull); while (child) { nsIFrame* result = InitScrollbarFrame(aPresContext, child, aSM); if (result) diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index ad2656844ba..aa8ca1f5c3c 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -132,9 +132,7 @@ nsTreeColFrame::GetFrameForPoint(nsIPresContext* aPresContext, if (left || right) { // We are a header. Look for the correct splitter. - nsIFrame* firstChild; - mParent->FirstChild(aPresContext, nsnull, &firstChild); - nsFrameList frames(firstChild); + nsFrameList frames(mParent->GetFirstChild(nsnull)); nsIFrame* child; if (left) child = frames.GetPrevSiblingFor(this);