From 5e4611081b7f1aa26ab65ffbde38c95932e495b1 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Thu, 24 Sep 1998 03:36:52 +0000 Subject: [PATCH] Removed mFirstContentOffset, LastContentOffset, and mLastContentIsComplete from nsContainerFrame --- layout/base/src/nsContainerFrame.cpp | 439 +----------------- layout/base/src/nsContainerFrame.h | 78 ---- layout/base/tests/TestContainerFrame.cpp | 0 layout/base/tests/makefile.win | 9 +- layout/generic/nsHTMLContainerFrame.cpp | 23 - layout/generic/nsInlineFrame.cpp | 8 - layout/html/base/src/nsBodyFrame.cpp | 57 +-- layout/html/base/src/nsBodyFrame.h | 15 +- layout/html/base/src/nsHTMLContainerFrame.cpp | 23 - layout/html/base/src/nsInlineFrame.cpp | 8 - layout/html/base/src/nsScrollFrame.cpp | 2 - layout/html/table/src/nsTableFrame.cpp | 7 +- .../html/table/src/nsTableRowGroupFrame.cpp | 29 +- layout/tables/nsTableFrame.cpp | 7 +- layout/tables/nsTableRowGroupFrame.cpp | 29 +- 15 files changed, 11 insertions(+), 723 deletions(-) delete mode 100644 layout/base/tests/TestContainerFrame.cpp diff --git a/layout/base/src/nsContainerFrame.cpp b/layout/base/src/nsContainerFrame.cpp index 8d0148851e8..a8f08979459 100644 --- a/layout/base/src/nsContainerFrame.cpp +++ b/layout/base/src/nsContainerFrame.cpp @@ -37,8 +37,7 @@ #endif nsContainerFrame::nsContainerFrame(nsIContent* aContent, nsIFrame* aParent) - : nsSplittableFrame(aContent, aParent), - mLastContentIsComplete(PR_TRUE) + : nsSplittableFrame(aContent, aParent) { } @@ -102,15 +101,6 @@ nsContainerFrame::PrepareContinuingFrame(nsIPresContext& aPresContext, { // Append the continuing frame to the flow aContFrame->AppendToFlow(this); - - // Initialize it's content offsets. Note that we assume for now that - // the continuingFrame will map the remainder of the content and - // that therefore mLastContentIsComplete will be true. - PRInt32 nextOffset = NextChildOffset(); - aContFrame->mFirstContentOffset = nextOffset; - aContFrame->mLastContentOffset = nextOffset; - aContFrame->mLastContentIsComplete = PR_TRUE; - aContFrame->SetStyleContext(&aPresContext, aStyleContext); } @@ -288,72 +278,6 @@ NS_METHOD nsContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext, return NS_OK; } -///////////////////////////////////////////////////////////////////////////// -// Managing content mapping - -// Get the offset for the next child content, i.e. the child after the -// last child that fit in us -PRInt32 nsContainerFrame::NextChildOffset() const -{ - PRInt32 result; - if (mChildCount > 0) { - result = mLastContentOffset; - if (mLastContentIsComplete) { - result++; - } - } - else { - result = mFirstContentOffset; - } - return result; -} - -/** - * Sets the first content offset based on the first child frame. - */ -void nsContainerFrame::SetFirstContentOffset(const nsIFrame* aFirstChild) -{ - NS_PRECONDITION(nsnull != aFirstChild, "bad argument"); - NS_PRECONDITION(IsChild(aFirstChild), "bad geometric parent"); - - if (ChildIsPseudoFrame(aFirstChild)) { - nsContainerFrame* pseudoFrame = (nsContainerFrame*)aFirstChild; - mFirstContentOffset = pseudoFrame->mFirstContentOffset; - } else { - // XXX TROY Change API to pass in content index if possible... - aFirstChild->GetContentIndex(mFirstContentOffset); - } -} - -/** - * Sets the last content offset based on the last child frame. If the last - * child is a pseudo frame then it sets mLastContentIsComplete to be the same - * as the last child's mLastContentIsComplete - */ -void nsContainerFrame::SetLastContentOffset(const nsIFrame* aLastChild) -{ - NS_PRECONDITION(nsnull != aLastChild, "bad argument"); - NS_PRECONDITION(IsChild(aLastChild), "bad geometric parent"); - - if (ChildIsPseudoFrame(aLastChild)) { - nsContainerFrame* pseudoFrame = (nsContainerFrame*)aLastChild; - mLastContentOffset = pseudoFrame->mLastContentOffset; -#ifdef NS_DEBUG - pseudoFrame->VerifyLastIsComplete(); -#endif - mLastContentIsComplete = pseudoFrame->mLastContentIsComplete; - } else { - // XXX TROY Change API to pass in content index if possible... - aLastChild->GetContentIndex(mLastContentOffset); - } -#ifdef NS_DEBUG - if (mLastContentOffset < mFirstContentOffset) { - DumpTree(); - } -#endif - NS_ASSERTION(mLastContentOffset >= mFirstContentOffset, "unexpected content mapping"); -} - ///////////////////////////////////////////////////////////////////////////// // Pseudo frame related @@ -487,16 +411,6 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* // Take the next-in-flow out of the parent's child list if (parent->mFirstChild == nextInFlow) { nextInFlow->GetNextSibling(parent->mFirstChild); - if (nsnull != parent->mFirstChild) { - parent->SetFirstContentOffset(parent->mFirstChild); - if (parent->IsPseudoFrame()) { - // Tell the parent's parent to update its content offsets - nsContainerFrame* pp = (nsContainerFrame*) parent->mGeometricParent; - pp->PropagateContentOffsets(parent, parent->mFirstContentOffset, - parent->mLastContentOffset, - parent->mLastContentIsComplete); - } - } // When a parent loses it's last child and that last child is a // pseudo-frame then the parent's content offsets are now wrong. @@ -538,33 +452,6 @@ void nsContainerFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow) { } -void -nsContainerFrame::PropagateContentOffsets(nsIFrame* aChild, - PRInt32 aFirstContentOffset, - PRInt32 aLastContentOffset, - PRBool aLastContentIsComplete) -{ - NS_PRECONDITION(ChildIsPseudoFrame(aChild), "not a pseudo frame"); - - // First update our offsets - if (mFirstChild == aChild) { - mFirstContentOffset = aFirstContentOffset; - } - nsIFrame* lastChild = LastFrame(mFirstChild); - if (lastChild == aChild) { - mLastContentOffset = aLastContentOffset; - mLastContentIsComplete = aLastContentIsComplete; - } - - // If we are a pseudo-frame then we need to update our parent - if (IsPseudoFrame()) { - nsContainerFrame* parent = (nsContainerFrame*) mGeometricParent; - parent->PropagateContentOffsets(this, mFirstContentOffset, - mLastContentOffset, - mLastContentIsComplete); - } -} - /** * Push aFromChild and its next siblings to the next-in-flow. Change the * geometric parent of each frame that's pushed. If there is no next-in-flow @@ -644,34 +531,8 @@ void nsContainerFrame::PushChildren(nsIFrame* aFromChild, // Prepend the frames to our next-in-flow's child list lastChild->SetNextSibling(nextInFlow->mFirstChild); nextInFlow->mFirstChild = aFromChild; - - // Update our next-in-flow's first content offset and child count - nextInFlow->SetFirstContentOffset(aFromChild); - if (0 == nextInFlow->mChildCount) { - nextInFlow->SetLastContentOffset(lastChild); - // If the child is pseudo-frame then SetLastContentOffset will - // have updated the next-in-flow's mLastContentIsComplete flag, - // otherwise we have to do it. - if (!nextInFlow->ChildIsPseudoFrame(lastChild)) { - nsIFrame* lastChildNextInFlow; - - lastChild->GetNextInFlow(lastChildNextInFlow); - nextInFlow->mLastContentIsComplete = (nsnull == lastChildNextInFlow); - } - } nextInFlow->mChildCount += numChildren; - // If the next-in-flow is being used as a pseudo frame then we need - // to propagate the content offsets upwards to its parent frame - if (nextInFlow->IsPseudoFrame()) { - nsContainerFrame* parent = (nsContainerFrame*) - nextInFlow->mGeometricParent; - parent->PropagateContentOffsets(nextInFlow, - nextInFlow->mFirstContentOffset, - nextInFlow->mLastContentOffset, - nextInFlow->mLastContentIsComplete); - } - #ifdef NOISY ListTag(stdout); printf(": push kids done (childCount=%d)\n", mChildCount); @@ -770,87 +631,6 @@ void nsContainerFrame::AppendChildren(nsIFrame* aChild, PRBool aSetParent) f->SetGeometricParent(this); } } - - // Update our content mapping - if (mFirstChild == aChild) { - SetFirstContentOffset(mFirstChild); - } - SetLastContentOffset(lastChild); - if (!ChildIsPseudoFrame(lastChild)) { - nsIFrame* nextInFlow; - - lastChild->GetNextInFlow(nextInFlow); - mLastContentIsComplete = (nsnull == nextInFlow); - } - -#ifdef NS_DEBUG - VerifyLastIsComplete(); -#endif -} - -/** - * Called after pulling-up children from the next-in-flow. Adjusts the first - * content offset of all the empty next-in-flows - * - * It's an error to call this function if all of the next-in-flow frames - * are empty. - * - * @return PR_TRUE if successful and PR_FALSE if all the next-in-flows are - * empty - */ -void nsContainerFrame::AdjustOffsetOfEmptyNextInFlows() -{ - // If the first next-in-flow is not empty then the caller drained - // more than one next-in-flow and then pushed back into it's - // immediate next-in-flow. - nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow; - PRInt32 nextOffset; - if ((nsnull != nextInFlow) && (nsnull != nextInFlow->mFirstChild)) { - // Use the offset from this frame's first next-in-flow (because - // it's not empty) to propagate into the next next-in-flow (and - // onward if necessary) - nextOffset = nextInFlow->NextChildOffset(); - - // Use next next-in-flow - nextInFlow = (nsContainerFrame*) nextInFlow->mNextInFlow; - - // When this happens, there *must* be a next next-in-flow and the - // next next-in-flow must be empty. - NS_ASSERTION(nsnull != nextInFlow, "bad adjust offsets"); - NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "bad adjust offsets"); - } else { - // Use our offset (since our next-in-flow is empty) to propagate - // into our empty next-in-flows - nextOffset = NextChildOffset(); - } - - while (nsnull != nextInFlow) { - if (nsnull == nextInFlow->mFirstChild) { - NS_ASSERTION(nextInFlow->IsEmpty(), "bad state"); - nextInFlow->mFirstContentOffset = nextOffset; - // If the next-in-flow is a pseudo-frame then we need to have it - // update it's parents offsets too. - if (nextInFlow->IsPseudoFrame()) { - nsContainerFrame* parent = (nsContainerFrame*) - nextInFlow->mGeometricParent; - parent->PropagateContentOffsets(nextInFlow, - nextInFlow->mFirstContentOffset, - nextInFlow->mLastContentOffset, - nextInFlow->mLastContentIsComplete); - } - } else { - // We found a non-empty frame. Verify that its first content offset - // is correct - NS_ASSERTION(nextInFlow->mFirstContentOffset == nextOffset, "bad first content offset"); - return; - } - - nextInFlow = (nsContainerFrame*)nextInFlow->mNextInFlow; - } - - // Make sure that all the next-in-flows weren't empty - NS_ASSERTION(nsnull != ((nsContainerFrame*)mNextInFlow)->mFirstChild, - "Every next-in-flow is empty!"); } ///////////////////////////////////////////////////////////////////////////// @@ -878,9 +658,6 @@ NS_METHOD nsContainerFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil fprintf(out, " [view=%p]", view); } - // Output the first/last content offset - fprintf(out, "[%d,%d,%c] ", mFirstContentOffset, mLastContentOffset, - (mLastContentIsComplete ? 'T' : 'F')); if (nsnull != mPrevInFlow) { fprintf(out, "prev-in-flow=%p ", mPrevInFlow); } @@ -952,73 +729,6 @@ NS_METHOD nsContainerFrame::VerifyTree() const } VERIFY_ASSERT(nsnull == mOverflowList, "bad overflow list"); - // Make sure our content offsets are sane - VERIFY_ASSERT(mFirstContentOffset <= mLastContentOffset, "bad offsets"); - - // Verify child content offsets and index-in-parents - PRInt32 offset = mFirstContentOffset; - nsIFrame* child = mFirstChild; - while (nsnull != child) { - // Make sure that the child's tree is valid - child->VerifyTree(); - - // Make sure child's index-in-parent is correct - if (ChildIsPseudoFrame(child)) { - nsContainerFrame* pseudo = (nsContainerFrame*) child; - if (pseudo == mFirstChild) { - VERIFY_ASSERT(pseudo->mFirstContentOffset == offset, - "bad pseudo first content offset"); - } - if (pseudo == lastChild) { - VERIFY_ASSERT(pseudo->mFirstContentOffset == offset, - "bad pseudo first content offset"); - VERIFY_ASSERT(pseudo->mLastContentOffset == mLastContentOffset, - "bad pseudo last content offset"); - VERIFY_ASSERT(pseudo->mLastContentIsComplete == mLastContentIsComplete, - "bad pseudo last content is complete"); - } - - offset = pseudo->mLastContentOffset; - if (pseudo->mLastContentIsComplete) { - offset++; - } - } else { - PRInt32 indexInParent; - - child->GetContentIndex(indexInParent); - VERIFY_ASSERT(offset == indexInParent, "bad child offset"); - - nsIFrame* nextInFlow; - child->GetNextInFlow(nextInFlow); - if (nsnull == nextInFlow) { - offset++; - } - } - - child->GetNextSibling(child); - } - - // Verify that our last content offset is correct - if (0 != mChildCount) { - if (mLastContentIsComplete) { - VERIFY_ASSERT(offset == mLastContentOffset + 1, "bad last offset"); - } else { - VERIFY_ASSERT(offset == mLastContentOffset, "bad last offset"); - } - } - - // Make sure that our flow blocks offsets are all correct - if (nsnull == mPrevInFlow) { - PRInt32 nextOffset = NextChildOffset(); - nsContainerFrame* nextInFlow = (nsContainerFrame*) mNextInFlow; - while (nsnull != nextInFlow) { - VERIFY_ASSERT(0 != nextInFlow->mChildCount, "empty next-in-flow"); - VERIFY_ASSERT(nextInFlow->GetFirstContentOffset() == nextOffset, - "bad next-in-flow first offset"); - nextOffset = nextInFlow->NextChildOffset(); - nextInFlow = (nsContainerFrame*) nextInFlow->mNextInFlow; - } - } #endif return NS_OK; } @@ -1069,19 +779,6 @@ PRBool nsContainerFrame::IsChild(const nsIFrame* aChild) const return PR_FALSE; } -// XXX Turn back on once all frame code has been changed to always add -// a child frame to the sibling list before reflowing the child. Right now -// that's not true for inline and column when reflowing unmapped children... -#if 0 - // Check that aChild is in our sibling list - PRInt32 index; - - IndexOf(aChild, index); - if (-1 == index) { - return PR_FALSE; - } -#endif - return PR_TRUE; } @@ -1117,46 +814,6 @@ void nsContainerFrame::DumpTree() const root->List(); } -void nsContainerFrame::CheckContentOffsets() -{ - NS_PRECONDITION(nsnull != mFirstChild, "null first child"); - - // Verify that our first content offset is correct - if (ChildIsPseudoFrame(mFirstChild)) { - nsContainerFrame* pseudoFrame = (nsContainerFrame*)mFirstChild; - - if (pseudoFrame->GetFirstContentOffset() != mFirstContentOffset) { - DumpTree(); - } - NS_ASSERTION(pseudoFrame->GetFirstContentOffset() == mFirstContentOffset, - "bad first content offset"); - } else { - PRInt32 indexInParent; - - mFirstChild->GetContentIndex(indexInParent); - if (indexInParent != mFirstContentOffset) { - DumpTree(); - } - - NS_ASSERTION(indexInParent == mFirstContentOffset, "bad first content offset"); - } - - // Verify that our last content offset is correct - nsIFrame* lastChild = LastFrame(mFirstChild); - if (ChildIsPseudoFrame(lastChild)) { - nsContainerFrame* pseudoFrame = (nsContainerFrame*)lastChild; - - NS_ASSERTION(pseudoFrame->GetLastContentOffset() == mLastContentOffset, - "bad last content offset"); - - } else { - PRInt32 indexInParent; - - lastChild->GetContentIndex(indexInParent); - NS_ASSERTION(indexInParent == mLastContentOffset, "bad last content offset"); - } -} - void nsContainerFrame::PreReflowCheck() { // XXX CONSTRUCTION @@ -1211,98 +868,4 @@ PRBool nsContainerFrame::IsEmpty() return PR_FALSE; } -void nsContainerFrame::CheckNextInFlowOffsets() -{ - // We have to be in a safe state before we can even consider - // checking our next-in-flows state. - if (!SafeToCheckLastContentOffset(this)) { - return; - } - - PRInt32 nextOffset = NextChildOffset(); - nsContainerFrame* nextInFlow = (nsContainerFrame*)mNextInFlow; - while (nsnull != nextInFlow) { - if (!SafeToCheckLastContentOffset(nextInFlow)) { - return; - } -#ifdef NS_DEBUG - if (nextInFlow->GetFirstContentOffset() != nextOffset) { - DumpTree(); - } -#endif - NS_ASSERTION(nextInFlow->GetFirstContentOffset() == nextOffset, - "bad next-in-flow first offset"); - // Verify the content offsets are in sync with the first/last child - nextInFlow->CheckContentOffsets(); - nextOffset = nextInFlow->NextChildOffset(); - - // Move to the next-in-flow - nextInFlow = (nsContainerFrame*)nextInFlow->mNextInFlow; - } -} - -PRBool -nsContainerFrame::SafeToCheckLastContentOffset(nsContainerFrame* aContainer) -{ - if (0 == aContainer->mChildCount) { - // We can't use the last content offset on an empty frame - return PR_FALSE; - } - - if (nsnull != aContainer->mOverflowList) { - // If a frame has an overflow list then it's last content offset - // cannot be used for assertion checks (because it's not done - // being reflowed). - return PR_FALSE; - } - - nsIFrame* lastChild = LastFrame(aContainer->mFirstChild); - if (aContainer->ChildIsPseudoFrame(lastChild)) { - // If the containers last child is a pseudo-frame then the - // containers last content offset is determined by the child. Ask - // the child if it's safe to use the last content offset. - return SafeToCheckLastContentOffset((nsContainerFrame*)lastChild); - } - - return PR_TRUE; -} - -void nsContainerFrame::VerifyLastIsComplete() const -{ - if (nsnull == mFirstChild) { - // If we have no children, our mLastContentIsComplete doesn't mean - // anything - return; - } - if (nsnull != mOverflowList) { - // If we can an overflow list then our mLastContentIsComplete and - // mLastContentOffset are un-verifyable because a reflow is in - // process. - return; - } - - nsIFrame* lastKid = LastFrame(mFirstChild); - if (ChildIsPseudoFrame(lastKid)) { - // When my last child is a pseudo-frame it means that our - // mLastContentIsComplete is a copy of it's. - nsContainerFrame* pseudoFrame = (nsContainerFrame*) lastKid; - NS_ASSERTION(mLastContentIsComplete == pseudoFrame->mLastContentIsComplete, - "bad mLastContentIsComplete"); - } else { - // If my last child has a next-in-flow then our - // mLastContentIsComplete must be false (because our last child is - // obviously not complete) - nsIFrame* lastKidNextInFlow; - - lastKid->GetNextInFlow(lastKidNextInFlow); - if (nsnull != lastKidNextInFlow) { - if (mLastContentIsComplete) { - DumpTree(); - } - NS_ASSERTION(mLastContentIsComplete == PR_FALSE, "bad mLastContentIsComplete"); - } else { - // We don't know what state our mLastContentIsComplete should be in. - } - } -} #endif diff --git a/layout/base/src/nsContainerFrame.h b/layout/base/src/nsContainerFrame.h index b125adc0bb4..f1dba6bfe17 100644 --- a/layout/base/src/nsContainerFrame.h +++ b/layout/base/src/nsContainerFrame.h @@ -138,25 +138,6 @@ public: // IndexOf() returns -1 if the frame is not in the child list. NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const; - // Access functions for starting and end content offsets. These reflect the - // range of content mapped by the frame. - // - // If the container is empty (has no children) the last content offset is - // undefined - PRInt32 GetFirstContentOffset() const {return mFirstContentOffset;} - void SetFirstContentOffset(PRInt32 aOffset) {mFirstContentOffset = aOffset;} - PRInt32 GetLastContentOffset() const {return mLastContentOffset;} - void SetLastContentOffset(PRInt32 aOffset) {mLastContentOffset = aOffset;} - - /** return PR_TRUE if the last mapped child is complete */ - PRBool GetLastContentIsComplete() const {return mLastContentIsComplete;} - /** set the state indicating whether the last mapped child is complete */ - void SetLastContentIsComplete(PRBool aLIC) {mLastContentIsComplete = aLIC;} - - // Get the offset for the next child content, i.e. the child after the - // last child that fit in us - PRInt32 NextChildOffset() const; - // Returns true if this frame is being used a pseudo frame PRBool IsPseudoFrame() const; @@ -165,20 +146,6 @@ public: NS_IMETHOD ListTag(FILE* out = stdout) const; NS_IMETHOD VerifyTree() const; - /** - * When aChild's content mapping offsets change and the child is a - * pseudo-frame (meaning that it is mapping content on the behalf of its - * geometric parent) then the geometric needs to have its content - * mapping offsets updated. This method is used to do just that. The - * object is responsible for updating its content mapping offsets and - * then if it is a pseudo-frame propogating the update upwards to its - * parent. - */ - virtual void PropagateContentOffsets(nsIFrame* aChild, - PRInt32 aFirstContentOffset, - PRInt32 aLastContentOffset, - PRBool aLastContentIsComplete); - /** * Return the number of children in the sibling list, starting at aChild. * Returns zero if aChild is nsnull. @@ -275,15 +242,6 @@ protected: void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling, PRBool aNextInFlowsLastChildIsComplete); - /** - * Called after pulling-up children from the next-in-flow. Adjusts the first - * content offset of all the empty next-in-flows - * - * It's an error to call this function if all of the next-in-flow frames - * are empty. - */ - void AdjustOffsetOfEmptyNextInFlows(); - /** * Append child list starting at aChild to this frame's child list. Used for * processing of the overflow list. @@ -330,48 +288,12 @@ protected: */ void PostReflowCheck(nsReflowStatus aStatus); - void CheckNextInFlowOffsets(); - PRBool IsEmpty(); - - PRBool SafeToCheckLastContentOffset(nsContainerFrame* nextInFlow); - - /** - * Verify that our mLastContentIsComplete flag is set correctly. - */ - void VerifyLastIsComplete() const; #endif nsIFrame* mFirstChild; PRInt32 mChildCount; - PRInt32 mFirstContentOffset; // index of first child we map - PRInt32 mLastContentOffset; // index of last child we map - PRBool mLastContentIsComplete; nsIFrame* mOverflowList; - -private: - /** - * Sets the first content offset based on the first child frame. - * @deprecated - */ - void SetFirstContentOffset(const nsIFrame* aFirstChild); - - /** - * Sets the last content offset based on the last child frame. If the last - * child is a pseudo frame then it sets mLastContentIsComplete to be the same - * as the last child's mLastContentIsComplete - * @deprecated - */ - void SetLastContentOffset(const nsIFrame* aLastChild); - -#ifdef NS_DEBUG - /** - * Helper function to verify that the first/last content offsets - * are correct. Note: this call will blow up if you have no - * children. - */ - void CheckContentOffsets(); -#endif }; #endif /* nsContainerFrame_h___ */ diff --git a/layout/base/tests/TestContainerFrame.cpp b/layout/base/tests/TestContainerFrame.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/layout/base/tests/makefile.win b/layout/base/tests/makefile.win index c42d394e885..1acdd2adde4 100644 --- a/layout/base/tests/makefile.win +++ b/layout/base/tests/makefile.win @@ -18,9 +18,8 @@ DEPTH=..\..\.. MAKE_OBJ_TYPE = EXE -PROG1 = .\$(OBJDIR)\TestContainerFrame.exe -PROG2 = .\$(OBJDIR)\TestSpaceManager.exe -PROGRAMS = $(PROG1) $(PROG2) +PROG1 = .\$(OBJDIR)\TestSpaceManager.exe +PROGRAMS = $(PROG1) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\src LLIBS= \ @@ -36,7 +35,6 @@ include <$(DEPTH)\layout\config\rules.mak> install:: $(PROGRAMS) $(MAKE_INSTALL) $(PROG1) $(DIST)\bin - $(MAKE_INSTALL) $(PROG2) $(DIST)\bin # Move this into config/obj.inc when it's allowed .cpp{.\$(OBJDIR)\}.exe: @@ -54,5 +52,4 @@ install:: $(PROGRAMS) $(CURDIR)$(*B).cpp <mLastContentIsComplete) { - nsIFrame* firstChild; - flow->FirstChild(firstChild); - nsIFrame* lastFrame = LastFrame(firstChild); - if (lastFrame == deadFrame) { - flow->mLastContentIsComplete = PR_TRUE; - } - } - // Remove frame from sibling list nsIFrame* nextSib; deadFrame->GetNextSibling(nextSib); @@ -230,7 +219,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, // removed from flow (because only the children that follow the // deletion need renumbering). flow->mChildCount--; - flow->mLastContentOffset--; // Break frame out of its flow and then destroy it nsIFrame* nextInFlow; @@ -250,17 +238,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, } } - // Repair any remaining next-in-flows content offsets; these are the - // next-in-flows the follow the last flow container that contained - // one of the deadFrame's. Therefore both content offsets need - // updating (because all the children are following the deletion). - flow = (nsHTMLContainerFrame*) flow->mNextInFlow; - while (nsnull != flow) { - flow->mFirstContentOffset--; - flow->mLastContentOffset--; - flow = (nsHTMLContainerFrame*) flow->mNextInFlow; - } - return rv; } diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index 27d27d93060..4d7110525b7 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -697,11 +697,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow, // Take the frame away from the next-in-flow. Update it's first // content offset. kidFrame->GetNextSibling(aNextInFlow->mFirstChild); - if (nsnull != aNextInFlow->mFirstChild) { - PRInt32 contentIndex; - aNextInFlow->mFirstChild->GetContentIndex(contentIndex); - aNextInFlow->SetFirstContentOffset(contentIndex); - } } // Now give the frame to this container @@ -715,9 +710,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow, // Add the frame on our list if (nsnull == aLastChild) { mFirstChild = kidFrame; - PRInt32 contentIndex; - kidFrame->GetContentIndex(contentIndex); - SetFirstContentOffset(contentIndex); } else { NS_ASSERTION(IsLastChild(aLastChild), "bad last child"); aLastChild->SetNextSibling(kidFrame); diff --git a/layout/html/base/src/nsBodyFrame.cpp b/layout/html/base/src/nsBodyFrame.cpp index e0d3003e113..5d7260bf727 100644 --- a/layout/html/base/src/nsBodyFrame.cpp +++ b/layout/html/base/src/nsBodyFrame.cpp @@ -340,22 +340,6 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext, return NS_OK; } -// XXX CONSTRUCTION -#if 0 -NS_METHOD nsBodyFrame::ContentInserted(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInParent) -{ - NS_ASSERTION(mContent == aContainer, "bad content-inserted target"); - - // Pass along the notification to our pseudo frame that maps all the content - return mFirstChild->ContentInserted(aShell, aPresContext, aContainer, - aChild, aIndexInParent); -} -#endif - NS_METHOD nsBodyFrame::ContentDeleted(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aContainer, @@ -602,30 +586,6 @@ void nsBodyFrame::AddFrame(nsIFrame* aFrame) mChildCount++; } -void -nsBodyFrame::PropagateContentOffsets(nsIFrame* aChild, - PRInt32 aFirstContentOffset, - PRInt32 aLastContentOffset, - PRBool aLastContentIsComplete) -{ - NS_PRECONDITION(ChildIsPseudoFrame(aChild), "not a pseudo frame"); - - // First update our offsets - if (mFirstChild == aChild) { - mFirstContentOffset = aFirstContentOffset; - mLastContentOffset = aLastContentOffset; - mLastContentIsComplete = aLastContentIsComplete; - } - - // If we are a pseudo-frame then we need to update our parent - if (IsPseudoFrame()) { - nsContainerFrame* parent = (nsContainerFrame*) mGeometricParent; - parent->PropagateContentOffsets(this, mFirstContentOffset, - mLastContentOffset, - mLastContentIsComplete); - } -} - ///////////////////////////////////////////////////////////////////////////// // Event handling @@ -1062,10 +1022,7 @@ NS_METHOD nsBodyFrame::VerifyTree() const } NS_ASSERTION(nsnull == mOverflowList, "bad overflow list"); - // Make sure our content offsets are sane - NS_ASSERTION(mFirstContentOffset <= mLastContentOffset, "bad offsets"); - - // Verify child content offsets + // Verify the child's tree is valid nsIFrame* child = mFirstChild; while (nsnull != child) { // Make sure that the child's tree is valid @@ -1073,18 +1030,6 @@ NS_METHOD nsBodyFrame::VerifyTree() const child->GetNextSibling(child); } - // Make sure that our flow blocks offsets are all correct - if (nsnull == mPrevInFlow) { - PRInt32 nextOffset = NextChildOffset(); - nsBodyFrame* nextInFlow = (nsBodyFrame*) mNextInFlow; - while (nsnull != nextInFlow) { - NS_ASSERTION(0 != nextInFlow->mChildCount, "empty next-in-flow"); - NS_ASSERTION(nextInFlow->GetFirstContentOffset() == nextOffset, - "bad next-in-flow first offset"); - nextOffset = nextInFlow->NextChildOffset(); - nextInFlow = (nsBodyFrame*) nextInFlow->mNextInFlow; - } - } #endif return NS_OK; } diff --git a/layout/html/base/src/nsBodyFrame.h b/layout/html/base/src/nsBodyFrame.h index a9909e0eb11..aa5b42b5c4a 100644 --- a/layout/html/base/src/nsBodyFrame.h +++ b/layout/html/base/src/nsBodyFrame.h @@ -45,19 +45,6 @@ public: const nsReflowState& aReflowState, nsReflowStatus& aStatus); -// XXX CONSTRUCTION -#if 0 - NS_IMETHOD ContentAppended(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer); - - NS_IMETHOD ContentInserted(nsIPresShell* aShell, - nsIPresContext* aPresContext, - nsIContent* aContainer, - nsIContent* aChild, - PRInt32 aIndexInParent); -#endif - NS_IMETHOD ContentDeleted(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aContainer, @@ -92,11 +79,13 @@ public: NS_IMETHOD VerifyTree() const; +#if 0 // nsContainerFrame virtual void PropagateContentOffsets(nsIFrame* aChild, PRInt32 aFirstContentOffset, PRInt32 aLastContentOffset, PRBool aLastContentIsComplete); +#endif protected: PRBool mIsPseudoFrame; diff --git a/layout/html/base/src/nsHTMLContainerFrame.cpp b/layout/html/base/src/nsHTMLContainerFrame.cpp index 01b76bee718..3acc977279b 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -204,17 +204,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, // Take the frame away; Note that we also have to take away any // continuations so we loop here until deadFrame is nsnull. while (nsnull != deadFrame) { - // If the last frame for the flow is the frame we are deleting - // then the flow will become complete. - if (!flow->mLastContentIsComplete) { - nsIFrame* firstChild; - flow->FirstChild(firstChild); - nsIFrame* lastFrame = LastFrame(firstChild); - if (lastFrame == deadFrame) { - flow->mLastContentIsComplete = PR_TRUE; - } - } - // Remove frame from sibling list nsIFrame* nextSib; deadFrame->GetNextSibling(nextSib); @@ -230,7 +219,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, // removed from flow (because only the children that follow the // deletion need renumbering). flow->mChildCount--; - flow->mLastContentOffset--; // Break frame out of its flow and then destroy it nsIFrame* nextInFlow; @@ -250,17 +238,6 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, } } - // Repair any remaining next-in-flows content offsets; these are the - // next-in-flows the follow the last flow container that contained - // one of the deadFrame's. Therefore both content offsets need - // updating (because all the children are following the deletion). - flow = (nsHTMLContainerFrame*) flow->mNextInFlow; - while (nsnull != flow) { - flow->mFirstContentOffset--; - flow->mLastContentOffset--; - flow = (nsHTMLContainerFrame*) flow->mNextInFlow; - } - return rv; } diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index 27d27d93060..4d7110525b7 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -697,11 +697,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow, // Take the frame away from the next-in-flow. Update it's first // content offset. kidFrame->GetNextSibling(aNextInFlow->mFirstChild); - if (nsnull != aNextInFlow->mFirstChild) { - PRInt32 contentIndex; - aNextInFlow->mFirstChild->GetContentIndex(contentIndex); - aNextInFlow->SetFirstContentOffset(contentIndex); - } } // Now give the frame to this container @@ -715,9 +710,6 @@ nsInlineFrame::PullOneChild(nsInlineFrame* aNextInFlow, // Add the frame on our list if (nsnull == aLastChild) { mFirstChild = kidFrame; - PRInt32 contentIndex; - kidFrame->GetContentIndex(contentIndex); - SetFirstContentOffset(contentIndex); } else { NS_ASSERTION(IsLastChild(aLastChild), "bad last child"); aLastChild->SetNextSibling(kidFrame); diff --git a/layout/html/base/src/nsScrollFrame.cpp b/layout/html/base/src/nsScrollFrame.cpp index fa7a649867b..48edaab8a07 100644 --- a/layout/html/base/src/nsScrollFrame.cpp +++ b/layout/html/base/src/nsScrollFrame.cpp @@ -62,7 +62,6 @@ nsScrollBodyFrame::CreateFirstChild(nsIPresContext* aPresContext) // Yes. Create the first page frame mFirstChild = new nsPageFrame(mContent, this);/* XXX mContent won't work here */ mChildCount = 1; - mLastContentOffset = mFirstContentOffset; } else { if (nsnull != mContent) { #if 0 @@ -83,7 +82,6 @@ nsScrollBodyFrame::CreateFirstChild(nsIPresContext* aPresContext) #else nsBodyFrame::NewFrame(&mFirstChild, mContent, this); mChildCount = 1; - mLastContentOffset = mFirstContentOffset; #endif } } diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index ebd7b7e5191..2fdc597dc8e 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -1778,12 +1778,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext, // Any space left? PRInt32 numKids; mContent->ChildCount(numKids); - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < numKids) { - status = NS_FRAME_NOT_COMPLETE; - } - } else if (NextChildOffset() < numKids) { + if (state.availSize.height > 0) { // Try and pull-up some children from a next-in-flow if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { // We were unable to pull-up all the existing frames from the diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 3be083acece..4e76e66ed3f 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -528,28 +528,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext, NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child"); } - // We need to make sure the first content offset is correct for any empty - // next-in-flow frames (frames where we pulled up all the child frames) - nextInFlow = (nsTableRowGroupFrame*)mNextInFlow; - if ((nsnull != nextInFlow) && (nsnull == nextInFlow->mFirstChild)) { - // We have at least one empty frame. Did we succesfully pull up all the - // child frames? - if (PR_FALSE == result) { - // No, so we need to adjust the first content offset of all the empty - // frames - AdjustOffsetOfEmptyNextInFlows(); -#ifdef NS_DEBUG - } else { - // Yes, we successfully pulled up all the child frames which means all - // the next-in-flows must be empty. Do a sanity check - while (nsnull != nextInFlow) { - NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "non-empty next-in-flow"); - nextInFlow->GetNextInFlow((nsIFrame*&)nextInFlow); - } -#endif - } - } - return result; } @@ -836,12 +814,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, // Any space left? PRInt32 numKids; mContent->ChildCount(numKids); - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < numKids) { - aStatus = NS_FRAME_NOT_COMPLETE; - } - } else if (NextChildOffset() < numKids) { + if (state.availSize.height > 0) { // Try and pull-up some children from a next-in-flow if (!PullUpChildren(&aPresContext, state, aDesiredSize.maxElementSize)) { // We were unable to pull-up all the existing frames from the diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index ebd7b7e5191..2fdc597dc8e 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1778,12 +1778,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext, // Any space left? PRInt32 numKids; mContent->ChildCount(numKids); - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < numKids) { - status = NS_FRAME_NOT_COMPLETE; - } - } else if (NextChildOffset() < numKids) { + if (state.availSize.height > 0) { // Try and pull-up some children from a next-in-flow if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) { // We were unable to pull-up all the existing frames from the diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 3be083acece..4e76e66ed3f 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -528,28 +528,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext, NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child"); } - // We need to make sure the first content offset is correct for any empty - // next-in-flow frames (frames where we pulled up all the child frames) - nextInFlow = (nsTableRowGroupFrame*)mNextInFlow; - if ((nsnull != nextInFlow) && (nsnull == nextInFlow->mFirstChild)) { - // We have at least one empty frame. Did we succesfully pull up all the - // child frames? - if (PR_FALSE == result) { - // No, so we need to adjust the first content offset of all the empty - // frames - AdjustOffsetOfEmptyNextInFlows(); -#ifdef NS_DEBUG - } else { - // Yes, we successfully pulled up all the child frames which means all - // the next-in-flows must be empty. Do a sanity check - while (nsnull != nextInFlow) { - NS_ASSERTION(nsnull == nextInFlow->mFirstChild, "non-empty next-in-flow"); - nextInFlow->GetNextInFlow((nsIFrame*&)nextInFlow); - } -#endif - } - } - return result; } @@ -836,12 +814,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext, // Any space left? PRInt32 numKids; mContent->ChildCount(numKids); - if (state.availSize.height <= 0) { - // No space left. Don't try to pull-up children or reflow unmapped - if (NextChildOffset() < numKids) { - aStatus = NS_FRAME_NOT_COMPLETE; - } - } else if (NextChildOffset() < numKids) { + if (state.availSize.height > 0) { // Try and pull-up some children from a next-in-flow if (!PullUpChildren(&aPresContext, state, aDesiredSize.maxElementSize)) { // We were unable to pull-up all the existing frames from the