changed getters to be XP_COM-like, with out-params instead of return values.

this is so these getters can be bound to an XPCOM interface, nsITableCellLayout
This commit is contained in:
buster%netscape.com 1999-02-11 01:16:28 +00:00
Родитель 3d131e6a4a
Коммит 178ad83c45
12 изменённых файлов: 264 добавлений и 106 удалений

Просмотреть файл

@ -321,7 +321,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
} }
if (-1==firstRowIndex) if (-1==firstRowIndex)
firstRowIndex = rowIndex; firstRowIndex = rowIndex;
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
@ -329,7 +331,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame); PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame);
if (colSpan>maxColSpan) if (colSpan>maxColSpan)
maxColSpan = colSpan; maxColSpan = colSpan;
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check
continue; continue;
@ -736,7 +740,9 @@ void BasicTableLayoutStrategy::SetMinAndMaxTableWidths()
if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex); if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex);
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figured in the cell the first time we saw it // For cells that span cols, we figured in the cell the first time we saw it
if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex); if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex);
continue; continue;
@ -1093,12 +1099,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
} }
if (-1==firstRowIndex) if (-1==firstRowIndex)
firstRowIndex = rowIndex; firstRowIndex = rowIndex;
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue; continue;
@ -1177,7 +1187,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
// otherwise it's already been factored in. // otherwise it's already been factored in.
// now, if this column holds the cell, create a spanInfo struct for the cell // now, if this column holds the cell, create a spanInfo struct for the cell
// so subsequent columns can take a proportion of this cell's space into account // so subsequent columns can take a proportion of this cell's space into account
if (cellFrame->GetColIndex()==colIndex) PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (cellColIndex==colIndex)
{ // add this cell to span list iff we are currently processing the column the cell starts in { // add this cell to span list iff we are currently processing the column the cell starts in
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width); SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols; spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;
@ -1823,12 +1835,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
{ // there is no cell in this row that corresponds to this column { // there is no cell in this row that corresponds to this column
continue; continue;
} }
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue; continue;
@ -1902,7 +1918,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
// otherwise it's already been factored in. // otherwise it's already been factored in.
// now, if this column holds the cell, create a spanInfo struct for the cell // now, if this column holds the cell, create a spanInfo struct for the cell
// so subsequent columns can take a proportion of this cell's space into account // so subsequent columns can take a proportion of this cell's space into account
if (cellFrame->GetColIndex()==colIndex) PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (cellColIndex==colIndex)
{ // add this cell to span list iff we are currently processing the column the cell starts in { // add this cell to span list iff we are currently processing the column the cell starts in
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width); SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols; spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;

Просмотреть файл

