diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index e5fb3ceca28..ebf4b12b0bb 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -212,8 +212,10 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont nscoord maxWidth = mTableFrame->CalcBorderBoxWidth(aReflowState); if (NS_UNCONSTRAINEDSIZE == maxWidth) { maxWidth = PR_MIN(maxWidth, aReflowState.availableWidth); - NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); - return PR_FALSE; + if (NS_UNCONSTRAINEDSIZE == maxWidth) { + NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); + return PR_FALSE; + } } // initialize the col percent and cell percent values to 0. ResetPctValues(mTableFrame, numCols); @@ -366,7 +368,7 @@ nscoord GetColWidth(nsTableColFrame* aColFrame, } } -// Allocate aWidthType values to all cols available in aIsAllocated +// Allocate aWidthType values to all cols available in aAllocTypes void BasicTableLayoutStrategy::AllocateFully(nscoord& aTotalAllocated, PRInt32* aAllocTypes, PRInt32 aWidthType) @@ -500,6 +502,7 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctColspans, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif PRInt32 numCols = mTableFrame->GetColCount(); + PRInt32 numEffCols = mTableFrame->GetEffectiveColCount(); // zero out prior ADJ values PRInt32 colX; @@ -515,8 +518,8 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR // Adjust the cols that each cell spans if necessary. Iterate backwards // so that nested and/or overlaping col spans handle the inner ones first, // ensuring more accurated calculations. - //if more than one colspan originate in one column, resort the access to - //the rows so that the inner colspans are handled first + // if more than one colspan originate in one column, resort the access to + // the rows so that the inner colspans are handled first PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32* numColSpans = new PRInt32[numRows]; if(!numColSpans) @@ -526,41 +529,34 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR delete [] numColSpans; return; } - for (colX = numCols - 1; colX >= 0; colX--) { + for (colX = numEffCols - 1; colX >= 0; colX--) { //loop only over effective columns PRInt32 rowX; for (rowX = 0; rowX < numRows; rowX++) { numColSpans[rowX] = 0; rowIndices[rowX] = 0; } - PRInt32 biggestColspan=0; + PRInt32 index = 0; for (rowX = 0; rowX < numRows; rowX++) { PRBool originates; PRInt32 colSpan; - nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); if (!originates || (1 == colSpan)) { continue; } - numColSpans[rowX]=colSpan; - if(colSpan > biggestColspan) - biggestColspan = colSpan; + numColSpans[index] = colSpan; + rowIndices[index] = rowX; + index++; } - PRInt32 index = 0; - for( PRInt32 j=2;j <= biggestColspan;j++) { - for( PRInt32 k = 0; k < numRows; k++) { - if( numColSpans[k] == j) { - rowIndices[index]=k; - index++; - } - } - } + RowSort(rowIndices, numColSpans, index); // do the row sorting for (PRInt32 i = 0; i < index; i++) { PRBool originates; PRInt32 colSpan; - PRInt32 rowX= rowIndices[i]; + rowX = rowIndices[i]; nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); - if (!originates || (1 == colSpan)) { + if (!cellFrame || !originates || (1 == colSpan)) { continue; } + colSpan = PR_MIN(colSpan, numEffCols - colX); // set MIN_ADJ, DES_ADJ, FIX_ADJ for (PRInt32 widthX = 0; widthX < NUM_MAJOR_WIDTHS; widthX++) { nscoord cellWidth = 0; @@ -1516,16 +1512,45 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow // For each col, consider the cells originating in it with colspans > 1. // Adjust the cols that each cell spans if necessary. - for (colX = 0; colX < numEffCols; colX++) { + // if more than one colspan originate in one column, resort the access to + // the rows so that the inner colspans are handled first + PRInt32* numColSpans = new PRInt32[numRows]; + if(!numColSpans) + return basis; + PRInt32* rowIndices = new PRInt32[numRows]; + if(!rowIndices) { + delete numColSpans; + return basis; + } + for (colX = numEffCols - 1; colX >= 0; colX--) { // loop only over effective columns + PRInt32 rowX; + for (rowX = 0; rowX < numRows; rowX++) { + numColSpans[rowX] = 0; + rowIndices[rowX] = 0; + } + PRInt32 index = 0; for (rowX = 0; rowX < numRows; rowX++) { PRBool originates; PRInt32 colSpan; - nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); if (!originates || (1 == colSpan)) { continue; } + numColSpans[index] = colSpan; + rowIndices[index] = rowX; + index++; + } + RowSort(rowIndices, numColSpans, index); // do the sorting + for (PRInt32 i = 0; i < index; i++) { + PRBool originates; + PRInt32 colSpan; + rowX = rowIndices[i]; + nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + if (!cellFrame || !originates || (1 == colSpan)) { + continue; + } colSpan = PR_MIN(colSpan,numEffCols-colX); - nscoord cellPctWidth = WIDTH_NOT_SET; + nscoord cellPctWidth = WIDTH_NOT_SET; // see if the cell has a style percentage width specified const nsStylePosition* cellPosition; cellFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)cellPosition); @@ -1544,7 +1569,11 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (cellPctWidth > 0) { nscoord spanCellSpacing = 0; nscoord spanTotal = 0; - nscoord colPctWidthTotal = 0; + nscoord spanTotalNoPctAdj = 0; + nscoord colPctWidthTotal = 0; // accumulate the PCT width + nscoord colPctAdjTotal = 0; // accumulate the PCT_ADJ width or the max of PCT_ADJ and PCT width if a + // PCT width is specified + PRBool canSkipPctAdj = PR_FALSE; // accumulate the spanTotal as the max of MIN, DES, FIX, PCT PRInt32 spanX; for (spanX = 0; spanX < colSpan; spanX++) { @@ -1553,12 +1582,19 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow nscoord colPctWidth = colFrame->GetWidth(PCT); if (colPctWidth > 0) { // skip pct cols colPctWidthTotal += colPctWidth; + colPctAdjTotal += PR_MAX(colFrame->GetWidth(PCT_ADJ), colPctWidth); continue; } + colPctAdjTotal += PR_MAX(colFrame->GetWidth(PCT_ADJ), 0); nscoord colWidth = PR_MAX(colFrame->GetMinWidth(), colFrame->GetFixWidth()); colWidth = PR_MAX(colWidth, colFrame->GetDesWidth()); // XXX check this //colWidth = PR_MAX(colWidth, colFrame->GetPctWidth()); spanTotal += colWidth; + if (colFrame->GetWidth(PCT_ADJ) <= 0) { // if we have a cell that is neither PCT or PCT_ADJ we have + // other places where we can drop the width + canSkipPctAdj = PR_TRUE; + spanTotalNoPctAdj += colWidth; + } if ((spanX > 0) && (mTableFrame->GetNumCellsOriginatingInCol(colX + spanX) > 0)) { spanCellSpacing += spacingX; } @@ -1567,20 +1603,30 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (cellPctWidth <= 0) { continue; } - if (colPctWidthTotal < cellPctWidth) { + spanTotal = canSkipPctAdj ? spanTotalNoPctAdj: spanTotal; // if we can skip the PCT_ADJ ignore theire width + + colPctWidthTotal = canSkipPctAdj ? colPctAdjTotal: colPctWidthTotal; + + if ((PR_MAX(colPctWidthTotal, colPctAdjTotal)+ spanCellSpacing) < cellPctWidth) { + // we have something to distribute ... // record the percent contributions for the spanned cols - for (spanX = 0; spanX < colSpan; spanX++) { + PRInt32 usedColumns = colSpan; + for (spanX = colSpan-1; spanX >= 0; spanX--) { nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX); if (!colFrame) continue; - if (colFrame->GetWidth(PCT) > 0) { // skip pct cols + if ((colFrame->GetWidth(PCT) > 0) || (canSkipPctAdj && (colFrame->GetWidth(PCT_ADJ) > 0))) { + // dont use pct cols or if we can skip the pct adj event do not take the PCT_ADJ cols + usedColumns--; continue; - } + } // count the pieces + if (usedColumns == 0) + usedColumns = 1; // avoid division by 0 later nscoord minWidth = colFrame->GetMinWidth(); nscoord colWidth = PR_MAX(minWidth, colFrame->GetFixWidth()); colWidth = PR_MAX(colWidth, colFrame->GetDesWidth()); // XXX check this float avail = (float)PR_MAX(cellPctWidth - colPctWidthTotal, 0); float colPctAdj = (0 == spanTotal) - ? avail / ((float) colSpan) / ((float)basis) + ? avail / ((float) usedColumns) / ((float)basis) : (avail / (float)basis) * (((float)colWidth) / (float)spanTotal); if (colPctAdj > 0) { nscoord colPctAdjWidth = colFrame->GetWidth(PCT_ADJ); @@ -1590,18 +1636,24 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (newColPctAdjWidth > colFrame->GetWidth(PCT)) { colFrame->SetWidth(PCT_ADJ, newColPctAdjWidth); colFrame->SetConstrainingCell(cellFrame); + if(0 != basis) { // I am paranoid + colPctTotal += NSToCoordRound(100.0f *(newColPctAdjWidth-colPctAdjWidth) / (float)basis); + // accumulate the new distributed percents + } } } + else { + usedColumns--; + colPctWidthTotal += colPctAdjWidth; // accumulate the already distributed percents + } } } } } } // end for (rowX .. - nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX); - if (!colFrame) continue; - colPctTotal += NSToCoordRound(100.0f * (float)colFrame->GetWidth(PCT_ADJ) / (float)basis); } // end for (colX .. - + delete [] numColSpans; + delete [] rowIndices; // if the percent total went over 100%, adjustments need to be made to right most cols if (colPctTotal > 100) { ReduceOverSpecifiedPctCols(NSToCoordRound(((float)(colPctTotal - 100)) * 0.01f * (float)basis)); @@ -1632,10 +1684,10 @@ void BasicTableLayoutStrategy::CalculateTotals(PRInt32* aTotalCounts, a0ProportionalCount = 0; nscoord spacingX = mTableFrame->GetCellSpacingX(); - PRInt32 numCols = mTableFrame->GetColCount(); + PRInt32 numEffCols = mTableFrame->GetEffectiveColCount(); PRInt32 colX; - for (colX = 0; colX < numCols; colX++) { + for (colX = 0; colX < numEffCols; colX++) { nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX); if (!colFrame) continue; nscoord minCol = colFrame->GetMinWidth(); @@ -1797,7 +1849,25 @@ AC_Sort(nsColInfo** aColInfo, PRInt32 aNumCols) } } - +void +BasicTableLayoutStrategy::RowSort(PRInt32* aRowIndices, PRInt32* aColSpans, + PRInt32 aIndex) +{ + PRInt32 swapCol, swapRow; + // sort the rows based on the colspan size + for (PRInt32 j = aIndex - 1; j > 0; j--) { + for (PRInt32 i = 0; i < j; i++) { + if (aColSpans[i] > aColSpans[i+1]) { // swap them + swapCol = aColSpans[i]; + swapRow = aRowIndices[i]; + aColSpans[i] = aColSpans[i+1]; + aRowIndices[i] = aRowIndices[i+1]; + aColSpans[i+1] = swapCol; + aRowIndices[i+1] = swapRow; + } + } + } +} // this assumes that the table has set the width for each col to be its min void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth, PRInt32 aWidthType, @@ -1922,57 +1992,6 @@ void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth, AC_Wrapup(mTableFrame, numConstrainedCols, colInfo); } - -PRBool BasicTableLayoutStrategy::IsColumnInList(const PRInt32 colIndex, - PRInt32* colIndexes, - PRInt32 aNumFixedColumns) -{ - PRBool result = PR_FALSE; - for (PRInt32 i = 0; i < aNumFixedColumns; i++) { - if (colIndex == colIndexes[i]) { - result = PR_TRUE; - break; - } - else if (colIndexGetColFrame(aColIndex); - nsStyleCoord colStyleWidth = colFrame->GetStyleWidth(); - switch (colStyleWidth.GetUnit()) { - case eStyleUnit_Coord: - if (0 == colStyleWidth.GetCoordValue()) { - result = PR_TRUE; - } - break; - case eStyleUnit_Percent: - { - // total hack for now for 0% and 1% specifications - // should compare percent to available parent width and see that it is below minimum - // for this column - float percent = colStyleWidth.GetPercentValue(); - if (0.0f == percent || 0.01f == percent) { - result = PR_TRUE; - } - break; - } - case eStyleUnit_Proportional: - if (0 == colStyleWidth.GetIntValue()) { - result = PR_TRUE; - } - - default: - break; - } - - return result; -} #ifdef DEBUG_TABLE_STRATEGY void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) { diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h index c74be043a29..a143342ed92 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * buster@netscape.com */ #ifndef BasicTableLayoutStrategy_h__ @@ -46,7 +47,8 @@ class BasicTableLayoutStrategy : public nsITableLayoutStrategy public: /** Public constructor. - * @paran aFrame the table frame for which this delegate will do layout + * @paran aFrame - the table frame for which this delegate will do layout + * @param aIsNavQuirksMode - honor NN4x table quirks */ BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool aIsNavQuirksMode = PR_TRUE); @@ -56,20 +58,19 @@ public: /** call every time any table thing changes that might effect the width of any column * in the table (content, structure, or style) - * @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool Initialize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState); /** Called during resize reflow to determine the new column widths - * @param aTableStyle - the resolved style for mTableFrame - * @param aReflowState - the reflow state for mTableFrame - * @param aMaxWidth - the computed max width for columns to fit into - */ + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame + */ virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState); - - nscoord GetCOLSAttribute() const; + void Dump(PRInt32 aIndent); protected: @@ -83,8 +84,7 @@ protected: * * @param aMaxWidth - the computed width of the table or * UNCONSTRAINED_SIZE if an auto width table - * @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error - * + * @return PR_TRUE has a pct cell or col, PR_FALSE otherwise */ virtual PRBool AssignNonPctColumnWidths(nsIPresContext* aPresContext, nscoord aComputedWidth, @@ -126,32 +126,95 @@ protected: PRInt32& aLimitType, float aPixelToTwips); + /** + * Determine percentage col widths for each col frame + * @param aReflowState - the reflow state of the table + * @param aBasis - the basis for percent width as computed by CalcPctAdjTableWidth + * @param aTableIsAutoWidth - true if no width specification for the table is available + * @param aPixelToTwips - the number of twips in a pixel. + * @return - the adjusted basis including table border, padding and cell spacing + */ nscoord AssignPctColumnWidths(const nsHTMLReflowState& aReflowState, nscoord aBasis, PRBool aTableIsAutoWidth, float aPixelToTwips); + /** + * Calculate the basis for percent width calculations of the table elements + * @param aReflowState - the reflow state of the table + * @param aAvailWidth - the available width for the table + * @param aPixelToTwips - the number of twips in a pixel. + * @return - the basis for percent calculations + */ nscoord CalcPctAdjTableWidth(const nsHTMLReflowState& aReflowState, nscoord aAvailWidth, float aPixelToTwips); + /** + * Reduce the percent columns by the amount specified in aExcess as the percent width's + * can accumulate to be over 100% + * @param aExcess - reduction amount + */ void ReduceOverSpecifiedPctCols(nscoord aExcess); + /** + * Sort rows by rising colspans, in order to treat the inner colspans first + * the result will be returned in the aRowIndices array. + * @param aRowIndices - array with indices of those rows which have colspans starting in the corresponding column + * @param aColSpans - array with the correspong colspan values + * @param aIndex - number of valid entries in the arrays + */ + void RowSort(PRInt32* aRowIndices, + PRInt32* aColSpans, + PRInt32 aIndex); + + /** + * calculate totals by width type. The logic here is kept in synch with + * that in CanAllocate + * @param aTotalCounts - array with counts for each width type that has determined the aTotalWidths sum + * @param aTotalWidths - array with accumulated widths for each width type + * @param aDupedWidths - (duplicatd) are widths that will be allocated in BalanceColumnWidths before aTotalsWidths + * @param a0ProportionalCount - number of columns with col="0*" constraint + */ void CalculateTotals(PRInt32* aTotalCounts, PRInt32* aTotalWidths, - PRInt32* aMinWidths, + PRInt32* aDupedWidths, PRInt32& a0ProportionalCount); + /** + * Allocate aWidthType values to the corresponding columns + * @param aTotalAllocated - width that has been allocated in this routine + * @param aAllocTypes - width type that has determined col width + * @param aWidthType - width type selecting the columns for full width allocation + */ void AllocateFully(nscoord& aTotalAllocated, PRInt32* aAllocTypes, PRInt32 aWidthType); + /** + * Allocate aWidthType values to the corresponding columns up to the aAvailWidth + * @param aAvailWidth - width that can distributed to the selected columns + * @param aWidthType - width type selecting the columns for width allocation + * @param aStartAtMin - allocation should start at min. content width + * @param aAllocTypes - width type that has determined col width + * @param aPixelToTwips - the number of twips in a pixel. + */ void AllocateConstrained(PRInt32 aAvailWidth, PRInt32 aWidthType, PRBool aStartAtMin, PRInt32* aAllocTypes, float aPixelToTwips); + /** + * Give the remaining space and exclude the selected columns + * @param aAllocAmount - space that can be distributed + * @param aAllocTypes - width type that has determined col width + * @param aExcludePct - dont give space to percent columns + * @param aExcludeFix - dont give space to fixed width columns + * @param aExcludePro - dont give space to proportional columns + * @param aExclude0Pro - dont give space to proportional columns with 0* + * @param aPixelToTwips - the number of twips in a pixel. + */ void AllocateUnconstrained(PRInt32 aAllocAmount, PRInt32* aAllocTypes, PRBool aExcludePct, @@ -160,28 +223,9 @@ protected: PRBool aExclude0Pro, float aPixelToTwips); - /** return true if the colIndex is in the list of colIndexes */ - virtual PRBool IsColumnInList(const PRInt32 colIndex, - PRInt32 *colIndexes, - PRInt32 aNumFixedColumns); - - /** returns true if the column is specified to have its min width */ - virtual PRBool ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex); - - /** eturns a list and count of all columns that behave like they have width=auto - * this includes columns with no width specified (the normal definition of "auto"), - * columns explicitly set to auto width, - * and columns whose fixed width comes from a span (meaning the real width is indeterminate.) - * - * @param aOutNumColumns -- out param, the number of columns matching aType - * @param aOutColumnIndexes -- out param, the indexes of the columns matching aType - * - * @return aOutNumColumns set to the number of auto columns, may be 0 - * allocates and fills aOutColumnIndexes - * caller must "delete [] aOutColumnIndexes" if it is not null + /** + * Check in debug mode whether the routine is called on a continuing frame */ - void GetColumnsThatActLikeAutoWidth(PRInt32& aOutNumColumns, - PRInt32*& aOutColumnIndexes); void ContinuingFrameCheck(); #ifdef DEBUG @@ -198,10 +242,5 @@ protected: float mMinToDesProportionRatio; PRPackedBool mIsNavQuirksMode; }; - -inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const -{ return mCols; }; - - #endif diff --git a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h index a65c0b12547..6d1ee23c6e8 100644 --- a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h @@ -40,25 +40,22 @@ public: virtual ~nsITableLayoutStrategy() {}; /** call once every time any table thing changes (content, structure, or style) - * @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param - * @param aComputedWidth the computed size of the table + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool Initialize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aBorderPadding)=0; + const nsHTMLReflowState& aReflowState)=0; /** assign widths for each column, taking into account the table content, the effective style, * the layout constraints, and the compatibility mode. Sets mColumnWidths as a side effect. - * @param aTableStyle the resolved style for the table - * @param aReflowState the reflow state for the calling table frame - * @param aMaxWidth the width constraint - + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState)=0; - /** return the value of the COLS attribute, used for balancing column widths */ - virtual nscoord GetCOLSAttribute() const = 0; + #ifdef DEBUG diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 78a200cabf1..c1dd81c9ba0 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -600,6 +600,8 @@ public: // calculate the computed height of aFrame including its border and padding given // its reflow state. nscoord CalcBorderBoxHeight(const nsHTMLReflowState& aReflowState); + // calculate the minimum width to layout aFrame and its desired width + // including border and padding given its reflow state and column width information void CalcMinAndPreferredWidths(const nsHTMLReflowState& aReflowState, nscoord& aMinWidth, nscoord& aPreferredWidth); diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index e5fb3ceca28..ebf4b12b0bb 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -212,8 +212,10 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont nscoord maxWidth = mTableFrame->CalcBorderBoxWidth(aReflowState); if (NS_UNCONSTRAINEDSIZE == maxWidth) { maxWidth = PR_MIN(maxWidth, aReflowState.availableWidth); - NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); - return PR_FALSE; + if (NS_UNCONSTRAINEDSIZE == maxWidth) { + NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); + return PR_FALSE; + } } // initialize the col percent and cell percent values to 0. ResetPctValues(mTableFrame, numCols); @@ -366,7 +368,7 @@ nscoord GetColWidth(nsTableColFrame* aColFrame, } } -// Allocate aWidthType values to all cols available in aIsAllocated +// Allocate aWidthType values to all cols available in aAllocTypes void BasicTableLayoutStrategy::AllocateFully(nscoord& aTotalAllocated, PRInt32* aAllocTypes, PRInt32 aWidthType) @@ -500,6 +502,7 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR nsTableFrame::DebugTimeMethod(nsTableFrame::eNonPctColspans, *mTableFrame, (nsHTMLReflowState&)aReflowState, PR_TRUE); #endif PRInt32 numCols = mTableFrame->GetColCount(); + PRInt32 numEffCols = mTableFrame->GetEffectiveColCount(); // zero out prior ADJ values PRInt32 colX; @@ -515,8 +518,8 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR // Adjust the cols that each cell spans if necessary. Iterate backwards // so that nested and/or overlaping col spans handle the inner ones first, // ensuring more accurated calculations. - //if more than one colspan originate in one column, resort the access to - //the rows so that the inner colspans are handled first + // if more than one colspan originate in one column, resort the access to + // the rows so that the inner colspans are handled first PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32* numColSpans = new PRInt32[numRows]; if(!numColSpans) @@ -526,41 +529,34 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(const nsHTMLReflowState& aR delete [] numColSpans; return; } - for (colX = numCols - 1; colX >= 0; colX--) { + for (colX = numEffCols - 1; colX >= 0; colX--) { //loop only over effective columns PRInt32 rowX; for (rowX = 0; rowX < numRows; rowX++) { numColSpans[rowX] = 0; rowIndices[rowX] = 0; } - PRInt32 biggestColspan=0; + PRInt32 index = 0; for (rowX = 0; rowX < numRows; rowX++) { PRBool originates; PRInt32 colSpan; - nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); if (!originates || (1 == colSpan)) { continue; } - numColSpans[rowX]=colSpan; - if(colSpan > biggestColspan) - biggestColspan = colSpan; + numColSpans[index] = colSpan; + rowIndices[index] = rowX; + index++; } - PRInt32 index = 0; - for( PRInt32 j=2;j <= biggestColspan;j++) { - for( PRInt32 k = 0; k < numRows; k++) { - if( numColSpans[k] == j) { - rowIndices[index]=k; - index++; - } - } - } + RowSort(rowIndices, numColSpans, index); // do the row sorting for (PRInt32 i = 0; i < index; i++) { PRBool originates; PRInt32 colSpan; - PRInt32 rowX= rowIndices[i]; + rowX = rowIndices[i]; nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); - if (!originates || (1 == colSpan)) { + if (!cellFrame || !originates || (1 == colSpan)) { continue; } + colSpan = PR_MIN(colSpan, numEffCols - colX); // set MIN_ADJ, DES_ADJ, FIX_ADJ for (PRInt32 widthX = 0; widthX < NUM_MAJOR_WIDTHS; widthX++) { nscoord cellWidth = 0; @@ -1516,16 +1512,45 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow // For each col, consider the cells originating in it with colspans > 1. // Adjust the cols that each cell spans if necessary. - for (colX = 0; colX < numEffCols; colX++) { + // if more than one colspan originate in one column, resort the access to + // the rows so that the inner colspans are handled first + PRInt32* numColSpans = new PRInt32[numRows]; + if(!numColSpans) + return basis; + PRInt32* rowIndices = new PRInt32[numRows]; + if(!rowIndices) { + delete numColSpans; + return basis; + } + for (colX = numEffCols - 1; colX >= 0; colX--) { // loop only over effective columns + PRInt32 rowX; + for (rowX = 0; rowX < numRows; rowX++) { + numColSpans[rowX] = 0; + rowIndices[rowX] = 0; + } + PRInt32 index = 0; for (rowX = 0; rowX < numRows; rowX++) { PRBool originates; PRInt32 colSpan; - nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); if (!originates || (1 == colSpan)) { continue; } + numColSpans[index] = colSpan; + rowIndices[index] = rowX; + index++; + } + RowSort(rowIndices, numColSpans, index); // do the sorting + for (PRInt32 i = 0; i < index; i++) { + PRBool originates; + PRInt32 colSpan; + rowX = rowIndices[i]; + nsTableCellFrame* cellFrame = mTableFrame->GetCellInfoAt(rowX, colX, &originates, &colSpan); + if (!cellFrame || !originates || (1 == colSpan)) { + continue; + } colSpan = PR_MIN(colSpan,numEffCols-colX); - nscoord cellPctWidth = WIDTH_NOT_SET; + nscoord cellPctWidth = WIDTH_NOT_SET; // see if the cell has a style percentage width specified const nsStylePosition* cellPosition; cellFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)cellPosition); @@ -1544,7 +1569,11 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (cellPctWidth > 0) { nscoord spanCellSpacing = 0; nscoord spanTotal = 0; - nscoord colPctWidthTotal = 0; + nscoord spanTotalNoPctAdj = 0; + nscoord colPctWidthTotal = 0; // accumulate the PCT width + nscoord colPctAdjTotal = 0; // accumulate the PCT_ADJ width or the max of PCT_ADJ and PCT width if a + // PCT width is specified + PRBool canSkipPctAdj = PR_FALSE; // accumulate the spanTotal as the max of MIN, DES, FIX, PCT PRInt32 spanX; for (spanX = 0; spanX < colSpan; spanX++) { @@ -1553,12 +1582,19 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow nscoord colPctWidth = colFrame->GetWidth(PCT); if (colPctWidth > 0) { // skip pct cols colPctWidthTotal += colPctWidth; + colPctAdjTotal += PR_MAX(colFrame->GetWidth(PCT_ADJ), colPctWidth); continue; } + colPctAdjTotal += PR_MAX(colFrame->GetWidth(PCT_ADJ), 0); nscoord colWidth = PR_MAX(colFrame->GetMinWidth(), colFrame->GetFixWidth()); colWidth = PR_MAX(colWidth, colFrame->GetDesWidth()); // XXX check this //colWidth = PR_MAX(colWidth, colFrame->GetPctWidth()); spanTotal += colWidth; + if (colFrame->GetWidth(PCT_ADJ) <= 0) { // if we have a cell that is neither PCT or PCT_ADJ we have + // other places where we can drop the width + canSkipPctAdj = PR_TRUE; + spanTotalNoPctAdj += colWidth; + } if ((spanX > 0) && (mTableFrame->GetNumCellsOriginatingInCol(colX + spanX) > 0)) { spanCellSpacing += spacingX; } @@ -1567,20 +1603,30 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (cellPctWidth <= 0) { continue; } - if (colPctWidthTotal < cellPctWidth) { + spanTotal = canSkipPctAdj ? spanTotalNoPctAdj: spanTotal; // if we can skip the PCT_ADJ ignore theire width + + colPctWidthTotal = canSkipPctAdj ? colPctAdjTotal: colPctWidthTotal; + + if ((PR_MAX(colPctWidthTotal, colPctAdjTotal)+ spanCellSpacing) < cellPctWidth) { + // we have something to distribute ... // record the percent contributions for the spanned cols - for (spanX = 0; spanX < colSpan; spanX++) { + PRInt32 usedColumns = colSpan; + for (spanX = colSpan-1; spanX >= 0; spanX--) { nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX); if (!colFrame) continue; - if (colFrame->GetWidth(PCT) > 0) { // skip pct cols + if ((colFrame->GetWidth(PCT) > 0) || (canSkipPctAdj && (colFrame->GetWidth(PCT_ADJ) > 0))) { + // dont use pct cols or if we can skip the pct adj event do not take the PCT_ADJ cols + usedColumns--; continue; - } + } // count the pieces + if (usedColumns == 0) + usedColumns = 1; // avoid division by 0 later nscoord minWidth = colFrame->GetMinWidth(); nscoord colWidth = PR_MAX(minWidth, colFrame->GetFixWidth()); colWidth = PR_MAX(colWidth, colFrame->GetDesWidth()); // XXX check this float avail = (float)PR_MAX(cellPctWidth - colPctWidthTotal, 0); float colPctAdj = (0 == spanTotal) - ? avail / ((float) colSpan) / ((float)basis) + ? avail / ((float) usedColumns) / ((float)basis) : (avail / (float)basis) * (((float)colWidth) / (float)spanTotal); if (colPctAdj > 0) { nscoord colPctAdjWidth = colFrame->GetWidth(PCT_ADJ); @@ -1590,18 +1636,24 @@ BasicTableLayoutStrategy::AssignPctColumnWidths(const nsHTMLReflowState& aReflow if (newColPctAdjWidth > colFrame->GetWidth(PCT)) { colFrame->SetWidth(PCT_ADJ, newColPctAdjWidth); colFrame->SetConstrainingCell(cellFrame); + if(0 != basis) { // I am paranoid + colPctTotal += NSToCoordRound(100.0f *(newColPctAdjWidth-colPctAdjWidth) / (float)basis); + // accumulate the new distributed percents + } } } + else { + usedColumns--; + colPctWidthTotal += colPctAdjWidth; // accumulate the already distributed percents + } } } } } } // end for (rowX .. - nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX); - if (!colFrame) continue; - colPctTotal += NSToCoordRound(100.0f * (float)colFrame->GetWidth(PCT_ADJ) / (float)basis); } // end for (colX .. - + delete [] numColSpans; + delete [] rowIndices; // if the percent total went over 100%, adjustments need to be made to right most cols if (colPctTotal > 100) { ReduceOverSpecifiedPctCols(NSToCoordRound(((float)(colPctTotal - 100)) * 0.01f * (float)basis)); @@ -1632,10 +1684,10 @@ void BasicTableLayoutStrategy::CalculateTotals(PRInt32* aTotalCounts, a0ProportionalCount = 0; nscoord spacingX = mTableFrame->GetCellSpacingX(); - PRInt32 numCols = mTableFrame->GetColCount(); + PRInt32 numEffCols = mTableFrame->GetEffectiveColCount(); PRInt32 colX; - for (colX = 0; colX < numCols; colX++) { + for (colX = 0; colX < numEffCols; colX++) { nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX); if (!colFrame) continue; nscoord minCol = colFrame->GetMinWidth(); @@ -1797,7 +1849,25 @@ AC_Sort(nsColInfo** aColInfo, PRInt32 aNumCols) } } - +void +BasicTableLayoutStrategy::RowSort(PRInt32* aRowIndices, PRInt32* aColSpans, + PRInt32 aIndex) +{ + PRInt32 swapCol, swapRow; + // sort the rows based on the colspan size + for (PRInt32 j = aIndex - 1; j > 0; j--) { + for (PRInt32 i = 0; i < j; i++) { + if (aColSpans[i] > aColSpans[i+1]) { // swap them + swapCol = aColSpans[i]; + swapRow = aRowIndices[i]; + aColSpans[i] = aColSpans[i+1]; + aRowIndices[i] = aRowIndices[i+1]; + aColSpans[i+1] = swapCol; + aRowIndices[i+1] = swapRow; + } + } + } +} // this assumes that the table has set the width for each col to be its min void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth, PRInt32 aWidthType, @@ -1922,57 +1992,6 @@ void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth, AC_Wrapup(mTableFrame, numConstrainedCols, colInfo); } - -PRBool BasicTableLayoutStrategy::IsColumnInList(const PRInt32 colIndex, - PRInt32* colIndexes, - PRInt32 aNumFixedColumns) -{ - PRBool result = PR_FALSE; - for (PRInt32 i = 0; i < aNumFixedColumns; i++) { - if (colIndex == colIndexes[i]) { - result = PR_TRUE; - break; - } - else if (colIndexGetColFrame(aColIndex); - nsStyleCoord colStyleWidth = colFrame->GetStyleWidth(); - switch (colStyleWidth.GetUnit()) { - case eStyleUnit_Coord: - if (0 == colStyleWidth.GetCoordValue()) { - result = PR_TRUE; - } - break; - case eStyleUnit_Percent: - { - // total hack for now for 0% and 1% specifications - // should compare percent to available parent width and see that it is below minimum - // for this column - float percent = colStyleWidth.GetPercentValue(); - if (0.0f == percent || 0.01f == percent) { - result = PR_TRUE; - } - break; - } - case eStyleUnit_Proportional: - if (0 == colStyleWidth.GetIntValue()) { - result = PR_TRUE; - } - - default: - break; - } - - return result; -} #ifdef DEBUG_TABLE_STRATEGY void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) { diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.h b/mozilla/layout/tables/BasicTableLayoutStrategy.h index c74be043a29..a143342ed92 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.h +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.h @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * buster@netscape.com */ #ifndef BasicTableLayoutStrategy_h__ @@ -46,7 +47,8 @@ class BasicTableLayoutStrategy : public nsITableLayoutStrategy public: /** Public constructor. - * @paran aFrame the table frame for which this delegate will do layout + * @paran aFrame - the table frame for which this delegate will do layout + * @param aIsNavQuirksMode - honor NN4x table quirks */ BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool aIsNavQuirksMode = PR_TRUE); @@ -56,20 +58,19 @@ public: /** call every time any table thing changes that might effect the width of any column * in the table (content, structure, or style) - * @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool Initialize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState); /** Called during resize reflow to determine the new column widths - * @param aTableStyle - the resolved style for mTableFrame - * @param aReflowState - the reflow state for mTableFrame - * @param aMaxWidth - the computed max width for columns to fit into - */ + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame + */ virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState); - - nscoord GetCOLSAttribute() const; + void Dump(PRInt32 aIndent); protected: @@ -83,8 +84,7 @@ protected: * * @param aMaxWidth - the computed width of the table or * UNCONSTRAINED_SIZE if an auto width table - * @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error - * + * @return PR_TRUE has a pct cell or col, PR_FALSE otherwise */ virtual PRBool AssignNonPctColumnWidths(nsIPresContext* aPresContext, nscoord aComputedWidth, @@ -126,32 +126,95 @@ protected: PRInt32& aLimitType, float aPixelToTwips); + /** + * Determine percentage col widths for each col frame + * @param aReflowState - the reflow state of the table + * @param aBasis - the basis for percent width as computed by CalcPctAdjTableWidth + * @param aTableIsAutoWidth - true if no width specification for the table is available + * @param aPixelToTwips - the number of twips in a pixel. + * @return - the adjusted basis including table border, padding and cell spacing + */ nscoord AssignPctColumnWidths(const nsHTMLReflowState& aReflowState, nscoord aBasis, PRBool aTableIsAutoWidth, float aPixelToTwips); + /** + * Calculate the basis for percent width calculations of the table elements + * @param aReflowState - the reflow state of the table + * @param aAvailWidth - the available width for the table + * @param aPixelToTwips - the number of twips in a pixel. + * @return - the basis for percent calculations + */ nscoord CalcPctAdjTableWidth(const nsHTMLReflowState& aReflowState, nscoord aAvailWidth, float aPixelToTwips); + /** + * Reduce the percent columns by the amount specified in aExcess as the percent width's + * can accumulate to be over 100% + * @param aExcess - reduction amount + */ void ReduceOverSpecifiedPctCols(nscoord aExcess); + /** + * Sort rows by rising colspans, in order to treat the inner colspans first + * the result will be returned in the aRowIndices array. + * @param aRowIndices - array with indices of those rows which have colspans starting in the corresponding column + * @param aColSpans - array with the correspong colspan values + * @param aIndex - number of valid entries in the arrays + */ + void RowSort(PRInt32* aRowIndices, + PRInt32* aColSpans, + PRInt32 aIndex); + + /** + * calculate totals by width type. The logic here is kept in synch with + * that in CanAllocate + * @param aTotalCounts - array with counts for each width type that has determined the aTotalWidths sum + * @param aTotalWidths - array with accumulated widths for each width type + * @param aDupedWidths - (duplicatd) are widths that will be allocated in BalanceColumnWidths before aTotalsWidths + * @param a0ProportionalCount - number of columns with col="0*" constraint + */ void CalculateTotals(PRInt32* aTotalCounts, PRInt32* aTotalWidths, - PRInt32* aMinWidths, + PRInt32* aDupedWidths, PRInt32& a0ProportionalCount); + /** + * Allocate aWidthType values to the corresponding columns + * @param aTotalAllocated - width that has been allocated in this routine + * @param aAllocTypes - width type that has determined col width + * @param aWidthType - width type selecting the columns for full width allocation + */ void AllocateFully(nscoord& aTotalAllocated, PRInt32* aAllocTypes, PRInt32 aWidthType); + /** + * Allocate aWidthType values to the corresponding columns up to the aAvailWidth + * @param aAvailWidth - width that can distributed to the selected columns + * @param aWidthType - width type selecting the columns for width allocation + * @param aStartAtMin - allocation should start at min. content width + * @param aAllocTypes - width type that has determined col width + * @param aPixelToTwips - the number of twips in a pixel. + */ void AllocateConstrained(PRInt32 aAvailWidth, PRInt32 aWidthType, PRBool aStartAtMin, PRInt32* aAllocTypes, float aPixelToTwips); + /** + * Give the remaining space and exclude the selected columns + * @param aAllocAmount - space that can be distributed + * @param aAllocTypes - width type that has determined col width + * @param aExcludePct - dont give space to percent columns + * @param aExcludeFix - dont give space to fixed width columns + * @param aExcludePro - dont give space to proportional columns + * @param aExclude0Pro - dont give space to proportional columns with 0* + * @param aPixelToTwips - the number of twips in a pixel. + */ void AllocateUnconstrained(PRInt32 aAllocAmount, PRInt32* aAllocTypes, PRBool aExcludePct, @@ -160,28 +223,9 @@ protected: PRBool aExclude0Pro, float aPixelToTwips); - /** return true if the colIndex is in the list of colIndexes */ - virtual PRBool IsColumnInList(const PRInt32 colIndex, - PRInt32 *colIndexes, - PRInt32 aNumFixedColumns); - - /** returns true if the column is specified to have its min width */ - virtual PRBool ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex); - - /** eturns a list and count of all columns that behave like they have width=auto - * this includes columns with no width specified (the normal definition of "auto"), - * columns explicitly set to auto width, - * and columns whose fixed width comes from a span (meaning the real width is indeterminate.) - * - * @param aOutNumColumns -- out param, the number of columns matching aType - * @param aOutColumnIndexes -- out param, the indexes of the columns matching aType - * - * @return aOutNumColumns set to the number of auto columns, may be 0 - * allocates and fills aOutColumnIndexes - * caller must "delete [] aOutColumnIndexes" if it is not null + /** + * Check in debug mode whether the routine is called on a continuing frame */ - void GetColumnsThatActLikeAutoWidth(PRInt32& aOutNumColumns, - PRInt32*& aOutColumnIndexes); void ContinuingFrameCheck(); #ifdef DEBUG @@ -198,10 +242,5 @@ protected: float mMinToDesProportionRatio; PRPackedBool mIsNavQuirksMode; }; - -inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const -{ return mCols; }; - - #endif diff --git a/mozilla/layout/tables/nsITableLayoutStrategy.h b/mozilla/layout/tables/nsITableLayoutStrategy.h index a65c0b12547..6d1ee23c6e8 100644 --- a/mozilla/layout/tables/nsITableLayoutStrategy.h +++ b/mozilla/layout/tables/nsITableLayoutStrategy.h @@ -40,25 +40,22 @@ public: virtual ~nsITableLayoutStrategy() {}; /** call once every time any table thing changes (content, structure, or style) - * @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param - * @param aComputedWidth the computed size of the table + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool Initialize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aBorderPadding)=0; + const nsHTMLReflowState& aReflowState)=0; /** assign widths for each column, taking into account the table content, the effective style, * the layout constraints, and the compatibility mode. Sets mColumnWidths as a side effect. - * @param aTableStyle the resolved style for the table - * @param aReflowState the reflow state for the calling table frame - * @param aMaxWidth the width constraint - + * @param aPresContext - the presentation context + * @param aReflowState - the reflow state for mTableFrame */ virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState)=0; - /** return the value of the COLS attribute, used for balancing column widths */ - virtual nscoord GetCOLSAttribute() const = 0; + #ifdef DEBUG diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 78a200cabf1..c1dd81c9ba0 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -600,6 +600,8 @@ public: // calculate the computed height of aFrame including its border and padding given // its reflow state. nscoord CalcBorderBoxHeight(const nsHTMLReflowState& aReflowState); + // calculate the minimum width to layout aFrame and its desired width + // including border and padding given its reflow state and column width information void CalcMinAndPreferredWidths(const nsHTMLReflowState& aReflowState, nscoord& aMinWidth, nscoord& aPreferredWidth);