bug 154780 - Revised bernd's patch. treat null unit margins as auto. leave the cell avail width at 0 if a strategy init will occur. sr=kin, r=alexsavulov.

This commit is contained in:
karnaze@netscape.com
2002-09-04 00:10:43 +00:00
parent 5f5899bd7f
commit 76e885f9f7
4 changed files with 52 additions and 34 deletions

View File

@@ -796,10 +796,12 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
// Do not allow auto margins to impact the max-element size // Do not allow auto margins to impact the max-element size
// since they are springy and don't really count! // since they are springy and don't really count!
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) { if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetLeftUnit())) {
m->width += maxElemMargin.left; m->width += maxElemMargin.left;
} }
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) { if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
m->width += maxElemMargin.right; m->width += maxElemMargin.right;
} }

View File

@@ -796,10 +796,12 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
// Do not allow auto margins to impact the max-element size // Do not allow auto margins to impact the max-element size
// since they are springy and don't really count! // since they are springy and don't really count!
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) { if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetLeftUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetLeftUnit())) {
m->width += maxElemMargin.left; m->width += maxElemMargin.left;
} }
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) { if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
m->width += maxElemMargin.right; m->width += maxElemMargin.right;
} }

View File

@@ -771,24 +771,31 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aCellAvailWidth) nscoord& aCellAvailWidth)
{ {
aColAvailWidth = aCellAvailWidth = 0; aColAvailWidth = aCellAvailWidth = 0;
PRInt32 colIndex; // If the table will intialize the strategy, leave the avail width at
aCellFrame.GetColIndex(colIndex); // 0 (at this point) in case the cell contains a % width frame. A constrained avail
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame); // width forces a computed width, and % width frames inside the cell base their sizes on it.
nscoord cellSpacing = 0; // This can happen during an incremental reflow when multiple commands get coalesced
// at the row.
if (!aTableFrame.NeedStrategyInit()) {
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) { for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX); nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) { if (colWidth > 0) {
aColAvailWidth += colWidth; aColAvailWidth += colWidth;
} }
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) { if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX; cellSpacing += aCellSpacingX;
}
} }
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
} }
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
nsFrameState frameState; nsFrameState frameState;
aCellFrame.GetFrameState(&frameState); aCellFrame.GetFrameState(&frameState);

View File

@@ -771,24 +771,31 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aCellAvailWidth) nscoord& aCellAvailWidth)
{ {
aColAvailWidth = aCellAvailWidth = 0; aColAvailWidth = aCellAvailWidth = 0;
PRInt32 colIndex; // If the table will intialize the strategy, leave the avail width at
aCellFrame.GetColIndex(colIndex); // 0 (at this point) in case the cell contains a % width frame. A constrained avail
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame); // width forces a computed width, and % width frames inside the cell base their sizes on it.
nscoord cellSpacing = 0; // This can happen during an incremental reflow when multiple commands get coalesced
// at the row.
if (!aTableFrame.NeedStrategyInit()) {
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) { for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX); nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) { if (colWidth > 0) {
aColAvailWidth += colWidth; aColAvailWidth += colWidth;
} }
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) { if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX; cellSpacing += aCellSpacingX;
}
} }
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
} }
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
nsFrameState frameState; nsFrameState frameState;
aCellFrame.GetFrameState(&frameState); aCellFrame.GetFrameState(&frameState);