Fixed problems with incremental reflow code that wasn't checking the display

type to tell whether the frame was a row frame. This was causing problems on
www.cnn.com, because for some odd reason there is a text frame inserted in the
row group. That caused us to incorrectly calculate the max-element-size
This commit is contained in:
troy%netscape.com 2000-01-15 05:39:58 +00:00
parent 433f25e9a6
commit 8a7719fa46
2 changed files with 52 additions and 28 deletions

View File

@ -814,10 +814,14 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContex
for (aKidFrame->GetNextSibling(&kidFrame); kidFrame; kidFrame->GetNextSibling(&kidFrame)) {
// Update the max element size
if (aMaxElementSize) {
nsSize kidMaxElementSize;
((nsTableRowFrame*)kidFrame)->GetMaxElementSize(kidMaxElementSize);
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
const nsStyleDisplay *display;
aKidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
nsSize kidMaxElementSize;
((nsTableRowFrame*)kidFrame)->GetMaxElementSize(kidMaxElementSize);
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
}
}
// Move the frame if we need to
@ -828,7 +832,6 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContex
kidFrame->GetOrigin(origin);
origin.y += aDeltaY;
kidFrame->WillReflow(aPresContext);
kidFrame->MoveTo(aPresContext, origin.x, origin.y);
}
@ -924,6 +927,11 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
} else {
// See whether the row frame has cells that span into it
const nsStyleDisplay *display;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW != display->mDisplay) {
NS_ASSERTION(PR_FALSE, "uh oh, not a row frame...");
}
PRInt32 rowIndex = ((nsTableRowFrame*)rowFrame)->GetRowIndex();
PRInt32 colCount = aTableFrame->GetColCount();
nsTableCellFrame* prevCellFrame = nsnull;
@ -1389,15 +1397,19 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
// Update the maximum element size
if (aMaxElementSize) {
// Get the row frame's cached max element size
nsSize kidMaxElementSize;
((nsTableRowFrame*)frame)->GetMaxElementSize(kidMaxElementSize);
if (aReflowState.firstRow) {
aMaxElementSize->width = kidMaxElementSize.width;
aMaxElementSize->height = kidMaxElementSize.height;
} else {
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
const nsStyleDisplay *display;
frame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
// Get the row frame's cached max element size
nsSize kidMaxElementSize;
((nsTableRowFrame*)frame)->GetMaxElementSize(kidMaxElementSize);
if (aReflowState.firstRow) {
aMaxElementSize->width = kidMaxElementSize.width;
aMaxElementSize->height = kidMaxElementSize.height;
} else {
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
}
}
}

View File

@ -814,10 +814,14 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContex
for (aKidFrame->GetNextSibling(&kidFrame); kidFrame; kidFrame->GetNextSibling(&kidFrame)) {
// Update the max element size
if (aMaxElementSize) {
nsSize kidMaxElementSize;
((nsTableRowFrame*)kidFrame)->GetMaxElementSize(kidMaxElementSize);
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
const nsStyleDisplay *display;
aKidFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
nsSize kidMaxElementSize;
((nsTableRowFrame*)kidFrame)->GetMaxElementSize(kidMaxElementSize);
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
}
}
// Move the frame if we need to
@ -828,7 +832,6 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext* aPresContex
kidFrame->GetOrigin(origin);
origin.y += aDeltaY;
kidFrame->WillReflow(aPresContext);
kidFrame->MoveTo(aPresContext, origin.x, origin.y);
}
@ -924,6 +927,11 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
} else {
// See whether the row frame has cells that span into it
const nsStyleDisplay *display;
rowFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW != display->mDisplay) {
NS_ASSERTION(PR_FALSE, "uh oh, not a row frame...");
}
PRInt32 rowIndex = ((nsTableRowFrame*)rowFrame)->GetRowIndex();
PRInt32 colCount = aTableFrame->GetColCount();
nsTableCellFrame* prevCellFrame = nsnull;
@ -1389,15 +1397,19 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
// Update the maximum element size
if (aMaxElementSize) {
// Get the row frame's cached max element size
nsSize kidMaxElementSize;
((nsTableRowFrame*)frame)->GetMaxElementSize(kidMaxElementSize);
if (aReflowState.firstRow) {
aMaxElementSize->width = kidMaxElementSize.width;
aMaxElementSize->height = kidMaxElementSize.height;
} else {
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
const nsStyleDisplay *display;
frame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
if (NS_STYLE_DISPLAY_TABLE_ROW == display->mDisplay) {
// Get the row frame's cached max element size
nsSize kidMaxElementSize;
((nsTableRowFrame*)frame)->GetMaxElementSize(kidMaxElementSize);
if (aReflowState.firstRow) {
aMaxElementSize->width = kidMaxElementSize.width;
aMaxElementSize->height = kidMaxElementSize.height;
} else {
aMaxElementSize->width = PR_MAX(aMaxElementSize->width, kidMaxElementSize.width);
}
}
}