@ -257,7 +257,8 @@ PRBool nsCellMap::RowIsSpannedInto(PRInt32 aRowIndex)
{ // the cell at (aRowIndex, colIndex) is the result of a span { // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex) if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
result = PR_TRUE; result = PR_TRUE;
@ -300,7 +301,8 @@ PRBool nsCellMap::RowHasSpanningCells(PRInt32 aRowIndex)
{ // the cell at (nextRowIndex, colIndex) is the result of a span { // the cell at (nextRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=nextRowIndex) if (realRowIndex!=nextRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
CellData *spanningCell = GetCellAt(aRowIndex, colIndex); CellData *spanningCell = GetCellAt(aRowIndex, colIndex);
@ -349,7 +351,8 @@ PRBool nsCellMap::ColIsSpannedInto(PRInt32 aColIndex)
{ // the cell at (rowIndex, aColIndex) is the result of a span { // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex) if (realColIndex!=aColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
result = PR_TRUE; result = PR_TRUE;
@ -389,7 +392,8 @@ PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex)
{ // the cell at (rowIndex, nextColIndex) is the result of a span { // the cell at (rowIndex, nextColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=nextColIndex) if (realColIndex!=nextColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
CellData *spanningCell =GetCellAt(rowIndex, aColIndex); CellData *spanningCell =GetCellAt(rowIndex, aColIndex);

Просмотреть файл

@ -50,6 +50,11 @@ static const PRBool gsDebugNT = PR_FALSE;
#endif #endif
NS_IMPL_ADDREF(nsTableCellFrame)
NS_IMPL_RELEASE(nsTableCellFrame)
void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex) void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{ {
NS_PRECONDITION(0<=aColIndex, "bad col index arg"); NS_PRECONDITION(0<=aColIndex, "bad col index arg");
@ -90,7 +95,9 @@ void nsTableCellFrame::SetBorderEdgeLength(PRUint8 aSide,
{ {
if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide)) if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide))
{ {
PRInt32 rowIndex = aIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength; border->mLength = aLength;
} }
@ -147,7 +154,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
} }
else else
{ {
//printf("-- Paint cell (%d %d)\n", GetRowIndex(), GetColIndex());
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this, nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides); aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
} }
@ -190,7 +196,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
{ {
case NS_SIDE_TOP: case NS_SIDE_TOP:
{ {
PRInt32 colIndex = aColIndex-GetColIndex(); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top); mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break; break;
@ -198,7 +206,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_BOTTOM: case NS_SIDE_BOTTOM:
{ {
PRInt32 colIndex = aColIndex-GetColIndex(); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom); mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break; break;
@ -206,7 +216,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_LEFT: case NS_SIDE_LEFT:
{ {
PRInt32 rowIndex = aRowIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left); mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break; break;
@ -214,7 +226,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_RIGHT: case NS_SIDE_RIGHT:
{ {
PRInt32 rowIndex = aRowIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right); mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break; break;
@ -568,7 +582,9 @@ nsTableCellFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
} }
cf->Init(aPresContext, mContent, aParent, aStyleContext); cf->Init(aPresContext, mContent, aParent, aStyleContext);
cf->AppendToFlow(this); cf->AppendToFlow(this);
cf->InitCellFrame(GetColIndex()); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
cf->InitCellFrame(baseColIndex);
aContinuingFrame = cf; aContinuingFrame = cf;
// Create a continuing body frame // Create a continuing body frame
@ -764,7 +780,9 @@ void nsTableCellFrame::MapVAlignAttribute(nsIPresContext* aPresContext, nsTableF
// check if valign is set on the cell's COL (or COLGROUP by inheritance) // check if valign is set on the cell's COL (or COLGROUP by inheritance)
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame); PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle; const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle); colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) if (colTextStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated)
@ -809,7 +827,9 @@ void nsTableCellFrame::MapHAlignAttribute(nsIPresContext* aPresContext, nsTableF
// check if halign is set on the cell's COL (or COLGROUP by inheritance) // check if halign is set on the cell's COL (or COLGROUP by inheritance)
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame); PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle; const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle); colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated) if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated)
@ -851,6 +871,10 @@ nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
if (NULL == aInstancePtr) { if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
if (aIID.Equals(nsITableCellLayout::IID())) {
*aInstancePtr = (void*)(nsISupports*)(nsITableCellLayout*)this;
return NS_OK;
}
return nsContainerFrame::QueryInterface(aIID, aInstancePtr); return nsContainerFrame::QueryInterface(aIID, aInstancePtr);
} }

Просмотреть файл

@ -18,6 +18,7 @@
#ifndef nsTableCellFrame_h__ #ifndef nsTableCellFrame_h__
#define nsTableCellFrame_h__ #define nsTableCellFrame_h__
#include "nsITableCellLayout.h"
#include "nscore.h" #include "nscore.h"
#include "nsHTMLContainerFrame.h" #include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex #include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
@ -31,12 +32,20 @@ class nsHTMLValue;
* nsTableCellFrame * nsTableCellFrame
* data structure to maintain information about a single table cell's frame * data structure to maintain information about a single table cell's frame
* *
* NOTE: frames are not ref counted. We expose addref and release here
* so we can change that decsion in the future. Users of nsITableCellLayout
* should refcount correctly as if this object is being ref counted, though
* no actual support is under the hood.
*
* @author sclark * @author sclark
*/ */
class nsTableCellFrame : public nsHTMLContainerFrame class nsTableCellFrame : public nsHTMLContainerFrame, nsITableCellLayout
{ {
public: public:
// nsISupports
NS_DECL_ISUPPORTS
// default constructor supplied by the compiler // default constructor supplied by the compiler
void InitCellFrame(PRInt32 aColIndex); void InitCellFrame(PRInt32 aColIndex);
@ -60,9 +69,6 @@ public:
friend nsresult friend nsresult
NS_NewTableCellFrame(nsIFrame*& aResult); NS_NewTableCellFrame(nsIFrame*& aResult);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@ -91,13 +97,13 @@ public:
// there is no set row index because row index depends on the cell's parent row only // there is no set row index because row index depends on the cell's parent row only
/** return the mapped cell's row index (starting at 0 for the first row) */ /** return the mapped cell's row index (starting at 0 for the first row) */
virtual PRInt32 GetRowIndex(); virtual nsresult GetRowIndex(PRInt32 &aRowIndex);
/** return the mapped cell's col span. Always >= 1. */ /** return the mapped cell's col span. Always >= 1. */
virtual PRInt32 GetColSpan(); virtual PRInt32 GetColSpan();
/** return the mapped cell's column index (starting at 0 for the first column) */ /** return the mapped cell's column index (starting at 0 for the first column) */
virtual PRInt32 GetColIndex(); virtual nsresult GetColIndex(PRInt32 &aColIndex);
/** return the available width given to this frame during its last reflow */ /** return the available width given to this frame during its last reflow */
virtual nscoord GetPriorAvailWidth(); virtual nscoord GetPriorAvailWidth();
@ -211,18 +217,29 @@ public:
}; };
inline PRInt32 nsTableCellFrame::GetRowIndex() inline nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex)
{ {
nsresult result;
nsTableRowFrame * row; nsTableRowFrame * row;
GetParent((nsIFrame **)&row); GetParent((nsIFrame **)&row);
if (nsnull!=row) if (nsnull!=row)
return row->GetRowIndex(); {
aRowIndex = row->GetRowIndex();
result = NS_OK;
}
else else
return 0; {
aRowIndex = 0;
result = NS_ERROR_NOT_INITIALIZED;
}
return result;
} }
inline PRInt32 nsTableCellFrame::GetColIndex() inline nsresult nsTableCellFrame::GetColIndex(PRInt32 &aColIndex)
{ return mColIndex;} {
aColIndex = mColIndex;
return NS_OK;
}
inline nscoord nsTableCellFrame::GetPriorAvailWidth() inline nscoord nsTableCellFrame::GetPriorAvailWidth()
{ return mPriorAvailWidth;} { return mPriorAvailWidth;}

