bugs 47163, 60807 and others, sr=buster
simplified BasicTableLayoutStrategy's CalculateTotals and CanAllocate better calculation of proportional cols calculation of adjusted widths due to colspans honors the fixed and pct widths of cols being spanned git-svn-id: svn://10.0.0.236/trunk@83859 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
7ada1cd259
commit
40a59f1659
File diff suppressed because it is too large
Load Diff
@ -109,11 +109,9 @@ protected:
|
||||
/**
|
||||
* Calculate the adjusted widths (min, desired, fixed, or pct) for a cell
|
||||
* spanning multiple columns.
|
||||
* @param aWidthIndex - the width to calculate (see nsTableColFrame.h for enums)
|
||||
* @param aCellFrame - the frame of the cell with a colspan
|
||||
* @param aColIndex - the column index of the cell in the table
|
||||
* @param aColSpan - the colspan of the cell
|
||||
* @param aReflowState - the reflow state of the table
|
||||
* @param aConsiderPct - if true, consider columns that have pct widths and are spanned by the cell
|
||||
* @param aPixelToTwips- the number of twips in a pixel.
|
||||
*/
|
||||
void ComputeNonPctColspanWidths(const nsHTMLReflowState& aReflowState,
|
||||
PRBool aConsiderPct,
|
||||
@ -121,17 +119,21 @@ protected:
|
||||
|
||||
/**
|
||||
* main helper for above. For min width calculations, it can get called up to
|
||||
* 3 times, 1st to let constrained (fix or pct) cols reach their limit, 2nd
|
||||
* to let auto cols reach their limit and 3rd to spread any remainder among
|
||||
* 3 times, 1st to let constrained pct cols reach their limit, 2nd
|
||||
* to let fix cols reach their limit and 3rd to spread any remainder among
|
||||
* auto cols. If there are no auto cols then only constrained cols are considered.
|
||||
* @param aCellWidth - the width of the cell
|
||||
* @param aLimitType - value indicating which type of width is being targeted
|
||||
* to reach a limit
|
||||
* @return - true if the computation completed, false otherwise
|
||||
* @param aWidthIndex - the width to calculate (see nsTableColFrame.h for enums)
|
||||
* @param aCellFrame - the frame of the cell with a colspan
|
||||
* @param aCellWidth - the width of the cell with a colspan
|
||||
* @param aColIndex - the column index of the cell in the table
|
||||
* @param aColSpan - the colspan of the cell
|
||||
* @param aLimitType - the type of limit (ie. pct, fix, none).
|
||||
* @param aPixelToTwips- the number of twips in a pixel.
|
||||
* @return - true if all of aCellWidth was allocated, false otherwise
|
||||
*/
|
||||
PRBool ComputeNonPctColspanWidths(PRInt32 aWidthIndex,
|
||||
nsTableCellFrame* aCellFrame,
|
||||
nscoord aCellWidth,
|
||||
PRInt32 aCellWidth,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aColSpan,
|
||||
PRInt32& aLimitType,
|
||||
@ -147,14 +149,12 @@ protected:
|
||||
void CalculateTotals(PRInt32& aCellSpacing,
|
||||
PRInt32* aTotalCounts,
|
||||
PRInt32* aTotalWidths,
|
||||
PRInt32* aTotalAvailWidths,
|
||||
PRInt32* aMinWidths,
|
||||
PRInt32& a0ProportionalCount);
|
||||
|
||||
void AllocateFully(nscoord& aTotalAllocated,
|
||||
PRInt32* aAllocTypes,
|
||||
PRInt32 aWidthType,
|
||||
PRBool aMarkAllocated = PR_TRUE);
|
||||
PRInt32 aWidthType);
|
||||
|
||||
void AllocateConstrained(PRInt32 aAvailWidth,
|
||||
PRInt32 aWidthType,
|
||||
@ -164,7 +164,10 @@ protected:
|
||||
|
||||
void AllocateUnconstrained(PRInt32 aAllocAmount,
|
||||
PRInt32* aAllocTypes,
|
||||
PRBool aSkip0Proportional,
|
||||
PRBool aExcludePct,
|
||||
PRBool aExcludeFix,
|
||||
PRBool aExcludePro,
|
||||
PRBool aExclude0Pro,
|
||||
float aPixelToTwips);
|
||||
|
||||
/** return true if the colIndex is in the list of colIndexes */
|
||||
|
||||
@ -1369,6 +1369,8 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext,
|
||||
delete row;
|
||||
}
|
||||
delete [] origRows;
|
||||
// remove any unused cols
|
||||
aMap.RemoveUnusedCols(aMap.GetColCount());
|
||||
}
|
||||
|
||||
void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
|
||||
@ -453,14 +453,29 @@ PRInt32 nsTableFrame::GetRowCount () const
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
/* return the effective col count */
|
||||
/* return the col count including dead cols */
|
||||
PRInt32 nsTableFrame::GetColCount ()
|
||||
{
|
||||
PRInt32 colCount = 0;
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_ASSERTION(nsnull != cellMap, "GetColCount null cellmap");
|
||||
if (nsnull != cellMap)
|
||||
if (nsnull != cellMap) {
|
||||
colCount = cellMap->GetColCount();
|
||||
}
|
||||
return colCount;
|
||||
}
|
||||
|
||||
/* return the effective col count */
|
||||
PRInt32 nsTableFrame::GetEffectiveColCount ()
|
||||
{
|
||||
PRInt32 colCount = GetColCount();
|
||||
// don't count cols at the end that don't have originating cells
|
||||
for (PRInt32 colX = colCount - 1; colX >= 0; colX--) {
|
||||
if (GetNumCellsOriginatingInCol(colX) <= 0) {
|
||||
colCount--;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
return colCount;
|
||||
}
|
||||
|
||||
|
||||
@ -776,6 +776,7 @@ public: /* ----- Cell Map public methods ----- */
|
||||
|
||||
/** returns the number of columns in this table after redundant columns have been removed
|
||||
*/
|
||||
virtual PRInt32 GetEffectiveColCount();
|
||||
virtual PRInt32 GetColCount();
|
||||
|
||||
/** return the column frame at colIndex.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -109,11 +109,9 @@ protected:
|
||||
/**
|
||||
* Calculate the adjusted widths (min, desired, fixed, or pct) for a cell
|
||||
* spanning multiple columns.
|
||||
* @param aWidthIndex - the width to calculate (see nsTableColFrame.h for enums)
|
||||
* @param aCellFrame - the frame of the cell with a colspan
|
||||
* @param aColIndex - the column index of the cell in the table
|
||||
* @param aColSpan - the colspan of the cell
|
||||
* @param aReflowState - the reflow state of the table
|
||||
* @param aConsiderPct - if true, consider columns that have pct widths and are spanned by the cell
|
||||
* @param aPixelToTwips- the number of twips in a pixel.
|
||||
*/
|
||||
void ComputeNonPctColspanWidths(const nsHTMLReflowState& aReflowState,
|
||||
PRBool aConsiderPct,
|
||||
@ -121,17 +119,21 @@ protected:
|
||||
|
||||
/**
|
||||
* main helper for above. For min width calculations, it can get called up to
|
||||
* 3 times, 1st to let constrained (fix or pct) cols reach their limit, 2nd
|
||||
* to let auto cols reach their limit and 3rd to spread any remainder among
|
||||
* 3 times, 1st to let constrained pct cols reach their limit, 2nd
|
||||
* to let fix cols reach their limit and 3rd to spread any remainder among
|
||||
* auto cols. If there are no auto cols then only constrained cols are considered.
|
||||
* @param aCellWidth - the width of the cell
|
||||
* @param aLimitType - value indicating which type of width is being targeted
|
||||
* to reach a limit
|
||||
* @return - true if the computation completed, false otherwise
|
||||
* @param aWidthIndex - the width to calculate (see nsTableColFrame.h for enums)
|
||||
* @param aCellFrame - the frame of the cell with a colspan
|
||||
* @param aCellWidth - the width of the cell with a colspan
|
||||
* @param aColIndex - the column index of the cell in the table
|
||||
* @param aColSpan - the colspan of the cell
|
||||
* @param aLimitType - the type of limit (ie. pct, fix, none).
|
||||
* @param aPixelToTwips- the number of twips in a pixel.
|
||||
* @return - true if all of aCellWidth was allocated, false otherwise
|
||||
*/
|
||||
PRBool ComputeNonPctColspanWidths(PRInt32 aWidthIndex,
|
||||
nsTableCellFrame* aCellFrame,
|
||||
nscoord aCellWidth,
|
||||
PRInt32 aCellWidth,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aColSpan,
|
||||
PRInt32& aLimitType,
|
||||
@ -147,14 +149,12 @@ protected:
|
||||
void CalculateTotals(PRInt32& aCellSpacing,
|
||||
PRInt32* aTotalCounts,
|
||||
PRInt32* aTotalWidths,
|
||||
PRInt32* aTotalAvailWidths,
|
||||
PRInt32* aMinWidths,
|
||||
PRInt32& a0ProportionalCount);
|
||||
|
||||
void AllocateFully(nscoord& aTotalAllocated,
|
||||
PRInt32* aAllocTypes,
|
||||
PRInt32 aWidthType,
|
||||
PRBool aMarkAllocated = PR_TRUE);
|
||||
PRInt32 aWidthType);
|
||||
|
||||
void AllocateConstrained(PRInt32 aAvailWidth,
|
||||
PRInt32 aWidthType,
|
||||
@ -164,7 +164,10 @@ protected:
|
||||
|
||||
void AllocateUnconstrained(PRInt32 aAllocAmount,
|
||||
PRInt32* aAllocTypes,
|
||||
PRBool aSkip0Proportional,
|
||||
PRBool aExcludePct,
|
||||
PRBool aExcludeFix,
|
||||
PRBool aExcludePro,
|
||||
PRBool aExclude0Pro,
|
||||
float aPixelToTwips);
|
||||
|
||||
/** return true if the colIndex is in the list of colIndexes */
|
||||
|
||||
@ -1369,6 +1369,8 @@ nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext,
|
||||
delete row;
|
||||
}
|
||||
delete [] origRows;
|
||||
// remove any unused cols
|
||||
aMap.RemoveUnusedCols(aMap.GetColCount());
|
||||
}
|
||||
|
||||
void nsCellMap::RebuildConsideringCells(nsTableCellMap& aMap,
|
||||
|
||||
@ -453,14 +453,29 @@ PRInt32 nsTableFrame::GetRowCount () const
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
/* return the effective col count */
|
||||
/* return the col count including dead cols */
|
||||
PRInt32 nsTableFrame::GetColCount ()
|
||||
{
|
||||
PRInt32 colCount = 0;
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_ASSERTION(nsnull != cellMap, "GetColCount null cellmap");
|
||||
if (nsnull != cellMap)
|
||||
if (nsnull != cellMap) {
|
||||
colCount = cellMap->GetColCount();
|
||||
}
|
||||
return colCount;
|
||||
}
|
||||
|
||||
/* return the effective col count */
|
||||
PRInt32 nsTableFrame::GetEffectiveColCount ()
|
||||
{
|
||||
PRInt32 colCount = GetColCount();
|
||||
// don't count cols at the end that don't have originating cells
|
||||
for (PRInt32 colX = colCount - 1; colX >= 0; colX--) {
|
||||
if (GetNumCellsOriginatingInCol(colX) <= 0) {
|
||||
colCount--;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
return colCount;
|
||||
}
|
||||
|
||||
|
||||
@ -776,6 +776,7 @@ public: /* ----- Cell Map public methods ----- */
|
||||
|
||||
/** returns the number of columns in this table after redundant columns have been removed
|
||||
*/
|
||||
virtual PRInt32 GetEffectiveColCount();
|
||||
virtual PRInt32 GetColCount();
|
||||
|
||||
/** return the column frame at colIndex.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user