Removed all references to m<First,Last>ContentOffset,mChildCount,mLastContentIsComplete

This commit is contained in:
troy%netscape.com 1998-09-21 03:40:32 +00:00
Родитель b547115229
Коммит 0f842c0152
12 изменённых файлов: 34 добавлений и 872 удалений

Просмотреть файл

@ -77,7 +77,6 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
// Create body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild);
mChildCount = 1;
// Resolve style and set the style context
nsIStyleContext* styleContext =
@ -194,7 +193,6 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
if (nsnull == mPrevInFlow) {
// No, create a body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild);
mChildCount = 1;
// Resolve style and set the style context
nsIStyleContext* styleContext =
@ -212,7 +210,6 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
prevPseudoFrame->GetStyleContext(aPresContext, kidSC);
prevPseudoFrame->CreateContinuingFrame(*aPresContext, this, kidSC, mFirstChild);
NS_RELEASE(kidSC);
mChildCount = 1;
}
}
@ -295,8 +292,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
printf("%p nsTableCellFrame::Reflow: maxSize=%d,%d\n",
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
mFirstContentOffset = mLastContentOffset = 0;
nsSize availSize(aReflowState.maxSize);
nsSize maxElementSize;
nsSize *pMaxElementSize = aDesiredSize.maxElementSize;
@ -323,8 +318,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
nsTableFrame* tableFrame = GetTableFrame();
tableFrame->GetCellMarginData(this,margin);
mLastContentIsComplete = PR_TRUE;
// get frame, creating one if needed
if (nsnull==mFirstChild)
{
@ -378,10 +371,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
this, kidSize.width, kidSize.height);
}
// Set our last content offset based on the pseudo-frame
nsBodyFrame* bodyPseudoFrame = (nsBodyFrame*)mFirstChild;
mLastContentOffset = bodyPseudoFrame->GetLastContentOffset();
// Place the child
//////////////////////////////// HACK //////////////////////////////
kidSize.width = PR_MIN(kidSize.width, availSize.width);
@ -389,12 +378,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
mFirstChild->SetRect(nsRect(leftInset, topInset,
kidSize.width, kidSize.height));
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
}
// Return our size and our result
// first, compute the height
@ -1126,7 +1109,7 @@ NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {
@ -1201,7 +1184,7 @@ void nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -90,7 +90,6 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC
} else {
lastChild->SetNextSibling(aChildList);
}
mChildCount += LengthOf(aChildList);
return NS_OK;
}
@ -312,7 +311,7 @@ NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -289,7 +289,6 @@ NS_IMETHODIMP
nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
return NS_OK;
}
@ -685,7 +684,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
}
lastColGroupFrame->SetNextSibling(firstRowGroupFrame);
}
mChildCount++;
}
else
{
@ -784,7 +782,6 @@ void nsTableFrame::EnsureColumnFrameAt(PRInt32 aColIndex,
}
lastColGroupFrame->SetNextSibling(firstRowGroupFrame);
}
mChildCount++;
}
else
{
@ -1615,9 +1612,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
nsReflowStatus result = NS_FRAME_COMPLETE;
mChildCount = 0;
mFirstContentOffset = mLastContentOffset = 0;
nsSize availSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); // availSize is the space available at any given time in the process
nsSize maxSize(0, 0); // maxSize is the size of the largest child so far in the process
nsSize kidMaxSize(0,0);
@ -1674,15 +1668,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
break;
}
}
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
}
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
// Recalculate Layout Dependencies
@ -1690,9 +1678,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "unexpected last child");
// can't use SetLastContentOffset here
mLastContentOffset = contentOffset-1; // takes into account colGroup frame we're not using
if (gsDebug) printf("INNER: set last content offset to %d\n", GetLastContentOffset()); //@@@
}
aDesiredSize.width = kidSize.width;
@ -1928,37 +1913,10 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
InnerTableReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
NS_PRECONDITION(nsnull != mFirstChild, "no children");
PRInt32 childCount = 0;
nsIFrame* prevKidFrame = nsnull;
mLastContentOffset = 0;
// Remember our original mLastContentIsComplete so that if we end up
// having to push children, we have the correct value to hand to
// PushChildren.
PRBool originalLastContentIsComplete = mLastContentIsComplete;
nsSize kidMaxElementSize(0,0);
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
PRBool result = PR_TRUE;
@ -2004,15 +1962,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
{
// The child is too wide to fit in the available space, and it's
// not our first child
// Since we are giving the next-in-flow our last child, we
// give it our original mLastContentIsComplete too (in case we
// are pushing into an empty next-in-flow)
PushChildren(kidFrame, prevKidFrame, originalLastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(kidFrame, prevKidFrame, PR_TRUE);
result = PR_FALSE;
break;
}
@ -2038,20 +1988,15 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
}
}
childCount++;
kidFrame->GetContentIndex(mLastContentOffset);
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
// Update mLastContentIsComplete now that this kid fits
mLastContentIsComplete = PRBool(NS_FRAME_IS_COMPLETE(status));
// Special handling for incomplete children
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
kidFrame->GetNextInFlow(kidNextInFlow);
PRBool lastContentIsComplete = mLastContentIsComplete;
if (nsnull == kidNextInFlow) {
// The child doesn't have a next-in-flow so create a continuing
// frame. This hooks the child into the flow
@ -2069,12 +2014,6 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
kidFrame->GetNextSibling(nextSib);
continuingFrame->SetNextSibling(nextSib);
kidFrame->SetNextSibling(continuingFrame);
if (nsnull == nextSib) {
// Assume that the continuation frame we just created is
// complete, for now. It will get reflowed by our
// next-in-flow (we are going to push it now)
lastContentIsComplete = PR_TRUE;
}
}
// We've used up all of our available space so push the remaining
// children to the next-in-flow
@ -2082,10 +2021,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
kidFrame->GetNextSibling(nextSibling);
if (nsnull != nextSibling) {
PushChildren(nextSibling, kidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(nextSibling, kidFrame, PR_TRUE);
}
result = PR_FALSE;
break;
@ -2099,39 +2035,6 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
}
// Update the child count
mChildCount = childCount;
#ifdef NS_DEBUG
NS_POSTCONDITION(LengthOf(mFirstChild) == mChildCount, "bad child count");
nsIFrame* lastChild = LastFrame(mFirstChild);
PRInt32 lastIndexInParent;
lastChild->GetContentIndex(lastIndexInParent);
NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset");
#endif
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -2147,43 +2050,11 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
InnerTableReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
nsTableFrame* nextInFlow = (nsTableFrame*)mNextInFlow;
nsTableFrame* nextInFlow = (nsTableFrame*)mNextInFlow;
nsSize kidMaxElementSize(0,0);
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
#ifdef NS_DEBUG
PRInt32 kidIndex = NextChildOffset();
#endif
nsIFrame* prevKidFrame = LastFrame(mFirstChild);
// This will hold the prevKidFrame's mLastContentIsComplete
// status. If we have to push the frame that follows prevKidFrame
// then this will become our mLastContentIsComplete state. Since
// prevKidFrame is initially our last frame, it's completion status
// is our mLastContentIsComplete value.
PRBool prevLastContentIsComplete = mLastContentIsComplete;
PRBool result = PR_TRUE;
PRBool result = PR_TRUE;
while (nsnull != nextInFlow) {
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -2219,7 +2090,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
if ((kidFrameSize.height > aState.availSize.height) &&
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
@ -2232,7 +2102,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
@ -2257,13 +2126,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
nextInFlow->mChildCount--;
// Update the next-in-flows first content offset
if (nsnull != nextInFlow->mFirstChild) {
PRInt32 contentIndex;
nextInFlow->mFirstChild->GetContentIndex(contentIndex);
nextInFlow->SetFirstContentOffset(contentIndex);
}
// Link the frame into our list of children
kidFrame->SetGeometricParent(this);
@ -2275,21 +2137,13 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
}
if (nsnull == prevKidFrame) {
mFirstChild = kidFrame;
PRInt32 contentIndex;
kidFrame->GetContentIndex(contentIndex);
SetFirstContentOffset(contentIndex);
} else {
prevKidFrame->SetNextSibling(kidFrame);
}
kidFrame->SetNextSibling(nsnull);
mChildCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
prevLastContentIsComplete = mLastContentIsComplete;
// Is the child we just pulled up complete?
mLastContentIsComplete = PRBool(NS_FRAME_IS_COMPLETE(status));
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
// No the child isn't complete
nsIFrame* kidNextInFlow;
@ -2311,16 +2165,10 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// it to the next-in-flow. This ensures the next-in-flow's
// content offsets and child count are set properly. Note that
// we can safely assume that the continuation is complete so
// we pass PR_TRUE into PushChidren in case our next-in-flow
// was just drained and now needs to know it's
// mLastContentIsComplete state.
// we pass PR_TRUE into PushChidren
kidFrame->SetNextSibling(continuingFrame);
PushChildren(continuingFrame, kidFrame, PR_TRUE);
// After we push the continuation frame we don't need to fuss
// with mLastContentIsComplete beause the continuation frame
// is no longer on *our* list.
}
// If the child isn't complete then it means that we've used up
@ -2330,39 +2178,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
}
}
// Update our last content offset
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
}
// 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 = (nsTableFrame*)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
}
}
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
return result;
}
@ -3389,7 +3204,7 @@ NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
}
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -107,12 +107,10 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram
NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
NS_ASSERTION(mChildCount > 0, "bad child list");
// Set our internal member data
mInnerTableFrame = (nsTableFrame*)mFirstChild;
if (2 == mChildCount) {
if (2 == LengthOf(mFirstChild)) {
mFirstChild->GetNextSibling(mCaptionFrame);
}
@ -616,7 +614,6 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
// Add it to the list of child frames
mFirstChild = mInnerTableFrame;
mChildCount++;
// Now create the caption frame, prepending a top caption and appending a
// bottom caption
@ -666,7 +663,6 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
mCaptionFrame->SetNextSibling(mFirstChild);
mFirstChild = mCaptionFrame;
}
mChildCount++;
break;
}
}
@ -700,23 +696,6 @@ nsTableOuterFrame::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;
if (mChildCount > 0) {
nextOffset = mLastContentOffset;
if (mLastContentIsComplete) {
nextOffset++;
}
} else {
nextOffset = mFirstContentOffset;
}
aContFrame->SetFirstContentOffset(nextOffset);
aContFrame->SetLastContentOffset(nextOffset);
aContFrame->SetLastContentIsComplete(PR_TRUE);
aContFrame->SetStyleContext(&aPresContext, aStyleContext);
}
@ -781,26 +760,6 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, n
// Take the next-in-flow out of the parent's child list
if (parent->mFirstChild == nextInFlow) {
nextInFlow->GetNextSibling(parent->mFirstChild);
if (nsnull != parent->mFirstChild) {
PRInt32 contentIndex;
parent->mFirstChild->GetContentIndex(contentIndex);
parent->SetFirstContentOffset(contentIndex);
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.
// However, we know that the parent will eventually be reflowed
// in one of two ways: it will either get a chance to pullup
// children or it will be deleted because it's prev-in-flow
// (e.g. this) is complete. In either case, the content offsets
// will be repaired.
} else {
nsIFrame* nextSibling;
@ -820,7 +779,6 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, n
// Delete the next-in-flow frame and adjust it's parent's child count
nextInFlow->DeleteFrame(aPresContext);
parent->mChildCount--;
#ifdef NS_DEBUG
aChild->GetNextInFlow(nextInFlow);
@ -918,7 +876,7 @@ NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFi
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -100,7 +100,6 @@ NS_IMETHODIMP
nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
return NS_OK;
}
@ -1027,7 +1026,7 @@ NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -130,14 +130,6 @@ NS_IMETHODIMP
nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
// XXX TEMP CODE UNTIL nsContainerFrame GOES AWAY...
nsIFrame* lastChild = LastFrame(mFirstChild);
if (nsnull != lastChild) {
lastChild->GetContentIndex(mLastContentOffset);
}
return NS_OK;
}
@ -268,36 +260,8 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
RowGroupReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
NS_PRECONDITION(nsnull != mFirstChild, "no children");
PRInt32 childCount = 0;
nsIFrame* prevKidFrame = nsnull;
// Remember our original mLastContentIsComplete so that if we end up
// having to push children, we have the correct value to hand to
// PushChildren.
PRBool lastContentIsComplete = mLastContentIsComplete;
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
PRBool result = PR_TRUE;
@ -354,17 +318,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
//
// Note that if the width is too big that's okay and we allow the
// child to extend horizontally outside of the reflow area
// Since we are giving the next-in-flow our last child, we
// give it our original mLastContentIsComplete, too (in case we
// are pushing into an empty next-in-flow)
PushChildren(kidFrame, prevKidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
// Our mLastContentIsComplete was already set by the last kid we
// reflowed reflow's status
PushChildren(kidFrame, prevKidFrame, PR_TRUE);
result = PR_FALSE;
break;
}
@ -378,14 +332,10 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
} else {
aState.prevMaxPosBottomMargin = bottomMargin;
}
childCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
// Update mLastContentIsComplete now that this kid fits
mLastContentIsComplete = NS_FRAME_IS_COMPLETE(status);
/* Row groups should not create continuing frames for rows
* unless they absolutely have to!
* check to see if this is absolutely necessary (with new params from troy)
@ -398,7 +348,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
nsIFrame* kidNextInFlow;
kidFrame->GetNextInFlow(kidNextInFlow);
PRBool lastContentIsComplete = mLastContentIsComplete;
if (nsnull == kidNextInFlow) {
// No the child isn't complete, and it doesn't have a next in flow so
// create a continuing frame. This hooks the child into the flow.
@ -415,12 +364,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
kidFrame->GetNextSibling(nextSib);
continuingFrame->SetNextSibling(nextSib);
kidFrame->SetNextSibling(continuingFrame);
if (nsnull == nextSib) {
// Assume that the continuation frame we just created is
// complete, for now. It will get reflowed by our
// next-in-flow (we are going to push it now)
lastContentIsComplete = PR_TRUE;
}
}
// We've used up all of our available space so push the remaining
// children to the next-in-flow
@ -428,10 +371,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
kidFrame->GetNextSibling(nextSibling);
if (nsnull != nextSibling) {
PushChildren(nextSibling, kidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(nextSibling, kidFrame, PR_TRUE);
}
result = PR_FALSE;
break;
@ -449,40 +389,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
}
// Update the child count
mChildCount = childCount;
#ifdef NS_DEBUG
NS_POSTCONDITION(LengthOf(mFirstChild) == mChildCount, "bad child count");
nsIFrame* lastChild = LastFrame(mFirstChild);
PRInt32 lastIndexInParent;
lastChild->GetContentIndex(lastIndexInParent);
NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset");
#endif
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -498,43 +404,11 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
RowGroupReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
nsTableRowGroupFrame* nextInFlow = (nsTableRowGroupFrame*)mNextInFlow;
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
#ifdef NS_DEBUG
PRInt32 kidIndex = NextChildOffset();
#endif
nsIFrame* prevKidFrame = LastFrame(mFirstChild);
// This will hold the prevKidFrame's mLastContentIsComplete
// status. If we have to push the frame that follows prevKidFrame
// then this will become our mLastContentIsComplete state. Since
// prevKidFrame is initially our last frame, it's completion status
// is our mLastContentIsComplete value.
PRBool prevLastContentIsComplete = mLastContentIsComplete;
PRBool result = PR_TRUE;
PRBool result = PR_TRUE;
while (nsnull != nextInFlow) {
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -571,7 +445,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
if ((kidFrameSize.height > aState.availSize.height) &&
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
@ -584,7 +457,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
@ -597,13 +469,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
nextInFlow->mChildCount--;
// Update the next-in-flows first content offset
if (nsnull != nextInFlow->mFirstChild) {
PRInt32 contentIndex;
nextInFlow->mFirstChild->GetContentIndex(contentIndex);
nextInFlow->SetFirstContentOffset(contentIndex);
}
// Link the frame into our list of children
kidFrame->SetGeometricParent(this);
@ -615,21 +480,15 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
}
if (nsnull == prevKidFrame) {
mFirstChild = kidFrame;
PRInt32 contentIndex;
kidFrame->GetContentIndex(contentIndex);
SetFirstContentOffset(contentIndex);
} else {
prevKidFrame->SetNextSibling(kidFrame);
}
kidFrame->SetNextSibling(nsnull);
mChildCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
prevLastContentIsComplete = mLastContentIsComplete;
// Is the child we just pulled up complete?
mLastContentIsComplete = NS_FRAME_IS_COMPLETE(status);
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
// No the child isn't complete
nsIFrame* kidNextInFlow;
@ -651,16 +510,10 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// it to the next-in-flow. This ensures the next-in-flow's
// content offsets and child count are set properly. Note that
// we can safely assume that the continuation is complete so
// we pass PR_TRUE into PushChidren in case our next-in-flow
// was just drained and now needs to know it's
// mLastContentIsComplete state.
// we pass PR_TRUE into PushChidren
kidFrame->SetNextSibling(continuingFrame);
PushChildren(continuingFrame, kidFrame, PR_TRUE);
// After we push the continuation frame we don't need to fuss
// with mLastContentIsComplete beause the continuation frame
// is no longer on *our* list.
}
// If the child isn't complete then it means that we've used up
@ -673,9 +526,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// Update our last content offset
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
}
// We need to make sure the first content offset is correct for any empty
@ -700,29 +550,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
}
}
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -1134,7 +961,7 @@ NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -77,7 +77,6 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
// Create body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild);
mChildCount = 1;
// Resolve style and set the style context
nsIStyleContext* styleContext =
@ -194,7 +193,6 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
if (nsnull == mPrevInFlow) {
// No, create a body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild);
mChildCount = 1;
// Resolve style and set the style context
nsIStyleContext* styleContext =
@ -212,7 +210,6 @@ void nsTableCellFrame::CreatePsuedoFrame(nsIPresContext* aPresContext)
prevPseudoFrame->GetStyleContext(aPresContext, kidSC);
prevPseudoFrame->CreateContinuingFrame(*aPresContext, this, kidSC, mFirstChild);
NS_RELEASE(kidSC);
mChildCount = 1;
}
}
@ -295,8 +292,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
printf("%p nsTableCellFrame::Reflow: maxSize=%d,%d\n",
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
mFirstContentOffset = mLastContentOffset = 0;
nsSize availSize(aReflowState.maxSize);
nsSize maxElementSize;
nsSize *pMaxElementSize = aDesiredSize.maxElementSize;
@ -323,8 +318,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
nsTableFrame* tableFrame = GetTableFrame();
tableFrame->GetCellMarginData(this,margin);
mLastContentIsComplete = PR_TRUE;
// get frame, creating one if needed
if (nsnull==mFirstChild)
{
@ -378,10 +371,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
this, kidSize.width, kidSize.height);
}
// Set our last content offset based on the pseudo-frame
nsBodyFrame* bodyPseudoFrame = (nsBodyFrame*)mFirstChild;
mLastContentOffset = bodyPseudoFrame->GetLastContentOffset();
// Place the child
//////////////////////////////// HACK //////////////////////////////
kidSize.width = PR_MIN(kidSize.width, availSize.width);
@ -389,12 +378,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
mFirstChild->SetRect(nsRect(leftInset, topInset,
kidSize.width, kidSize.height));
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
}
// Return our size and our result
// first, compute the height
@ -1126,7 +1109,7 @@ NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFil
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {
@ -1201,7 +1184,7 @@ void nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -90,7 +90,6 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC
} else {
lastChild->SetNextSibling(aChildList);
}
mChildCount += LengthOf(aChildList);
return NS_OK;
}
@ -312,7 +311,7 @@ NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -289,7 +289,6 @@ NS_IMETHODIMP
nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
return NS_OK;
}
@ -685,7 +684,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
}
lastColGroupFrame->SetNextSibling(firstRowGroupFrame);
}
mChildCount++;
}
else
{
@ -784,7 +782,6 @@ void nsTableFrame::EnsureColumnFrameAt(PRInt32 aColIndex,
}
lastColGroupFrame->SetNextSibling(firstRowGroupFrame);
}
mChildCount++;
}
else
{
@ -1615,9 +1612,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
this, aReflowState.maxSize.width, aReflowState.maxSize.height);
nsReflowStatus result = NS_FRAME_COMPLETE;
mChildCount = 0;
mFirstContentOffset = mLastContentOffset = 0;
nsSize availSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); // availSize is the space available at any given time in the process
nsSize maxSize(0, 0); // maxSize is the size of the largest child so far in the process
nsSize kidMaxSize(0,0);
@ -1674,15 +1668,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
break;
}
}
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
// up all of our available space (or needs us to split).
mLastContentIsComplete = PR_FALSE;
}
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
// Recalculate Layout Dependencies
@ -1690,9 +1678,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "unexpected last child");
// can't use SetLastContentOffset here
mLastContentOffset = contentOffset-1; // takes into account colGroup frame we're not using
if (gsDebug) printf("INNER: set last content offset to %d\n", GetLastContentOffset()); //@@@
}
aDesiredSize.width = kidSize.width;
@ -1928,37 +1913,10 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
InnerTableReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
NS_PRECONDITION(nsnull != mFirstChild, "no children");
PRInt32 childCount = 0;
nsIFrame* prevKidFrame = nsnull;
mLastContentOffset = 0;
// Remember our original mLastContentIsComplete so that if we end up
// having to push children, we have the correct value to hand to
// PushChildren.
PRBool originalLastContentIsComplete = mLastContentIsComplete;
nsSize kidMaxElementSize(0,0);
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
PRBool result = PR_TRUE;
@ -2004,15 +1962,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
{
// The child is too wide to fit in the available space, and it's
// not our first child
// Since we are giving the next-in-flow our last child, we
// give it our original mLastContentIsComplete too (in case we
// are pushing into an empty next-in-flow)
PushChildren(kidFrame, prevKidFrame, originalLastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(kidFrame, prevKidFrame, PR_TRUE);
result = PR_FALSE;
break;
}
@ -2038,20 +1988,15 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
}
}
childCount++;
kidFrame->GetContentIndex(mLastContentOffset);
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
// Update mLastContentIsComplete now that this kid fits
mLastContentIsComplete = PRBool(NS_FRAME_IS_COMPLETE(status));
// Special handling for incomplete children
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
kidFrame->GetNextInFlow(kidNextInFlow);
PRBool lastContentIsComplete = mLastContentIsComplete;
if (nsnull == kidNextInFlow) {
// The child doesn't have a next-in-flow so create a continuing
// frame. This hooks the child into the flow
@ -2069,12 +2014,6 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
kidFrame->GetNextSibling(nextSib);
continuingFrame->SetNextSibling(nextSib);
kidFrame->SetNextSibling(continuingFrame);
if (nsnull == nextSib) {
// Assume that the continuation frame we just created is
// complete, for now. It will get reflowed by our
// next-in-flow (we are going to push it now)
lastContentIsComplete = PR_TRUE;
}
}
// We've used up all of our available space so push the remaining
// children to the next-in-flow
@ -2082,10 +2021,7 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
kidFrame->GetNextSibling(nextSibling);
if (nsnull != nextSibling) {
PushChildren(nextSibling, kidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(nextSibling, kidFrame, PR_TRUE);
}
result = PR_FALSE;
break;
@ -2099,39 +2035,6 @@ PRBool nsTableFrame::ReflowMappedChildren( nsIPresContext* aPresContext,
}
// Update the child count
mChildCount = childCount;
#ifdef NS_DEBUG
NS_POSTCONDITION(LengthOf(mFirstChild) == mChildCount, "bad child count");
nsIFrame* lastChild = LastFrame(mFirstChild);
PRInt32 lastIndexInParent;
lastChild->GetContentIndex(lastIndexInParent);
NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset");
#endif
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -2147,43 +2050,11 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
InnerTableReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableFrame* flow = (nsTableFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableFrame*) flow->mNextInFlow;
}
}
#endif
#endif
nsTableFrame* nextInFlow = (nsTableFrame*)mNextInFlow;
nsTableFrame* nextInFlow = (nsTableFrame*)mNextInFlow;
nsSize kidMaxElementSize(0,0);
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
#ifdef NS_DEBUG
PRInt32 kidIndex = NextChildOffset();
#endif
nsIFrame* prevKidFrame = LastFrame(mFirstChild);
// This will hold the prevKidFrame's mLastContentIsComplete
// status. If we have to push the frame that follows prevKidFrame
// then this will become our mLastContentIsComplete state. Since
// prevKidFrame is initially our last frame, it's completion status
// is our mLastContentIsComplete value.
PRBool prevLastContentIsComplete = mLastContentIsComplete;
PRBool result = PR_TRUE;
PRBool result = PR_TRUE;
while (nsnull != nextInFlow) {
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -2219,7 +2090,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
if ((kidFrameSize.height > aState.availSize.height) &&
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
@ -2232,7 +2102,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
@ -2257,13 +2126,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
nextInFlow->mChildCount--;
// Update the next-in-flows first content offset
if (nsnull != nextInFlow->mFirstChild) {
PRInt32 contentIndex;
nextInFlow->mFirstChild->GetContentIndex(contentIndex);
nextInFlow->SetFirstContentOffset(contentIndex);
}
// Link the frame into our list of children
kidFrame->SetGeometricParent(this);
@ -2275,21 +2137,13 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
}
if (nsnull == prevKidFrame) {
mFirstChild = kidFrame;
PRInt32 contentIndex;
kidFrame->GetContentIndex(contentIndex);
SetFirstContentOffset(contentIndex);
} else {
prevKidFrame->SetNextSibling(kidFrame);
}
kidFrame->SetNextSibling(nsnull);
mChildCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
prevLastContentIsComplete = mLastContentIsComplete;
// Is the child we just pulled up complete?
mLastContentIsComplete = PRBool(NS_FRAME_IS_COMPLETE(status));
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
// No the child isn't complete
nsIFrame* kidNextInFlow;
@ -2311,16 +2165,10 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
// it to the next-in-flow. This ensures the next-in-flow's
// content offsets and child count are set properly. Note that
// we can safely assume that the continuation is complete so
// we pass PR_TRUE into PushChidren in case our next-in-flow
// was just drained and now needs to know it's
// mLastContentIsComplete state.
// we pass PR_TRUE into PushChidren
kidFrame->SetNextSibling(continuingFrame);
PushChildren(continuingFrame, kidFrame, PR_TRUE);
// After we push the continuation frame we don't need to fuss
// with mLastContentIsComplete beause the continuation frame
// is no longer on *our* list.
}
// If the child isn't complete then it means that we've used up
@ -2330,39 +2178,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
}
}
// Update our last content offset
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
}
// 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 = (nsTableFrame*)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
}
}
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
return result;
}
@ -3389,7 +3204,7 @@ NS_METHOD nsTableFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter)
}
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -107,12 +107,10 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram
NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
NS_ASSERTION(mChildCount > 0, "bad child list");
// Set our internal member data
mInnerTableFrame = (nsTableFrame*)mFirstChild;
if (2 == mChildCount) {
if (2 == LengthOf(mFirstChild)) {
mFirstChild->GetNextSibling(mCaptionFrame);
}
@ -616,7 +614,6 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
// Add it to the list of child frames
mFirstChild = mInnerTableFrame;
mChildCount++;
// Now create the caption frame, prepending a top caption and appending a
// bottom caption
@ -666,7 +663,6 @@ nsresult nsTableOuterFrame::CreateChildFrames(nsIPresContext* aPresContext)
mCaptionFrame->SetNextSibling(mFirstChild);
mFirstChild = mCaptionFrame;
}
mChildCount++;
break;
}
}
@ -700,23 +696,6 @@ nsTableOuterFrame::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;
if (mChildCount > 0) {
nextOffset = mLastContentOffset;
if (mLastContentIsComplete) {
nextOffset++;
}
} else {
nextOffset = mFirstContentOffset;
}
aContFrame->SetFirstContentOffset(nextOffset);
aContFrame->SetLastContentOffset(nextOffset);
aContFrame->SetLastContentIsComplete(PR_TRUE);
aContFrame->SetStyleContext(&aPresContext, aStyleContext);
}
@ -781,26 +760,6 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, n
// Take the next-in-flow out of the parent's child list
if (parent->mFirstChild == nextInFlow) {
nextInFlow->GetNextSibling(parent->mFirstChild);
if (nsnull != parent->mFirstChild) {
PRInt32 contentIndex;
parent->mFirstChild->GetContentIndex(contentIndex);
parent->SetFirstContentOffset(contentIndex);
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.
// However, we know that the parent will eventually be reflowed
// in one of two ways: it will either get a chance to pullup
// children or it will be deleted because it's prev-in-flow
// (e.g. this) is complete. In either case, the content offsets
// will be repaired.
} else {
nsIFrame* nextSibling;
@ -820,7 +779,6 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, n
// Delete the next-in-flow frame and adjust it's parent's child count
nextInFlow->DeleteFrame(aPresContext);
parent->mChildCount--;
#ifdef NS_DEBUG
aChild->GetNextInFlow(nextInFlow);
@ -918,7 +876,7 @@ NS_METHOD nsTableOuterFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFi
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -100,7 +100,6 @@ NS_IMETHODIMP
nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
return NS_OK;
}
@ -1027,7 +1026,7 @@ NS_METHOD nsTableRowFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilt
fputs("\n", out);
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {

Просмотреть файл

@ -130,14 +130,6 @@ NS_IMETHODIMP
nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
{
mFirstChild = aChildList;
mChildCount = LengthOf(mFirstChild);
// XXX TEMP CODE UNTIL nsContainerFrame GOES AWAY...
nsIFrame* lastChild = LastFrame(mFirstChild);
if (nsnull != lastChild) {
lastChild->GetContentIndex(mLastContentOffset);
}
return NS_OK;
}
@ -268,36 +260,8 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
RowGroupReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
NS_PRECONDITION(nsnull != mFirstChild, "no children");
PRInt32 childCount = 0;
nsIFrame* prevKidFrame = nsnull;
// Remember our original mLastContentIsComplete so that if we end up
// having to push children, we have the correct value to hand to
// PushChildren.
PRBool lastContentIsComplete = mLastContentIsComplete;
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
PRBool result = PR_TRUE;
@ -354,17 +318,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
//
// Note that if the width is too big that's okay and we allow the
// child to extend horizontally outside of the reflow area
// Since we are giving the next-in-flow our last child, we
// give it our original mLastContentIsComplete, too (in case we
// are pushing into an empty next-in-flow)
PushChildren(kidFrame, prevKidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
// Our mLastContentIsComplete was already set by the last kid we
// reflowed reflow's status
PushChildren(kidFrame, prevKidFrame, PR_TRUE);
result = PR_FALSE;
break;
}
@ -378,14 +332,10 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
} else {
aState.prevMaxPosBottomMargin = bottomMargin;
}
childCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
// Update mLastContentIsComplete now that this kid fits
mLastContentIsComplete = NS_FRAME_IS_COMPLETE(status);
/* Row groups should not create continuing frames for rows
* unless they absolutely have to!
* check to see if this is absolutely necessary (with new params from troy)
@ -398,7 +348,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
nsIFrame* kidNextInFlow;
kidFrame->GetNextInFlow(kidNextInFlow);
PRBool lastContentIsComplete = mLastContentIsComplete;
if (nsnull == kidNextInFlow) {
// No the child isn't complete, and it doesn't have a next in flow so
// create a continuing frame. This hooks the child into the flow.
@ -415,12 +364,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
kidFrame->GetNextSibling(nextSib);
continuingFrame->SetNextSibling(nextSib);
kidFrame->SetNextSibling(continuingFrame);
if (nsnull == nextSib) {
// Assume that the continuation frame we just created is
// complete, for now. It will get reflowed by our
// next-in-flow (we are going to push it now)
lastContentIsComplete = PR_TRUE;
}
}
// We've used up all of our available space so push the remaining
// children to the next-in-flow
@ -428,10 +371,7 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
kidFrame->GetNextSibling(nextSibling);
if (nsnull != nextSibling) {
PushChildren(nextSibling, kidFrame, lastContentIsComplete);
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
PushChildren(nextSibling, kidFrame, PR_TRUE);
}
result = PR_FALSE;
break;
@ -449,40 +389,6 @@ PRBool nsTableRowGroupFrame::ReflowMappedChildren( nsIPresContext* aPresCon
}
// Update the child count
mChildCount = childCount;
#ifdef NS_DEBUG
NS_POSTCONDITION(LengthOf(mFirstChild) == mChildCount, "bad child count");
nsIFrame* lastChild = LastFrame(mFirstChild);
PRInt32 lastIndexInParent;
lastChild->GetContentIndex(lastIndexInParent);
NS_POSTCONDITION(lastIndexInParent == mLastContentOffset, "bad last content offset");
#endif
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": reflow mapped %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -498,43 +404,11 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
RowGroupReflowState& aState,
nsSize* aMaxElementSize)
{
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup (childCount=%d) [%d,%d,%c]\n",
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
nsTableRowGroupFrame* nextInFlow = (nsTableRowGroupFrame*)mNextInFlow;
nsSize kidMaxElementSize;
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
#ifdef NS_DEBUG
PRInt32 kidIndex = NextChildOffset();
#endif
nsIFrame* prevKidFrame = LastFrame(mFirstChild);
// This will hold the prevKidFrame's mLastContentIsComplete
// status. If we have to push the frame that follows prevKidFrame
// then this will become our mLastContentIsComplete state. Since
// prevKidFrame is initially our last frame, it's completion status
// is our mLastContentIsComplete value.
PRBool prevLastContentIsComplete = mLastContentIsComplete;
PRBool result = PR_TRUE;
PRBool result = PR_TRUE;
while (nsnull != nextInFlow) {
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -571,7 +445,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
if ((kidFrameSize.height > aState.availSize.height) &&
NS_FRAME_IS_NOT_SPLITTABLE(kidIsSplittable)) {
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
@ -584,7 +457,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// The child is too wide to fit in the available space, and it's
// not our first child
result = PR_FALSE;
mLastContentIsComplete = prevLastContentIsComplete;
break;
}
@ -597,13 +469,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// Remove the frame from its current parent
kidFrame->GetNextSibling(nextInFlow->mFirstChild);
nextInFlow->mChildCount--;
// Update the next-in-flows first content offset
if (nsnull != nextInFlow->mFirstChild) {
PRInt32 contentIndex;
nextInFlow->mFirstChild->GetContentIndex(contentIndex);
nextInFlow->SetFirstContentOffset(contentIndex);
}
// Link the frame into our list of children
kidFrame->SetGeometricParent(this);
@ -615,21 +480,15 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
}
if (nsnull == prevKidFrame) {
mFirstChild = kidFrame;
PRInt32 contentIndex;
kidFrame->GetContentIndex(contentIndex);
SetFirstContentOffset(contentIndex);
} else {
prevKidFrame->SetNextSibling(kidFrame);
}
kidFrame->SetNextSibling(nsnull);
mChildCount++;
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
prevLastContentIsComplete = mLastContentIsComplete;
// Is the child we just pulled up complete?
mLastContentIsComplete = NS_FRAME_IS_COMPLETE(status);
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
// No the child isn't complete
nsIFrame* kidNextInFlow;
@ -651,16 +510,10 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// it to the next-in-flow. This ensures the next-in-flow's
// content offsets and child count are set properly. Note that
// we can safely assume that the continuation is complete so
// we pass PR_TRUE into PushChidren in case our next-in-flow
// was just drained and now needs to know it's
// mLastContentIsComplete state.
// we pass PR_TRUE into PushChidren
kidFrame->SetNextSibling(continuingFrame);
PushChildren(continuingFrame, kidFrame, PR_TRUE);
// After we push the continuation frame we don't need to fuss
// with mLastContentIsComplete beause the continuation frame
// is no longer on *our* list.
}
// If the child isn't complete then it means that we've used up
@ -673,9 +526,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
// Update our last content offset
if (nsnull != prevKidFrame) {
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
PRInt32 contentIndex;
prevKidFrame->GetContentIndex(contentIndex);
SetLastContentOffset(contentIndex);
}
// We need to make sure the first content offset is correct for any empty
@ -700,29 +550,6 @@ PRBool nsTableRowGroupFrame::PullUpChildren(nsIPresContext* aPresContext,
}
}
#ifdef NS_DEBUG
VerifyLastIsComplete();
#endif
#ifdef NOISY
ListTag(stdout);
printf(": pullup %sok (childCount=%d) [%d,%d,%c]\n",
(result ? "" : "NOT "),
mChildCount,
mFirstContentOffset, mLastContentOffset,
(mLastContentIsComplete ? 'T' : 'F'));
#ifdef NOISY_FLOW
{
nsTableRowGroupFrame* flow = (nsTableRowGroupFrame*) mNextInFlow;
while (flow != 0) {
printf(" %p: [%d,%d,%c]\n",
flow, flow->mFirstContentOffset, flow->mLastContentOffset,
(flow->mLastContentIsComplete ? 'T' : 'F'));
flow = (nsTableRowGroupFrame*) flow->mNextInFlow;
}
}
#endif
#endif
return result;
}
@ -1134,7 +961,7 @@ NS_METHOD nsTableRowGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *
}
// Output the children
if (mChildCount > 0) {
if (nsnull != mFirstChild) {
if (PR_TRUE==outputMe)
{
if (0 != mState) {