зеркало из https://github.com/mozilla/gecko-dev.git
Removed some commented out code that's not needed now that we're using the
new frame construction
This commit is contained in:
Родитель
c4af68389c
Коммит
840d73eab9
|
@ -1557,116 +1557,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
|||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
nsIContent * prevKid; // do NOT hold a reference for this temp pointer!
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
/* assumes that Table's children are in the following order:
|
||||
* Captions
|
||||
* ColGroups, in order
|
||||
* THead, in order
|
||||
* TFoot, in order
|
||||
* TBody, in order
|
||||
*/
|
||||
for (;;) {
|
||||
nsIContentPtr kid;
|
||||
mContent->ChildAt(kidIndex, kid.AssignRef()); // kid: REFCNT++
|
||||
if (kid.IsNull()) {
|
||||
result = NS_FRAME_COMPLETE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (kid==prevKid)
|
||||
{ // we just saw this kid, but in it's processing someone inserted something in front of it
|
||||
// (probably a colgroup). So don't process it twice.
|
||||
kidIndex++;
|
||||
continue;
|
||||
}
|
||||
prevKid = kid;
|
||||
|
||||
mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
// Resolve style
|
||||
nsIStyleContextPtr kidStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(kid, this, PR_TRUE);
|
||||
NS_ASSERTION(kidStyleContext.IsNotNull(), "null style context for kid");
|
||||
const nsStyleDisplay *childDisplay = (nsStyleDisplay*)kidStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (NS_STYLE_DISPLAY_TABLE_CAPTION != childDisplay->mDisplay)
|
||||
{
|
||||
// get next frame, creating one if needed
|
||||
nsIFrame* kidFrame=nsnull;
|
||||
if (nsnull!=prevKidFrame)
|
||||
prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null...
|
||||
else
|
||||
kidFrame=mFirstChild;
|
||||
|
||||
// if this is the first time, allocate the frame
|
||||
if (nsnull==kidFrame)
|
||||
{
|
||||
nsIContentDelegate* kidDel;
|
||||
kidDel = kid->GetDelegate(aPresContext);
|
||||
nsresult rv = kidDel->CreateFrame(aPresContext, kid,
|
||||
this, kidStyleContext, kidFrame);
|
||||
reflowReason = eReflowReason_Initial;
|
||||
NS_RELEASE(kidDel);
|
||||
|
||||
// Link child frame into the list of children
|
||||
if (nsnull != prevKidFrame) {
|
||||
prevKidFrame->SetNextSibling(kidFrame);
|
||||
} else {
|
||||
// Our first child
|
||||
mFirstChild = kidFrame;
|
||||
SetFirstContentOffset(kidIndex);
|
||||
if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@
|
||||
}
|
||||
mChildCount++;
|
||||
}
|
||||
|
||||
nsSize maxKidElementSize(0,0);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSize,
|
||||
reflowReason);
|
||||
PRInt32 yCoord = y;
|
||||
if (NS_UNCONSTRAINEDSIZE!=yCoord)
|
||||
yCoord+= topInset;
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(leftInset, yCoord);
|
||||
result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState);
|
||||
|
||||
// Place the child since some of it's content fit in us.
|
||||
if (PR_TRUE==gsDebugNT) {
|
||||
printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n",
|
||||
this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height);
|
||||
}
|
||||
kidFrame->SetRect(nsRect(leftInset, yCoord,
|
||||
kidSize.width, kidSize.height));
|
||||
if (NS_UNCONSTRAINEDSIZE==kidSize.height)
|
||||
y = NS_UNCONSTRAINEDSIZE;
|
||||
else
|
||||
y += kidSize.height;
|
||||
if (kidMaxSize.width > maxSize.width) {
|
||||
maxSize.width = kidMaxSize.width;
|
||||
}
|
||||
if (kidMaxSize.height > maxSize.height) {
|
||||
maxSize.height = kidMaxSize.height;
|
||||
}
|
||||
|
||||
prevKidFrame = kidFrame;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
contentOffset++;
|
||||
kidIndex++;
|
||||
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;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
||||
nsSize maxKidElementSize(0,0);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSize);
|
||||
|
@ -1708,7 +1598,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
|||
// up all of our available space (or needs us to split).
|
||||
mLastContentIsComplete = PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
// Recalculate Layout Dependencies
|
||||
|
@ -1791,16 +1680,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
|||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// XXX CONSTRUCTION. WE SHOULD NEVER HAVE UNMAPPED CHILDREN...
|
||||
#if 0
|
||||
// If we still have unmapped children then create some new frames
|
||||
mContent->ChildCount(numKids);
|
||||
if (NextChildOffset() < numKids) {
|
||||
status = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
// next in flow
|
||||
status = NS_FRAME_NOT_COMPLETE;
|
||||
|
@ -2403,156 +2283,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new frames for content we haven't yet mapped
|
||||
*
|
||||
* @param aPresContext presentation context to use
|
||||
* @param aState current inline state
|
||||
* @return frComplete if all content has been mapped and frNotComplete
|
||||
* if we should be continued
|
||||
*/
|
||||
nsReflowStatus
|
||||
nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
||||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
VerifyLastIsComplete();
|
||||
#endif
|
||||
nsIFrame* kidPrevInFlow = nsnull;
|
||||
nsReflowStatus result = NS_FRAME_NOT_COMPLETE;
|
||||
|
||||
// If we have no children and we have a prev-in-flow then we need to pick
|
||||
// up where it left off. If we have children, e.g. we're being resized, then
|
||||
// our content offset should already be set correctly...
|
||||
if ((nsnull == mFirstChild) && (nsnull != mPrevInFlow)) {
|
||||
nsTableFrame* prev = (nsTableFrame*)mPrevInFlow;
|
||||
NS_ASSERTION(prev->mLastContentOffset >= prev->mFirstContentOffset, "bad prevInFlow");
|
||||
|
||||
mFirstContentOffset = prev->NextChildOffset();
|
||||
if (!prev->mLastContentIsComplete) {
|
||||
// Our prev-in-flow's last child is not complete
|
||||
prev->LastChild(kidPrevInFlow);
|
||||
}
|
||||
}
|
||||
mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
// Place our children, one at a time until we are out of children
|
||||
nsSize kidMaxElementSize(0,0);
|
||||
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
|
||||
PRInt32 kidIndex = NextChildOffset();
|
||||
nsIFrame* prevKidFrame;
|
||||
|
||||
LastChild(prevKidFrame);
|
||||
for (;;) {
|
||||
// Get the next content object
|
||||
nsIContentPtr kid;
|
||||
mContent->ChildAt(kidIndex, kid.AssignRef());
|
||||
if (kid.IsNull()) {
|
||||
result = NS_FRAME_COMPLETE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure we still have room left
|
||||
if (aState.availSize.height <= 0) {
|
||||
// Note: return status was set to frNotComplete above...
|
||||
break;
|
||||
}
|
||||
|
||||
// Resolve style for the child
|
||||
nsIStyleContextPtr kidStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(kid, this, PR_TRUE);
|
||||
|
||||
// Figure out how we should treat the child
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
// Create a child frame
|
||||
if (nsnull == kidPrevInFlow) {
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = kid->GetDelegate(aPresContext);
|
||||
nsresult rv = kidDel->CreateFrame(aPresContext, kid, this,
|
||||
kidStyleContext, kidFrame);
|
||||
NS_RELEASE(kidDel);
|
||||
} else {
|
||||
kidPrevInFlow->CreateContinuingFrame(*aPresContext, this, kidStyleContext,
|
||||
kidFrame);
|
||||
}
|
||||
|
||||
// Link child frame into the list of children
|
||||
if (nsnull != prevKidFrame) {
|
||||
prevKidFrame->SetNextSibling(kidFrame);
|
||||
} else {
|
||||
mFirstChild = kidFrame; // our first child
|
||||
SetFirstContentOffset(kidIndex);
|
||||
}
|
||||
mChildCount++;
|
||||
|
||||
// Try to reflow the child into the available space. It might not
|
||||
// fit or might need continuing.
|
||||
nsReflowMetrics kidSize(pKidMaxElementSize);
|
||||
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
|
||||
eReflowReason_Initial);
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(0, aState.y);
|
||||
nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState);
|
||||
|
||||
// Did the child fit?
|
||||
if ((kidSize.height > aState.availSize.height) && (nsnull != mFirstChild)) {
|
||||
// The child is too wide to fit in the available space, and it's
|
||||
// not our first child. Add the frame to our overflow list
|
||||
NS_ASSERTION(nsnull == mOverflowList, "bad overflow list");
|
||||
mOverflowList = kidFrame;
|
||||
prevKidFrame->SetNextSibling(nsnull);
|
||||
break;
|
||||
}
|
||||
|
||||
// Advance y by the topMargin between children. Zero out the
|
||||
// topMargin in case this frame is continued because
|
||||
// continuations do not have a top margin. Update the prev
|
||||
// bottom margin state in the body reflow state so that we can
|
||||
// apply the bottom margin when we hit the next child (or
|
||||
// finish).
|
||||
//aState.y += topMargin;
|
||||
nsRect kidRect (0, aState.y, kidSize.width, kidSize.height);
|
||||
const nsStyleDisplay *childDisplay;
|
||||
kidFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay ||
|
||||
NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == childDisplay->mDisplay ||
|
||||
NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == childDisplay->mDisplay )
|
||||
{
|
||||
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
|
||||
}
|
||||
|
||||
prevKidFrame = kidFrame;
|
||||
kidIndex++;
|
||||
|
||||
// Did the child complete?
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
||||
// If the child isn't complete then it means that we've used up
|
||||
// all of our available space
|
||||
mLastContentIsComplete = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
kidPrevInFlow = nsnull;
|
||||
}
|
||||
|
||||
// Update the content mapping
|
||||
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
|
||||
PRInt32 contentIndex;
|
||||
prevKidFrame->GetContentIndex(contentIndex);
|
||||
SetLastContentOffset(contentIndex);
|
||||
#ifdef NS_DEBUG
|
||||
PRInt32 len = LengthOf(mFirstChild);
|
||||
NS_ASSERTION(len == mChildCount, "bad child count");
|
||||
#endif
|
||||
#ifdef NS_DEBUG
|
||||
VerifyLastIsComplete();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Now I've got all the cells laid out in an infinite space.
|
||||
For each column, use the min size for each cell in that column
|
||||
|
|
|
@ -323,19 +323,6 @@ protected:
|
|||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
/**
|
||||
* Create new frames for content we haven't yet mapped
|
||||
*
|
||||
* @param aPresContext presentation context to use
|
||||
* @param aState current inline state
|
||||
* @return frComplete if all content has been mapped and frNotComplete
|
||||
* if we should be continued
|
||||
*/
|
||||
nsReflowStatus ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
||||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
|
||||
/** assign widths for each column, taking into account the table content, the effective style,
|
||||
* the layout constraints, and the compatibility mode. Sets mColumnWidths as a side effect.
|
||||
* @param aPresContext the presentation context
|
||||
|
|
|
@ -1557,116 +1557,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
|||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
nsIContent * prevKid; // do NOT hold a reference for this temp pointer!
|
||||
|
||||
// XXX CONSTRUCTION
|
||||
#if 0
|
||||
/* assumes that Table's children are in the following order:
|
||||
* Captions
|
||||
* ColGroups, in order
|
||||
* THead, in order
|
||||
* TFoot, in order
|
||||
* TBody, in order
|
||||
*/
|
||||
for (;;) {
|
||||
nsIContentPtr kid;
|
||||
mContent->ChildAt(kidIndex, kid.AssignRef()); // kid: REFCNT++
|
||||
if (kid.IsNull()) {
|
||||
result = NS_FRAME_COMPLETE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (kid==prevKid)
|
||||
{ // we just saw this kid, but in it's processing someone inserted something in front of it
|
||||
// (probably a colgroup). So don't process it twice.
|
||||
kidIndex++;
|
||||
continue;
|
||||
}
|
||||
prevKid = kid;
|
||||
|
||||
mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
// Resolve style
|
||||
nsIStyleContextPtr kidStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(kid, this, PR_TRUE);
|
||||
NS_ASSERTION(kidStyleContext.IsNotNull(), "null style context for kid");
|
||||
const nsStyleDisplay *childDisplay = (nsStyleDisplay*)kidStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (NS_STYLE_DISPLAY_TABLE_CAPTION != childDisplay->mDisplay)
|
||||
{
|
||||
// get next frame, creating one if needed
|
||||
nsIFrame* kidFrame=nsnull;
|
||||
if (nsnull!=prevKidFrame)
|
||||
prevKidFrame->GetNextSibling(kidFrame); // no need to check for an error, just see if it returned null...
|
||||
else
|
||||
kidFrame=mFirstChild;
|
||||
|
||||
// if this is the first time, allocate the frame
|
||||
if (nsnull==kidFrame)
|
||||
{
|
||||
nsIContentDelegate* kidDel;
|
||||
kidDel = kid->GetDelegate(aPresContext);
|
||||
nsresult rv = kidDel->CreateFrame(aPresContext, kid,
|
||||
this, kidStyleContext, kidFrame);
|
||||
reflowReason = eReflowReason_Initial;
|
||||
NS_RELEASE(kidDel);
|
||||
|
||||
// Link child frame into the list of children
|
||||
if (nsnull != prevKidFrame) {
|
||||
prevKidFrame->SetNextSibling(kidFrame);
|
||||
} else {
|
||||
// Our first child
|
||||
mFirstChild = kidFrame;
|
||||
SetFirstContentOffset(kidIndex);
|
||||
if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@
|
||||
}
|
||||
mChildCount++;
|
||||
}
|
||||
|
||||
nsSize maxKidElementSize(0,0);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSize,
|
||||
reflowReason);
|
||||
PRInt32 yCoord = y;
|
||||
if (NS_UNCONSTRAINEDSIZE!=yCoord)
|
||||
yCoord+= topInset;
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(leftInset, yCoord);
|
||||
result = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState);
|
||||
|
||||
// Place the child since some of it's content fit in us.
|
||||
if (PR_TRUE==gsDebugNT) {
|
||||
printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n",
|
||||
this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height);
|
||||
}
|
||||
kidFrame->SetRect(nsRect(leftInset, yCoord,
|
||||
kidSize.width, kidSize.height));
|
||||
if (NS_UNCONSTRAINEDSIZE==kidSize.height)
|
||||
y = NS_UNCONSTRAINEDSIZE;
|
||||
else
|
||||
y += kidSize.height;
|
||||
if (kidMaxSize.width > maxSize.width) {
|
||||
maxSize.width = kidMaxSize.width;
|
||||
}
|
||||
if (kidMaxSize.height > maxSize.height) {
|
||||
maxSize.height = kidMaxSize.height;
|
||||
}
|
||||
|
||||
prevKidFrame = kidFrame;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
contentOffset++;
|
||||
kidIndex++;
|
||||
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;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (nsIFrame* kidFrame = mFirstChild; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
||||
nsSize maxKidElementSize(0,0);
|
||||
nsReflowState kidReflowState(kidFrame, aReflowState, availSize);
|
||||
|
@ -1708,7 +1598,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
|
|||
// up all of our available space (or needs us to split).
|
||||
mLastContentIsComplete = PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
// Recalculate Layout Dependencies
|
||||
|
@ -1791,16 +1680,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass2(nsIPresContext* aPresContext,
|
|||
}
|
||||
} else if (NextChildOffset() < numKids) {
|
||||
// Try and pull-up some children from a next-in-flow
|
||||
if (PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// XXX CONSTRUCTION. WE SHOULD NEVER HAVE UNMAPPED CHILDREN...
|
||||
#if 0
|
||||
// If we still have unmapped children then create some new frames
|
||||
mContent->ChildCount(numKids);
|
||||
if (NextChildOffset() < numKids) {
|
||||
status = ReflowUnmappedChildren(aPresContext, state, aDesiredSize.maxElementSize);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (!PullUpChildren(aPresContext, state, aDesiredSize.maxElementSize)) {
|
||||
// We were unable to pull-up all the existing frames from the
|
||||
// next in flow
|
||||
status = NS_FRAME_NOT_COMPLETE;
|
||||
|
@ -2403,156 +2283,6 @@ PRBool nsTableFrame::PullUpChildren(nsIPresContext* aPresContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new frames for content we haven't yet mapped
|
||||
*
|
||||
* @param aPresContext presentation context to use
|
||||
* @param aState current inline state
|
||||
* @return frComplete if all content has been mapped and frNotComplete
|
||||
* if we should be continued
|
||||
*/
|
||||
nsReflowStatus
|
||||
nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
||||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize)
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
VerifyLastIsComplete();
|
||||
#endif
|
||||
nsIFrame* kidPrevInFlow = nsnull;
|
||||
nsReflowStatus result = NS_FRAME_NOT_COMPLETE;
|
||||
|
||||
// If we have no children and we have a prev-in-flow then we need to pick
|
||||
// up where it left off. If we have children, e.g. we're being resized, then
|
||||
// our content offset should already be set correctly...
|
||||
if ((nsnull == mFirstChild) && (nsnull != mPrevInFlow)) {
|
||||
nsTableFrame* prev = (nsTableFrame*)mPrevInFlow;
|
||||
NS_ASSERTION(prev->mLastContentOffset >= prev->mFirstContentOffset, "bad prevInFlow");
|
||||
|
||||
mFirstContentOffset = prev->NextChildOffset();
|
||||
if (!prev->mLastContentIsComplete) {
|
||||
// Our prev-in-flow's last child is not complete
|
||||
prev->LastChild(kidPrevInFlow);
|
||||
}
|
||||
}
|
||||
mLastContentIsComplete = PR_TRUE;
|
||||
|
||||
// Place our children, one at a time until we are out of children
|
||||
nsSize kidMaxElementSize(0,0);
|
||||
nsSize* pKidMaxElementSize = (nsnull != aMaxElementSize) ? &kidMaxElementSize : nsnull;
|
||||
PRInt32 kidIndex = NextChildOffset();
|
||||
nsIFrame* prevKidFrame;
|
||||
|
||||
LastChild(prevKidFrame);
|
||||
for (;;) {
|
||||
// Get the next content object
|
||||
nsIContentPtr kid;
|
||||
mContent->ChildAt(kidIndex, kid.AssignRef());
|
||||
if (kid.IsNull()) {
|
||||
result = NS_FRAME_COMPLETE;
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure we still have room left
|
||||
if (aState.availSize.height <= 0) {
|
||||
// Note: return status was set to frNotComplete above...
|
||||
break;
|
||||
}
|
||||
|
||||
// Resolve style for the child
|
||||
nsIStyleContextPtr kidStyleContext =
|
||||
aPresContext->ResolveStyleContextFor(kid, this, PR_TRUE);
|
||||
|
||||
// Figure out how we should treat the child
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
// Create a child frame
|
||||
if (nsnull == kidPrevInFlow) {
|
||||
nsIContentDelegate* kidDel = nsnull;
|
||||
kidDel = kid->GetDelegate(aPresContext);
|
||||
nsresult rv = kidDel->CreateFrame(aPresContext, kid, this,
|
||||
kidStyleContext, kidFrame);
|
||||
NS_RELEASE(kidDel);
|
||||
} else {
|
||||
kidPrevInFlow->CreateContinuingFrame(*aPresContext, this, kidStyleContext,
|
||||
kidFrame);
|
||||
}
|
||||
|
||||
// Link child frame into the list of children
|
||||
if (nsnull != prevKidFrame) {
|
||||
prevKidFrame->SetNextSibling(kidFrame);
|
||||
} else {
|
||||
mFirstChild = kidFrame; // our first child
|
||||
SetFirstContentOffset(kidIndex);
|
||||
}
|
||||
mChildCount++;
|
||||
|
||||
// Try to reflow the child into the available space. It might not
|
||||
// fit or might need continuing.
|
||||
nsReflowMetrics kidSize(pKidMaxElementSize);
|
||||
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
|
||||
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
|
||||
eReflowReason_Initial);
|
||||
kidFrame->WillReflow(*aPresContext);
|
||||
kidFrame->MoveTo(0, aState.y);
|
||||
nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize, kidReflowState);
|
||||
|
||||
// Did the child fit?
|
||||
if ((kidSize.height > aState.availSize.height) && (nsnull != mFirstChild)) {
|
||||
// The child is too wide to fit in the available space, and it's
|
||||
// not our first child. Add the frame to our overflow list
|
||||
NS_ASSERTION(nsnull == mOverflowList, "bad overflow list");
|
||||
mOverflowList = kidFrame;
|
||||
prevKidFrame->SetNextSibling(nsnull);
|
||||
break;
|
||||
}
|
||||
|
||||
// Advance y by the topMargin between children. Zero out the
|
||||
// topMargin in case this frame is continued because
|
||||
// continuations do not have a top margin. Update the prev
|
||||
// bottom margin state in the body reflow state so that we can
|
||||
// apply the bottom margin when we hit the next child (or
|
||||
// finish).
|
||||
//aState.y += topMargin;
|
||||
nsRect kidRect (0, aState.y, kidSize.width, kidSize.height);
|
||||
const nsStyleDisplay *childDisplay;
|
||||
kidFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == childDisplay->mDisplay ||
|
||||
NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == childDisplay->mDisplay ||
|
||||
NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == childDisplay->mDisplay )
|
||||
{
|
||||
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
|
||||
}
|
||||
|
||||
prevKidFrame = kidFrame;
|
||||
kidIndex++;
|
||||
|
||||
// Did the child complete?
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
||||
// If the child isn't complete then it means that we've used up
|
||||
// all of our available space
|
||||
mLastContentIsComplete = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
kidPrevInFlow = nsnull;
|
||||
}
|
||||
|
||||
// Update the content mapping
|
||||
NS_ASSERTION(IsLastChild(prevKidFrame), "bad last child");
|
||||
PRInt32 contentIndex;
|
||||
prevKidFrame->GetContentIndex(contentIndex);
|
||||
SetLastContentOffset(contentIndex);
|
||||
#ifdef NS_DEBUG
|
||||
PRInt32 len = LengthOf(mFirstChild);
|
||||
NS_ASSERTION(len == mChildCount, "bad child count");
|
||||
#endif
|
||||
#ifdef NS_DEBUG
|
||||
VerifyLastIsComplete();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Now I've got all the cells laid out in an infinite space.
|
||||
For each column, use the min size for each cell in that column
|
||||
|
|
|
@ -323,19 +323,6 @@ protected:
|
|||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
/**
|
||||
* Create new frames for content we haven't yet mapped
|
||||
*
|
||||
* @param aPresContext presentation context to use
|
||||
* @param aState current inline state
|
||||
* @return frComplete if all content has been mapped and frNotComplete
|
||||
* if we should be continued
|
||||
*/
|
||||
nsReflowStatus ReflowUnmappedChildren(nsIPresContext* aPresContext,
|
||||
InnerTableReflowState& aState,
|
||||
nsSize* aMaxElementSize);
|
||||
|
||||
|
||||
/** assign widths for each column, taking into account the table content, the effective style,
|
||||
* the layout constraints, and the compatibility mode. Sets mColumnWidths as a side effect.
|
||||
* @param aPresContext the presentation context
|
||||
|
|
Загрузка…
Ссылка в новой задаче