Просмотреть файл

@ -611,7 +611,8 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{ {
result = colSpan; result = colSpan;
// check for case where all cells in a column have a colspan // check for case where all cells in a column have a colspan
PRInt32 initialColIndex = aCell->GetColIndex(); PRInt32 initialColIndex;
aCell->GetColIndex(initialColIndex);
PRInt32 minColSpanForCol = cellMap->GetMinColSpan(initialColIndex); PRInt32 minColSpanForCol = cellMap->GetMinColSpan(initialColIndex);
result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1 result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1
// and we want to treat default as 0 (no effect) // and we want to treat default as 0 (no effect)
@ -621,7 +622,9 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{ {
printf("ERROR!\n"); printf("ERROR!\n");
DumpCellMap(); DumpCellMap();
printf("aColIndex=%d, cell->colIndex=%d\n", aColIndex, aCell->GetColIndex()); PRInt32 initialColIndex;
aCell->GetColIndex(initialColIndex);
printf("aColIndex=%d, cell->colIndex=%d\n", aColIndex, initialColIndex);
printf("aCell->colSpan=%d\n", aCell->GetColSpan()); printf("aCell->colSpan=%d\n", aCell->GetColSpan());
printf("colCount=%d\n", mCellMap->GetColCount()); printf("colCount=%d\n", mCellMap->GetColCount());
} }
@ -972,7 +975,8 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame *row; nsTableRowFrame *row;
cell->GetParent((nsIFrame **)&row); cell->GetParent((nsIFrame **)&row);
int rr = row->GetRowIndex (); int rr = row->GetRowIndex ();
int cc = cell->GetColIndex (); int cc;
cell->GetColIndex(cc);
printf("S%d,%d ", rr, cc); printf("S%d,%d ", rr, cc);
if (cd->mOverlap != nsnull) if (cd->mOverlap != nsnull)
{ {
@ -980,7 +984,7 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame* row2; nsTableRowFrame* row2;
cell->GetParent((nsIFrame **)&row2); cell->GetParent((nsIFrame **)&row2);
rr = row2->GetRowIndex (); rr = row2->GetRowIndex ();
cc = cell->GetColIndex (); cell->GetColIndex (cc);
printf("O%d,%c ", rr, cc); printf("O%d,%c ", rr, cc);
} }
else else
@ -1422,7 +1426,8 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (aRowIndex, colIndex) is the result of a span { // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex) if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
rightNeighborFrame = cd->mRealCell->mCell; rightNeighborFrame = cd->mRealCell->mCell;
@ -1640,7 +1645,8 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (rowIndex, aColIndex) is the result of a span { // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex) if (realColIndex!=aColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
bottomNeighborFrame = cd->mRealCell->mCell; bottomNeighborFrame = cd->mRealCell->mCell;
@ -3830,16 +3836,18 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext,
if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) || if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) ||
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) { (eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// compute the width per column spanned // compute the width per column spanned
PRInt32 colSpan = GetEffectiveColSpan(aCellFrame->GetColIndex(), aCellFrame); PRInt32 baseColIndex;
aCellFrame->GetColIndex(baseColIndex);
PRInt32 colSpan = GetEffectiveColSpan(baseColIndex, aCellFrame);
if (PR_TRUE==gsDebug) if (PR_TRUE==gsDebug)
printf("TIF SetCSFromCell: for col %d with colspan %d\n",aCellFrame->GetColIndex(), colSpan); printf("TIF SetCSFromCell: for col %d with colspan %d\n",baseColIndex, colSpan);
for (PRInt32 i=0; i<colSpan; i++) for (PRInt32 i=0; i<colSpan; i++)
{ {
// get the appropriate column frame // get the appropriate column frame
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame); GetColumnFrame(i+baseColIndex, colFrame);
if (PR_TRUE==gsDebug) if (PR_TRUE==gsDebug)
printf("TIF SetCSFromCell: for col %d (%p)\n",i+aCellFrame->GetColIndex(), colFrame); printf("TIF SetCSFromCell: for col %d (%p)\n",i+baseColIndex, colFrame);
// if the colspan is 1 and we already have a cell that set this column's width // if the colspan is 1 and we already have a cell that set this column's width
// then ignore this width attribute // then ignore this width attribute
if ((1==colSpan) && (nsTableColFrame::eWIDTH_SOURCE_CELL == colFrame->GetWidthSource())) if ((1==colSpan) && (nsTableColFrame::eWIDTH_SOURCE_CELL == colFrame->GetWidthSource()))
@ -4686,7 +4694,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if ((NS_OK==rv) && (nsnull!=tableParent) && (nsnull!=tableParent->mColumnWidths)) if ((NS_OK==rv) && (nsnull!=tableParent) && (nsnull!=tableParent->mColumnWidths))
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i=0; i<colSpan; i++) for (PRInt32 i=0; i<colSpan; i++)
parentWidth += tableParent->GetColumnWidth(colIndex); parentWidth += tableParent->GetColumnWidth(colIndex);
@ -4738,7 +4747,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths) if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths)
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++) for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex); parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
@ -4762,7 +4772,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet()) if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++) for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex); parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);

