Changed to make sure we link the child frame into the list of frames before

we reflow it
This commit is contained in:
troy 1998-06-24 16:35:21 +00:00
Родитель 21ad7b2304
Коммит d8ba6d4919
10 изменённых файлов: 126 добавлений и 108 удалений

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

@ -322,6 +322,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
nsReflowState kidReflowState(mFirstChild, aReflowState, availSize);
mFirstChild->WillReflow(*aPresContext);
mFirstChild->MoveTo(leftInset, topInset);
aStatus = ReflowChild(mFirstChild, aPresContext, kidSize, kidReflowState);
if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT)

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

@ -1223,12 +1223,27 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
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(kidFrame);
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.
@ -1236,9 +1251,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n",
this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height);
}
PRInt32 yCoord = y;
if (NS_UNCONSTRAINEDSIZE!=yCoord)
yCoord+= topInset;
kidFrame->SetRect(nsRect(leftInset, yCoord,
kidSize.width, kidSize.height));
if (NS_UNCONSTRAINEDSIZE==kidSize.height)
@ -1252,17 +1264,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
maxSize.height = kidMaxSize.height;
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
// Our first child (**blush**)
mFirstChild = kidFrame;
SetFirstContentOffset(kidFrame);
if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@
}
prevKidFrame = kidFrame;
mChildCount++;
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
@ -2031,6 +2033,15 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidFrame);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -2038,6 +2049,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
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?
@ -2057,8 +2069,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
// apply the bottom margin when we hit the next child (or
// finish).
//aState.y += topMargin;
nsRect kidRect (0, 0, kidSize.width, kidSize.height);
kidRect.y += aState.y;
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 ||
@ -2068,15 +2079,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?

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

@ -637,7 +637,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex
if ((kidFrame == mFirstChild) || (aState.availSize.height > 0)) {
// Reflow the child into the available space
kidFrame->WillReflow(*aPresContext);
// XXX Set the origin...
kidFrame->MoveTo(kidMargin.left, aState.y);
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ?
aState.innerTableMaxSize : aState.availSize,
eReflowReason_Resize);
@ -662,9 +662,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex
// Place the child after taking into account it's margin
aState.y += topMargin;
nsRect kidRect (0, 0, kidSize.width, kidSize.height);
kidRect.x += kidMargin.left;
kidRect.y += aState.y;
nsRect kidRect (kidMargin.left, aState.y, kidSize.width, kidSize.height);
PlaceChild(aState, kidFrame, kidRect, aMaxElementSize, kidMaxElementSize);
if (bottomMargin < 0) {
aState.prevMaxNegBottomMargin = -bottomMargin;

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

@ -943,17 +943,40 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
maxTopMargin = PR_MAX(margin.top,maxTopMargin);
maxBottomMargin = PR_MAX(margin.bottom,maxBottomMargin);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Compute the origin for the child frame
aState.x = margin.left;
// if we're constrained, compute the x offset where the cell should be put
if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width)
{
// Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
for (PRInt32 colIndex=0; colIndex<cellColIndex; colIndex++)
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
}
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics desiredSize(pKidMaxElementSize);
desiredSize.width=desiredSize.height=desiredSize.ascent=desiredSize.descent=0;
nsReflowStatus status;
// Inform the child it's being reflowed
kidFrame->WillReflow(*aPresContext);
kidFrame->MoveTo(aState.x, topMargin);
if (NS_UNCONSTRAINEDSIZE == aState.availSize.width)
{
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
eReflowReason_Initial);
// Reflow the child into the available space
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize);
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
@ -969,7 +992,6 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
NS_ASSERTION(0<availWidth, "illegal width for this column");
kidAvailSize.width = availWidth;
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize, eReflowReason_Initial);
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
}
if (nsnull!=pKidMaxElementSize)
@ -999,28 +1021,11 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
break;
}
aState.x = margin.left;
// if we're constrained, compute the x offset where the cell should be put
if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width)
{
// Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
for (PRInt32 colIndex=0; colIndex<cellColIndex; colIndex++)
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
}
// Place the child
nsRect kidRect (aState.x, topMargin, desiredSize.width, desiredSize.height);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?

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

@ -766,6 +766,15 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidFrame);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -773,6 +782,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Initial);
kidFrame->WillReflow(*aPresContext);
kidFrame->MoveTo(0, aState.y);
nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize,
kidReflowState);
@ -793,15 +803,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidRect.y += aState.y;
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?

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

@ -322,6 +322,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
nsReflowState kidReflowState(mFirstChild, aReflowState, availSize);
mFirstChild->WillReflow(*aPresContext);
mFirstChild->MoveTo(leftInset, topInset);
aStatus = ReflowChild(mFirstChild, aPresContext, kidSize, kidReflowState);
if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT)

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

