fixed some nested table layout problems
git-svn-id: svn://10.0.0.236/trunk@15463 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
2428418e65
commit
826b9af0fe
@ -184,6 +184,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext *aTableStyl
|
||||
|
||||
nscoord specifiedTableWidth = 0; // not cached as a data member because it can vary depending on aMaxWidth
|
||||
PRBool tableIsAutoWidth = nsTableFrame::TableIsAutoWidth(mTableFrame, aTableStyle, aReflowState, specifiedTableWidth);
|
||||
// HACK! Fix TableIsAutoWidth to return the right width
|
||||
if (specifiedTableWidth>aMaxWidth)
|
||||
specifiedTableWidth = aMaxWidth;
|
||||
if (NS_UNCONSTRAINEDSIZE==specifiedTableWidth)
|
||||
{
|
||||
specifiedTableWidth=0;
|
||||
@ -2030,7 +2033,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
|
||||
}
|
||||
|
||||
// second, fix up tables where column width attributes give us a table that is too wide or too narrow
|
||||
nscoord computedWidth=0;
|
||||
nscoord computedWidth=colInset;
|
||||
for (PRInt32 i=0; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
|
||||
@ -3379,6 +3379,10 @@ PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(nsnull!=mColumnWidths, "illegal state");
|
||||
// can't assert on IsColumnWidthsSet because we might want to call this
|
||||
// while we're in the process of setting column widths, and we don't
|
||||
// want to complicate IsColumnWidthsSet by making it a multiple state return value
|
||||
// (like eNotSet, eSetting, eIsSet)
|
||||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(nsnull!=mCellMap, "no cell map");
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
@ -3793,13 +3797,17 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nsnull!=((nsTableFrame*)(rs->frame))->mColumnWidths)
|
||||
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
|
||||
{
|
||||
parentWidth=0;
|
||||
PRInt32 colIndex = lastCellFrame->GetColIndex();
|
||||
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
|
||||
for (PRInt32 i = 0; i<colSpan; i++)
|
||||
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
|
||||
// factor in the cell
|
||||
lastCellFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct *&)spacing);
|
||||
spacing->CalcBorderPaddingFor(lastCellFrame, borderPadding);
|
||||
parentWidth -= (borderPadding.right + borderPadding.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3838,7 +3846,6 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
|
||||
|
||||
rs = rs->parentReflowState;
|
||||
}
|
||||
|
||||
return parentWidth;
|
||||
}
|
||||
|
||||
|
||||
@ -184,6 +184,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext *aTableStyl
|
||||
|
||||
nscoord specifiedTableWidth = 0; // not cached as a data member because it can vary depending on aMaxWidth
|
||||
PRBool tableIsAutoWidth = nsTableFrame::TableIsAutoWidth(mTableFrame, aTableStyle, aReflowState, specifiedTableWidth);
|
||||
// HACK! Fix TableIsAutoWidth to return the right width
|
||||
if (specifiedTableWidth>aMaxWidth)
|
||||
specifiedTableWidth = aMaxWidth;
|
||||
if (NS_UNCONSTRAINEDSIZE==specifiedTableWidth)
|
||||
{
|
||||
specifiedTableWidth=0;
|
||||
@ -2030,7 +2033,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
|
||||
}
|
||||
|
||||
// second, fix up tables where column width attributes give us a table that is too wide or too narrow
|
||||
nscoord computedWidth=0;
|
||||
nscoord computedWidth=colInset;
|
||||
for (PRInt32 i=0; i<mNumCols; i++) {
|
||||
computedWidth += mTableFrame->GetColumnWidth(i) + colInset;
|
||||
}
|
||||
|
||||
@ -3379,6 +3379,10 @@ PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(nsnull!=mColumnWidths, "illegal state");
|
||||
// can't assert on IsColumnWidthsSet because we might want to call this
|
||||
// while we're in the process of setting column widths, and we don't
|
||||
// want to complicate IsColumnWidthsSet by making it a multiple state return value
|
||||
// (like eNotSet, eSetting, eIsSet)
|
||||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(nsnull!=mCellMap, "no cell map");
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
@ -3793,13 +3797,17 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nsnull!=((nsTableFrame*)(rs->frame))->mColumnWidths)
|
||||
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
|
||||
{
|
||||
parentWidth=0;
|
||||
PRInt32 colIndex = lastCellFrame->GetColIndex();
|
||||
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
|
||||
for (PRInt32 i = 0; i<colSpan; i++)
|
||||
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
|
||||
// factor in the cell
|
||||
lastCellFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct *&)spacing);
|
||||
spacing->CalcBorderPaddingFor(lastCellFrame, borderPadding);
|
||||
parentWidth -= (borderPadding.right + borderPadding.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3838,7 +3846,6 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
|
||||
|
||||
rs = rs->parentReflowState;
|
||||
}
|
||||
|
||||
return parentWidth;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user