Просмотреть файл

@ -527,7 +527,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
// Compute the x-origin for the child, taking into account straddlers (cells from prior // Compute the x-origin for the child, taking into account straddlers (cells from prior
// rows with rowspans > 1) // rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); PRInt32 cellColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
if (prevColIndex != (cellColIndex-1)) if (prevColIndex != (cellColIndex-1))
{ // if this cell is not immediately adjacent to the previous cell, factor in missing col info { // if this cell is not immediately adjacent to the previous cell, factor in missing col info
for (PRInt32 colIndex=prevColIndex+1; colIndex<cellColIndex; colIndex++) for (PRInt32 colIndex=prevColIndex+1; colIndex<cellColIndex; colIndex++)
@ -544,8 +545,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
// at this point, we know the column widths. // at this point, we know the column widths.
// so we get the avail width from the known column widths // so we get the avail width from the known column widths
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)kidFrame)->GetColIndex(), PRInt32 baseColIndex;
((nsTableCellFrame *)kidFrame)); ((nsTableCellFrame *)kidFrame)->GetColIndex(baseColIndex);
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(baseColIndex,
((nsTableCellFrame *)kidFrame));
nscoord availWidth = 0; nscoord availWidth = 0;
for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++) for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++)
{ {
@ -781,7 +784,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
} }
else else
{ {
PRInt32 colIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); PRInt32 colIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(colIndex);
kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE); kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE);
} }
@ -1240,9 +1244,10 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
// At this point, we know the column widths. Get the available width // At this point, we know the column widths. Get the available width
// from the known column widths // from the known column widths
PRInt32 cellColIndex = ((nsTableCellFrame *)aNextFrame)->GetColIndex(); PRInt32 cellColIndex;
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)aNextFrame)->GetColIndex(), ((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
((nsTableCellFrame *)aNextFrame)); PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
((nsTableCellFrame *)aNextFrame));
nscoord availWidth = 0; nscoord availWidth = 0;
for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++) for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++)
{ {

Просмотреть файл

@ -321,7 +321,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
} }
if (-1==firstRowIndex) if (-1==firstRowIndex)
firstRowIndex = rowIndex; firstRowIndex = rowIndex;
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
@ -329,7 +331,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame); PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame);
if (colSpan>maxColSpan) if (colSpan>maxColSpan)
maxColSpan = colSpan; maxColSpan = colSpan;
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check
continue; continue;
@ -736,7 +740,9 @@ void BasicTableLayoutStrategy::SetMinAndMaxTableWidths()
if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex); if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex);
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figured in the cell the first time we saw it // For cells that span cols, we figured in the cell the first time we saw it
if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex); if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex);
continue; continue;
@ -1093,12 +1099,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
} }
if (-1==firstRowIndex) if (-1==firstRowIndex)
firstRowIndex = rowIndex; firstRowIndex = rowIndex;
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue; continue;
@ -1177,7 +1187,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
// otherwise it's already been factored in. // otherwise it's already been factored in.
// now, if this column holds the cell, create a spanInfo struct for the cell // now, if this column holds the cell, create a spanInfo struct for the cell
// so subsequent columns can take a proportion of this cell's space into account // so subsequent columns can take a proportion of this cell's space into account
if (cellFrame->GetColIndex()==colIndex) PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (cellColIndex==colIndex)
{ // add this cell to span list iff we are currently processing the column the cell starts in { // add this cell to span list iff we are currently processing the column the cell starts in
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width); SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols; spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;
@ -1823,12 +1835,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
{ // there is no cell in this row that corresponds to this column { // there is no cell in this row that corresponds to this column
continue; continue;
} }
if (rowIndex!=cellFrame->GetRowIndex()) { PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// For cells that span rows, we only figure it in once // For cells that span rows, we only figure it in once
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue; continue;
} }
if (colIndex!=cellFrame->GetColIndex()) { PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (colIndex!=cellColIndex) {
// For cells that span cols, we figure in the row using previously-built SpanInfo // For cells that span cols, we figure in the row using previously-built SpanInfo
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue; continue;
@ -1902,7 +1918,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
// otherwise it's already been factored in. // otherwise it's already been factored in.
// now, if this column holds the cell, create a spanInfo struct for the cell // now, if this column holds the cell, create a spanInfo struct for the cell
// so subsequent columns can take a proportion of this cell's space into account // so subsequent columns can take a proportion of this cell's space into account
if (cellFrame->GetColIndex()==colIndex) PRInt32 cellColIndex;
cellFrame->GetColIndex(cellColIndex);
if (cellColIndex==colIndex)
{ // add this cell to span list iff we are currently processing the column the cell starts in { // add this cell to span list iff we are currently processing the column the cell starts in
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width); SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols; spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;

Просмотреть файл

@ -257,7 +257,8 @@ PRBool nsCellMap::RowIsSpannedInto(PRInt32 aRowIndex)
{ // the cell at (aRowIndex, colIndex) is the result of a span { // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex) if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
result = PR_TRUE; result = PR_TRUE;
@ -300,7 +301,8 @@ PRBool nsCellMap::RowHasSpanningCells(PRInt32 aRowIndex)
{ // the cell at (nextRowIndex, colIndex) is the result of a span { // the cell at (nextRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=nextRowIndex) if (realRowIndex!=nextRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
CellData *spanningCell = GetCellAt(aRowIndex, colIndex); CellData *spanningCell = GetCellAt(aRowIndex, colIndex);
@ -349,7 +351,8 @@ PRBool nsCellMap::ColIsSpannedInto(PRInt32 aColIndex)
{ // the cell at (rowIndex, aColIndex) is the result of a span { // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex) if (realColIndex!=aColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
result = PR_TRUE; result = PR_TRUE;
@ -389,7 +392,8 @@ PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex)
{ // the cell at (rowIndex, nextColIndex) is the result of a span { // the cell at (rowIndex, nextColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=nextColIndex) if (realColIndex!=nextColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
CellData *spanningCell =GetCellAt(rowIndex, aColIndex); CellData *spanningCell =GetCellAt(rowIndex, aColIndex);

Просмотреть файл

@ -50,6 +50,11 @@ static const PRBool gsDebugNT = PR_FALSE;
#endif #endif
NS_IMPL_ADDREF(nsTableCellFrame)
NS_IMPL_RELEASE(nsTableCellFrame)
void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex) void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{ {
NS_PRECONDITION(0<=aColIndex, "bad col index arg"); NS_PRECONDITION(0<=aColIndex, "bad col index arg");
@ -90,7 +95,9 @@ void nsTableCellFrame::SetBorderEdgeLength(PRUint8 aSide,
{ {
if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide)) if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide))
{ {
PRInt32 rowIndex = aIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength; border->mLength = aLength;
} }
@ -147,7 +154,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
} }
else else
{ {
//printf("-- Paint cell (%d %d)\n", GetRowIndex(), GetColIndex());
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this, nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides); aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
} }
@ -190,7 +196,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
{ {
case NS_SIDE_TOP: case NS_SIDE_TOP:
{ {
PRInt32 colIndex = aColIndex-GetColIndex(); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top); mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break; break;
@ -198,7 +206,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_BOTTOM: case NS_SIDE_BOTTOM:
{ {
PRInt32 colIndex = aColIndex-GetColIndex(); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom); mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break; break;
@ -206,7 +216,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_LEFT: case NS_SIDE_LEFT:
{ {
PRInt32 rowIndex = aRowIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left); mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break; break;
@ -214,7 +226,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_RIGHT: case NS_SIDE_RIGHT:
{ {
PRInt32 rowIndex = aRowIndex-GetRowIndex(); PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex)); border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right); mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break; break;
@ -568,7 +582,9 @@ nsTableCellFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
} }
cf->Init(aPresContext, mContent, aParent, aStyleContext); cf->Init(aPresContext, mContent, aParent, aStyleContext);
cf->AppendToFlow(this); cf->AppendToFlow(this);
cf->InitCellFrame(GetColIndex()); PRInt32 baseColIndex;
GetColIndex(baseColIndex);
cf->InitCellFrame(baseColIndex);
aContinuingFrame = cf; aContinuingFrame = cf;
// Create a continuing body frame // Create a continuing body frame
@ -764,7 +780,9 @@ void nsTableCellFrame::MapVAlignAttribute(nsIPresContext* aPresContext, nsTableF
// check if valign is set on the cell's COL (or COLGROUP by inheritance) // check if valign is set on the cell's COL (or COLGROUP by inheritance)
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame); PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle; const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle); colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) if (colTextStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated)
@ -809,7 +827,9 @@ void nsTableCellFrame::MapHAlignAttribute(nsIPresContext* aPresContext, nsTableF
// check if halign is set on the cell's COL (or COLGROUP by inheritance) // check if halign is set on the cell's COL (or COLGROUP by inheritance)
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame); PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle; const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle); colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated) if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated)
@ -851,6 +871,10 @@ nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
if (NULL == aInstancePtr) { if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
if (aIID.Equals(nsITableCellLayout::IID())) {
*aInstancePtr = (void*)(nsISupports*)(nsITableCellLayout*)this;
return NS_OK;
}
return nsContainerFrame::QueryInterface(aIID, aInstancePtr); return nsContainerFrame::QueryInterface(aIID, aInstancePtr);
} }

