fix flawed reflow logic for empty table cells bug 226637 r/sr=bzbarsky

This commit is contained in:
bmlk%gmx.de 2004-10-29 17:31:53 +00:00
Родитель 709c9bc234
Коммит 0422c5d7a6
4 изменённых файлов: 32 добавлений и 2240 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -687,7 +687,7 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aColAvailWidth,
nscoord& aCellAvailWidth)
{
aColAvailWidth = aCellAvailWidth = 0;
aColAvailWidth = aCellAvailWidth = NS_UNCONSTRAINEDSIZE;
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
@ -695,14 +695,19 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
if (colWidth != WIDTH_NOT_SET) {
if (NS_UNCONSTRAINEDSIZE == aColAvailWidth) {
aColAvailWidth = colWidth;
}
else {
aColAvailWidth += colWidth;
}
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
@ -721,7 +726,11 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
aPixelToTwips, &aCellFrame);
}
nscoord fixWidth = cellPosition->mWidth.GetCoordValue() + borderPadding.left + borderPadding.right;
aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
} else {
aCellAvailWidth = fixWidth;
}
}
}
}
@ -884,8 +893,6 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
nscoord availColWidth, availCellWidth;
CalcAvailWidth(aTableFrame, GetComputedWidth(aReflowState, aTableFrame), p2t,
*cellFrame, cellSpacingX, availColWidth, availCellWidth);
if (0 == availColWidth) availColWidth = NS_UNCONSTRAINEDSIZE;
if (0 == availCellWidth) availCellWidth = NS_UNCONSTRAINEDSIZE;
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;

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

@ -1928,11 +1928,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
PRBool needUpdateMetrics = PR_TRUE;
PRBool isPctWidth;
IsAutoWidth(*mInnerTableFrame, &isPctWidth);
if ((eReflowReason_Resize == aOuterRS.reason) &&
(aOuterRS.availableWidth == mPriorAvailWidth) &&
!aPresContext->IsPaginated() &&
!::IsPctHeight(mInnerTableFrame)) {
!::IsPctHeight(mInnerTableFrame) &&
!isPctWidth) {
// don't do much if we are resize reflowed exactly like last time
aDesiredSize.width = mRect.width;
aDesiredSize.height = mRect.height;

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

@ -687,7 +687,7 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aColAvailWidth,
nscoord& aCellAvailWidth)
{
aColAvailWidth = aCellAvailWidth = 0;
aColAvailWidth = aCellAvailWidth = NS_UNCONSTRAINEDSIZE;
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
@ -695,14 +695,19 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
if (colWidth != WIDTH_NOT_SET) {
if (NS_UNCONSTRAINEDSIZE == aColAvailWidth) {
aColAvailWidth = colWidth;
}
else {
aColAvailWidth += colWidth;
}
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
@ -721,7 +726,11 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
aPixelToTwips, &aCellFrame);
}
nscoord fixWidth = cellPosition->mWidth.GetCoordValue() + borderPadding.left + borderPadding.right;
aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
} else {
aCellAvailWidth = fixWidth;
}
}
}
}
@ -884,8 +893,6 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
nscoord availColWidth, availCellWidth;
CalcAvailWidth(aTableFrame, GetComputedWidth(aReflowState, aTableFrame), p2t,
*cellFrame, cellSpacingX, availColWidth, availCellWidth);
if (0 == availColWidth) availColWidth = NS_UNCONSTRAINEDSIZE;
if (0 == availCellWidth) availCellWidth = NS_UNCONSTRAINEDSIZE;
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;