@ -1223,12 +1223,27 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
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(kidFrame);
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.
@ -1236,9 +1251,6 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
printf ("%p: reflow of row group returned desired=%d,%d, max-element=%d,%d\n",
this, kidSize.width, kidSize.height, kidMaxSize.width, kidMaxSize.height);
}
PRInt32 yCoord = y;
if (NS_UNCONSTRAINEDSIZE!=yCoord)
yCoord+= topInset;
kidFrame->SetRect(nsRect(leftInset, yCoord,
kidSize.width, kidSize.height));
if (NS_UNCONSTRAINEDSIZE==kidSize.height)
@ -1252,17 +1264,7 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
maxSize.height = kidMaxSize.height;
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
// Our first child (**blush**)
mFirstChild = kidFrame;
SetFirstContentOffset(kidFrame);
if (gsDebug) printf("INNER: set first content offset to %d\n", GetFirstContentOffset()); //@@@
}
prevKidFrame = kidFrame;
mChildCount++;
if (NS_FRAME_IS_NOT_COMPLETE(result)) {
// If the child didn't finish layout then it means that it used
@ -2031,6 +2033,15 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidFrame);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -2038,6 +2049,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
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?
@ -2057,8 +2069,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
// apply the bottom margin when we hit the next child (or
// finish).
//aState.y += topMargin;
nsRect kidRect (0, 0, kidSize.width, kidSize.height);
kidRect.y += aState.y;
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 ||
@ -2068,15 +2079,7 @@ nsTableFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?

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

@ -637,7 +637,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex
if ((kidFrame == mFirstChild) || (aState.availSize.height > 0)) {
// Reflow the child into the available space
kidFrame->WillReflow(*aPresContext);
// XXX Set the origin...
kidFrame->MoveTo(kidMargin.left, aState.y);
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidFrame == mInnerTableFrame ?
aState.innerTableMaxSize : aState.availSize,
eReflowReason_Resize);
@ -662,9 +662,7 @@ PRBool nsTableOuterFrame::ReflowMappedChildren( nsIPresContext* aPresContex
// Place the child after taking into account it's margin
aState.y += topMargin;
nsRect kidRect (0, 0, kidSize.width, kidSize.height);
kidRect.x += kidMargin.left;
kidRect.y += aState.y;
nsRect kidRect (kidMargin.left, aState.y, kidSize.width, kidSize.height);
PlaceChild(aState, kidFrame, kidRect, aMaxElementSize, kidMaxElementSize);
if (bottomMargin < 0) {
aState.prevMaxNegBottomMargin = -bottomMargin;

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

@ -943,17 +943,40 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
maxTopMargin = PR_MAX(margin.top,maxTopMargin);
maxBottomMargin = PR_MAX(margin.bottom,maxBottomMargin);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Compute the origin for the child frame
aState.x = margin.left;
// if we're constrained, compute the x offset where the cell should be put
if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width)
{
// Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
for (PRInt32 colIndex=0; colIndex<cellColIndex; colIndex++)
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
}
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics desiredSize(pKidMaxElementSize);
desiredSize.width=desiredSize.height=desiredSize.ascent=desiredSize.descent=0;
nsReflowStatus status;
// Inform the child it's being reflowed
kidFrame->WillReflow(*aPresContext);
kidFrame->MoveTo(aState.x, topMargin);
if (NS_UNCONSTRAINEDSIZE == aState.availSize.width)
{
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize,
eReflowReason_Initial);
// Reflow the child into the available space
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
nsCellLayoutData *kidLayoutData = new nsCellLayoutData((nsTableCellFrame *)kidFrame, &desiredSize, pKidMaxElementSize);
((nsTableCellFrame *)kidFrame)->SetCellLayoutData(kidLayoutData);
@ -969,7 +992,6 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
NS_ASSERTION(0<availWidth, "illegal width for this column");
kidAvailSize.width = availWidth;
nsReflowState kidReflowState(kidFrame, aState.reflowState, kidAvailSize, eReflowReason_Initial);
kidFrame->WillReflow(*aPresContext);
status = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState);
}
if (nsnull!=pKidMaxElementSize)
@ -999,28 +1021,11 @@ nsTableRowFrame::ReflowUnmappedChildren( nsIPresContext* aPresContext,
break;
}
aState.x = margin.left;
// if we're constrained, compute the x offset where the cell should be put
if (NS_UNCONSTRAINEDSIZE!=aState.availSize.width)
{
// Adjust the running x-offset, taking into account intruders (cells from prior rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
for (PRInt32 colIndex=0; colIndex<cellColIndex; colIndex++)
aState.x += aState.tableFrame->GetColumnWidth(colIndex);
}
// Place the child
nsRect kidRect (aState.x, topMargin, desiredSize.width, desiredSize.height);
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?

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

@ -766,6 +766,15 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidFrame);
}
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
mChildCount++;
// Try to reflow the child into the available space. It might not
// fit or might need continuing.
nsReflowMetrics kidSize(pKidMaxElementSize);
@ -773,6 +782,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
nsReflowState kidReflowState(kidFrame, aState.reflowState, aState.availSize,
eReflowReason_Initial);
kidFrame->WillReflow(*aPresContext);
kidFrame->MoveTo(0, aState.y);
nsReflowStatus status = ReflowChild(kidFrame,aPresContext, kidSize,
kidReflowState);
@ -793,15 +803,7 @@ nsTableRowGroupFrame::ReflowUnmappedChildren(nsIPresContext* aPresContext,
kidRect.y += aState.y;
PlaceChild(aPresContext, aState, kidFrame, kidRect, aMaxElementSize, *pKidMaxElementSize);
// Link child frame into the list of children
if (nsnull != prevKidFrame) {
prevKidFrame->SetNextSibling(kidFrame);
} else {
mFirstChild = kidFrame; // our first child
SetFirstContentOffset(kidFrame);
}
prevKidFrame = kidFrame;
mChildCount++;
kidIndex++;
// Did the child complete?