Просмотреть файл

@ -18,6 +18,7 @@
#ifndef nsTableCellFrame_h__ #ifndef nsTableCellFrame_h__
#define nsTableCellFrame_h__ #define nsTableCellFrame_h__
#include "nsITableCellLayout.h"
#include "nscore.h" #include "nscore.h"
#include "nsHTMLContainerFrame.h" #include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex #include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
@ -31,12 +32,20 @@ class nsHTMLValue;
* nsTableCellFrame * nsTableCellFrame
* data structure to maintain information about a single table cell's frame * data structure to maintain information about a single table cell's frame
* *
* NOTE: frames are not ref counted. We expose addref and release here
* so we can change that decsion in the future. Users of nsITableCellLayout
* should refcount correctly as if this object is being ref counted, though
* no actual support is under the hood.
*
* @author sclark * @author sclark
*/ */
class nsTableCellFrame : public nsHTMLContainerFrame class nsTableCellFrame : public nsHTMLContainerFrame, nsITableCellLayout
{ {
public: public:
// nsISupports
NS_DECL_ISUPPORTS
// default constructor supplied by the compiler // default constructor supplied by the compiler
void InitCellFrame(PRInt32 aColIndex); void InitCellFrame(PRInt32 aColIndex);
@ -60,9 +69,6 @@ public:
friend nsresult friend nsresult
NS_NewTableCellFrame(nsIFrame*& aResult); NS_NewTableCellFrame(nsIFrame*& aResult);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@ -91,13 +97,13 @@ public:
// there is no set row index because row index depends on the cell's parent row only // there is no set row index because row index depends on the cell's parent row only
/** return the mapped cell's row index (starting at 0 for the first row) */ /** return the mapped cell's row index (starting at 0 for the first row) */
virtual PRInt32 GetRowIndex(); virtual nsresult GetRowIndex(PRInt32 &aRowIndex);
/** return the mapped cell's col span. Always >= 1. */ /** return the mapped cell's col span. Always >= 1. */
virtual PRInt32 GetColSpan(); virtual PRInt32 GetColSpan();
/** return the mapped cell's column index (starting at 0 for the first column) */ /** return the mapped cell's column index (starting at 0 for the first column) */
virtual PRInt32 GetColIndex(); virtual nsresult GetColIndex(PRInt32 &aColIndex);
/** return the available width given to this frame during its last reflow */ /** return the available width given to this frame during its last reflow */
virtual nscoord GetPriorAvailWidth(); virtual nscoord GetPriorAvailWidth();
@ -211,18 +217,29 @@ public:
}; };
inline PRInt32 nsTableCellFrame::GetRowIndex() inline nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex)
{ {
nsresult result;
nsTableRowFrame * row; nsTableRowFrame * row;
GetParent((nsIFrame **)&row); GetParent((nsIFrame **)&row);
if (nsnull!=row) if (nsnull!=row)
return row->GetRowIndex(); {
aRowIndex = row->GetRowIndex();
result = NS_OK;
}
else else
return 0; {
aRowIndex = 0;
result = NS_ERROR_NOT_INITIALIZED;
}
return result;
} }
inline PRInt32 nsTableCellFrame::GetColIndex() inline nsresult nsTableCellFrame::GetColIndex(PRInt32 &aColIndex)
{ return mColIndex;} {
aColIndex = mColIndex;
return NS_OK;
}
inline nscoord nsTableCellFrame::GetPriorAvailWidth() inline nscoord nsTableCellFrame::GetPriorAvailWidth()
{ return mPriorAvailWidth;} { return mPriorAvailWidth;}

