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

View File

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