diff --git a/content/html/content/public/nsIHTMLContent.h b/content/html/content/public/nsIHTMLContent.h index 339132b4a31b..aa8f0a8a2a1f 100644 --- a/content/html/content/public/nsIHTMLContent.h +++ b/content/html/content/public/nsIHTMLContent.h @@ -82,7 +82,6 @@ public: * for the content. */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) = 0; }; diff --git a/layout/base/public/nsIContentDelegate.h b/layout/base/public/nsIContentDelegate.h index e2d50297c602..caadb59b9f98 100644 --- a/layout/base/public/nsIContentDelegate.h +++ b/layout/base/public/nsIContentDelegate.h @@ -38,7 +38,6 @@ public: */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) = 0; }; diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index 61a58cc62620..604c62264bfb 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -96,10 +96,9 @@ public: NS_IMETHOD GetContent(nsIContent*& aContent) const = 0; /** - * Get/Set the frame's index in parent. + * Get the index in parent of the frame's content object */ - NS_IMETHOD GetIndexInParent(PRInt32& aIndexInParent) const = 0; - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent) = 0; + NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const = 0; /** * Get the style context associated with this frame. Note that GetStyleContext() diff --git a/layout/base/src/nsContainerFrame.cpp b/layout/base/src/nsContainerFrame.cpp index 36616f1fcc63..4224c89099d5 100644 --- a/layout/base/src/nsContainerFrame.cpp +++ b/layout/base/src/nsContainerFrame.cpp @@ -39,10 +39,8 @@ static NS_DEFINE_IID(kIStyleSpacingSID, NS_STYLESPACING_SID); static NS_DEFINE_IID(kIRunaroundIID, NS_IRUNAROUND_IID); static NS_DEFINE_IID(kStyleDisplaySID, NS_STYLEDISPLAY_SID); -nsContainerFrame::nsContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsSplittableFrame(aContent, aIndexInParent, aParent), +nsContainerFrame::nsContainerFrame(nsIContent* aContent, nsIFrame* aParent) + : nsSplittableFrame(aContent, aParent), mLastContentIsComplete(PR_TRUE) { } @@ -90,8 +88,7 @@ NS_METHOD nsContainerFrame::CreateContinuingFrame(nsIPresContext* aPresContext, { nsIContentDelegate* contentDelegate = mContent->GetDelegate(aPresContext); - aContinuingFrame = contentDelegate->CreateFrame(aPresContext, mContent, - mIndexInParent, aParent); + aContinuingFrame = contentDelegate->CreateFrame(aPresContext, mContent, aParent); NS_RELEASE(contentDelegate); PrepareContinuingFrame(aPresContext, aParent, (nsContainerFrame*)aContinuingFrame); @@ -322,7 +319,8 @@ void nsContainerFrame::SetFirstContentOffset(const nsIFrame* aFirstChild) nsContainerFrame* pseudoFrame = (nsContainerFrame*)aFirstChild; mFirstContentOffset = pseudoFrame->mFirstContentOffset; } else { - aFirstChild->GetIndexInParent(mFirstContentOffset); + // XXX TROY Change API to pass in content index if possible... + aFirstChild->GetContentIndex(mFirstContentOffset); } } @@ -344,7 +342,8 @@ void nsContainerFrame::SetLastContentOffset(const nsIFrame* aLastChild) #endif mLastContentIsComplete = pseudoFrame->mLastContentIsComplete; } else { - aLastChild->GetIndexInParent(mLastContentOffset); + // XXX TROY Change API to pass in content index if possible... + aLastChild->GetContentIndex(mLastContentOffset); } #ifdef NS_DEBUG if (mLastContentOffset < mFirstContentOffset) { @@ -1146,7 +1145,7 @@ NS_METHOD nsContainerFrame::VerifyTree() const } else { PRInt32 indexInParent; - child->GetIndexInParent(indexInParent); + child->GetContentIndex(indexInParent); VERIFY_ASSERT(offset == indexInParent, "bad child offset"); nsIFrame* nextInFlow; @@ -1275,7 +1274,7 @@ void nsContainerFrame::CheckContentOffsets() } else { PRInt32 indexInParent; - mFirstChild->GetIndexInParent(indexInParent); + mFirstChild->GetContentIndex(indexInParent); if (indexInParent != mFirstContentOffset) { DumpTree(); } @@ -1296,7 +1295,7 @@ void nsContainerFrame::CheckContentOffsets() } else { PRInt32 indexInParent; - lastChild->GetIndexInParent(indexInParent); + lastChild->GetContentIndex(indexInParent); NS_ASSERTION(indexInParent == mLastContentOffset, "bad last content offset"); } } diff --git a/layout/base/src/nsContainerFrame.h b/layout/base/src/nsContainerFrame.h index 16e32aea74d8..92dacc002581 100644 --- a/layout/base/src/nsContainerFrame.h +++ b/layout/base/src/nsContainerFrame.h @@ -190,9 +190,7 @@ public: protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - nsContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsContainerFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsContainerFrame(); @@ -201,8 +199,8 @@ protected: * flow, sets its content offsets, mLastContentIsComplete, and style context. * Subclasses should invoke this method after construction of a continuing frame. */ - void PrepareContinuingFrame(nsIPresContext* aPresContext, - nsIFrame* aParent, + void PrepareContinuingFrame(nsIPresContext* aPresContext, + nsIFrame* aParent, nsContainerFrame* aContFrame); diff --git a/layout/base/src/nsFrame.cpp b/layout/base/src/nsFrame.cpp index 82f349854b11..31c958a5bce8 100644 --- a/layout/base/src/nsFrame.cpp +++ b/layout/base/src/nsFrame.cpp @@ -67,16 +67,15 @@ NS_LAYOUT PRBool nsIFrame::GetShowFrameBorders() static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); nsresult -nsFrame::NewFrame(nsIFrame** aInstancePtrResult, +nsFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -92,11 +91,8 @@ void* nsFrame::operator new(size_t size) return result; } -nsFrame::nsFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : mContent(aContent), mIndexInParent(aIndexInParent), mContentParent(aParent), - mGeometricParent(aParent) +nsFrame::nsFrame(nsIContent* aContent, nsIFrame* aParent) + : mContent(aContent), mContentParent(aParent), mGeometricParent(aParent) { NS_ADDREF(mContent); } @@ -178,15 +174,12 @@ NS_METHOD nsFrame::GetContent(nsIContent*& aContent) const return NS_OK; } -NS_METHOD nsFrame::GetIndexInParent(PRInt32& aIndexInParent) const +NS_METHOD nsFrame::GetContentIndex(PRInt32& aIndexInParent) const { - aIndexInParent = mIndexInParent; - return NS_OK; -} - -NS_METHOD nsFrame::SetIndexInParent(PRInt32 aIndexInParent) -{ - mIndexInParent = aIndexInParent; + nsIContent* parent = mContent->GetParent(); + + aIndexInParent = parent->IndexOf(mContent); + NS_RELEASE(parent); return NS_OK; } @@ -923,7 +916,10 @@ NS_METHOD nsFrame::ListTag(FILE* out) const fputs(buf, out); NS_RELEASE(tag); } - fprintf(out, "(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + + GetContentIndex(contentIndex); + fprintf(out, "(%d)@%p", contentIndex, this); return NS_OK; } diff --git a/layout/base/src/nsFrame.h b/layout/base/src/nsFrame.h index 7d7828172cc5..a5d5f7b0e0ad 100644 --- a/layout/base/src/nsFrame.h +++ b/layout/base/src/nsFrame.h @@ -30,9 +30,8 @@ public: * Create a new "empty" frame that maps a given piece of content into a * 0,0 area. */ - static nsresult NewFrame(nsIFrame** aInstancePtrResult, + static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); @@ -43,8 +42,7 @@ public: NS_IMETHOD DeleteFrame(); NS_IMETHOD GetContent(nsIContent*& aContent) const; - NS_IMETHOD GetIndexInParent(PRInt32& aIndexInParent) const; - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent); + NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const; NS_IMETHOD GetStyleContext(nsIPresContext* aContext, nsIStyleContext*& aStyleContext); NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aContext); @@ -204,16 +202,13 @@ protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - nsFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsFrame(); nsRect mRect; nsIContent* mContent; nsIStyleContext* mStyleContext; - PRInt32 mIndexInParent; nsIFrame* mContentParent; nsIFrame* mGeometricParent; nsIFrame* mNextSibling; // singly linked list of frames diff --git a/layout/base/src/nsPresShell.cpp b/layout/base/src/nsPresShell.cpp index 6c34d1c38942..e407447d7a4f 100644 --- a/layout/base/src/nsPresShell.cpp +++ b/layout/base/src/nsPresShell.cpp @@ -341,7 +341,7 @@ void PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) if (nsnull != root) { nsIContentDelegate* cd = root->GetDelegate(mPresContext); if (nsnull != cd) { - mRootFrame = cd->CreateFrame(mPresContext, root, -1, nsnull); + mRootFrame = cd->CreateFrame(mPresContext, root, nsnull); NS_RELEASE(cd); // set root frame's style context diff --git a/layout/base/src/nsSplittableFrame.cpp b/layout/base/src/nsSplittableFrame.cpp index ba739b19f2ea..df4b5a4851f3 100644 --- a/layout/base/src/nsSplittableFrame.cpp +++ b/layout/base/src/nsSplittableFrame.cpp @@ -22,9 +22,8 @@ #include "nsIStyleContext.h" nsSplittableFrame::nsSplittableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) - : nsFrame(aContent, aIndexInParent, aParent) + : nsFrame(aContent, aParent) { } @@ -55,8 +54,7 @@ NS_METHOD nsSplittableFrame::CreateContinuingFrame(nsIPresContext* aPresContext, { nsIContentDelegate* contentDelegate = mContent->GetDelegate(aPresContext); - aContinuingFrame = contentDelegate->CreateFrame(aPresContext, mContent, - mIndexInParent, aParent); + aContinuingFrame = contentDelegate->CreateFrame(aPresContext, mContent, aParent); NS_RELEASE(contentDelegate); // Append the continuing frame to the flow diff --git a/layout/base/src/nsSplittableFrame.h b/layout/base/src/nsSplittableFrame.h index 2dabfe05725e..c8d4d11c08d9 100644 --- a/layout/base/src/nsSplittableFrame.h +++ b/layout/base/src/nsSplittableFrame.h @@ -24,8 +24,6 @@ class nsSplittableFrame : public nsFrame { public: - // Flow member functions. - // CreateContinuingFrame() does the default behavior of using the // content delegate to create a new frame NS_IMETHOD IsSplittable(SplittableType& aIsSplittable) const; @@ -33,6 +31,7 @@ public: nsIFrame* aParent, nsIFrame*& aContinuingFrame); + // Flow member functions. NS_IMETHOD GetPrevInFlow(nsIFrame*& aPrevInFlow) const; NS_IMETHOD SetPrevInFlow(nsIFrame*); NS_IMETHOD GetNextInFlow(nsIFrame*& aNextInFlow) const; @@ -57,9 +56,7 @@ public: protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - nsSplittableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsSplittableFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsSplittableFrame(); diff --git a/layout/base/tests/TestContainerFrame.cpp b/layout/base/tests/TestContainerFrame.cpp index db9e991fff87..327706818566 100644 --- a/layout/base/tests/TestContainerFrame.cpp +++ b/layout/base/tests/TestContainerFrame.cpp @@ -90,7 +90,7 @@ NS_IMPL_ISUPPORTS(SimpleContent, kIContentIID); class SimpleContainer : public nsContainerFrame { public: - SimpleContainer(nsIContent* aContent, PRInt32 aIndexInParent); + SimpleContainer(nsIContent* aContent); ReflowStatus IncrementalReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -108,8 +108,8 @@ public: PRInt32 ChildCount() {return mChildCount;} }; -SimpleContainer::SimpleContainer(nsIContent* aContent, PRInt32 aIndexInParent) - : nsContainerFrame(aContent, aIndexInParent, nsnull) +SimpleContainer::SimpleContainer(nsIContent* aContent) + : nsContainerFrame(aContent, nsnull) { } @@ -147,15 +147,12 @@ PRBool SimpleContainer::DeleteChildsNextInFlow(nsIFrame* aChild) class SimpleSplittableFrame : public nsSplittableFrame { public: - SimpleSplittableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + SimpleSplittableFrame(nsIContent* aContent, nsIFrame* aParent); }; SimpleSplittableFrame::SimpleSplittableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) - : nsSplittableFrame(aContent, aIndexInParent, aParent) + : nsSplittableFrame(aContent, aParent) { } @@ -167,7 +164,7 @@ static PRBool TestChildEnumeration() { // Create a simple test container - SimpleContainer* f = new SimpleContainer(new SimpleContent(), 0); + SimpleContainer* f = new SimpleContainer(new SimpleContent()); // Add three child frames SimpleContent* childContent = new SimpleContent(); @@ -175,9 +172,9 @@ TestChildEnumeration() nsFrame* c2; nsFrame* c3; - nsFrame::NewFrame((nsIFrame**)&c1, childContent, 0, f); - nsFrame::NewFrame((nsIFrame**)&c2, childContent, 1, f); - nsFrame::NewFrame((nsIFrame**)&c3, childContent, 2, f); + nsFrame::NewFrame((nsIFrame**)&c1, childContent, f); + nsFrame::NewFrame((nsIFrame**)&c2, childContent, f); + nsFrame::NewFrame((nsIFrame**)&c3, childContent, f); c1->SetNextSibling(c2); c2->SetNextSibling(c3); @@ -256,7 +253,7 @@ static PRBool TestPushChildren() { // Create a simple test container - SimpleContainer* f = new SimpleContainer(new SimpleContent(), 0); + SimpleContainer* f = new SimpleContainer(new SimpleContent()); // Add five child frames SimpleContent* childContent = new SimpleContent(); @@ -317,7 +314,7 @@ TestPushChildren() f->SetOverflowList(nsnull); // Create a continuing frame - SimpleContainer* f1 = new SimpleContainer(f->GetContent(), 0); + SimpleContainer* f1 = new SimpleContainer(f->GetContent()); // Link it into the flow f->SetNextInFlow(f1); @@ -416,7 +413,7 @@ static PRBool TestDeleteChildsNext() { // Create two simple test containers - SimpleContainer* f = new SimpleContainer(new SimpleContent(), 0); + SimpleContainer* f = new SimpleContainer(new SimpleContent()); // Create two child frames SimpleContent* childContent = new SimpleContent(); @@ -462,7 +459,7 @@ TestDeleteChildsNext() // #2a // Create a second container frame - SimpleContainer* f1 = new SimpleContainer(new SimpleContent(), 0); + SimpleContainer* f1 = new SimpleContainer(new SimpleContent()); // Re-create the continuing child frame c11 = new SimpleSplittableFrame(childContent, 0, f1); diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index ff180997a50d..694023fc8b72 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 99b374649843..b09af228e914 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -144,7 +144,6 @@ public: */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // nsISupports @@ -224,9 +223,7 @@ public: nsIFrame* aFrame); protected: - nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsBlockFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsBlockFrame(); diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index ff180997a50d..694023fc8b72 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index ff180997a50d..694023fc8b72 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp index e000ca9ea7af..eff15d3c419a 100644 --- a/layout/generic/nsHTMLContainerFrame.cpp +++ b/layout/generic/nsHTMLContainerFrame.cpp @@ -43,10 +43,8 @@ static NS_DEFINE_IID(kStyleDisplaySID, NS_STYLEDISPLAY_SID); NS_DEF_PTR(nsIStyleContext); -nsHTMLContainerFrame::nsHTMLContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsContainerFrame(aContent, aIndexInParent, aParent) +nsHTMLContainerFrame::nsHTMLContainerFrame(nsIContent* aContent, nsIFrame* aParent) + : nsContainerFrame(aContent, aParent) { } @@ -228,8 +226,9 @@ static void AdjustIndexInParents(nsIFrame* aContainerFrame, } else { PRInt32 index; - childFrame->GetIndexInParent(index); + childFrame->GetContentIndex(index); +#if 0 if (::ContentInserted == aChange) { if (index >= aIndexInParent) { childFrame->SetIndexInParent(index + 1); @@ -239,13 +238,13 @@ static void AdjustIndexInParents(nsIFrame* aContainerFrame, childFrame->SetIndexInParent(index - 1); } } +#endif } } } nsIFrame* nsHTMLContainerFrame::CreateFrameFor(nsIPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aIndexInParent) + nsIContent* aContent) { // Get the style content for the frame nsIStyleContextPtr styleContext = aPresContext->ResolveStyleContextFor(aContent, this); @@ -255,18 +254,18 @@ nsIFrame* nsHTMLContainerFrame::CreateFrameFor(nsIPresContext* aPresContext, // See whether it wants any special handling if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) { - AbsoluteFrame::NewFrame(&result, aContent, aIndexInParent, this); + AbsoluteFrame::NewFrame(&result, aContent, this); } else if (display->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&result, aContent, aIndexInParent, this); + PlaceholderFrame::NewFrame(&result, aContent, this); } else if (NS_STYLE_DISPLAY_NONE == display->mDisplay) { - nsFrame::NewFrame(&result, aContent, aIndexInParent, this); + nsFrame::NewFrame(&result, aContent, this); } else { nsIContentDelegate* delegate; // Ask the content delegate to create the frame // XXX The delegate will also resolve the style context... delegate = aContent->GetDelegate(aPresContext); - result = delegate->CreateFrame(aPresContext, aContent, aIndexInParent, this); + result = delegate->CreateFrame(aPresContext, aContent, this); NS_RELEASE(delegate); } @@ -331,7 +330,7 @@ NS_METHOD nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell, } // Create the new frame - nsIFrame* newFrame = parent->CreateFrameFor(aPresContext, aChild, aIndexInParent); + nsIFrame* newFrame = parent->CreateFrameFor(aPresContext, aChild); // Insert the frame if (nsnull == prevSibling) { diff --git a/layout/generic/nsHTMLContainerFrame.h b/layout/generic/nsHTMLContainerFrame.h index c126f8711f70..f3a4fe248cc4 100644 --- a/layout/generic/nsHTMLContainerFrame.h +++ b/layout/generic/nsHTMLContainerFrame.h @@ -26,7 +26,6 @@ class nsString; class nsHTMLContainerFrame : public nsContainerFrame { public: nsHTMLContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -63,8 +62,7 @@ protected: const nsString& aTargetSpec); nsIFrame* CreateFrameFor(nsIPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aIndexInParent); + nsIContent* aContent); }; #endif /* nsHTMLContainerFrame_h___ */ diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 61a58cc62620..604c62264bfb 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -96,10 +96,9 @@ public: NS_IMETHOD GetContent(nsIContent*& aContent) const = 0; /** - * Get/Set the frame's index in parent. + * Get the index in parent of the frame's content object */ - NS_IMETHOD GetIndexInParent(PRInt32& aIndexInParent) const = 0; - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent) = 0; + NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const = 0; /** * Get the style context associated with this frame. Note that GetStyleContext() diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index c87f53b3f2e2..6b6688e25496 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -123,14 +123,13 @@ private: nsresult nsInlineFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsInlineFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsInlineFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -138,10 +137,8 @@ nsresult nsInlineFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsInlineFrame::nsInlineFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsInlineFrame::nsInlineFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { NS_PRECONDITION(!IsPseudoFrame(), "can not be a pseudo frame"); } @@ -304,7 +301,7 @@ PRBool nsInlineFrame::ReflowMappedChildren(nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); VerifyLastIsComplete(); #endif @@ -572,10 +569,10 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, // Check whether it wants to floated or absolutely positioned if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) { - AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this); + AbsoluteFrame::NewFrame(&kidFrame, kid, this); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this); + PlaceholderFrame::NewFrame(&kidFrame, kid, this); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel; @@ -593,13 +590,13 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, case NS_STYLE_DISPLAY_INLINE: kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); break; default: NS_ASSERTION(nsnull == kidPrevInFlow, "bad prev in flow"); - nsFrame::NewFrame(&kidFrame, kid, kidIndex, this); + nsFrame::NewFrame(&kidFrame, kid, this); break; } kidFrame->SetStyleContext(aPresContext,kidStyleContext); diff --git a/layout/generic/nsLeafFrame.cpp b/layout/generic/nsLeafFrame.cpp index 912178cb2db3..c82d80d10d05 100644 --- a/layout/generic/nsLeafFrame.cpp +++ b/layout/generic/nsLeafFrame.cpp @@ -23,10 +23,8 @@ static NS_DEFINE_IID(kStyleSpacingSID, NS_STYLESPACING_SID); static NS_DEFINE_IID(kStyleBorderSID, NS_STYLEBORDER_SID); static NS_DEFINE_IID(kStyleColorSID, NS_STYLECOLOR_SID); -nsLeafFrame::nsLeafFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsFrame(aContent, aIndexInParent, aParentFrame) +nsLeafFrame::nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsFrame(aContent, aParentFrame) { } diff --git a/layout/generic/nsLeafFrame.h b/layout/generic/nsLeafFrame.h index e979cc2aa06c..0c10771db8b7 100644 --- a/layout/generic/nsLeafFrame.h +++ b/layout/generic/nsLeafFrame.h @@ -49,9 +49,7 @@ public: nsIFrame*& aContinuingFrame); protected: - nsLeafFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual ~nsLeafFrame(); /** diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 77f58c2a536f..368b6a8d53e8 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -116,7 +116,7 @@ nsLineData::Verify(PRBool aFinalCheck) const } while ((nsnull != child) && (child != nextLinesFirstChild)) { PRInt32 indexInParent; - child->GetIndexInParent(indexInParent); + child->GetContentIndex(indexInParent); NS_ASSERTION(indexInParent == offset, "bad line offsets"); len++; if (len != mChildCount) { @@ -585,7 +585,7 @@ nsLineLayout::SplitLine(PRInt32 aChildReflowStatus, PRInt32 aRemainingKids) } PRInt32 kidIndexInParent; - mKidFrame->GetIndexInParent(kidIndexInParent); + mKidFrame->GetContentIndex(kidIndexInParent); to->mFirstChild = mKidFrame; to->mChildCount += aRemainingKids; to->mFirstContentOffset = kidIndexInParent; @@ -757,7 +757,7 @@ nsLineLayout::PullUpChildren() // new first content offset. mKidFrame->GetNextSibling(line->mFirstChild); PRInt32 indexInParent; - line->mFirstChild->GetIndexInParent(indexInParent); + line->mFirstChild->GetContentIndex(indexInParent); line->mFirstContentOffset = indexInParent; #ifdef NS_DEBUG line->Verify(); @@ -843,10 +843,10 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) PRBool isBlock = PR_FALSE; nsIFrame* kidFrame; if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) { - AbsoluteFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + AbsoluteFrame::NewFrame(&kidFrame, aKid, mBlock); kidFrame->SetStyleContext(mPresContext, kidSC); } else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + PlaceholderFrame::NewFrame(&kidFrame, aKid, mBlock); kidFrame->SetStyleContext(mPresContext, kidSC); } else if (nsnull == mKidPrevInFlow) { // Create initial frame for the child @@ -872,7 +872,7 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) } #endif kidDel = aKid->GetDelegate(mPresContext); - kidFrame = kidDel->CreateFrame(mPresContext, aKid, mKidIndex, mBlock); + kidFrame = kidDel->CreateFrame(mPresContext, aKid, mBlock); NS_RELEASE(kidDel); isBlock = PR_TRUE; break; @@ -881,12 +881,12 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) // XXX pass in kidSC to speed things up *alot*! // XXX fix CreateFrame API to return an nsresult! kidDel = aKid->GetDelegate(mPresContext); - kidFrame = kidDel->CreateFrame(mPresContext, aKid, mKidIndex, mBlock); + kidFrame = kidDel->CreateFrame(mPresContext, aKid, mBlock); NS_RELEASE(kidDel); break; default:/* XXX bzzt! */ - nsFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + nsFrame::NewFrame(&kidFrame, aKid, mBlock); break; } kidFrame->SetStyleContext(mPresContext, kidSC); diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 39803bddc098..e9f420ab4cfc 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -23,8 +23,8 @@ #include "nsReflowCommand.h" #include "nsIRenderingContext.h" -PageFrame::PageFrame(nsIContent* aContent, PRInt32 aIndexInParent, nsIFrame* aParent) - : nsContainerFrame(aContent, aIndexInParent, aParent) +PageFrame::PageFrame(nsIContent* aContent, nsIFrame* aParent) + : nsContainerFrame(aContent, aParent) { } @@ -38,7 +38,7 @@ void PageFrame::CreateFirstChild(nsIPresContext* aPresContext) // Create a frame nsIContentDelegate* cd = child->GetDelegate(aPresContext); if (nsnull != cd) { - mFirstChild = cd->CreateFrame(aPresContext, child, 0, this); + mFirstChild = cd->CreateFrame(aPresContext, child, this); if (nsnull != mFirstChild) { mChildCount = 1; mLastContentOffset = mFirstContentOffset; @@ -158,7 +158,7 @@ NS_METHOD PageFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - PageFrame* cf = new PageFrame(mContent, mIndexInParent, aParent); + PageFrame* cf = new PageFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; diff --git a/layout/generic/nsPageFrame.h b/layout/generic/nsPageFrame.h index aaee82d3952e..629816d36317 100644 --- a/layout/generic/nsPageFrame.h +++ b/layout/generic/nsPageFrame.h @@ -23,7 +23,7 @@ // Pseudo frame created by the root content frame class PageFrame : public nsContainerFrame { public: - PageFrame(nsIContent* aContent, PRInt32 aIndexInParent, nsIFrame* aParent); + PageFrame(nsIContent* aContent, nsIFrame* aParent); NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, diff --git a/layout/generic/nsPlaceholderFrame.cpp b/layout/generic/nsPlaceholderFrame.cpp index 8a056b9c8c54..fbc71ef6076a 100644 --- a/layout/generic/nsPlaceholderFrame.cpp +++ b/layout/generic/nsPlaceholderFrame.cpp @@ -25,14 +25,13 @@ static NS_DEFINE_IID(kIFloaterContainerIID, NS_IFLOATERCONTAINER_IID); nsresult PlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new PlaceholderFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new PlaceholderFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -40,10 +39,8 @@ PlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -PlaceholderFrame::PlaceholderFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsFrame(aContent, aIndexInParent, aParent) +PlaceholderFrame::PlaceholderFrame(nsIContent* aContent, nsIFrame* aParent) + : nsFrame(aContent, aParent) { mAnchoredItem = nsnull; } @@ -52,15 +49,6 @@ PlaceholderFrame::~PlaceholderFrame() { } -NS_METHOD PlaceholderFrame::SetIndexInParent(PRInt32 aIndexInParent) -{ - if (nsnull != mAnchoredItem) { - mAnchoredItem->SetIndexInParent(aIndexInParent); - } - - return nsFrame::SetIndexInParent(aIndexInParent); -} - NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, const nsSize& aMaxSize, @@ -82,8 +70,7 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, // Create the anchored item nsIContentDelegate* delegate = mContent->GetDelegate(aPresContext); - mAnchoredItem = delegate->CreateFrame(aPresContext, mContent, mIndexInParent, - mGeometricParent); + mAnchoredItem = delegate->CreateFrame(aPresContext, mContent, mGeometricParent); NS_RELEASE(delegate); // Set the style context for the frame @@ -106,6 +93,8 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, NS_METHOD PlaceholderFrame::ListTag(FILE* out) const { fputs("*placeholder", out); - fprintf(out, "(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, "(%d)@%p", contentIndex, this); return NS_OK; } diff --git a/layout/generic/nsPlaceholderFrame.h b/layout/generic/nsPlaceholderFrame.h index 9f4d5a68a516..1a56bb3b913b 100644 --- a/layout/generic/nsPlaceholderFrame.h +++ b/layout/generic/nsPlaceholderFrame.h @@ -29,14 +29,11 @@ public: */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // Returns the associated anchored item nsIFrame* GetAnchoredItem() const {return mAnchoredItem;} - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent); - // Resize reflow methods NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -48,9 +45,7 @@ public: protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - PlaceholderFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + PlaceholderFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~PlaceholderFrame(); diff --git a/layout/html/base/src/deadnsInlineFrame.h b/layout/html/base/src/deadnsInlineFrame.h index c3a8b582a454..980ba3d44425 100644 --- a/layout/html/base/src/deadnsInlineFrame.h +++ b/layout/html/base/src/deadnsInlineFrame.h @@ -28,7 +28,6 @@ class nsInlineFrame : public nsHTMLContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, @@ -47,9 +46,7 @@ public: nsReflowMetrics& aMetrics); protected: - nsInlineFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsInlineFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsInlineFrame(); diff --git a/layout/html/base/src/nsAbsoluteFrame.cpp b/layout/html/base/src/nsAbsoluteFrame.cpp index fbb9d22fc142..fcd06811503a 100644 --- a/layout/html/base/src/nsAbsoluteFrame.cpp +++ b/layout/html/base/src/nsAbsoluteFrame.cpp @@ -36,14 +36,13 @@ NS_DEF_PTR(nsIStyleContext); nsresult AbsoluteFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new AbsoluteFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new AbsoluteFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -51,10 +50,8 @@ AbsoluteFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -AbsoluteFrame::AbsoluteFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsFrame(aContent, aIndexInParent, aParent) +AbsoluteFrame::AbsoluteFrame(nsIContent* aContent, nsIFrame* aParent) + : nsFrame(aContent, aParent) { mFrame = nsnull; } @@ -63,15 +60,6 @@ AbsoluteFrame::~AbsoluteFrame() { } -NS_METHOD AbsoluteFrame::SetIndexInParent(PRInt32 aIndexInParent) -{ - if (nsnull != mFrame) { - mFrame->SetIndexInParent(aIndexInParent); - } - - return nsFrame::SetIndexInParent(aIndexInParent); -} - nsIView* AbsoluteFrame::CreateView(nsIView* aContainingView, const nsRect& aRect, nsStylePosition* aPosition) @@ -246,7 +234,7 @@ NS_METHOD AbsoluteFrame::ResizeReflow(nsIPresContext* aPresContext, if (nsnull == mFrame) { // If the content object is a container then wrap it in a body pseudo-frame if (mContent->CanContainChildren()) { - nsBodyFrame::NewFrame(&mFrame, mContent, mIndexInParent, this); + nsBodyFrame::NewFrame(&mFrame, mContent, this); // Resolve style for the pseudo-frame. We can't use our style context nsIStyleContextPtr styleContext = aPresContext->ResolveStyleContextFor(mContent, this); @@ -257,7 +245,7 @@ NS_METHOD AbsoluteFrame::ResizeReflow(nsIPresContext* aPresContext, // also create a view nsIContentDelegate* delegate = mContent->GetDelegate(aPresContext); - mFrame= delegate->CreateFrame(aPresContext, mContent, mIndexInParent, this); + mFrame= delegate->CreateFrame(aPresContext, mContent, this); NS_RELEASE(delegate); // Set the style context for the frame @@ -328,7 +316,10 @@ NS_METHOD AbsoluteFrame::List(FILE* out, PRInt32 aIndent) const // Output the tag fputs("*absolute", out); - fprintf(out, "(%d)@%p ", mIndexInParent, this); + + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, "(%d)@%p ", contentIndex, this); // Output the rect out << mRect; diff --git a/layout/html/base/src/nsAbsoluteFrame.h b/layout/html/base/src/nsAbsoluteFrame.h index 2f410a11ce58..f72862a00117 100644 --- a/layout/html/base/src/nsAbsoluteFrame.h +++ b/layout/html/base/src/nsAbsoluteFrame.h @@ -30,11 +30,8 @@ public: */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent); - // Resize reflow methods NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -49,9 +46,7 @@ protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - AbsoluteFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + AbsoluteFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~AbsoluteFrame(); diff --git a/layout/html/base/src/nsBRPart.cpp b/layout/html/base/src/nsBRPart.cpp index b2cf9a7e5a9a..3d6e0d9a29f2 100644 --- a/layout/html/base/src/nsBRPart.cpp +++ b/layout/html/base/src/nsBRPart.cpp @@ -36,9 +36,7 @@ static NS_DEFINE_IID(kStyleColorSID, NS_STYLECOLOR_SID); class BRFrame : public nsFrame { public: - BRFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + BRFrame(nsIContent* aContent, nsIFrame* aParentFrame); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -56,9 +54,8 @@ protected: }; BRFrame::BRFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsFrame(aContent, aIndexInParent, aParentFrame) + nsIFrame* aParentFrame) + : nsFrame(aContent, aParentFrame) { } @@ -138,7 +135,6 @@ public: virtual void UnsetAttribute(nsIAtom* aAttribute); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); PRInt32 GetClear() { @@ -168,10 +164,9 @@ BRPart::~BRPart() } nsIFrame* BRPart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - nsIFrame* rv = new BRFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new BRFrame(this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index ff180997a50d..694023fc8b72 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/html/base/src/nsBlockFrame.h b/layout/html/base/src/nsBlockFrame.h index 99b374649843..b09af228e914 100644 --- a/layout/html/base/src/nsBlockFrame.h +++ b/layout/html/base/src/nsBlockFrame.h @@ -144,7 +144,6 @@ public: */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // nsISupports @@ -224,9 +223,7 @@ public: nsIFrame* aFrame); protected: - nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + nsBlockFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~nsBlockFrame(); diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index ff180997a50d..694023fc8b72 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index ff180997a50d..694023fc8b72 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -145,14 +145,13 @@ nsBlockReflowState::Initialize(nsIPresContext* aPresContext, nsresult nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBlockFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBlockFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -160,10 +159,8 @@ nsBlockFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBlockFrame::nsBlockFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsBlockFrame::nsBlockFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { } @@ -210,7 +207,7 @@ nsBlockFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBlockFrame* cf = new nsBlockFrame(mContent, mIndexInParent, aParent); + nsBlockFrame* cf = new nsBlockFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -227,7 +224,9 @@ nsBlockFrame::ListTag(FILE* out) const atom->ToString(tmp); fputs(tmp, out); } - fprintf(out, ">(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, ">(%d)@%p", contentIndex, this); } else { nsHTMLContainerFrame::ListTag(out); } @@ -357,7 +356,7 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) nsIFrame* nextKid; aNextInFlow->GetNextSibling(nextKid); line->mFirstChild = nextKid; - nextKid->GetIndexInParent(line->mFirstContentOffset); + nextKid->GetContentIndex(line->mFirstContentOffset); } break; } @@ -399,7 +398,7 @@ nsBlockFrame::CreateLineForOverflowList(nsIFrame* aOverflowList) if (nsnull != newLine) { nsIFrame* kid = aOverflowList; newLine->mFirstChild = kid; - kid->GetIndexInParent(newLine->mFirstContentOffset); + kid->GetContentIndex(newLine->mFirstContentOffset); newLine->mLastContentOffset = -1; newLine->mLastContentIsComplete = PRPackedBool(0x255); PRInt32 kids = 0; @@ -704,7 +703,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState, nsLineData* aLine) nextInFlow->mLines = aLine; nextInFlow->mFirstChild = firstKid; nextInFlow->mChildCount += pushCount; - firstKid->GetIndexInParent(nextInFlow->mFirstContentOffset); + firstKid->GetContentIndex(nextInFlow->mFirstContentOffset); #ifdef NS_DEBUG nextInFlow->VerifyLines(PR_FALSE); diff --git a/layout/html/base/src/nsBodyFrame.cpp b/layout/html/base/src/nsBodyFrame.cpp index a5ea89769876..51ec9b1547f8 100644 --- a/layout/html/base/src/nsBodyFrame.cpp +++ b/layout/html/base/src/nsBodyFrame.cpp @@ -36,14 +36,13 @@ static NS_DEFINE_IID(kStyleSpacingSID, NS_STYLESPACING_SID); nsresult nsBodyFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsBodyFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsBodyFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -51,10 +50,8 @@ nsresult nsBodyFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsBodyFrame::nsBodyFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParentFrame) +nsBodyFrame::nsBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsHTMLContainerFrame(aContent, aParentFrame) { mSpaceManager = new SpaceManager(this); NS_ADDREF(mSpaceManager); @@ -84,7 +81,7 @@ void nsBodyFrame::CreateColumnFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - nsBlockFrame::NewFrame(&mFirstChild, mContent, mIndexInParent, this); + nsBlockFrame::NewFrame(&mFirstChild, mContent, this); mChildCount = 1; // Resolve style and set the style context @@ -371,7 +368,7 @@ NS_METHOD nsBodyFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsBodyFrame* cf = new nsBodyFrame(mContent, mIndexInParent, aParent); + nsBodyFrame* cf = new nsBodyFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; diff --git a/layout/html/base/src/nsBodyFrame.h b/layout/html/base/src/nsBodyFrame.h index 1106c6ea85d2..adebebc17438 100644 --- a/layout/html/base/src/nsBodyFrame.h +++ b/layout/html/base/src/nsBodyFrame.h @@ -29,7 +29,6 @@ class nsBodyFrame : public nsHTMLContainerFrame, public nsIAnchoredItems { public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); @@ -69,9 +68,7 @@ public: NS_IMETHOD VerifyTree() const; protected: - nsBodyFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsBodyFrame(nsIContent* aContent, nsIFrame* aParentFrame); ~nsBodyFrame(); diff --git a/layout/html/base/src/nsBodyPart.cpp b/layout/html/base/src/nsBodyPart.cpp index 3fb848829a87..ffd011e9ee50 100644 --- a/layout/html/base/src/nsBodyPart.cpp +++ b/layout/html/base/src/nsBodyPart.cpp @@ -28,7 +28,6 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(); NS_IMETHOD_(nsrefcnt) Release(); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); protected: @@ -59,12 +58,10 @@ nsrefcnt BodyPart::Release(void) } nsIFrame* BodyPart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsBodyFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsBodyFrame::NewFrame(&rv, this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsHRPart.cpp b/layout/html/base/src/nsHRPart.cpp index ab7a6b9ffb05..5f00a230e25e 100644 --- a/layout/html/base/src/nsHRPart.cpp +++ b/layout/html/base/src/nsHRPart.cpp @@ -48,7 +48,6 @@ public: virtual nsrefcnt Release(void); #endif virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); @@ -70,7 +69,6 @@ protected: class HRuleFrame : public nsLeafFrame { public: HRuleFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -99,9 +97,8 @@ protected: }; HRuleFrame::HRuleFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsLeafFrame(aContent, aIndexInParent, aParentFrame) + : nsLeafFrame(aContent, aParentFrame) { } @@ -421,10 +418,9 @@ nsContentAttr HRulePart::AttributeToString(nsIAtom* aAttribute, //---------------------------------------------------------------------- nsIFrame* HRulePart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - nsIFrame* rv = new HRuleFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new HRuleFrame(this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsHTMLContainer.cpp b/layout/html/base/src/nsHTMLContainer.cpp index bc640a86b662..abd1f3c68fd0 100644 --- a/layout/html/base/src/nsHTMLContainer.cpp +++ b/layout/html/base/src/nsHTMLContainer.cpp @@ -183,7 +183,6 @@ void nsHTMLContainer::Compact() } nsIFrame* nsHTMLContainer::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { // Resolve style for the piece of content @@ -199,18 +198,18 @@ nsIFrame* nsHTMLContainer::CreateFrame(nsIPresContext* aPresContext, nsresult fr; switch (styleDisplay->mDisplay) { case NS_STYLE_DISPLAY_BLOCK: - fr = nsBlockFrame::NewFrame(&rv, this, aIndexInParent, aParentFrame); + fr = nsBlockFrame::NewFrame(&rv, this, aParentFrame); break; case NS_STYLE_DISPLAY_INLINE: - fr = nsInlineFrame::NewFrame(&rv, this, aIndexInParent, aParentFrame); + fr = nsInlineFrame::NewFrame(&rv, this, aParentFrame); break; case NS_STYLE_DISPLAY_LIST_ITEM: - fr = nsListItemFrame::NewFrame(&rv, this, aIndexInParent, aParentFrame); + fr = nsListItemFrame::NewFrame(&rv, this, aParentFrame); break; default: // Create an empty frame for holding content that is not being // reflowed. - fr = nsFrame::NewFrame(&rv, this, aIndexInParent, aParentFrame); + fr = nsFrame::NewFrame(&rv, this, aParentFrame); break; } diff --git a/layout/html/base/src/nsHTMLContainer.h b/layout/html/base/src/nsHTMLContainer.h index 56f78a9dea93..b63ccfdce28f 100644 --- a/layout/html/base/src/nsHTMLContainer.h +++ b/layout/html/base/src/nsHTMLContainer.h @@ -39,7 +39,6 @@ public: virtual void Compact(); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); diff --git a/layout/html/base/src/nsHTMLContainerFrame.cpp b/layout/html/base/src/nsHTMLContainerFrame.cpp index e000ca9ea7af..eff15d3c419a 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -43,10 +43,8 @@ static NS_DEFINE_IID(kStyleDisplaySID, NS_STYLEDISPLAY_SID); NS_DEF_PTR(nsIStyleContext); -nsHTMLContainerFrame::nsHTMLContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsContainerFrame(aContent, aIndexInParent, aParent) +nsHTMLContainerFrame::nsHTMLContainerFrame(nsIContent* aContent, nsIFrame* aParent) + : nsContainerFrame(aContent, aParent) { } @@ -228,8 +226,9 @@ static void AdjustIndexInParents(nsIFrame* aContainerFrame, } else { PRInt32 index; - childFrame->GetIndexInParent(index); + childFrame->GetContentIndex(index); +#if 0 if (::ContentInserted == aChange) { if (index >= aIndexInParent) { childFrame->SetIndexInParent(index + 1); @@ -239,13 +238,13 @@ static void AdjustIndexInParents(nsIFrame* aContainerFrame, childFrame->SetIndexInParent(index - 1); } } +#endif } } } nsIFrame* nsHTMLContainerFrame::CreateFrameFor(nsIPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aIndexInParent) + nsIContent* aContent) { // Get the style content for the frame nsIStyleContextPtr styleContext = aPresContext->ResolveStyleContextFor(aContent, this); @@ -255,18 +254,18 @@ nsIFrame* nsHTMLContainerFrame::CreateFrameFor(nsIPresContext* aPresContext, // See whether it wants any special handling if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) { - AbsoluteFrame::NewFrame(&result, aContent, aIndexInParent, this); + AbsoluteFrame::NewFrame(&result, aContent, this); } else if (display->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&result, aContent, aIndexInParent, this); + PlaceholderFrame::NewFrame(&result, aContent, this); } else if (NS_STYLE_DISPLAY_NONE == display->mDisplay) { - nsFrame::NewFrame(&result, aContent, aIndexInParent, this); + nsFrame::NewFrame(&result, aContent, this); } else { nsIContentDelegate* delegate; // Ask the content delegate to create the frame // XXX The delegate will also resolve the style context... delegate = aContent->GetDelegate(aPresContext); - result = delegate->CreateFrame(aPresContext, aContent, aIndexInParent, this); + result = delegate->CreateFrame(aPresContext, aContent, this); NS_RELEASE(delegate); } @@ -331,7 +330,7 @@ NS_METHOD nsHTMLContainerFrame::ContentInserted(nsIPresShell* aShell, } // Create the new frame - nsIFrame* newFrame = parent->CreateFrameFor(aPresContext, aChild, aIndexInParent); + nsIFrame* newFrame = parent->CreateFrameFor(aPresContext, aChild); // Insert the frame if (nsnull == prevSibling) { diff --git a/layout/html/base/src/nsHTMLContainerFrame.h b/layout/html/base/src/nsHTMLContainerFrame.h index c126f8711f70..f3a4fe248cc4 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.h +++ b/layout/html/base/src/nsHTMLContainerFrame.h @@ -26,7 +26,6 @@ class nsString; class nsHTMLContainerFrame : public nsContainerFrame { public: nsHTMLContainerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -63,8 +62,7 @@ protected: const nsString& aTargetSpec); nsIFrame* CreateFrameFor(nsIPresContext* aPresContext, - nsIContent* aContent, - PRInt32 aIndexInParent); + nsIContent* aContent); }; #endif /* nsHTMLContainerFrame_h___ */ diff --git a/layout/html/base/src/nsHTMLContent.cpp b/layout/html/base/src/nsHTMLContent.cpp index d2a64f7a89b9..7c62dc0af8ad 100644 --- a/layout/html/base/src/nsHTMLContent.cpp +++ b/layout/html/base/src/nsHTMLContent.cpp @@ -46,7 +46,6 @@ public: NS_DECL_ISUPPORTS virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); protected: ~ContentDelegate(); @@ -65,7 +64,6 @@ ContentDelegate::~ContentDelegate() nsIFrame* ContentDelegate::CreateFrame(nsIPresContext* aPresContext, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { NS_PRECONDITION(nsnull != aContent, "null ptr"); @@ -78,12 +76,12 @@ nsIFrame* ContentDelegate::CreateFrame(nsIPresContext* aPresContext, // This means that *somehow* somebody which is not an html // content object got ahold of this delegate and tried to // create a frame with it. Give them back an nsFrame. - status = nsFrame::NewFrame(&rv, aContent, aIndexInParent, aParentFrame); + status = nsFrame::NewFrame(&rv, aContent, aParentFrame); return rv; } // Ask the content object to create the frame - rv = hc->CreateFrame(aPresContext, aIndexInParent, aParentFrame); + rv = hc->CreateFrame(aPresContext, aParentFrame); NS_RELEASE(hc); return rv; } diff --git a/layout/html/base/src/nsHTMLImage.cpp b/layout/html/base/src/nsHTMLImage.cpp index 19494990c366..e2c0e139dbf2 100644 --- a/layout/html/base/src/nsHTMLImage.cpp +++ b/layout/html/base/src/nsHTMLImage.cpp @@ -41,9 +41,7 @@ static NS_DEFINE_IID(kStyleTextSID, NS_STYLETEXT_SID); class ImageFrame : public nsLeafFrame { public: - ImageFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + ImageFrame(nsIContent* aContent, nsIFrame* aParentFrame); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -79,7 +77,6 @@ public: ImagePart(nsIAtom* aTag); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); @@ -117,10 +114,8 @@ protected: //---------------------------------------------------------------------- -ImageFrame::ImageFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsLeafFrame(aContent, aIndexInParent, aParentFrame) +ImageFrame::ImageFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsLeafFrame(aContent, aParentFrame) { } @@ -571,10 +566,9 @@ void ImagePart::MapAttributesInto(nsIStyleContext* aContext, } nsIFrame* ImagePart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - ImageFrame* rv = new ImageFrame(this, aIndexInParent, aParentFrame); + ImageFrame* rv = new ImageFrame(this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsIHTMLContent.h b/layout/html/base/src/nsIHTMLContent.h index 339132b4a31b..aa8f0a8a2a1f 100644 --- a/layout/html/base/src/nsIHTMLContent.h +++ b/layout/html/base/src/nsIHTMLContent.h @@ -82,7 +82,6 @@ public: * for the content. */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) = 0; }; diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index c87f53b3f2e2..6b6688e25496 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -123,14 +123,13 @@ private: nsresult nsInlineFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsInlineFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsInlineFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -138,10 +137,8 @@ nsresult nsInlineFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsInlineFrame::nsInlineFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsHTMLContainerFrame(aContent, aIndexInParent, aParent) +nsInlineFrame::nsInlineFrame(nsIContent* aContent, nsIFrame* aParent) + : nsHTMLContainerFrame(aContent, aParent) { NS_PRECONDITION(!IsPseudoFrame(), "can not be a pseudo frame"); } @@ -304,7 +301,7 @@ PRBool nsInlineFrame::ReflowMappedChildren(nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); VerifyLastIsComplete(); #endif @@ -572,10 +569,10 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, // Check whether it wants to floated or absolutely positioned if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) { - AbsoluteFrame::NewFrame(&kidFrame, kid, kidIndex, this); + AbsoluteFrame::NewFrame(&kidFrame, kid, this); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&kidFrame, kid, kidIndex, this); + PlaceholderFrame::NewFrame(&kidFrame, kid, this); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel; @@ -593,13 +590,13 @@ nsInlineFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, case NS_STYLE_DISPLAY_INLINE: kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); break; default: NS_ASSERTION(nsnull == kidPrevInFlow, "bad prev in flow"); - nsFrame::NewFrame(&kidFrame, kid, kidIndex, this); + nsFrame::NewFrame(&kidFrame, kid, this); break; } kidFrame->SetStyleContext(aPresContext,kidStyleContext); diff --git a/layout/html/base/src/nsLeafFrame.cpp b/layout/html/base/src/nsLeafFrame.cpp index 912178cb2db3..c82d80d10d05 100644 --- a/layout/html/base/src/nsLeafFrame.cpp +++ b/layout/html/base/src/nsLeafFrame.cpp @@ -23,10 +23,8 @@ static NS_DEFINE_IID(kStyleSpacingSID, NS_STYLESPACING_SID); static NS_DEFINE_IID(kStyleBorderSID, NS_STYLEBORDER_SID); static NS_DEFINE_IID(kStyleColorSID, NS_STYLECOLOR_SID); -nsLeafFrame::nsLeafFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsFrame(aContent, aIndexInParent, aParentFrame) +nsLeafFrame::nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsFrame(aContent, aParentFrame) { } diff --git a/layout/html/base/src/nsLeafFrame.h b/layout/html/base/src/nsLeafFrame.h index e979cc2aa06c..0c10771db8b7 100644 --- a/layout/html/base/src/nsLeafFrame.h +++ b/layout/html/base/src/nsLeafFrame.h @@ -49,9 +49,7 @@ public: nsIFrame*& aContinuingFrame); protected: - nsLeafFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsLeafFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual ~nsLeafFrame(); /** diff --git a/layout/html/base/src/nsLineLayout.cpp b/layout/html/base/src/nsLineLayout.cpp index 77f58c2a536f..368b6a8d53e8 100644 --- a/layout/html/base/src/nsLineLayout.cpp +++ b/layout/html/base/src/nsLineLayout.cpp @@ -116,7 +116,7 @@ nsLineData::Verify(PRBool aFinalCheck) const } while ((nsnull != child) && (child != nextLinesFirstChild)) { PRInt32 indexInParent; - child->GetIndexInParent(indexInParent); + child->GetContentIndex(indexInParent); NS_ASSERTION(indexInParent == offset, "bad line offsets"); len++; if (len != mChildCount) { @@ -585,7 +585,7 @@ nsLineLayout::SplitLine(PRInt32 aChildReflowStatus, PRInt32 aRemainingKids) } PRInt32 kidIndexInParent; - mKidFrame->GetIndexInParent(kidIndexInParent); + mKidFrame->GetContentIndex(kidIndexInParent); to->mFirstChild = mKidFrame; to->mChildCount += aRemainingKids; to->mFirstContentOffset = kidIndexInParent; @@ -757,7 +757,7 @@ nsLineLayout::PullUpChildren() // new first content offset. mKidFrame->GetNextSibling(line->mFirstChild); PRInt32 indexInParent; - line->mFirstChild->GetIndexInParent(indexInParent); + line->mFirstChild->GetContentIndex(indexInParent); line->mFirstContentOffset = indexInParent; #ifdef NS_DEBUG line->Verify(); @@ -843,10 +843,10 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) PRBool isBlock = PR_FALSE; nsIFrame* kidFrame; if (NS_STYLE_POSITION_ABSOLUTE == kidPosition->mPosition) { - AbsoluteFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + AbsoluteFrame::NewFrame(&kidFrame, aKid, mBlock); kidFrame->SetStyleContext(mPresContext, kidSC); } else if (kidDisplay->mFloats != NS_STYLE_FLOAT_NONE) { - PlaceholderFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + PlaceholderFrame::NewFrame(&kidFrame, aKid, mBlock); kidFrame->SetStyleContext(mPresContext, kidSC); } else if (nsnull == mKidPrevInFlow) { // Create initial frame for the child @@ -872,7 +872,7 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) } #endif kidDel = aKid->GetDelegate(mPresContext); - kidFrame = kidDel->CreateFrame(mPresContext, aKid, mKidIndex, mBlock); + kidFrame = kidDel->CreateFrame(mPresContext, aKid, mBlock); NS_RELEASE(kidDel); isBlock = PR_TRUE; break; @@ -881,12 +881,12 @@ nsLineLayout::CreateFrameFor(nsIContent* aKid) // XXX pass in kidSC to speed things up *alot*! // XXX fix CreateFrame API to return an nsresult! kidDel = aKid->GetDelegate(mPresContext); - kidFrame = kidDel->CreateFrame(mPresContext, aKid, mKidIndex, mBlock); + kidFrame = kidDel->CreateFrame(mPresContext, aKid, mBlock); NS_RELEASE(kidDel); break; default:/* XXX bzzt! */ - nsFrame::NewFrame(&kidFrame, aKid, mKidIndex, mBlock); + nsFrame::NewFrame(&kidFrame, aKid, mBlock); break; } kidFrame->SetStyleContext(mPresContext, kidSC); diff --git a/layout/html/base/src/nsListItemFrame.cpp b/layout/html/base/src/nsListItemFrame.cpp index ee6971db0dde..2b30ce501b36 100644 --- a/layout/html/base/src/nsListItemFrame.cpp +++ b/layout/html/base/src/nsListItemFrame.cpp @@ -49,9 +49,7 @@ static NS_DEFINE_IID(kStyleListSID, NS_STYLELIST_SID); */ class BulletFrame : public nsContainerFrame { public: - BulletFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual ~BulletFrame(); NS_IMETHOD Paint(nsIPresContext &aCX, @@ -83,10 +81,8 @@ public: PRInt32 mOrdinal; }; -BulletFrame::BulletFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) +BulletFrame::BulletFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { } @@ -411,14 +407,13 @@ void BulletFrame::GetBulletSize(nsIPresContext* aCX, nsresult nsListItemFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsListItemFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsListItemFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -426,10 +421,8 @@ nsresult nsListItemFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -nsListItemFrame::nsListItemFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsBlockFrame(aContent, aIndexInParent, aParent) +nsListItemFrame::nsListItemFrame(nsIContent* aContent, nsIFrame* aParent) + : nsBlockFrame(aContent, aParent) { } @@ -441,7 +434,7 @@ nsIFrame* nsListItemFrame::CreateBullet(nsIPresContext *aCX) { // Create bullet. The bullet shares the same style context as // ourselves. - nsIFrame* bullet = new BulletFrame(mContent, mIndexInParent, this); + nsIFrame* bullet = new BulletFrame(mContent, this); bullet->SetStyleContext(aCX,mStyleContext); return bullet; } @@ -658,7 +651,7 @@ NS_METHOD nsListItemFrame::CreateContinuingFrame(nsIPresContext* aCX, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsListItemFrame* cf = new nsListItemFrame(mContent, mIndexInParent, aParent); + nsListItemFrame* cf = new nsListItemFrame(mContent, aParent); PrepareContinuingFrame(aCX, aParent, cf); aContinuingFrame = cf; return NS_OK; diff --git a/layout/html/base/src/nsListItemFrame.h b/layout/html/base/src/nsListItemFrame.h index 66ed62e576fb..526994f0f138 100644 --- a/layout/html/base/src/nsListItemFrame.h +++ b/layout/html/base/src/nsListItemFrame.h @@ -25,7 +25,6 @@ class nsListItemFrame : public nsBlockFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // nsIFrame @@ -48,7 +47,6 @@ public: protected: nsListItemFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); virtual ~nsListItemFrame(); diff --git a/layout/html/base/src/nsPageFrame.cpp b/layout/html/base/src/nsPageFrame.cpp index 39803bddc098..e9f420ab4cfc 100644 --- a/layout/html/base/src/nsPageFrame.cpp +++ b/layout/html/base/src/nsPageFrame.cpp @@ -23,8 +23,8 @@ #include "nsReflowCommand.h" #include "nsIRenderingContext.h" -PageFrame::PageFrame(nsIContent* aContent, PRInt32 aIndexInParent, nsIFrame* aParent) - : nsContainerFrame(aContent, aIndexInParent, aParent) +PageFrame::PageFrame(nsIContent* aContent, nsIFrame* aParent) + : nsContainerFrame(aContent, aParent) { } @@ -38,7 +38,7 @@ void PageFrame::CreateFirstChild(nsIPresContext* aPresContext) // Create a frame nsIContentDelegate* cd = child->GetDelegate(aPresContext); if (nsnull != cd) { - mFirstChild = cd->CreateFrame(aPresContext, child, 0, this); + mFirstChild = cd->CreateFrame(aPresContext, child, this); if (nsnull != mFirstChild) { mChildCount = 1; mLastContentOffset = mFirstContentOffset; @@ -158,7 +158,7 @@ NS_METHOD PageFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - PageFrame* cf = new PageFrame(mContent, mIndexInParent, aParent); + PageFrame* cf = new PageFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; diff --git a/layout/html/base/src/nsPageFrame.h b/layout/html/base/src/nsPageFrame.h index aaee82d3952e..629816d36317 100644 --- a/layout/html/base/src/nsPageFrame.h +++ b/layout/html/base/src/nsPageFrame.h @@ -23,7 +23,7 @@ // Pseudo frame created by the root content frame class PageFrame : public nsContainerFrame { public: - PageFrame(nsIContent* aContent, PRInt32 aIndexInParent, nsIFrame* aParent); + PageFrame(nsIContent* aContent, nsIFrame* aParent); NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, diff --git a/layout/html/base/src/nsPlaceholderFrame.cpp b/layout/html/base/src/nsPlaceholderFrame.cpp index 8a056b9c8c54..fbc71ef6076a 100644 --- a/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/layout/html/base/src/nsPlaceholderFrame.cpp @@ -25,14 +25,13 @@ static NS_DEFINE_IID(kIFloaterContainerIID, NS_IFLOATERCONTAINER_IID); nsresult PlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new PlaceholderFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new PlaceholderFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -40,10 +39,8 @@ PlaceholderFrame::NewFrame(nsIFrame** aInstancePtrResult, return NS_OK; } -PlaceholderFrame::PlaceholderFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsFrame(aContent, aIndexInParent, aParent) +PlaceholderFrame::PlaceholderFrame(nsIContent* aContent, nsIFrame* aParent) + : nsFrame(aContent, aParent) { mAnchoredItem = nsnull; } @@ -52,15 +49,6 @@ PlaceholderFrame::~PlaceholderFrame() { } -NS_METHOD PlaceholderFrame::SetIndexInParent(PRInt32 aIndexInParent) -{ - if (nsnull != mAnchoredItem) { - mAnchoredItem->SetIndexInParent(aIndexInParent); - } - - return nsFrame::SetIndexInParent(aIndexInParent); -} - NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, const nsSize& aMaxSize, @@ -82,8 +70,7 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, // Create the anchored item nsIContentDelegate* delegate = mContent->GetDelegate(aPresContext); - mAnchoredItem = delegate->CreateFrame(aPresContext, mContent, mIndexInParent, - mGeometricParent); + mAnchoredItem = delegate->CreateFrame(aPresContext, mContent, mGeometricParent); NS_RELEASE(delegate); // Set the style context for the frame @@ -106,6 +93,8 @@ NS_METHOD PlaceholderFrame::ResizeReflow(nsIPresContext* aPresContext, NS_METHOD PlaceholderFrame::ListTag(FILE* out) const { fputs("*placeholder", out); - fprintf(out, "(%d)@%p", mIndexInParent, this); + PRInt32 contentIndex; + GetContentIndex(contentIndex); + fprintf(out, "(%d)@%p", contentIndex, this); return NS_OK; } diff --git a/layout/html/base/src/nsPlaceholderFrame.h b/layout/html/base/src/nsPlaceholderFrame.h index 9f4d5a68a516..1a56bb3b913b 100644 --- a/layout/html/base/src/nsPlaceholderFrame.h +++ b/layout/html/base/src/nsPlaceholderFrame.h @@ -29,14 +29,11 @@ public: */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // Returns the associated anchored item nsIFrame* GetAnchoredItem() const {return mAnchoredItem;} - NS_IMETHOD SetIndexInParent(PRInt32 aIndexInParent); - // Resize reflow methods NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -48,9 +45,7 @@ public: protected: // Constructor. Takes as arguments the content object, the index in parent, // and the Frame for the content parent - PlaceholderFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent); + PlaceholderFrame(nsIContent* aContent, nsIFrame* aParent); virtual ~PlaceholderFrame(); diff --git a/layout/html/base/src/nsRootPart.cpp b/layout/html/base/src/nsRootPart.cpp index 43796531d654..879ffac032fb 100644 --- a/layout/html/base/src/nsRootPart.cpp +++ b/layout/html/base/src/nsRootPart.cpp @@ -59,7 +59,7 @@ public: // Pseudo frame created by the root frame class RootContentFrame : public nsContainerFrame { public: - RootContentFrame(nsIContent* aContent, PRInt32 aIndexInParent, nsIFrame* aParent); + RootContentFrame(nsIContent* aContent, nsIFrame* aParent); NS_IMETHOD ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -84,7 +84,7 @@ protected: //---------------------------------------------------------------------- RootFrame::RootFrame(nsIContent* aContent) - : nsContainerFrame(aContent, -1, nsnull) + : nsContainerFrame(aContent, nsnull) { } @@ -102,7 +102,7 @@ NS_METHOD RootFrame::ResizeReflow(nsIPresContext* aPresContext, // Do we have any children? if (nsnull == mFirstChild) { // No. Create a pseudo frame - mFirstChild = new RootContentFrame(mContent, mIndexInParent, this); + mFirstChild = new RootContentFrame(mContent, this); mChildCount = 1; nsIStyleContext* style = aPresContext->ResolveStyleContextFor(mContent, this); mFirstChild->SetStyleContext(aPresContext,style); @@ -208,10 +208,8 @@ NS_METHOD RootFrame::HandleEvent(nsIPresContext& aPresContext, //---------------------------------------------------------------------- -RootContentFrame::RootContentFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParent) - : nsContainerFrame(aContent, aIndexInParent, aParent) +RootContentFrame::RootContentFrame(nsIContent* aContent, nsIFrame* aParent) + : nsContainerFrame(aContent, aParent) { // Create a view nsIFrame* parent; @@ -256,7 +254,7 @@ void RootContentFrame::CreateFirstChild(nsIPresContext* aPresContext) // Are we paginated? if (aPresContext->IsPaginated()) { // Yes. Create the first page frame - mFirstChild = new PageFrame(mContent, mIndexInParent, this); + mFirstChild = new PageFrame(mContent, this); mChildCount = 1; mLastContentOffset = mFirstContentOffset; @@ -269,7 +267,7 @@ void RootContentFrame::CreateFirstChild(nsIPresContext* aPresContext) // Create a frame nsIContentDelegate* cd = child->GetDelegate(aPresContext); if (nsnull != cd) { - mFirstChild = cd->CreateFrame(aPresContext, child, 0, this); + mFirstChild = cd->CreateFrame(aPresContext, child, this); if (nsnull != mFirstChild) { mChildCount = 1; mLastContentOffset = mFirstContentOffset; @@ -451,7 +449,6 @@ public: NS_IMETHOD_(nsrefcnt) AddRef(); NS_IMETHOD_(nsrefcnt) Release(); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); protected: @@ -484,7 +481,6 @@ nsrefcnt RootPart::Release(void) } nsIFrame* RootPart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv = new RootFrame(this); diff --git a/layout/html/base/src/nsSpacerPart.cpp b/layout/html/base/src/nsSpacerPart.cpp index 4ef630a0ad28..c5a614417ccf 100644 --- a/layout/html/base/src/nsSpacerPart.cpp +++ b/layout/html/base/src/nsSpacerPart.cpp @@ -36,9 +36,7 @@ class SpacerFrame : public nsFrame { public: - SpacerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual ReflowStatus ResizeReflow(nsIPresContext* aPresContext, nsReflowMetrics& aDesiredSize, @@ -53,7 +51,6 @@ public: SpacerPart(nsIAtom* aTag); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); @@ -72,10 +69,8 @@ protected: //---------------------------------------------------------------------- -SpacerFrame::SpacerFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsFrame(aContent, aIndexInParent, aParentFrame) +SpacerFrame::SpacerFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsFrame(aContent, aParentFrame) { } @@ -205,11 +200,9 @@ SpacerPart::~SpacerPart() { } -nsIFrame* SpacerPart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) +nsIFrame* SpacerPart::CreateFrame(nsIPresContext* aPresContext, nsIFrame* aParentFrame) { - nsIFrame* rv = new SpacerFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new SpacerFrame(this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsTextContent.cpp b/layout/html/base/src/nsTextContent.cpp index 9985b3977bc5..f07c73ef2363 100644 --- a/layout/html/base/src/nsTextContent.cpp +++ b/layout/html/base/src/nsTextContent.cpp @@ -108,9 +108,7 @@ public: class TextFrame : public nsSplittableFrame { public: - TextFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + TextFrame(nsIContent* aContent, nsIFrame* aParentFrame); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -220,9 +218,7 @@ public: virtual void ToHTMLString(nsString& aBuf) const; - virtual nsIFrame* CreateFrame(nsIPresContext* aCX, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + virtual nsIFrame* CreateFrame(nsIPresContext* aCX, nsIFrame* aParentFrame); // nsIScriptObjectOwner interface virtual nsresult GetScriptObject(JSContext *aContext, void** aScriptObject); @@ -357,10 +353,8 @@ void TextTimer::Notify(nsITimer *timer) //---------------------------------------------------------------------- -TextFrame::TextFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsSplittableFrame(aContent, aIndexInParent, aParentFrame) +TextFrame::TextFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsSplittableFrame(aContent, aParentFrame) { if (nsnull == gTextBlinker) { // Create text timer the first time out @@ -1148,8 +1142,10 @@ NS_METHOD TextFrame::List(FILE* out, PRInt32 aIndent) const { PRInt32 i; for (i = aIndent; --i >= 0; ) fputs(" ", out); + PRInt32 contentIndex; + GetContentIndex(contentIndex); fprintf(out, "Text(%d)@%p[%d,%d] ", - mIndexInParent, this, + contentIndex, this, mContentOffset, mContentOffset+mContentLength-1); out << mRect; aIndent++; @@ -1312,11 +1308,9 @@ void Text::GetText(nsString& aBuf, PRInt32 aOffset, PRInt32 aCount) } #endif -nsIFrame* Text::CreateFrame(nsIPresContext* aCX, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) +nsIFrame* Text::CreateFrame(nsIPresContext* aCX, nsIFrame* aParentFrame) { - nsIFrame* rv = new TextFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new TextFrame(this, aParentFrame); return rv; } diff --git a/layout/html/base/src/nsWBRPart.cpp b/layout/html/base/src/nsWBRPart.cpp index 9aaf833f41f4..1d1f76204858 100644 --- a/layout/html/base/src/nsWBRPart.cpp +++ b/layout/html/base/src/nsWBRPart.cpp @@ -25,7 +25,6 @@ public: WBRPart(nsIAtom* aTag); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); protected: @@ -41,12 +40,10 @@ WBRPart::~WBRPart() { } -nsIFrame* WBRPart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) +nsIFrame* WBRPart::CreateFrame(nsIPresContext* aPresContext, nsIFrame* aParentFrame) { nsIFrame* frame; - nsresult rv = nsFrame::NewFrame(&frame, this, aIndexInParent, aParentFrame); + nsresult rv = nsFrame::NewFrame(&frame, this, aParentFrame); if (NS_OK == rv) { return frame; } diff --git a/layout/html/forms/src/nsInput.cpp b/layout/html/forms/src/nsInput.cpp index 3d1810fa4de8..9510f8510d13 100644 --- a/layout/html/forms/src/nsInput.cpp +++ b/layout/html/forms/src/nsInput.cpp @@ -165,7 +165,6 @@ nsrefcnt nsInput::Release() nsIFrame* nsInput::CreateFrame(nsIPresContext *aPresContext, - PRInt32 aIndexInParent, nsIFrame *aParentFrame) { NS_ASSERTION(0, "frames must be created by subclasses of Input"); diff --git a/layout/html/forms/src/nsInput.h b/layout/html/forms/src/nsInput.h index a5f35d86fa8a..17aa84879877 100644 --- a/layout/html/forms/src/nsInput.h +++ b/layout/html/forms/src/nsInput.h @@ -47,7 +47,6 @@ public: * @see nsIContentDelegate CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void MapAttributesInto(nsIStyleContext* aContext, diff --git a/layout/html/forms/src/nsInputButton.cpp b/layout/html/forms/src/nsInputButton.cpp index 86515c5245b5..95f8c2bac840 100644 --- a/layout/html/forms/src/nsInputButton.cpp +++ b/layout/html/forms/src/nsInputButton.cpp @@ -64,7 +64,6 @@ public: nsButtonType aType); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void GetDefaultLabel(nsString& aLabel); @@ -93,9 +92,7 @@ public: class nsInputButtonFrame : public nsInputFrame { public: typedef nsInputFrame nsInputButtonFrameSuper; - nsInputButtonFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsInputButtonFrame(nsIContent* aContent, nsIFrame* aParentFrame); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -211,16 +208,15 @@ nsInputButton::GetDefaultLabel(nsString& aString) nsIFrame* nsInputButton::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { if (kButton_Hidden == mType) { nsIFrame* frame; - nsFrame::NewFrame(&frame, this, aIndexInParent, aParentFrame); + nsFrame::NewFrame(&frame, this, aParentFrame); return frame; } else { - return new nsInputButtonFrame(this, aIndexInParent, aParentFrame); + return new nsInputButtonFrame(this, aParentFrame); } } @@ -281,9 +277,8 @@ nsInputButton::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, // nsInputButtonFrame Implementation nsInputButtonFrame::nsInputButtonFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } diff --git a/layout/html/forms/src/nsInputCheckbox.cpp b/layout/html/forms/src/nsInputCheckbox.cpp index 923ae3dea5e4..8fbd6228ec00 100644 --- a/layout/html/forms/src/nsInputCheckbox.cpp +++ b/layout/html/forms/src/nsInputCheckbox.cpp @@ -33,9 +33,7 @@ class nsInputCheckboxFrame : public nsInputFrame { public: - nsInputCheckboxFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsInputCheckboxFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual void PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView); @@ -56,10 +54,8 @@ protected: nsSize& aDesiredWidgetSize); }; -nsInputCheckboxFrame::nsInputCheckboxFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) +nsInputCheckboxFrame::nsInputCheckboxFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } @@ -200,11 +196,9 @@ nsInputCheckbox::Reset() } nsIFrame* -nsInputCheckbox::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) +nsInputCheckbox::CreateFrame(nsIPresContext* aPresContext, nsIFrame* aParentFrame) { - nsIFrame* rv = new nsInputCheckboxFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new nsInputCheckboxFrame(this, aParentFrame); return rv; } diff --git a/layout/html/forms/src/nsInputCheckbox.h b/layout/html/forms/src/nsInputCheckbox.h index 84b5c930be0b..eb46276b42d5 100644 --- a/layout/html/forms/src/nsInputCheckbox.h +++ b/layout/html/forms/src/nsInputCheckbox.h @@ -29,7 +29,6 @@ public: nsInputCheckbox (nsIAtom* aTag, nsIFormManager* aManager); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); diff --git a/layout/html/forms/src/nsInputFile.cpp b/layout/html/forms/src/nsInputFile.cpp index 85343603ed04..75d13d5dfd3e 100644 --- a/layout/html/forms/src/nsInputFile.cpp +++ b/layout/html/forms/src/nsInputFile.cpp @@ -30,9 +30,7 @@ class nsInputFileFrame : public nsInputFrame { public: - nsInputFileFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsInputFileFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual void PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView); @@ -40,10 +38,8 @@ protected: virtual ~nsInputFileFrame(); }; -nsInputFileFrame::nsInputFileFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) +nsInputFileFrame::nsInputFileFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } @@ -74,10 +70,9 @@ nsInputFile::~nsInputFile() nsIFrame* nsInputFile::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - nsIFrame* rv = new nsInputFileFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new nsInputFileFrame(this, aParentFrame); return rv; } diff --git a/layout/html/forms/src/nsInputFile.h b/layout/html/forms/src/nsInputFile.h index f4d3aeb9e0cc..5d7b67ec1286 100644 --- a/layout/html/forms/src/nsInputFile.h +++ b/layout/html/forms/src/nsInputFile.h @@ -31,7 +31,6 @@ public: nsInputFile (nsIAtom* aTag, nsIFormManager* aManager); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); protected: diff --git a/layout/html/forms/src/nsInputFrame.cpp b/layout/html/forms/src/nsInputFrame.cpp index 656ae7a95041..823555c4803b 100644 --- a/layout/html/forms/src/nsInputFrame.cpp +++ b/layout/html/forms/src/nsInputFrame.cpp @@ -60,10 +60,8 @@ struct nsInputCallbackData } }; -nsInputFrame::nsInputFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsLeafFrame(aContent, aIndexInParent, aParentFrame) +nsInputFrame::nsInputFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsLeafFrame(aContent, aParentFrame) { mCacheBounds.width = 0; mCacheBounds.height = 0; diff --git a/layout/html/forms/src/nsInputFrame.h b/layout/html/forms/src/nsInputFrame.h index bb518645a414..c774e656db3b 100644 --- a/layout/html/forms/src/nsInputFrame.h +++ b/layout/html/forms/src/nsInputFrame.h @@ -80,12 +80,9 @@ public: /** * Main constructor * @param aContent the content representing this frame - * @param aIndexInParent the position in the parent frame's children which this frame occupies * @param aParentFrame the parent frame */ - nsInputFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsInputFrame(nsIContent* aContent, nsIFrame* aParentFrame); static nscoord CalculateSize (nsIPresContext* aPresContext, nsInputFrame* aFrame, const nsSize& aCSSSize, nsInputDimensionSpec& aDimensionSpec, diff --git a/layout/html/forms/src/nsInputRadio.cpp b/layout/html/forms/src/nsInputRadio.cpp index ae96f6859093..9704ea98c17b 100644 --- a/layout/html/forms/src/nsInputRadio.cpp +++ b/layout/html/forms/src/nsInputRadio.cpp @@ -35,9 +35,7 @@ class nsInputRadioFrame : public nsInputFrame { public: - nsInputRadioFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsInputRadioFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual void PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView); @@ -59,10 +57,8 @@ protected: nsSize& aDesiredWidgetSize); }; -nsInputRadioFrame::nsInputRadioFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) +nsInputRadioFrame::nsInputRadioFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } @@ -192,10 +188,9 @@ nsInputRadio::SetChecked(PRBool aValue, PRBool aSetInitialValue) nsIFrame* nsInputRadio::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - nsIFrame* rv = new nsInputRadioFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new nsInputRadioFrame(this, aParentFrame); return rv; } diff --git a/layout/html/forms/src/nsInputRadio.h b/layout/html/forms/src/nsInputRadio.h index 7d65bf8ae1e2..5d4ed90562cd 100644 --- a/layout/html/forms/src/nsInputRadio.h +++ b/layout/html/forms/src/nsInputRadio.h @@ -33,7 +33,6 @@ public: nsInputRadio (nsIAtom* aTag, nsIFormManager* aManager); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); diff --git a/layout/html/forms/src/nsInputText.cpp b/layout/html/forms/src/nsInputText.cpp index e8c4df54c5e5..2ec06730ae4f 100644 --- a/layout/html/forms/src/nsInputText.cpp +++ b/layout/html/forms/src/nsInputText.cpp @@ -37,7 +37,6 @@ class nsInputTextFrame : public nsInputFrame { public: nsInputTextFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual nsInputWidgetData* GetWidgetInitData(); @@ -61,9 +60,8 @@ protected: }; nsInputTextFrame::nsInputTextFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } @@ -206,10 +204,9 @@ nsInputText::GetTextType() const nsIFrame* nsInputText::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - return new nsInputTextFrame(this, aIndexInParent, aParentFrame); + return new nsInputTextFrame(this, aParentFrame); } PRInt32 diff --git a/layout/html/forms/src/nsInputText.h b/layout/html/forms/src/nsInputText.h index 5345bb889e9b..c9ed078c0223 100644 --- a/layout/html/forms/src/nsInputText.h +++ b/layout/html/forms/src/nsInputText.h @@ -39,7 +39,6 @@ public: nsInputText (nsIAtom* aTag, nsIFormManager* aManager, nsInputTextType aType); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); diff --git a/layout/html/forms/src/nsSelect.cpp b/layout/html/forms/src/nsSelect.cpp index 751b15e3fe06..aac6b7ffa8a9 100644 --- a/layout/html/forms/src/nsSelect.cpp +++ b/layout/html/forms/src/nsSelect.cpp @@ -46,9 +46,7 @@ static NS_DEFINE_IID(kListBoxIID, NS_ILISTBOX_IID); class nsSelectFrame : public nsInputFrame { public: - nsSelectFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsSelectFrame(nsIContent* aContent, nsIFrame* aParentFrame); virtual nsInputWidgetData* GetWidgetInitData(); @@ -77,7 +75,6 @@ public: nsSelect (nsIAtom* aTag, nsIFormManager* aFormMan); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); @@ -112,7 +109,6 @@ public: nsOption (nsIAtom* aTag); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); @@ -140,9 +136,8 @@ protected: nsSelectFrame::nsSelectFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsInputFrame(aContent, aIndexInParent, aParentFrame) + : nsInputFrame(aContent, aParentFrame) { } @@ -306,10 +301,9 @@ void nsSelect::GetType(nsString& aResult) const nsIFrame* nsSelect::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - nsIFrame* rv = new nsSelectFrame(this, aIndexInParent, aParentFrame); + nsIFrame* rv = new nsSelectFrame(this, aParentFrame); return rv; } @@ -468,11 +462,10 @@ void nsOption::GetType(nsString& aResult) const nsIFrame* nsOption::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* frame; - nsFrame::NewFrame(&frame, this, aIndexInParent, aParentFrame); + nsFrame::NewFrame(&frame, this, aParentFrame); return frame; } diff --git a/layout/html/table/src/nsTableCaption.cpp b/layout/html/table/src/nsTableCaption.cpp index 1660193b3781..1d7d4a5ef11c 100644 --- a/layout/html/table/src/nsTableCaption.cpp +++ b/layout/html/table/src/nsTableCaption.cpp @@ -77,13 +77,11 @@ int nsTableCaption::GetType() } nsIFrame* nsTableCaption::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { NS_PRECONDITION(nsnull!=aPresContext, "bad arg"); nsIFrame* rv; - nsresult status = nsTableCaptionFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableCaptionFrame::NewFrame(&rv, this, aParentFrame); NS_ASSERTION(nsnull!=rv, "bad arg"); return rv; } diff --git a/layout/html/table/src/nsTableCaption.h b/layout/html/table/src/nsTableCaption.h index f01a4fb056da..e8d6881b3fb9 100644 --- a/layout/html/table/src/nsTableCaption.h +++ b/layout/html/table/src/nsTableCaption.h @@ -59,9 +59,7 @@ public: virtual int GetType(); /** @see nsIHTMLContent::CreateFrame */ - virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, nsIFrame* aParentFrame); }; diff --git a/layout/html/table/src/nsTableCaptionFrame.cpp b/layout/html/table/src/nsTableCaptionFrame.cpp index ad4f16d8c1f8..180c98a0ad16 100644 --- a/layout/html/table/src/nsTableCaptionFrame.cpp +++ b/layout/html/table/src/nsTableCaptionFrame.cpp @@ -41,9 +41,8 @@ static NS_DEFINE_IID(kStyleTextSID, NS_STYLETEXT_SID); /** */ nsTableCaptionFrame::nsTableCaptionFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), + : nsContainerFrame(aContent, aParentFrame), mMinWidth(0), mMaxWidth(0) { @@ -76,7 +75,7 @@ void nsTableCaptionFrame::CreatePsuedoFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - nsBodyFrame::NewFrame(&mFirstChild, mContent, mIndexInParent, this); + nsBodyFrame::NewFrame(&mFirstChild, mContent, this); mChildCount = 1; // Resolve style and set the style context @@ -330,7 +329,7 @@ NS_METHOD nsTableCaptionFrame::CreateContinuingFrame(nsIPresContext* aPresContex nsIFrame*& aContinuingFrame) { if (PR_TRUE==gsDebug) printf("nsTableCaptionFrame::CreateContinuingFrame called\n"); - nsTableCaptionFrame* cf = new nsTableCaptionFrame(mContent, mIndexInParent, aParent); + nsTableCaptionFrame* cf = new nsTableCaptionFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -340,14 +339,13 @@ NS_METHOD nsTableCaptionFrame::CreateContinuingFrame(nsIPresContext* aPresContex nsresult nsTableCaptionFrame::NewFrame( nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableCaptionFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableCaptionFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableCaptionFrame.h b/layout/html/table/src/nsTableCaptionFrame.h index b40c4182d426..7b2c8c294c4d 100644 --- a/layout/html/table/src/nsTableCaptionFrame.h +++ b/layout/html/table/src/nsTableCaptionFrame.h @@ -33,7 +33,6 @@ class nsTableCaptionFrame : public nsContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -79,9 +78,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableCaptionFrame( nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableCaptionFrame( nsIContent* aContent, nsIFrame* aParentFrame); /** Create a psuedo-frame for this caption. Handles continuing frames as needed. */ diff --git a/layout/html/table/src/nsTableCell.cpp b/layout/html/table/src/nsTableCell.cpp index 91b1bd685abf..d0701cc8fe58 100644 --- a/layout/html/table/src/nsTableCell.cpp +++ b/layout/html/table/src/nsTableCell.cpp @@ -144,13 +144,11 @@ void nsTableCell::SetColIndex (int aColIndex) } nsIFrame* nsTableCell::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { NS_PRECONDITION(nsnull!=aPresContext, "bad arg"); nsIFrame* rv; - nsresult status = nsTableCellFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableCellFrame::NewFrame(&rv, this, aParentFrame); NS_ASSERTION(nsnull!=rv, "bad arg"); return rv; } diff --git a/layout/html/table/src/nsTableCell.h b/layout/html/table/src/nsTableCell.h index 7a04bc004687..2ba412a5d5e0 100644 --- a/layout/html/table/src/nsTableCell.h +++ b/layout/html/table/src/nsTableCell.h @@ -87,7 +87,6 @@ public: /** @see nsIHTMLContent::CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); virtual void SetAttribute(nsIAtom* aAttribute, const nsString& aValue); diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 4e614cda8f97..c05c1a1a9acc 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -44,9 +44,8 @@ static NS_DEFINE_IID(kStyleTextSID, NS_STYLETEXT_SID); /** */ nsTableCellFrame::nsTableCellFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { } @@ -180,7 +179,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - nsBodyFrame::NewFrame(&mFirstChild, mContent, mIndexInParent, this); + nsBodyFrame::NewFrame(&mFirstChild, mContent, this); mChildCount = 1; // Resolve style and set the style context @@ -339,7 +338,7 @@ NS_METHOD nsTableCellFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableCellFrame* cf = new nsTableCellFrame(mContent, mIndexInParent, aParent); + nsTableCellFrame* cf = new nsTableCellFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -491,14 +490,13 @@ NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableCellFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableCellFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index ebeb5465e193..7679dc2f2722 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -33,7 +33,6 @@ class nsTableCellFrame : public nsContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -79,7 +78,6 @@ protected: * @see NewFrame */ nsTableCellFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** Create a psuedo-frame for this caption. Handles continuing frames as needed. diff --git a/layout/html/table/src/nsTableCol.cpp b/layout/html/table/src/nsTableCol.cpp index 8a2ec92b382a..fc8a48d8388a 100644 --- a/layout/html/table/src/nsTableCol.cpp +++ b/layout/html/table/src/nsTableCol.cpp @@ -39,7 +39,6 @@ class nsTableColFrame : public nsFrame { public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -60,9 +59,7 @@ public: protected: - nsTableColFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame); ~nsTableColFrame(); @@ -70,10 +67,8 @@ protected: -nsTableColFrame::nsTableColFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsFrame(aContent, aIndexInParent, aParentFrame) +nsTableColFrame::nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsFrame(aContent, aParentFrame) { } @@ -126,14 +121,13 @@ NS_METHOD nsTableColFrame::IncrementalReflow(nsIPresContext* aPresContext, nsresult nsTableColFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableColFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableColFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } @@ -326,12 +320,10 @@ nsString * nsTableCol::GetAllInternalAttributeNames () } nsIFrame* nsTableCol::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsTableColFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableColFrame::NewFrame(&rv, this, aParentFrame); return rv; } diff --git a/layout/html/table/src/nsTableCol.h b/layout/html/table/src/nsTableCol.h index 3aef2b153078..cb74175f3060 100644 --- a/layout/html/table/src/nsTableCol.h +++ b/layout/html/table/src/nsTableCol.h @@ -77,7 +77,6 @@ public: /** @see nsIHTMLContent::CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** return the number of columns this content object represents. always >= 1*/ diff --git a/layout/html/table/src/nsTableColGroup.cpp b/layout/html/table/src/nsTableColGroup.cpp index b7d8a996eb62..c9511ece403b 100644 --- a/layout/html/table/src/nsTableColGroup.cpp +++ b/layout/html/table/src/nsTableColGroup.cpp @@ -332,12 +332,10 @@ PRBool nsTableColGroup::IsCol(nsIContent * aContent) const } nsIFrame* nsTableColGroup::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsTableColGroupFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableColGroupFrame::NewFrame(&rv, this, aParentFrame); NS_ASSERTION(nsnull!=rv, "can't allocate a new frame"); return rv; } diff --git a/layout/html/table/src/nsTableColGroup.h b/layout/html/table/src/nsTableColGroup.h index 121adda21d63..8befe33b59ce 100644 --- a/layout/html/table/src/nsTableColGroup.h +++ b/layout/html/table/src/nsTableColGroup.h @@ -78,7 +78,6 @@ public: /** @see nsIHTMLContent::CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** returns nsITableContent::kTableColGroupType */ diff --git a/layout/html/table/src/nsTableColGroupFrame.cpp b/layout/html/table/src/nsTableColGroupFrame.cpp index f9bee13cc806..23fd2283b6c8 100644 --- a/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/layout/html/table/src/nsTableColGroupFrame.cpp @@ -25,9 +25,8 @@ static PRBool gsDebug = PR_FALSE; nsTableColGroupFrame::nsTableColGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { } @@ -79,14 +78,13 @@ nsTableColGroupFrame::IncrementalReflow(nsIPresContext* aPresContext, nsresult nsTableColGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableColGroupFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableColGroupFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableColGroupFrame.h b/layout/html/table/src/nsTableColGroupFrame.h index e2a93f7a00b1..44762ddc912f 100644 --- a/layout/html/table/src/nsTableColGroupFrame.h +++ b/layout/html/table/src/nsTableColGroupFrame.h @@ -33,7 +33,6 @@ class nsTableColGroupFrame : public nsContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -54,9 +53,7 @@ public: protected: - nsTableColGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableColGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); ~nsTableColGroupFrame(); diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 1b7886f25220..ed652616bd94 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -142,10 +142,8 @@ struct InnerTableReflowState { /* ----------- nsTableFrame ---------- */ -nsTableFrame::nsTableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), +nsTableFrame::nsTableFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame), mColumnLayoutData(nsnull), mColumnWidths(nsnull), mTableLayoutStrategy(nsnull), @@ -639,7 +637,7 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont { nsIContentDelegate* kidDel; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } @@ -1105,7 +1103,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -1414,7 +1412,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext, kidStyleContext); } else { @@ -2045,7 +2043,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableFrame* cf = new nsTableFrame(mContent, mIndexInParent, aParent); + nsTableFrame* cf = new nsTableFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); if (PR_TRUE==gsDebug) printf("nsTableFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf); // set my width, because all frames in a table flow are the same width @@ -2076,7 +2074,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext, aPresContext->ResolveStyleContextFor(content, cf); // kidStyleContext: REFCNT++ nsIContentDelegate* kidDel = nsnull; kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++ - nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf); + nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, cf); NS_RELEASE(kidDel); // kidDel: REFCNT-- duplicateFrame->SetStyleContext(aPresContext,kidStyleContext); NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT-- @@ -2161,14 +2159,13 @@ NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext* aPresContext) nsresult nsTableFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index c89d89425a80..62ce24bb1a9f 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -50,14 +50,12 @@ public: /** instantiate a new instance of nsTableFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -173,9 +171,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** destructor, responsible for mColumnLayoutData and mColumnWidths */ virtual ~nsTableFrame(); diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 2cc16d278078..3105384a3071 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -101,10 +101,8 @@ struct OuterTableReflowState { /** */ -nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), +nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame), mInnerTableFrame(nsnull), mCaptionFrames(nsnull), mBottomCaptions(nsnull), @@ -939,7 +937,7 @@ nsTableOuterFrame::ReflowChild( nsIFrame* aKidFrame, void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) { nsIFrame *prevKidFrame = nsnull; - nsresult frameCreated = nsTableFrame::NewFrame((nsIFrame **)(&mInnerTableFrame), mContent, 0, this); + nsresult frameCreated = nsTableFrame::NewFrame((nsIFrame **)(&mInnerTableFrame), mContent, this); if (NS_OK!=frameCreated) return; // SEC: an error!!!! // Resolve style @@ -966,7 +964,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) if (contentType==nsITableContent::kTableCaptionType) { nsIFrame *captionFrame=nsnull; - frameCreated = nsTableCaptionFrame::NewFrame(&captionFrame, caption, 0, this); + frameCreated = nsTableCaptionFrame::NewFrame(&captionFrame, caption, this); if (NS_OK!=frameCreated) return; // SEC: an error!!!! // Resolve style @@ -1084,7 +1082,7 @@ nsTableOuterFrame::ResizeReflowTopCaptionsPass2(nsIPresContext* aPresContext, mInnerTableFrame->MoveTo(0, topCaptionY); PRInt32 captionIndexInParent; - captionFrame->GetIndexInParent(captionIndexInParent); + captionFrame->GetContentIndex(captionIndexInParent); if (0==captionIndexInParent) { SetFirstContentOffset(captionFrame); @@ -1208,7 +1206,7 @@ NS_METHOD nsTableOuterFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableOuterFrame* cf = new nsTableOuterFrame(mContent, mIndexInParent, aParent); + nsTableOuterFrame* cf = new nsTableOuterFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); cf->SetFirstPassValid(PR_TRUE); if (PR_TRUE==gsDebug) @@ -1358,7 +1356,7 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - mInnerTableFrame = new nsTableFrame(mContent, mIndexInParent, this); + mInnerTableFrame = new nsTableFrame(mContent, this); mChildCount++; // Resolve style and set the style context @@ -1387,14 +1385,13 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext) nsresult nsTableOuterFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableOuterFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableOuterFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableOuterFrame.h b/layout/html/table/src/nsTableOuterFrame.h index b53523daabc8..08d0c7ea89b5 100644 --- a/layout/html/table/src/nsTableOuterFrame.h +++ b/layout/html/table/src/nsTableOuterFrame.h @@ -45,14 +45,12 @@ public: /** instantiate a new instance of nsTableFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -110,9 +108,7 @@ protected: /** protected constructor * @see NewFrame */ - nsTableOuterFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** return PR_TRUE if the table needs to be reflowed. * the outer table needs to be reflowed if the table content has changed, diff --git a/layout/html/table/src/nsTablePart.cpp b/layout/html/table/src/nsTablePart.cpp index 966a7a8d5925..379423626956 100644 --- a/layout/html/table/src/nsTablePart.cpp +++ b/layout/html/table/src/nsTablePart.cpp @@ -998,13 +998,10 @@ PRInt32 nsTablePart::GetEffectiveRowSpan (PRInt32 aRowIndex, nsTableCell *aCell) /** * Create a frame object that will layout this table. */ -nsIFrame* nsTablePart::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) +nsIFrame* nsTablePart::CreateFrame(nsIPresContext* aPresContext, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsTableOuterFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableOuterFrame::NewFrame(&rv, this, aParentFrame); return rv; } diff --git a/layout/html/table/src/nsTablePart.h b/layout/html/table/src/nsTablePart.h index ebf4eb53cf6b..14d379e2835f 100644 --- a/layout/html/table/src/nsTablePart.h +++ b/layout/html/table/src/nsTablePart.h @@ -145,7 +145,6 @@ public: virtual PRBool RemoveChildAt(PRInt32 aIndex); virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** called when the input stream knows that the input has been completely consumed. diff --git a/layout/html/table/src/nsTableRow.cpp b/layout/html/table/src/nsTableRow.cpp index 9e215daed967..0d079052225c 100644 --- a/layout/html/table/src/nsTableRow.cpp +++ b/layout/html/table/src/nsTableRow.cpp @@ -241,12 +241,10 @@ PRBool nsTableRow::RemoveChildAt (int aIndex) // nsTableRowFrame checks args nsIFrame* nsTableRow::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsTableRowFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableRowFrame::NewFrame(&rv, this, aParentFrame); return rv; } diff --git a/layout/html/table/src/nsTableRow.h b/layout/html/table/src/nsTableRow.h index a31cfba62a0e..c23fb602a99c 100644 --- a/layout/html/table/src/nsTableRow.h +++ b/layout/html/table/src/nsTableRow.h @@ -71,7 +71,6 @@ public: /** @see nsIHTMLContent::CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** return the row group that contains me (my parent) */ diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index 4c885604ae0f..23198d8279dd 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -87,9 +87,8 @@ struct RowReflowState { /* ----------- nsTableRowpFrame ---------- */ nsTableRowFrame::nsTableRowFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), + : nsContainerFrame(aContent, aParentFrame), mTallestCell(0) { } @@ -444,7 +443,7 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -809,7 +808,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = cell->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, cell, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else { @@ -1036,7 +1035,7 @@ NS_METHOD nsTableRowFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame*& aContinuingFrame) { if (gsDebug1==PR_TRUE) printf("nsTableRowFrame::CreateContinuingFrame\n"); - nsTableRowFrame* cf = new nsTableRowFrame(mContent, mIndexInParent, aParent); + nsTableRowFrame* cf = new nsTableRowFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -1044,14 +1043,13 @@ NS_METHOD nsTableRowFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsresult nsTableRowFrame::NewFrame( nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableRowFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableRowFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableRowFrame.h b/layout/html/table/src/nsTableRowFrame.h index 141ef6a9a6d4..77578e710668 100644 --- a/layout/html/table/src/nsTableRowFrame.h +++ b/layout/html/table/src/nsTableRowFrame.h @@ -43,14 +43,12 @@ public: /** instantiate a new instance of nsTableRowFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -112,9 +110,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableRowFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableRowFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** destructor */ virtual ~nsTableRowFrame(); diff --git a/layout/html/table/src/nsTableRowGroup.cpp b/layout/html/table/src/nsTableRowGroup.cpp index d9c792c3a1f5..7e473dc97291 100644 --- a/layout/html/table/src/nsTableRowGroup.cpp +++ b/layout/html/table/src/nsTableRowGroup.cpp @@ -96,12 +96,10 @@ nsrefcnt nsTableRowGroup::Release(void) // nsTableRowGroupFrame checks arguments nsIFrame* nsTableRowGroup::CreateFrame( nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { nsIFrame* rv; - nsresult status = nsTableRowGroupFrame::NewFrame(&rv, this, aIndexInParent, - aParentFrame); + nsresult status = nsTableRowGroupFrame::NewFrame(&rv, this, aParentFrame); return rv; } diff --git a/layout/html/table/src/nsTableRowGroup.h b/layout/html/table/src/nsTableRowGroup.h index 91cb906a72f5..5c408a9f6933 100644 --- a/layout/html/table/src/nsTableRowGroup.h +++ b/layout/html/table/src/nsTableRowGroup.h @@ -64,7 +64,6 @@ public: /** @see nsIHTMLContent::CreateFrame */ virtual nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** return the number of contained rows */ diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 4188aed37302..a92ca395f69a 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -88,10 +88,8 @@ struct RowGroupReflowState { /* ----------- nsTableRowGroupFrame ---------- */ -nsTableRowGroupFrame::nsTableRowGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) +nsTableRowGroupFrame::nsTableRowGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { mType = aContent->GetTag(); // mType: REFCNT++ } @@ -411,7 +409,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -741,7 +739,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidSC); } else { @@ -928,7 +926,7 @@ NS_METHOD nsTableRowGroupFrame::CreateContinuingFrame(nsIPresContext* aPresConte nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableRowGroupFrame* cf = new nsTableRowGroupFrame(mContent, mIndexInParent, aParent); + nsTableRowGroupFrame* cf = new nsTableRowGroupFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); if (PR_TRUE==gsDebug1) printf("nsTableRowGroupFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf); aContinuingFrame = cf; @@ -939,14 +937,13 @@ NS_METHOD nsTableRowGroupFrame::CreateContinuingFrame(nsIPresContext* aPresConte nsresult nsTableRowGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableRowGroupFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableRowGroupFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/html/table/src/nsTableRowGroupFrame.h b/layout/html/table/src/nsTableRowGroupFrame.h index c341db18a060..f215d4ad2852 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.h +++ b/layout/html/table/src/nsTableRowGroupFrame.h @@ -43,14 +43,12 @@ public: /** instantiate a new instance of nsTableRowGroupFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -105,9 +103,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableRowGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableRowGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** protected destructor */ ~nsTableRowGroupFrame(); diff --git a/layout/html/tests/TestInlineFrame.cpp b/layout/html/tests/TestInlineFrame.cpp index 4ba324bf6b92..0cdb776ba76c 100644 --- a/layout/html/tests/TestInlineFrame.cpp +++ b/layout/html/tests/TestInlineFrame.cpp @@ -65,7 +65,6 @@ void MyDocument::LoadURL(nsIURL* aURL) class FixedSizeFrame : public nsSplittableFrame { public: FixedSizeFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); ReflowStatus ResizeReflow(nsIPresContext* aPresContext, @@ -83,7 +82,6 @@ public: PRBool aIsSplittable = PR_FALSE); nsIFrame* CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); // Accessors @@ -105,9 +103,8 @@ private: // FixedSizeFrame::FixedSizeFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsSplittableFrame(aContent, aIndexInParent, aParentFrame) + : nsSplittableFrame(aContent, aParentFrame) { } @@ -164,10 +161,9 @@ FixedSizeContent::FixedSizeContent(nscoord aWidth, } nsIFrame* FixedSizeContent::CreateFrame(nsIPresContext* aPresContext, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) { - return new FixedSizeFrame(this, aIndexInParent, aParentFrame); + return new FixedSizeFrame(this, aParentFrame); } // Change the width of the content triggering an incremental reflow @@ -193,7 +189,6 @@ class InlineFrame : public nsInlineFrame { public: InlineFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); // Accessors to return protected state @@ -207,9 +202,8 @@ public: }; InlineFrame::InlineFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) - : nsInlineFrame(aContent, aIndexInParent, aParent) + : nsInlineFrame(aContent, aParent) { } diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 4e614cda8f97..c05c1a1a9acc 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -44,9 +44,8 @@ static NS_DEFINE_IID(kStyleTextSID, NS_STYLETEXT_SID); /** */ nsTableCellFrame::nsTableCellFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { } @@ -180,7 +179,7 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - nsBodyFrame::NewFrame(&mFirstChild, mContent, mIndexInParent, this); + nsBodyFrame::NewFrame(&mFirstChild, mContent, this); mChildCount = 1; // Resolve style and set the style context @@ -339,7 +338,7 @@ NS_METHOD nsTableCellFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableCellFrame* cf = new nsTableCellFrame(mContent, mIndexInParent, aParent); + nsTableCellFrame* cf = new nsTableCellFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -491,14 +490,13 @@ NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) nsresult nsTableCellFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableCellFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableCellFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index ebeb5465e193..7679dc2f2722 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -33,7 +33,6 @@ class nsTableCellFrame : public nsContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -79,7 +78,6 @@ protected: * @see NewFrame */ nsTableCellFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame); /** Create a psuedo-frame for this caption. Handles continuing frames as needed. diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index f9bee13cc806..23fd2283b6c8 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -25,9 +25,8 @@ static PRBool gsDebug = PR_FALSE; nsTableColGroupFrame::nsTableColGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { } @@ -79,14 +78,13 @@ nsTableColGroupFrame::IncrementalReflow(nsIPresContext* aPresContext, nsresult nsTableColGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableColGroupFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableColGroupFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index e2a93f7a00b1..44762ddc912f 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -33,7 +33,6 @@ class nsTableColGroupFrame : public nsContainerFrame public: static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); NS_IMETHOD Paint(nsIPresContext& aPresContext, @@ -54,9 +53,7 @@ public: protected: - nsTableColGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableColGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); ~nsTableColGroupFrame(); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 1b7886f25220..ed652616bd94 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -142,10 +142,8 @@ struct InnerTableReflowState { /* ----------- nsTableFrame ---------- */ -nsTableFrame::nsTableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), +nsTableFrame::nsTableFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame), mColumnLayoutData(nsnull), mColumnWidths(nsnull), mTableLayoutStrategy(nsnull), @@ -639,7 +637,7 @@ nsIFrame::ReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresCont { nsIContentDelegate* kidDel; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, contentOffset, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } @@ -1105,7 +1103,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -1414,7 +1412,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext, kidStyleContext); } else { @@ -2045,7 +2043,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableFrame* cf = new nsTableFrame(mContent, mIndexInParent, aParent); + nsTableFrame* cf = new nsTableFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); if (PR_TRUE==gsDebug) printf("nsTableFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf); // set my width, because all frames in a table flow are the same width @@ -2076,7 +2074,7 @@ NS_METHOD nsTableFrame::CreateContinuingFrame(nsIPresContext* aPresContext, aPresContext->ResolveStyleContextFor(content, cf); // kidStyleContext: REFCNT++ nsIContentDelegate* kidDel = nsnull; kidDel = content->GetDelegate(aPresContext); // kidDel: REFCNT++ - nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, index, cf); + nsIFrame * duplicateFrame = kidDel->CreateFrame(aPresContext, content, cf); NS_RELEASE(kidDel); // kidDel: REFCNT-- duplicateFrame->SetStyleContext(aPresContext,kidStyleContext); NS_RELEASE(kidStyleContext); // kidStyleContenxt: REFCNT-- @@ -2161,14 +2159,13 @@ NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext* aPresContext) nsresult nsTableFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index c89d89425a80..62ce24bb1a9f 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -50,14 +50,12 @@ public: /** instantiate a new instance of nsTableFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -173,9 +171,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** destructor, responsible for mColumnLayoutData and mColumnWidths */ virtual ~nsTableFrame(); diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 2cc16d278078..3105384a3071 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -101,10 +101,8 @@ struct OuterTableReflowState { /** */ -nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), +nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame), mInnerTableFrame(nsnull), mCaptionFrames(nsnull), mBottomCaptions(nsnull), @@ -939,7 +937,7 @@ nsTableOuterFrame::ReflowChild( nsIFrame* aKidFrame, void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) { nsIFrame *prevKidFrame = nsnull; - nsresult frameCreated = nsTableFrame::NewFrame((nsIFrame **)(&mInnerTableFrame), mContent, 0, this); + nsresult frameCreated = nsTableFrame::NewFrame((nsIFrame **)(&mInnerTableFrame), mContent, this); if (NS_OK!=frameCreated) return; // SEC: an error!!!! // Resolve style @@ -966,7 +964,7 @@ void nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext) if (contentType==nsITableContent::kTableCaptionType) { nsIFrame *captionFrame=nsnull; - frameCreated = nsTableCaptionFrame::NewFrame(&captionFrame, caption, 0, this); + frameCreated = nsTableCaptionFrame::NewFrame(&captionFrame, caption, this); if (NS_OK!=frameCreated) return; // SEC: an error!!!! // Resolve style @@ -1084,7 +1082,7 @@ nsTableOuterFrame::ResizeReflowTopCaptionsPass2(nsIPresContext* aPresContext, mInnerTableFrame->MoveTo(0, topCaptionY); PRInt32 captionIndexInParent; - captionFrame->GetIndexInParent(captionIndexInParent); + captionFrame->GetContentIndex(captionIndexInParent); if (0==captionIndexInParent) { SetFirstContentOffset(captionFrame); @@ -1208,7 +1206,7 @@ NS_METHOD nsTableOuterFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableOuterFrame* cf = new nsTableOuterFrame(mContent, mIndexInParent, aParent); + nsTableOuterFrame* cf = new nsTableOuterFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); cf->SetFirstPassValid(PR_TRUE); if (PR_TRUE==gsDebug) @@ -1358,7 +1356,7 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext) // Do we have a prev-in-flow? if (nsnull == mPrevInFlow) { // No, create a column pseudo frame - mInnerTableFrame = new nsTableFrame(mContent, mIndexInParent, this); + mInnerTableFrame = new nsTableFrame(mContent, this); mChildCount++; // Resolve style and set the style context @@ -1387,14 +1385,13 @@ void nsTableOuterFrame::CreateInnerTableFrame(nsIPresContext* aPresContext) nsresult nsTableOuterFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableOuterFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableOuterFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index b53523daabc8..08d0c7ea89b5 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -45,14 +45,12 @@ public: /** instantiate a new instance of nsTableFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -110,9 +108,7 @@ protected: /** protected constructor * @see NewFrame */ - nsTableOuterFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** return PR_TRUE if the table needs to be reflowed. * the outer table needs to be reflowed if the table content has changed, diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 4c885604ae0f..23198d8279dd 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -87,9 +87,8 @@ struct RowReflowState { /* ----------- nsTableRowpFrame ---------- */ nsTableRowFrame::nsTableRowFrame(nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame), + : nsContainerFrame(aContent, aParentFrame), mTallestCell(0) { } @@ -444,7 +443,7 @@ PRBool nsTableRowFrame::ReflowMappedChildren(nsIPresContext* aPresContext, PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -809,7 +808,7 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = cell->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, cell, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, cell, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidStyleContext); } else { @@ -1036,7 +1035,7 @@ NS_METHOD nsTableRowFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsIFrame*& aContinuingFrame) { if (gsDebug1==PR_TRUE) printf("nsTableRowFrame::CreateContinuingFrame\n"); - nsTableRowFrame* cf = new nsTableRowFrame(mContent, mIndexInParent, aParent); + nsTableRowFrame* cf = new nsTableRowFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); aContinuingFrame = cf; return NS_OK; @@ -1044,14 +1043,13 @@ NS_METHOD nsTableRowFrame::CreateContinuingFrame(nsIPresContext* aPresContext, nsresult nsTableRowFrame::NewFrame( nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableRowFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableRowFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 141ef6a9a6d4..77578e710668 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -43,14 +43,12 @@ public: /** instantiate a new instance of nsTableRowFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -112,9 +110,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableRowFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableRowFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** destructor */ virtual ~nsTableRowFrame(); diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 4188aed37302..a92ca395f69a 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -88,10 +88,8 @@ struct RowGroupReflowState { /* ----------- nsTableRowGroupFrame ---------- */ -nsTableRowGroupFrame::nsTableRowGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame) - : nsContainerFrame(aContent, aIndexInParent, aParentFrame) +nsTableRowGroupFrame::nsTableRowGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame) + : nsContainerFrame(aContent, aParentFrame) { mType = aContent->GetTag(); // mType: REFCNT++ } @@ -411,7 +409,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon PRInt32 lastIndexInParent; LastChild(lastChild); - lastChild->GetIndexInParent(lastIndexInParent); + lastChild->GetContentIndex(lastIndexInParent); NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset"); #endif @@ -741,7 +739,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext, if (nsnull == kidPrevInFlow) { nsIContentDelegate* kidDel = nsnull; kidDel = kid->GetDelegate(aPresContext); - kidFrame = kidDel->CreateFrame(aPresContext, kid, kidIndex, this); + kidFrame = kidDel->CreateFrame(aPresContext, kid, this); NS_RELEASE(kidDel); kidFrame->SetStyleContext(aPresContext,kidSC); } else { @@ -928,7 +926,7 @@ NS_METHOD nsTableRowGroupFrame::CreateContinuingFrame(nsIPresContext* aPresConte nsIFrame* aParent, nsIFrame*& aContinuingFrame) { - nsTableRowGroupFrame* cf = new nsTableRowGroupFrame(mContent, mIndexInParent, aParent); + nsTableRowGroupFrame* cf = new nsTableRowGroupFrame(mContent, aParent); PrepareContinuingFrame(aPresContext, aParent, cf); if (PR_TRUE==gsDebug1) printf("nsTableRowGroupFrame::CCF parent = %p, this=%p, cf=%p\n", aParent, this, cf); aContinuingFrame = cf; @@ -939,14 +937,13 @@ NS_METHOD nsTableRowGroupFrame::CreateContinuingFrame(nsIPresContext* aPresConte nsresult nsTableRowGroupFrame::NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIFrame* it = new nsTableRowGroupFrame(aContent, aIndexInParent, aParent); + nsIFrame* it = new nsTableRowGroupFrame(aContent, aParent); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index c341db18a060..f215d4ad2852 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -43,14 +43,12 @@ public: /** instantiate a new instance of nsTableRowGroupFrame. * @param aInstancePtrResult the new object is returned in this out-param * @param aContent the table object to map - * @param aIndexInParent which child is the new frame? * @param aParent the parent of the new frame * * @return NS_OK if the frame was properly allocated, otherwise an error code */ static nsresult NewFrame(nsIFrame** aInstancePtrResult, nsIContent* aContent, - PRInt32 aIndexInParent, nsIFrame* aParent); /** @see nsIFrame::Paint */ @@ -105,9 +103,7 @@ protected: /** protected constructor. * @see NewFrame */ - nsTableRowGroupFrame(nsIContent* aContent, - PRInt32 aIndexInParent, - nsIFrame* aParentFrame); + nsTableRowGroupFrame(nsIContent* aContent, nsIFrame* aParentFrame); /** protected destructor */ ~nsTableRowGroupFrame();