Просмотреть файл

@ -611,7 +611,8 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{ {
result = colSpan; result = colSpan;
// check for case where all cells in a column have a colspan // check for case where all cells in a column have a colspan
PRInt32 initialColIndex = aCell->GetColIndex(); PRInt32 initialColIndex;
aCell->GetColIndex(initialColIndex);
PRInt32 minColSpanForCol = cellMap->GetMinColSpan(initialColIndex); PRInt32 minColSpanForCol = cellMap->GetMinColSpan(initialColIndex);
result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1 result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1
// and we want to treat default as 0 (no effect) // and we want to treat default as 0 (no effect)
@ -621,7 +622,9 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{ {
printf("ERROR!\n"); printf("ERROR!\n");
DumpCellMap(); DumpCellMap();
printf("aColIndex=%d, cell->colIndex=%d\n", aColIndex, aCell->GetColIndex()); PRInt32 initialColIndex;
aCell->GetColIndex(initialColIndex);
printf("aColIndex=%d, cell->colIndex=%d\n", aColIndex, initialColIndex);
printf("aCell->colSpan=%d\n", aCell->GetColSpan()); printf("aCell->colSpan=%d\n", aCell->GetColSpan());
printf("colCount=%d\n", mCellMap->GetColCount()); printf("colCount=%d\n", mCellMap->GetColCount());
} }
@ -972,7 +975,8 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame *row; nsTableRowFrame *row;
cell->GetParent((nsIFrame **)&row); cell->GetParent((nsIFrame **)&row);
int rr = row->GetRowIndex (); int rr = row->GetRowIndex ();
int cc = cell->GetColIndex (); int cc;
cell->GetColIndex(cc);
printf("S%d,%d ", rr, cc); printf("S%d,%d ", rr, cc);
if (cd->mOverlap != nsnull) if (cd->mOverlap != nsnull)
{ {
@ -980,7 +984,7 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame* row2; nsTableRowFrame* row2;
cell->GetParent((nsIFrame **)&row2); cell->GetParent((nsIFrame **)&row2);
rr = row2->GetRowIndex (); rr = row2->GetRowIndex ();
cc = cell->GetColIndex (); cell->GetColIndex (cc);
printf("O%d,%c ", rr, cc); printf("O%d,%c ", rr, cc);
} }
else else
@ -1422,7 +1426,8 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (aRowIndex, colIndex) is the result of a span { // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex (); PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex) if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan { // the span is caused by a rowspan
rightNeighborFrame = cd->mRealCell->mCell; rightNeighborFrame = cd->mRealCell->mCell;
@ -1640,7 +1645,8 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (rowIndex, aColIndex) is the result of a span { // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell; nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell"); NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex (); PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex) if (realColIndex!=aColIndex)
{ // the span is caused by a colspan { // the span is caused by a colspan
bottomNeighborFrame = cd->mRealCell->mCell; bottomNeighborFrame = cd->mRealCell->mCell;
@ -3830,16 +3836,18 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext,
if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) || if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) ||
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) { (eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// compute the width per column spanned // compute the width per column spanned
PRInt32 colSpan = GetEffectiveColSpan(aCellFrame->GetColIndex(), aCellFrame); PRInt32 baseColIndex;
aCellFrame->GetColIndex(baseColIndex);
PRInt32 colSpan = GetEffectiveColSpan(baseColIndex, aCellFrame);
if (PR_TRUE==gsDebug) if (PR_TRUE==gsDebug)
printf("TIF SetCSFromCell: for col %d with colspan %d\n",aCellFrame->GetColIndex(), colSpan); printf("TIF SetCSFromCell: for col %d with colspan %d\n",baseColIndex, colSpan);
for (PRInt32 i=0; i<colSpan; i++) for (PRInt32 i=0; i<colSpan; i++)
{ {
// get the appropriate column frame // get the appropriate column frame
nsTableColFrame *colFrame; nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame); GetColumnFrame(i+baseColIndex, colFrame);
if (PR_TRUE==gsDebug) if (PR_TRUE==gsDebug)
printf("TIF SetCSFromCell: for col %d (%p)\n",i+aCellFrame->GetColIndex(), colFrame); printf("TIF SetCSFromCell: for col %d (%p)\n",i+baseColIndex, colFrame);
// if the colspan is 1 and we already have a cell that set this column's width // if the colspan is 1 and we already have a cell that set this column's width
// then ignore this width attribute // then ignore this width attribute
if ((1==colSpan) && (nsTableColFrame::eWIDTH_SOURCE_CELL == colFrame->GetWidthSource())) if ((1==colSpan) && (nsTableColFrame::eWIDTH_SOURCE_CELL == colFrame->GetWidthSource()))
@ -4686,7 +4694,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if ((NS_OK==rv) && (nsnull!=tableParent) && (nsnull!=tableParent->mColumnWidths)) if ((NS_OK==rv) && (nsnull!=tableParent) && (nsnull!=tableParent->mColumnWidths))
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i=0; i<colSpan; i++) for (PRInt32 i=0; i<colSpan; i++)
parentWidth += tableParent->GetColumnWidth(colIndex); parentWidth += tableParent->GetColumnWidth(colIndex);
@ -4738,7 +4747,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths) if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths)
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++) for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex); parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
@ -4762,7 +4772,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet()) if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
{ {
parentWidth=0; parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex(); PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame); PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++) for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex); parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);

