зеркало из https://github.com/mozilla/gecko-dev.git
fixed printing assertions; more throughly check cell map usage for contuining frames;
fixed bug 24057; r=kmcclusk,cmanske; could not run mail smoke tests due to prior bustage.
This commit is contained in:
Родитель
01ce4c8e4b
Коммит
8a106ef33c
|
@ -1677,7 +1677,7 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord*
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
if (aPrevStyleWidth) {
|
||||
nsTableColFrame* colSpanFrame = colFrame;
|
||||
|
@ -1745,7 +1745,7 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
// check to see if DES_CON can affect columns
|
||||
nsTableColFrame* spanFrame = colFrame;
|
||||
|
@ -1776,7 +1776,7 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
nscoord cellMin = aCellFrame.GetPass1MaxElementSize().width;
|
||||
nscoord cellDes = aCellFrame.GetMaximumWidth();
|
||||
|
|
|
@ -121,7 +121,7 @@ PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputed
|
|||
const nsStylePosition* cellPosition;
|
||||
cellFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
|
||||
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(cellFrame);
|
||||
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(*cellFrame);
|
||||
// Get fixed cell width if available
|
||||
if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {
|
||||
colWidths[colX] = cellPosition->mWidth.GetCoordValue() / colSpan;
|
||||
|
|
|
@ -186,10 +186,11 @@ nsTableCellMap::GetColSpan(PRInt32 aRowIndex,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsTableCellFrame* nsTableCellMap::GetCellFrame(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
nsTableCellFrame*
|
||||
nsTableCellMap::GetCellFrame(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
{
|
||||
nsCellMap* map = mFirstMap;
|
||||
while (map) {
|
||||
|
@ -289,10 +290,11 @@ nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
|
|||
}
|
||||
|
||||
PRInt32
|
||||
nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
{
|
||||
NS_ASSERTION(&aCellFrame == aCellFrame.GetFirstInFlow(), "invalid call on continuing frame");
|
||||
PRInt32 rowIndex = aRowIndex;
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
|
@ -358,6 +360,8 @@ void
|
|||
nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
PRInt32 aRowIndex)
|
||||
{
|
||||
NS_ASSERTION(aCellFrame == (nsTableCellFrame *)aCellFrame->GetFirstInFlow(),
|
||||
"invalid call on continuing frame");
|
||||
PRInt32 rowIndex = aRowIndex;
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
|
@ -387,30 +391,30 @@ nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const
|
|||
void
|
||||
nsTableCellMap::Dump() const
|
||||
{
|
||||
printf("***** START TABLE CELL MAP DUMP *****\n");
|
||||
printf("***** START TABLE CELL MAP DUMP ***** %p\n", this);
|
||||
// output col info
|
||||
PRInt32 colCount = mCols.Count();
|
||||
printf ("\ncols array orig/span-> ");
|
||||
printf ("cols array orig/span-> ", this);
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
printf ("%d=%d/%d", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
}
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
cellMap->Dump();
|
||||
cellMap = cellMap->GetNextSibling();
|
||||
}
|
||||
printf("\n***** END TABLE CELL MAP DUMP *****\n");
|
||||
printf("***** END TABLE CELL MAP DUMP *****\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32
|
||||
nsTableCellMap::GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame* aCell)
|
||||
const nsTableCellFrame& aCellFrameIn)
|
||||
{
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aCell->GetFirstInFlow();
|
||||
nsTableCellFrame& cellFrame = (nsTableCellFrame &)*(aCellFrameIn.GetFirstInFlow());
|
||||
PRInt32 rowIndex;
|
||||
cellFrame->GetRowIndex(rowIndex);
|
||||
cellFrame.GetRowIndex(rowIndex);
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
if (cellMap->GetRowCount() > rowIndex) {
|
||||
|
@ -554,10 +558,11 @@ nsCellMap::~nsCellMap()
|
|||
}
|
||||
}
|
||||
|
||||
nsTableCellFrame* nsCellMap::GetCellFrame(PRInt32 aRowIndexIn,
|
||||
PRInt32 aColIndexIn,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
nsTableCellFrame*
|
||||
nsCellMap::GetCellFrame(PRInt32 aRowIndexIn,
|
||||
PRInt32 aColIndexIn,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
{
|
||||
PRInt32 rowIndex = aRowIndexIn - aData.GetRowSpanOffset();
|
||||
PRInt32 colIndex = aColIndexIn - aData.GetColSpanOffset();
|
||||
|
@ -675,10 +680,11 @@ nsCellMap::RemoveRows(nsTableCellMap& aMap,
|
|||
}
|
||||
}
|
||||
|
||||
PRInt32 nsCellMap::AppendCell(nsTableCellMap& aMap,
|
||||
nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
PRInt32
|
||||
nsCellMap::AppendCell(nsTableCellMap& aMap,
|
||||
nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
{
|
||||
PRInt32 origNumMapRows = mRows.Count();
|
||||
PRInt32 origNumCols = aMap.GetColCount();
|
||||
|
@ -788,7 +794,7 @@ PRInt32 nsCellMap::AppendCell(nsTableCellMap& aMap,
|
|||
}
|
||||
}
|
||||
}
|
||||
//printf("appended cell=%p row=%d \n", aCellFrame, aRowIndex);
|
||||
//printf("appended cell=%p row=%d \n", &aCellFrame, aRowIndex);
|
||||
//aMap.Dump();
|
||||
return startColIndex;
|
||||
}
|
||||
|
@ -1502,14 +1508,14 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap,
|
|||
#ifdef NS_DEBUG
|
||||
void nsCellMap::Dump() const
|
||||
{
|
||||
printf("***** START GROUP CELL MAP DUMP *****\n");
|
||||
printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this);
|
||||
PRInt32 mapRowCount = mRows.Count();
|
||||
printf("mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
|
||||
printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
|
||||
|
||||
PRInt32 rowIndex, colIndex;
|
||||
for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) {
|
||||
nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rowIndex);
|
||||
printf("row %d : ", rowIndex);
|
||||
printf(" row %d : ", rowIndex);
|
||||
PRInt32 colCount = row->Count();
|
||||
for (colIndex = 0; colIndex < colCount; colIndex++) {
|
||||
CellData* cd = (CellData *)row->ElementAt(colIndex);
|
||||
|
@ -1520,21 +1526,10 @@ void nsCellMap::Dump() const
|
|||
nsTableCellFrame* cell = nsnull;
|
||||
if (cd->IsRowSpan()) {
|
||||
cell = GetCellFrame(rowIndex, colIndex, *cd, PR_TRUE);
|
||||
// check the validity of the cell map
|
||||
nsVoidArray* rowAbove = (nsVoidArray *)mRows.ElementAt(rowIndex - 1);
|
||||
CellData* cdAbove = (CellData *)rowAbove->ElementAt(colIndex);
|
||||
if (GetCellFrame(rowIndex - 1, colIndex, *cdAbove, PR_TRUE) != cell) {
|
||||
NS_ASSERTION(PR_FALSE, "bad row span data");
|
||||
}
|
||||
printf("R ");
|
||||
}
|
||||
if (cd->IsColSpan()) {
|
||||
cell = GetCellFrame(rowIndex, colIndex, *cd, PR_FALSE);
|
||||
// check the validity of the cell map
|
||||
CellData* cdBefore = (CellData *)row->ElementAt(colIndex - 1);
|
||||
if (GetCellFrame(rowIndex, colIndex - 1, *cdBefore, PR_FALSE) != cell) {
|
||||
NS_ASSERTION(PR_FALSE, "bad col span data");
|
||||
}
|
||||
printf("C ");
|
||||
}
|
||||
if (!(cd->IsRowSpan() && cd->IsColSpan())) {
|
||||
|
@ -1554,6 +1549,7 @@ void nsCellMap::Dump() const
|
|||
for (PRInt32 rIndex = 0; rIndex < mapRowCount; rIndex++) {
|
||||
nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rIndex);
|
||||
PRInt32 colCount = row->Count();
|
||||
printf(" ");
|
||||
for (colIndex = 0; colIndex < colCount; colIndex++) {
|
||||
CellData* cd = (CellData *)row->ElementAt(colIndex);
|
||||
if (cd) {
|
||||
|
@ -1569,7 +1565,7 @@ void nsCellMap::Dump() const
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n***** END GROUP CELL MAP DUMP *****\n");
|
||||
printf(" ***** END GROUP CELL MAP DUMP *****\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1733,7 +1729,7 @@ void nsCellMap::SetMapCellAt(nsTableCellMap& aMap,
|
|||
PRInt32 nsCellMap::GetEffectiveColSpan(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aNumColsInTable,
|
||||
const nsTableCellFrame* aCell)
|
||||
const nsTableCellFrame& aCell)
|
||||
{
|
||||
PRInt32 effColSpan = 0;
|
||||
for (PRInt32 colX = aColIndex; colX < aNumColsInTable; colX++) {
|
||||
|
@ -1741,12 +1737,12 @@ PRInt32 nsCellMap::GetEffectiveColSpan(PRInt32 aRowIndex,
|
|||
CellData* cellData = GetCellAt(aRowIndex, colX, aNumColsInTable);
|
||||
if (cellData) {
|
||||
if (cellData->IsOrig()) {
|
||||
if (cellData->GetCellFrame() == aCell) {
|
||||
if (cellData->GetCellFrame() == &aCell) {
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (cellData->IsColSpan() &&
|
||||
(GetCellFrame(aRowIndex, colX, *cellData, PR_FALSE) == aCell)) {
|
||||
(GetCellFrame(aRowIndex, colX, *cellData, PR_FALSE) == &aCell)) {
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1791,10 +1787,10 @@ nsCellMap::GetCellInfoAt(PRInt32 aRowX,
|
|||
cellFrame = data->GetCellFrame();
|
||||
if (aOriginates)
|
||||
*aOriginates = PR_TRUE;
|
||||
if (aColSpan) {
|
||||
if (cellFrame && aColSpan) {
|
||||
PRInt32 initialColIndex;
|
||||
cellFrame->GetColIndex(initialColIndex);
|
||||
*aColSpan = GetEffectiveColSpan(aRowX, initialColIndex, aNumColsInTable, cellFrame);
|
||||
*aColSpan = GetEffectiveColSpan(aRowX, initialColIndex, aNumColsInTable, *cellFrame);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
PRBool aConsiderSpans);
|
||||
|
||||
PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame* aCell);
|
||||
const nsTableCellFrame& aCell);
|
||||
|
||||
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
||||
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
PRInt32 GetEffectiveColSpan(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aNumColsInTable,
|
||||
const nsTableCellFrame* aCell);
|
||||
const nsTableCellFrame& aCell);
|
||||
|
||||
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
||||
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
||||
|
|
|
@ -524,23 +524,22 @@ PRInt32 nsTableFrame::GetEffectiveRowSpan(nsTableCellFrame *aCell)
|
|||
// GetEffectiveColSpan (indexOfColThatContains_aCell, aCell)
|
||||
//
|
||||
// XXX Should be moved to colgroup, as GetEffectiveRowSpan should be moved to rowgroup?
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(PRInt32 aColIndex, const nsTableCellFrame* aCell) const
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame& aCell) const
|
||||
{
|
||||
NS_PRECONDITION (nsnull != aCell, "bad cell arg");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_PRECONDITION (nsnull != cellMap, "bad call, cellMap not yet allocated.");
|
||||
|
||||
return cellMap->GetEffectiveColSpan(aColIndex, aCell);
|
||||
}
|
||||
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame* aCell) const
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame& aCell) const
|
||||
{
|
||||
NS_PRECONDITION (nsnull != aCell, "bad cell arg");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_PRECONDITION (nsnull != cellMap, "bad call, cellMap not yet allocated.");
|
||||
|
||||
PRInt32 initialColIndex;
|
||||
aCell->GetColIndex(initialColIndex);
|
||||
aCell.GetColIndex(initialColIndex);
|
||||
return cellMap->GetEffectiveColSpan(initialColIndex, aCell);
|
||||
}
|
||||
|
||||
|
@ -2075,16 +2074,17 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
cellFrame->GetNextSibling(&cellFrame);
|
||||
}
|
||||
// check if a cell above spans into here
|
||||
//if (!collapseGroup) {
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
nsTableCellFrame* lastCell = nsnull;
|
||||
for (int colX = 0; colX < numCols; colX++) {
|
||||
CellData* cellData = mCellMap->GetCellAt(aRowX, colX);
|
||||
CellData* cellData = cellMap->GetCellAt(aRowX, colX);
|
||||
if (cellData && cellData->IsSpan()) { // a cell above is spanning into here
|
||||
// adjust the real cell's rect only once
|
||||
nsTableCellFrame* realCell = nsnull;
|
||||
if (cellData->IsRowSpan())
|
||||
realCell = mCellMap->GetCellFrame(aRowX, colX, *cellData, PR_TRUE);
|
||||
realCell = cellMap->GetCellFrame(aRowX, colX, *cellData, PR_TRUE);
|
||||
if (realCell != lastCell) {
|
||||
nsRect realRect;
|
||||
realCell->GetRect(realRect);
|
||||
|
@ -2094,7 +2094,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
lastCell = realCell;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
} else { // row is not collapsed but needs to be adjusted by those that are
|
||||
rowRect.y -= aYGroupOffset;
|
||||
rowFrame->SetRect(aPresContext, rowRect);
|
||||
|
@ -2143,7 +2143,10 @@ NS_METHOD nsTableFrame::AdjustForCollapsingRows(nsIPresContext* aPresContext,
|
|||
NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
||||
nscoord& aWidth)
|
||||
{
|
||||
PRInt32 numRows = mCellMap->GetRowCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) return NS_OK;
|
||||
|
||||
PRInt32 numRows = cellMap->GetRowCount();
|
||||
nsTableIterator groupIter(mColGroups, eTableDIR);
|
||||
nsIFrame* groupFrame = groupIter.First();
|
||||
nscoord cellSpacingX = GetCellSpacingX();
|
||||
|
@ -2170,7 +2173,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
nsTableCellFrame* lastCell = nsnull;
|
||||
nsTableCellFrame* cellFrame = nsnull;
|
||||
for (PRInt32 rowX = 0; rowX < numRows; rowX++) {
|
||||
CellData* cellData = mCellMap->GetCellAt(rowX, colX);
|
||||
CellData* cellData = cellMap->GetCellAt(rowX, colX);
|
||||
nsRect cellRect;
|
||||
if (cellData) {
|
||||
if (cellData->IsOrig()) { // the cell originates at (rowX, colX)
|
||||
|
@ -2191,7 +2194,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
// if the cell does not originate at (rowX, colX), adjust the real cells width
|
||||
} else if (collapseGroup || collapseCol) {
|
||||
if (cellData->IsColSpan()) {
|
||||
cellFrame = mCellMap->GetCellFrame(rowX, colX, *cellData, PR_FALSE);
|
||||
cellFrame = cellMap->GetCellFrame(rowX, colX, *cellData, PR_FALSE);
|
||||
}
|
||||
if ((cellFrame) && (lastCell != cellFrame)) {
|
||||
cellFrame->GetRect(cellRect);
|
||||
|
@ -3206,9 +3209,13 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
nsSize* aMaxElementSize)
|
||||
{
|
||||
NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!");
|
||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
if (numCols>mColumnWidthsLength)
|
||||
{
|
||||
PRInt32 priorColumnWidthsLength=mColumnWidthsLength;
|
||||
|
@ -3256,7 +3263,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
|
||||
// if collapsing borders, compute the top and bottom edges now that we have column widths
|
||||
if ((NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle()) && mBorderCollapser) {
|
||||
mBorderCollapser->ComputeHorizontalBorders(aPresContext, 0, mCellMap->GetRowCount()-1);
|
||||
mBorderCollapser->ComputeHorizontalBorders(aPresContext, 0, cellMap->GetRowCount()-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3268,7 +3275,11 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
void nsTableFrame::SetTableWidth(nsIPresContext* aPresContext)
|
||||
{
|
||||
NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!");
|
||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return;
|
||||
}
|
||||
|
||||
nscoord cellSpacing = GetCellSpacingX();
|
||||
PRInt32 tableWidth = 0;
|
||||
|
@ -3493,7 +3504,11 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext* aPresContext
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nscoord aDefaultHeight)
|
||||
{
|
||||
NS_ASSERTION(mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return 0;
|
||||
}
|
||||
nscoord result = aDefaultHeight;
|
||||
|
||||
nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState, PR_TRUE);
|
||||
|
@ -3691,8 +3706,12 @@ PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
|
|||
// an incremental reflow. That's okay, just return 0 for the column
|
||||
// width
|
||||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(nsnull!=mCellMap, "no cell map");
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "no cell map");
|
||||
return 0;
|
||||
}
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
NS_ASSERTION (numCols > aColIndex, "bad arg, col index out of bounds");
|
||||
#endif
|
||||
if (nsnull!=mColumnWidths)
|
||||
|
@ -3715,7 +3734,7 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, nscoord aWidth)
|
|||
// strategy will call to set a column width before we've allocated the
|
||||
// column width array
|
||||
if (!mColumnWidths) {
|
||||
mColumnWidthsLength = mCellMap->GetColCount();
|
||||
mColumnWidthsLength = mCellMap->GetColCount(); // mCellMap is valid since first inflow
|
||||
mColumnWidths = new PRInt32[mColumnWidthsLength];
|
||||
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
|
||||
}
|
||||
|
|
|
@ -301,8 +301,10 @@ public:
|
|||
* @return the col span, correcting for col spans that extend beyond the edge
|
||||
* of the table.
|
||||
*/
|
||||
virtual PRInt32 GetEffectiveColSpan(PRInt32 aColIndex, const nsTableCellFrame *aCell) const;
|
||||
virtual PRInt32 GetEffectiveColSpan(const nsTableCellFrame *aCell) const;
|
||||
virtual PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame& aCell) const;
|
||||
|
||||
virtual PRInt32 GetEffectiveColSpan(const nsTableCellFrame& aCell) const;
|
||||
|
||||
/** return the value of the COLS attribute, adjusted for the
|
||||
* actual number of columns in the table
|
||||
|
|
|
@ -732,7 +732,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
|||
PRInt32 cellColIndex;
|
||||
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
||||
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
|
||||
((nsTableCellFrame *)kidFrame));
|
||||
((nsTableCellFrame &)*kidFrame));
|
||||
|
||||
// Compute the x-origin for the child, taking into account straddlers (cells from prior
|
||||
// rows with rowspans > 1)
|
||||
|
@ -1206,7 +1206,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
|
|||
PRInt32 cellColIndex;
|
||||
((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
|
||||
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
|
||||
((nsTableCellFrame *)aNextFrame));
|
||||
((nsTableCellFrame &)*aNextFrame));
|
||||
nscoord cellSpacingX = aReflowState.tableFrame->GetCellSpacingX();
|
||||
|
||||
nscoord cellAvailWidth = CalculateCellAvailableWidth(aReflowState.tableFrame, aNextFrame,
|
||||
|
|
|
@ -1237,7 +1237,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext,
|
|||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
|
||||
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() : 0;
|
||||
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : 0;
|
||||
tableFrame->InsertRows(*aPresContext, *this, rows, rowIndex, PR_TRUE);
|
||||
|
||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||
|
|
|
@ -1677,7 +1677,7 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord*
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
if (aPrevStyleWidth) {
|
||||
nsTableColFrame* colSpanFrame = colFrame;
|
||||
|
@ -1745,7 +1745,7 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
// check to see if DES_CON can affect columns
|
||||
nsTableColFrame* spanFrame = colFrame;
|
||||
|
@ -1776,7 +1776,7 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
|
|||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(&aCellFrame);
|
||||
nscoord colSpan = mTableFrame->GetEffectiveColSpan(aCellFrame);
|
||||
|
||||
nscoord cellMin = aCellFrame.GetPass1MaxElementSize().width;
|
||||
nscoord cellDes = aCellFrame.GetMaximumWidth();
|
||||
|
|
|
@ -121,7 +121,7 @@ PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputed
|
|||
const nsStylePosition* cellPosition;
|
||||
cellFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
|
||||
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(cellFrame);
|
||||
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(*cellFrame);
|
||||
// Get fixed cell width if available
|
||||
if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {
|
||||
colWidths[colX] = cellPosition->mWidth.GetCoordValue() / colSpan;
|
||||
|
|
|
@ -186,10 +186,11 @@ nsTableCellMap::GetColSpan(PRInt32 aRowIndex,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsTableCellFrame* nsTableCellMap::GetCellFrame(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
nsTableCellFrame*
|
||||
nsTableCellMap::GetCellFrame(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
{
|
||||
nsCellMap* map = mFirstMap;
|
||||
while (map) {
|
||||
|
@ -289,10 +290,11 @@ nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
|
|||
}
|
||||
|
||||
PRInt32
|
||||
nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
nsTableCellMap::AppendCell(nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
{
|
||||
NS_ASSERTION(&aCellFrame == aCellFrame.GetFirstInFlow(), "invalid call on continuing frame");
|
||||
PRInt32 rowIndex = aRowIndex;
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
|
@ -358,6 +360,8 @@ void
|
|||
nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
PRInt32 aRowIndex)
|
||||
{
|
||||
NS_ASSERTION(aCellFrame == (nsTableCellFrame *)aCellFrame->GetFirstInFlow(),
|
||||
"invalid call on continuing frame");
|
||||
PRInt32 rowIndex = aRowIndex;
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
|
@ -387,30 +391,30 @@ nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const
|
|||
void
|
||||
nsTableCellMap::Dump() const
|
||||
{
|
||||
printf("***** START TABLE CELL MAP DUMP *****\n");
|
||||
printf("***** START TABLE CELL MAP DUMP ***** %p\n", this);
|
||||
// output col info
|
||||
PRInt32 colCount = mCols.Count();
|
||||
printf ("\ncols array orig/span-> ");
|
||||
printf ("cols array orig/span-> ", this);
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
printf ("%d=%d/%d", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
}
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
cellMap->Dump();
|
||||
cellMap = cellMap->GetNextSibling();
|
||||
}
|
||||
printf("\n***** END TABLE CELL MAP DUMP *****\n");
|
||||
printf("***** END TABLE CELL MAP DUMP *****\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32
|
||||
nsTableCellMap::GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame* aCell)
|
||||
const nsTableCellFrame& aCellFrameIn)
|
||||
{
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aCell->GetFirstInFlow();
|
||||
nsTableCellFrame& cellFrame = (nsTableCellFrame &)*(aCellFrameIn.GetFirstInFlow());
|
||||
PRInt32 rowIndex;
|
||||
cellFrame->GetRowIndex(rowIndex);
|
||||
cellFrame.GetRowIndex(rowIndex);
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
while (cellMap) {
|
||||
if (cellMap->GetRowCount() > rowIndex) {
|
||||
|
@ -554,10 +558,11 @@ nsCellMap::~nsCellMap()
|
|||
}
|
||||
}
|
||||
|
||||
nsTableCellFrame* nsCellMap::GetCellFrame(PRInt32 aRowIndexIn,
|
||||
PRInt32 aColIndexIn,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
nsTableCellFrame*
|
||||
nsCellMap::GetCellFrame(PRInt32 aRowIndexIn,
|
||||
PRInt32 aColIndexIn,
|
||||
CellData& aData,
|
||||
PRBool aUseRowIfOverlap) const
|
||||
{
|
||||
PRInt32 rowIndex = aRowIndexIn - aData.GetRowSpanOffset();
|
||||
PRInt32 colIndex = aColIndexIn - aData.GetColSpanOffset();
|
||||
|
@ -675,10 +680,11 @@ nsCellMap::RemoveRows(nsTableCellMap& aMap,
|
|||
}
|
||||
}
|
||||
|
||||
PRInt32 nsCellMap::AppendCell(nsTableCellMap& aMap,
|
||||
nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
PRInt32
|
||||
nsCellMap::AppendCell(nsTableCellMap& aMap,
|
||||
nsTableCellFrame& aCellFrame,
|
||||
PRInt32 aRowIndex,
|
||||
PRBool aRebuildIfNecessary)
|
||||
{
|
||||
PRInt32 origNumMapRows = mRows.Count();
|
||||
PRInt32 origNumCols = aMap.GetColCount();
|
||||
|
@ -788,7 +794,7 @@ PRInt32 nsCellMap::AppendCell(nsTableCellMap& aMap,
|
|||
}
|
||||
}
|
||||
}
|
||||
//printf("appended cell=%p row=%d \n", aCellFrame, aRowIndex);
|
||||
//printf("appended cell=%p row=%d \n", &aCellFrame, aRowIndex);
|
||||
//aMap.Dump();
|
||||
return startColIndex;
|
||||
}
|
||||
|
@ -1502,14 +1508,14 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap,
|
|||
#ifdef NS_DEBUG
|
||||
void nsCellMap::Dump() const
|
||||
{
|
||||
printf("***** START GROUP CELL MAP DUMP *****\n");
|
||||
printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this);
|
||||
PRInt32 mapRowCount = mRows.Count();
|
||||
printf("mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
|
||||
printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount);
|
||||
|
||||
PRInt32 rowIndex, colIndex;
|
||||
for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) {
|
||||
nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rowIndex);
|
||||
printf("row %d : ", rowIndex);
|
||||
printf(" row %d : ", rowIndex);
|
||||
PRInt32 colCount = row->Count();
|
||||
for (colIndex = 0; colIndex < colCount; colIndex++) {
|
||||
CellData* cd = (CellData *)row->ElementAt(colIndex);
|
||||
|
@ -1520,21 +1526,10 @@ void nsCellMap::Dump() const
|
|||
nsTableCellFrame* cell = nsnull;
|
||||
if (cd->IsRowSpan()) {
|
||||
cell = GetCellFrame(rowIndex, colIndex, *cd, PR_TRUE);
|
||||
// check the validity of the cell map
|
||||
nsVoidArray* rowAbove = (nsVoidArray *)mRows.ElementAt(rowIndex - 1);
|
||||
CellData* cdAbove = (CellData *)rowAbove->ElementAt(colIndex);
|
||||
if (GetCellFrame(rowIndex - 1, colIndex, *cdAbove, PR_TRUE) != cell) {
|
||||
NS_ASSERTION(PR_FALSE, "bad row span data");
|
||||
}
|
||||
printf("R ");
|
||||
}
|
||||
if (cd->IsColSpan()) {
|
||||
cell = GetCellFrame(rowIndex, colIndex, *cd, PR_FALSE);
|
||||
// check the validity of the cell map
|
||||
CellData* cdBefore = (CellData *)row->ElementAt(colIndex - 1);
|
||||
if (GetCellFrame(rowIndex, colIndex - 1, *cdBefore, PR_FALSE) != cell) {
|
||||
NS_ASSERTION(PR_FALSE, "bad col span data");
|
||||
}
|
||||
printf("C ");
|
||||
}
|
||||
if (!(cd->IsRowSpan() && cd->IsColSpan())) {
|
||||
|
@ -1554,6 +1549,7 @@ void nsCellMap::Dump() const
|
|||
for (PRInt32 rIndex = 0; rIndex < mapRowCount; rIndex++) {
|
||||
nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rIndex);
|
||||
PRInt32 colCount = row->Count();
|
||||
printf(" ");
|
||||
for (colIndex = 0; colIndex < colCount; colIndex++) {
|
||||
CellData* cd = (CellData *)row->ElementAt(colIndex);
|
||||
if (cd) {
|
||||
|
@ -1569,7 +1565,7 @@ void nsCellMap::Dump() const
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n***** END GROUP CELL MAP DUMP *****\n");
|
||||
printf(" ***** END GROUP CELL MAP DUMP *****\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1733,7 +1729,7 @@ void nsCellMap::SetMapCellAt(nsTableCellMap& aMap,
|
|||
PRInt32 nsCellMap::GetEffectiveColSpan(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aNumColsInTable,
|
||||
const nsTableCellFrame* aCell)
|
||||
const nsTableCellFrame& aCell)
|
||||
{
|
||||
PRInt32 effColSpan = 0;
|
||||
for (PRInt32 colX = aColIndex; colX < aNumColsInTable; colX++) {
|
||||
|
@ -1741,12 +1737,12 @@ PRInt32 nsCellMap::GetEffectiveColSpan(PRInt32 aRowIndex,
|
|||
CellData* cellData = GetCellAt(aRowIndex, colX, aNumColsInTable);
|
||||
if (cellData) {
|
||||
if (cellData->IsOrig()) {
|
||||
if (cellData->GetCellFrame() == aCell) {
|
||||
if (cellData->GetCellFrame() == &aCell) {
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (cellData->IsColSpan() &&
|
||||
(GetCellFrame(aRowIndex, colX, *cellData, PR_FALSE) == aCell)) {
|
||||
(GetCellFrame(aRowIndex, colX, *cellData, PR_FALSE) == &aCell)) {
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -1791,10 +1787,10 @@ nsCellMap::GetCellInfoAt(PRInt32 aRowX,
|
|||
cellFrame = data->GetCellFrame();
|
||||
if (aOriginates)
|
||||
*aOriginates = PR_TRUE;
|
||||
if (aColSpan) {
|
||||
if (cellFrame && aColSpan) {
|
||||
PRInt32 initialColIndex;
|
||||
cellFrame->GetColIndex(initialColIndex);
|
||||
*aColSpan = GetEffectiveColSpan(aRowX, initialColIndex, aNumColsInTable, cellFrame);
|
||||
*aColSpan = GetEffectiveColSpan(aRowX, initialColIndex, aNumColsInTable, *cellFrame);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
PRBool aConsiderSpans);
|
||||
|
||||
PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame* aCell);
|
||||
const nsTableCellFrame& aCell);
|
||||
|
||||
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
||||
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
PRInt32 GetEffectiveColSpan(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
PRInt32 aNumColsInTable,
|
||||
const nsTableCellFrame* aCell);
|
||||
const nsTableCellFrame& aCell);
|
||||
|
||||
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
||||
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
||||
|
|
|
@ -524,23 +524,22 @@ PRInt32 nsTableFrame::GetEffectiveRowSpan(nsTableCellFrame *aCell)
|
|||
// GetEffectiveColSpan (indexOfColThatContains_aCell, aCell)
|
||||
//
|
||||
// XXX Should be moved to colgroup, as GetEffectiveRowSpan should be moved to rowgroup?
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(PRInt32 aColIndex, const nsTableCellFrame* aCell) const
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame& aCell) const
|
||||
{
|
||||
NS_PRECONDITION (nsnull != aCell, "bad cell arg");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_PRECONDITION (nsnull != cellMap, "bad call, cellMap not yet allocated.");
|
||||
|
||||
return cellMap->GetEffectiveColSpan(aColIndex, aCell);
|
||||
}
|
||||
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame* aCell) const
|
||||
PRInt32 nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame& aCell) const
|
||||
{
|
||||
NS_PRECONDITION (nsnull != aCell, "bad cell arg");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
NS_PRECONDITION (nsnull != cellMap, "bad call, cellMap not yet allocated.");
|
||||
|
||||
PRInt32 initialColIndex;
|
||||
aCell->GetColIndex(initialColIndex);
|
||||
aCell.GetColIndex(initialColIndex);
|
||||
return cellMap->GetEffectiveColSpan(initialColIndex, aCell);
|
||||
}
|
||||
|
||||
|
@ -2075,16 +2074,17 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
cellFrame->GetNextSibling(&cellFrame);
|
||||
}
|
||||
// check if a cell above spans into here
|
||||
//if (!collapseGroup) {
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
nsTableCellFrame* lastCell = nsnull;
|
||||
for (int colX = 0; colX < numCols; colX++) {
|
||||
CellData* cellData = mCellMap->GetCellAt(aRowX, colX);
|
||||
CellData* cellData = cellMap->GetCellAt(aRowX, colX);
|
||||
if (cellData && cellData->IsSpan()) { // a cell above is spanning into here
|
||||
// adjust the real cell's rect only once
|
||||
nsTableCellFrame* realCell = nsnull;
|
||||
if (cellData->IsRowSpan())
|
||||
realCell = mCellMap->GetCellFrame(aRowX, colX, *cellData, PR_TRUE);
|
||||
realCell = cellMap->GetCellFrame(aRowX, colX, *cellData, PR_TRUE);
|
||||
if (realCell != lastCell) {
|
||||
nsRect realRect;
|
||||
realCell->GetRect(realRect);
|
||||
|
@ -2094,7 +2094,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|||
lastCell = realCell;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
} else { // row is not collapsed but needs to be adjusted by those that are
|
||||
rowRect.y -= aYGroupOffset;
|
||||
rowFrame->SetRect(aPresContext, rowRect);
|
||||
|
@ -2143,7 +2143,10 @@ NS_METHOD nsTableFrame::AdjustForCollapsingRows(nsIPresContext* aPresContext,
|
|||
NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
||||
nscoord& aWidth)
|
||||
{
|
||||
PRInt32 numRows = mCellMap->GetRowCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) return NS_OK;
|
||||
|
||||
PRInt32 numRows = cellMap->GetRowCount();
|
||||
nsTableIterator groupIter(mColGroups, eTableDIR);
|
||||
nsIFrame* groupFrame = groupIter.First();
|
||||
nscoord cellSpacingX = GetCellSpacingX();
|
||||
|
@ -2170,7 +2173,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
nsTableCellFrame* lastCell = nsnull;
|
||||
nsTableCellFrame* cellFrame = nsnull;
|
||||
for (PRInt32 rowX = 0; rowX < numRows; rowX++) {
|
||||
CellData* cellData = mCellMap->GetCellAt(rowX, colX);
|
||||
CellData* cellData = cellMap->GetCellAt(rowX, colX);
|
||||
nsRect cellRect;
|
||||
if (cellData) {
|
||||
if (cellData->IsOrig()) { // the cell originates at (rowX, colX)
|
||||
|
@ -2191,7 +2194,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
|||
// if the cell does not originate at (rowX, colX), adjust the real cells width
|
||||
} else if (collapseGroup || collapseCol) {
|
||||
if (cellData->IsColSpan()) {
|
||||
cellFrame = mCellMap->GetCellFrame(rowX, colX, *cellData, PR_FALSE);
|
||||
cellFrame = cellMap->GetCellFrame(rowX, colX, *cellData, PR_FALSE);
|
||||
}
|
||||
if ((cellFrame) && (lastCell != cellFrame)) {
|
||||
cellFrame->GetRect(cellRect);
|
||||
|
@ -3206,9 +3209,13 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
nsSize* aMaxElementSize)
|
||||
{
|
||||
NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!");
|
||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
if (numCols>mColumnWidthsLength)
|
||||
{
|
||||
PRInt32 priorColumnWidthsLength=mColumnWidthsLength;
|
||||
|
@ -3256,7 +3263,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
|
||||
// if collapsing borders, compute the top and bottom edges now that we have column widths
|
||||
if ((NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle()) && mBorderCollapser) {
|
||||
mBorderCollapser->ComputeHorizontalBorders(aPresContext, 0, mCellMap->GetRowCount()-1);
|
||||
mBorderCollapser->ComputeHorizontalBorders(aPresContext, 0, cellMap->GetRowCount()-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3268,7 +3275,11 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
|
|||
void nsTableFrame::SetTableWidth(nsIPresContext* aPresContext)
|
||||
{
|
||||
NS_ASSERTION(nsnull==mPrevInFlow, "never ever call me on a continuing frame!");
|
||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return;
|
||||
}
|
||||
|
||||
nscoord cellSpacing = GetCellSpacingX();
|
||||
PRInt32 tableWidth = 0;
|
||||
|
@ -3493,7 +3504,11 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext* aPresContext
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nscoord aDefaultHeight)
|
||||
{
|
||||
NS_ASSERTION(mCellMap, "never ever call me until the cell map is built!");
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "never ever call me until the cell map is built!");
|
||||
return 0;
|
||||
}
|
||||
nscoord result = aDefaultHeight;
|
||||
|
||||
nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState, PR_TRUE);
|
||||
|
@ -3691,8 +3706,12 @@ PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
|
|||
// an incremental reflow. That's okay, just return 0 for the column
|
||||
// width
|
||||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(nsnull!=mCellMap, "no cell map");
|
||||
PRInt32 numCols = mCellMap->GetColCount();
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) {
|
||||
NS_ASSERTION(PR_FALSE, "no cell map");
|
||||
return 0;
|
||||
}
|
||||
PRInt32 numCols = cellMap->GetColCount();
|
||||
NS_ASSERTION (numCols > aColIndex, "bad arg, col index out of bounds");
|
||||
#endif
|
||||
if (nsnull!=mColumnWidths)
|
||||
|
@ -3715,7 +3734,7 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, nscoord aWidth)
|
|||
// strategy will call to set a column width before we've allocated the
|
||||
// column width array
|
||||
if (!mColumnWidths) {
|
||||
mColumnWidthsLength = mCellMap->GetColCount();
|
||||
mColumnWidthsLength = mCellMap->GetColCount(); // mCellMap is valid since first inflow
|
||||
mColumnWidths = new PRInt32[mColumnWidthsLength];
|
||||
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
|
||||
}
|
||||
|
|
|
@ -301,8 +301,10 @@ public:
|
|||
* @return the col span, correcting for col spans that extend beyond the edge
|
||||
* of the table.
|
||||
*/
|
||||
virtual PRInt32 GetEffectiveColSpan(PRInt32 aColIndex, const nsTableCellFrame *aCell) const;
|
||||
virtual PRInt32 GetEffectiveColSpan(const nsTableCellFrame *aCell) const;
|
||||
virtual PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
|
||||
const nsTableCellFrame& aCell) const;
|
||||
|
||||
virtual PRInt32 GetEffectiveColSpan(const nsTableCellFrame& aCell) const;
|
||||
|
||||
/** return the value of the COLS attribute, adjusted for the
|
||||
* actual number of columns in the table
|
||||
|
|
|
@ -732,7 +732,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
|
|||
PRInt32 cellColIndex;
|
||||
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
|
||||
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
|
||||
((nsTableCellFrame *)kidFrame));
|
||||
((nsTableCellFrame &)*kidFrame));
|
||||
|
||||
// Compute the x-origin for the child, taking into account straddlers (cells from prior
|
||||
// rows with rowspans > 1)
|
||||
|
@ -1206,7 +1206,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
|
|||
PRInt32 cellColIndex;
|
||||
((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
|
||||
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
|
||||
((nsTableCellFrame *)aNextFrame));
|
||||
((nsTableCellFrame &)*aNextFrame));
|
||||
nscoord cellSpacingX = aReflowState.tableFrame->GetCellSpacingX();
|
||||
|
||||
nscoord cellAvailWidth = CalculateCellAvailableWidth(aReflowState.tableFrame, aNextFrame,
|
||||
|
|
|
@ -1237,7 +1237,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext,
|
|||
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (tableFrame) {
|
||||
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
|
||||
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() : 0;
|
||||
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : 0;
|
||||
tableFrame->InsertRows(*aPresContext, *this, rows, rowIndex, PR_TRUE);
|
||||
|
||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||
|
|
Загрузка…
Ссылка в новой задаче