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.

git-svn-id: svn://10.0.0.236/trunk@128780 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
karnaze%netscape.com 2002-09-04 00:10:43 +00:00
parent 015d412b98
commit f7e67af4b3
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
// 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;
}
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) {
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
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
// 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;
}
if (eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) {
if ((eStyleUnit_Auto != mStyleMargin->mMargin.GetRightUnit()) &&
(eStyleUnit_Null != mStyleMargin->mMargin.GetRightUnit())) {
m->width += maxElemMargin.right;
}

View File

@ -771,24 +771,31 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aCellAvailWidth)
{
aColAvailWidth = aCellAvailWidth = 0;
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 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;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
nsFrameState frameState;
aCellFrame.GetFrameState(&frameState);

View File

@ -771,24 +771,31 @@ CalcAvailWidth(nsTableFrame& aTableFrame,
nscoord& aCellAvailWidth)
{
aColAvailWidth = aCellAvailWidth = 0;
PRInt32 colIndex;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 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;
aCellFrame.GetColIndex(colIndex);
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
nscoord cellSpacing = 0;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
if (colWidth > 0) {
aColAvailWidth += colWidth;
}
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
cellSpacing += aCellSpacingX;
}
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
}
if (aColAvailWidth > 0) {
aColAvailWidth += cellSpacing;
}
aCellAvailWidth = aColAvailWidth;
nsFrameState frameState;
aCellFrame.GetFrameState(&frameState);