bug 77982 - consider border/padding on a cell that goes from empty to non-empty during an incremental reflow. sr=attinasi, r=alexsavulov

This commit is contained in:
karnaze%netscape.com 2001-11-06 23:05:32 +00:00
Родитель f007b04e93
Коммит d98959d0cd
4 изменённых файлов: 30 добавлений и 4 удалений

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

@ -738,6 +738,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (NS_UNCONSTRAINEDSIZE==aReflowState.availableWidth)
pMaxElementSize = &maxElementSize;
PRBool contentEmptyBeforeReflow = GetContentEmpty();
/* XXX: remove tableFrame when border-collapse inherits */
nsTableFrame* tableFrame=nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);
@ -746,7 +747,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsMargin borderPadding = aReflowState.mComputedPadding;
nsMargin border;
GetCellBorder(border, tableFrame);
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !GetContentEmpty()) {
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !contentEmptyBeforeReflow) {
borderPadding += border;
}
@ -861,6 +862,14 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
}
else {
SetContentEmpty(PR_FALSE);
if ((eReflowReason_Incremental == aReflowState.reason) && contentEmptyBeforeReflow) {
// need to consider borders, since they were factored out above
leftInset += border.left;
rightInset += border.right;
topInset += border.top;
bottomInset += border.bottom;
kidOrigin.MoveTo(leftInset, topInset);
}
}
const nsStylePosition* pos;

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

@ -785,6 +785,7 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
@ -792,9 +793,12 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
aColAvailWidth += aCellSpacingX;
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
// for a cell with a colspan > 1, use its fix width (if set) as the avail width

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

@ -738,6 +738,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (NS_UNCONSTRAINEDSIZE==aReflowState.availableWidth)
pMaxElementSize = &maxElementSize;
PRBool contentEmptyBeforeReflow = GetContentEmpty();
/* XXX: remove tableFrame when border-collapse inherits */
nsTableFrame* tableFrame=nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);
@ -746,7 +747,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsMargin borderPadding = aReflowState.mComputedPadding;
nsMargin border;
GetCellBorder(border, tableFrame);
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !GetContentEmpty()) {
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !contentEmptyBeforeReflow) {
borderPadding += border;
}
@ -861,6 +862,14 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
}
else {
SetContentEmpty(PR_FALSE);
if ((eReflowReason_Incremental == aReflowState.reason) && contentEmptyBeforeReflow) {
// need to consider borders, since they were factored out above
leftInset += border.left;
rightInset += border.right;
topInset += border.top;
bottomInset += border.bottom;
kidOrigin.MoveTo(leftInset, topInset);
}
}
const nsStylePosition* pos;

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

@ -785,6 +785,7 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
@ -792,9 +793,12 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
aColAvailWidth += aCellSpacingX;
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
// for a cell with a colspan > 1, use its fix width (if set) as the avail width