Просмотреть файл

@ -527,7 +527,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
// Compute the x-origin for the child, taking into account straddlers (cells from prior // Compute the x-origin for the child, taking into account straddlers (cells from prior
// rows with rowspans > 1) // rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); PRInt32 cellColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
if (prevColIndex != (cellColIndex-1)) if (prevColIndex != (cellColIndex-1))
{ // if this cell is not immediately adjacent to the previous cell, factor in missing col info { // if this cell is not immediately adjacent to the previous cell, factor in missing col info
for (PRInt32 colIndex=prevColIndex+1; colIndex<cellColIndex; colIndex++) for (PRInt32 colIndex=prevColIndex+1; colIndex<cellColIndex; colIndex++)
@ -544,8 +545,10 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext& aPresContext,
// at this point, we know the column widths. // at this point, we know the column widths.
// so we get the avail width from the known column widths // so we get the avail width from the known column widths
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)kidFrame)->GetColIndex(), PRInt32 baseColIndex;
((nsTableCellFrame *)kidFrame)); ((nsTableCellFrame *)kidFrame)->GetColIndex(baseColIndex);
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(baseColIndex,
((nsTableCellFrame *)kidFrame));
nscoord availWidth = 0; nscoord availWidth = 0;
for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++) for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++)
{ {
@ -781,7 +784,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
} }
else else
{ {
PRInt32 colIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex(); PRInt32 colIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(colIndex);
kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE); kidAvailSize.SizeTo(table->GetColumnWidth(colIndex), NS_UNCONSTRAINEDSIZE);
} }
@ -1240,9 +1244,10 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
// At this point, we know the column widths. Get the available width // At this point, we know the column widths. Get the available width
// from the known column widths // from the known column widths
PRInt32 cellColIndex = ((nsTableCellFrame *)aNextFrame)->GetColIndex(); PRInt32 cellColIndex;
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)aNextFrame)->GetColIndex(), ((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
((nsTableCellFrame *)aNextFrame)); PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
((nsTableCellFrame *)aNextFrame));
nscoord availWidth = 0; nscoord availWidth = 0;
for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++) for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++)
{ {