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)
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
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue;
@ -329,7 +331,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame);
if (colSpan>maxColSpan)
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check
continue;
@ -736,7 +740,9 @@ void BasicTableLayoutStrategy::SetMinAndMaxTableWidths()
if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex);
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
if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex);
continue;
@ -1093,12 +1099,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
}
if (-1==firstRowIndex)
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
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue;
@ -1177,7 +1187,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
// otherwise it's already been factored in.
// 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
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
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;
@ -1823,12 +1835,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
{ // there is no cell in this row that corresponds to this column
continue;
}
if (rowIndex!=cellFrame->GetRowIndex()) {
PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// 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
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue;
@ -1902,7 +1918,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
// otherwise it's already been factored in.
// 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
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
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;

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

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

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

@ -50,6 +50,11 @@ static const PRBool gsDebugNT = PR_FALSE;
#endif
NS_IMPL_ADDREF(nsTableCellFrame)
NS_IMPL_RELEASE(nsTableCellFrame)
void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{
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))
{
PRInt32 rowIndex = aIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength;
}
@ -147,7 +154,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
}
else
{
//printf("-- Paint cell (%d %d)\n", GetRowIndex(), GetColIndex());
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
}
@ -190,7 +196,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
{
case NS_SIDE_TOP:
{
PRInt32 colIndex = aColIndex-GetColIndex();
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break;
@ -198,7 +206,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_BOTTOM:
{
PRInt32 colIndex = aColIndex-GetColIndex();
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break;
@ -206,7 +216,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_LEFT:
{
PRInt32 rowIndex = aRowIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break;
@ -214,7 +226,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_RIGHT:
{
PRInt32 rowIndex = aRowIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break;
@ -568,7 +582,9 @@ nsTableCellFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
}
cf->Init(aPresContext, mContent, aParent, aStyleContext);
cf->AppendToFlow(this);
cf->InitCellFrame(GetColIndex());
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
cf->InitCellFrame(baseColIndex);
aContinuingFrame = cf;
// 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)
nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame);
PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
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)
nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame);
PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated)
@ -851,6 +871,10 @@ nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(nsITableCellLayout::IID())) {
*aInstancePtr = (void*)(nsISupports*)(nsITableCellLayout*)this;
return NS_OK;
}
return nsContainerFrame::QueryInterface(aIID, aInstancePtr);
}

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

@ -18,6 +18,7 @@
#ifndef nsTableCellFrame_h__
#define nsTableCellFrame_h__
#include "nsITableCellLayout.h"
#include "nscore.h"
#include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
@ -31,12 +32,20 @@ class nsHTMLValue;
* nsTableCellFrame
* 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
*/
class nsTableCellFrame : public nsHTMLContainerFrame
class nsTableCellFrame : public nsHTMLContainerFrame, nsITableCellLayout
{
public:
// nsISupports
NS_DECL_ISUPPORTS
// default constructor supplied by the compiler
void InitCellFrame(PRInt32 aColIndex);
@ -60,9 +69,6 @@ public:
friend nsresult
NS_NewTableCellFrame(nsIFrame*& aResult);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
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
/** 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. */
virtual PRInt32 GetColSpan();
/** 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 */
virtual nscoord GetPriorAvailWidth();
@ -211,18 +217,29 @@ public:
};
inline PRInt32 nsTableCellFrame::GetRowIndex()
inline nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex)
{
nsresult result;
nsTableRowFrame * row;
GetParent((nsIFrame **)&row);
if (nsnull!=row)
return row->GetRowIndex();
{
aRowIndex = row->GetRowIndex();
result = NS_OK;
}
else
return 0;
{
aRowIndex = 0;
result = NS_ERROR_NOT_INITIALIZED;
}
return result;
}
inline PRInt32 nsTableCellFrame::GetColIndex()
{ return mColIndex;}
inline nsresult nsTableCellFrame::GetColIndex(PRInt32 &aColIndex)
{
aColIndex = mColIndex;
return NS_OK;
}
inline nscoord nsTableCellFrame::GetPriorAvailWidth()
{ return mPriorAvailWidth;}

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

@ -611,7 +611,8 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{
result = 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);
result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1
// and we want to treat default as 0 (no effect)
@ -621,7 +622,9 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{
printf("ERROR!\n");
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("colCount=%d\n", mCellMap->GetColCount());
}
@ -972,7 +975,8 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame *row;
cell->GetParent((nsIFrame **)&row);
int rr = row->GetRowIndex ();
int cc = cell->GetColIndex ();
int cc;
cell->GetColIndex(cc);
printf("S%d,%d ", rr, cc);
if (cd->mOverlap != nsnull)
{
@ -980,7 +984,7 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame* row2;
cell->GetParent((nsIFrame **)&row2);
rr = row2->GetRowIndex ();
cc = cell->GetColIndex ();
cell->GetColIndex (cc);
printf("O%d,%c ", rr, cc);
}
else
@ -1422,7 +1426,8 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex ();
PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan
rightNeighborFrame = cd->mRealCell->mCell;
@ -1640,7 +1645,8 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex ();
PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex)
{ // the span is caused by a colspan
bottomNeighborFrame = cd->mRealCell->mCell;
@ -3830,16 +3836,18 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext,
if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) ||
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// 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)
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++)
{
// get the appropriate column frame
nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame);
GetColumnFrame(i+baseColIndex, colFrame);
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
// then ignore this width attribute
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))
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i=0; i<colSpan; i++)
parentWidth += tableParent->GetColumnWidth(colIndex);
@ -4738,7 +4747,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths)
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
@ -4762,7 +4772,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++)
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
// rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
PRInt32 cellColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
if (prevColIndex != (cellColIndex-1))
{ // if this cell is not immediately adjacent to the previous cell, factor in missing col info
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.
// so we get the avail width from the known column widths
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)kidFrame)->GetColIndex(),
((nsTableCellFrame *)kidFrame));
PRInt32 baseColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(baseColIndex);
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(baseColIndex,
((nsTableCellFrame *)kidFrame));
nscoord availWidth = 0;
for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++)
{
@ -781,7 +784,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
}
else
{
PRInt32 colIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
PRInt32 colIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(colIndex);
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
// from the known column widths
PRInt32 cellColIndex = ((nsTableCellFrame *)aNextFrame)->GetColIndex();
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)aNextFrame)->GetColIndex(),
((nsTableCellFrame *)aNextFrame));
PRInt32 cellColIndex;
((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
((nsTableCellFrame *)aNextFrame));
nscoord availWidth = 0;
for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++)
{

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

@ -321,7 +321,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
}
if (-1==firstRowIndex)
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
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
continue;
@ -329,7 +331,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(colIndex, cellFrame);
if (colSpan>maxColSpan)
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match col span"); // sanity check
continue;
@ -736,7 +740,9 @@ void BasicTableLayoutStrategy::SetMinAndMaxTableWidths()
if (gsDebug) printf(" col %d skipped because there is no cell\n", colIndex);
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
if (gsDebug) printf(" col %d skipped because it has colspan so we've already added it in\n", colIndex);
continue;
@ -1093,12 +1099,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
}
if (-1==firstRowIndex)
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
NS_ASSERTION(1 != cellFrame->GetRowSpan(), "row index does not match row span"); // sanity check
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue;
@ -1177,7 +1187,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
// otherwise it's already been factored in.
// 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
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
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;
@ -1823,12 +1835,16 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
{ // there is no cell in this row that corresponds to this column
continue;
}
if (rowIndex!=cellFrame->GetRowIndex()) {
PRInt32 cellRowIndex;
cellFrame->GetRowIndex(cellRowIndex);
if (rowIndex!=cellRowIndex) {
// 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
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
NS_ASSERTION(1 != cellFrame->GetColSpan(), "col index does not match row span"); // sanity check
continue;
@ -1902,7 +1918,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt
// otherwise it's already been factored in.
// 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
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
SpanInfo *spanInfo = new SpanInfo(colIndex, colSpan-1, cellMinSize.width, cellDesiredSize.width);
spanInfo->effectiveMaxWidthOfSpannedCols = effectiveMaxWidthOfSpannedCols;

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

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

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

@ -50,6 +50,11 @@ static const PRBool gsDebugNT = PR_FALSE;
#endif
NS_IMPL_ADDREF(nsTableCellFrame)
NS_IMPL_RELEASE(nsTableCellFrame)
void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{
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))
{
PRInt32 rowIndex = aIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength;
}
@ -147,7 +154,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
}
else
{
//printf("-- Paint cell (%d %d)\n", GetRowIndex(), GetColIndex());
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
}
@ -190,7 +196,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
{
case NS_SIDE_TOP:
{
PRInt32 colIndex = aColIndex-GetColIndex();
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break;
@ -198,7 +206,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_BOTTOM:
{
PRInt32 colIndex = aColIndex-GetColIndex();
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break;
@ -206,7 +216,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_LEFT:
{
PRInt32 rowIndex = aRowIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break;
@ -214,7 +226,9 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
case NS_SIDE_RIGHT:
{
PRInt32 rowIndex = aRowIndex-GetRowIndex();
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break;
@ -568,7 +582,9 @@ nsTableCellFrame::CreateContinuingFrame(nsIPresContext& aPresContext,
}
cf->Init(aPresContext, mContent, aParent, aStyleContext);
cf->AppendToFlow(this);
cf->InitCellFrame(GetColIndex());
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
cf->InitCellFrame(baseColIndex);
aContinuingFrame = cf;
// 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)
nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame);
PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
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)
nsTableColFrame *colFrame;
aTableFrame->GetColumnFrame(GetColIndex(), colFrame);
PRInt32 colIndex;
GetColIndex(colIndex);
aTableFrame->GetColumnFrame(colIndex, colFrame);
const nsStyleText* colTextStyle;
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
if (colTextStyle->mTextAlign.GetUnit() == eStyleUnit_Enumerated)
@ -851,6 +871,10 @@ nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(nsITableCellLayout::IID())) {
*aInstancePtr = (void*)(nsISupports*)(nsITableCellLayout*)this;
return NS_OK;
}
return nsContainerFrame::QueryInterface(aIID, aInstancePtr);
}

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

@ -18,6 +18,7 @@
#ifndef nsTableCellFrame_h__
#define nsTableCellFrame_h__
#include "nsITableCellLayout.h"
#include "nscore.h"
#include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
@ -31,12 +32,20 @@ class nsHTMLValue;
* nsTableCellFrame
* 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
*/
class nsTableCellFrame : public nsHTMLContainerFrame
class nsTableCellFrame : public nsHTMLContainerFrame, nsITableCellLayout
{
public:
// nsISupports
NS_DECL_ISUPPORTS
// default constructor supplied by the compiler
void InitCellFrame(PRInt32 aColIndex);
@ -60,9 +69,6 @@ public:
friend nsresult
NS_NewTableCellFrame(nsIFrame*& aResult);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,
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
/** 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. */
virtual PRInt32 GetColSpan();
/** 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 */
virtual nscoord GetPriorAvailWidth();
@ -211,18 +217,29 @@ public:
};
inline PRInt32 nsTableCellFrame::GetRowIndex()
inline nsresult nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex)
{
nsresult result;
nsTableRowFrame * row;
GetParent((nsIFrame **)&row);
if (nsnull!=row)
return row->GetRowIndex();
{
aRowIndex = row->GetRowIndex();
result = NS_OK;
}
else
return 0;
{
aRowIndex = 0;
result = NS_ERROR_NOT_INITIALIZED;
}
return result;
}
inline PRInt32 nsTableCellFrame::GetColIndex()
{ return mColIndex;}
inline nsresult nsTableCellFrame::GetColIndex(PRInt32 &aColIndex)
{
aColIndex = mColIndex;
return NS_OK;
}
inline nscoord nsTableCellFrame::GetPriorAvailWidth()
{ return mPriorAvailWidth;}

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

@ -611,7 +611,8 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{
result = 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);
result -= (minColSpanForCol - 1); // minColSpanForCol is always at least 1
// and we want to treat default as 0 (no effect)
@ -621,7 +622,9 @@ PRInt32 nsTableFrame::GetEffectiveColSpan (PRInt32 aColIndex, nsTableCellFrame *
{
printf("ERROR!\n");
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("colCount=%d\n", mCellMap->GetColCount());
}
@ -972,7 +975,8 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame *row;
cell->GetParent((nsIFrame **)&row);
int rr = row->GetRowIndex ();
int cc = cell->GetColIndex ();
int cc;
cell->GetColIndex(cc);
printf("S%d,%d ", rr, cc);
if (cd->mOverlap != nsnull)
{
@ -980,7 +984,7 @@ void nsTableFrame::DumpCellMap ()
nsTableRowFrame* row2;
cell->GetParent((nsIFrame **)&row2);
rr = row2->GetRowIndex ();
cc = cell->GetColIndex ();
cell->GetColIndex (cc);
printf("O%d,%c ", rr, cc);
}
else
@ -1422,7 +1426,8 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (aRowIndex, colIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realRowIndex = cell->GetRowIndex ();
PRInt32 realRowIndex;
cell->GetRowIndex (realRowIndex);
if (realRowIndex!=aRowIndex)
{ // the span is caused by a rowspan
rightNeighborFrame = cd->mRealCell->mCell;
@ -1640,7 +1645,8 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{ // the cell at (rowIndex, aColIndex) is the result of a span
nsTableCellFrame *cell = cd->mRealCell->mCell;
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
const PRInt32 realColIndex = cell->GetColIndex ();
PRInt32 realColIndex;
cell->GetColIndex (realColIndex);
if (realColIndex!=aColIndex)
{ // the span is caused by a colspan
bottomNeighborFrame = cd->mRealCell->mCell;
@ -3830,16 +3836,18 @@ nsTableFrame::SetColumnStyleFromCell(nsIPresContext & aPresContext,
if ((eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) ||
(eStyleUnit_Percent==cellPosition->mWidth.GetUnit())) {
// 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)
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++)
{
// get the appropriate column frame
nsTableColFrame *colFrame;
GetColumnFrame(i+aCellFrame->GetColIndex(), colFrame);
GetColumnFrame(i+baseColIndex, colFrame);
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
// then ignore this width attribute
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))
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = tableParent->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i=0; i<colSpan; i++)
parentWidth += tableParent->GetColumnWidth(colIndex);
@ -4738,7 +4747,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (nsnull != ((nsTableFrame*)(rs->frame))->mColumnWidths)
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++)
parentWidth += ((nsTableFrame*)(rs->frame))->GetColumnWidth(i+colIndex);
@ -4762,7 +4772,8 @@ nscoord nsTableFrame::GetTableContainerWidth(const nsHTMLReflowState& aReflowSta
if (PR_TRUE==((nsTableFrame*)(rs->frame))->IsColumnWidthsSet())
{
parentWidth=0;
PRInt32 colIndex = lastCellFrame->GetColIndex();
PRInt32 colIndex;
lastCellFrame->GetColIndex(colIndex);
PRInt32 colSpan = ((nsTableFrame*)(rs->frame))->GetEffectiveColSpan(colIndex, lastCellFrame);
for (PRInt32 i = 0; i<colSpan; i++)
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
// rows with rowspans > 1)
PRInt32 cellColIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
PRInt32 cellColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(cellColIndex);
if (prevColIndex != (cellColIndex-1))
{ // if this cell is not immediately adjacent to the previous cell, factor in missing col info
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.
// so we get the avail width from the known column widths
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)kidFrame)->GetColIndex(),
((nsTableCellFrame *)kidFrame));
PRInt32 baseColIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(baseColIndex);
cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(baseColIndex,
((nsTableCellFrame *)kidFrame));
nscoord availWidth = 0;
for (PRInt32 numColSpan=0; numColSpan<cellColSpan; numColSpan++)
{
@ -781,7 +784,8 @@ nsTableRowFrame::InitialReflow(nsIPresContext& aPresContext,
}
else
{
PRInt32 colIndex = ((nsTableCellFrame *)kidFrame)->GetColIndex();
PRInt32 colIndex;
((nsTableCellFrame *)kidFrame)->GetColIndex(colIndex);
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
// from the known column widths
PRInt32 cellColIndex = ((nsTableCellFrame *)aNextFrame)->GetColIndex();
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(((nsTableCellFrame *)aNextFrame)->GetColIndex(),
((nsTableCellFrame *)aNextFrame));
PRInt32 cellColIndex;
((nsTableCellFrame *)aNextFrame)->GetColIndex(cellColIndex);
PRInt32 cellColSpan = aReflowState.tableFrame->GetEffectiveColSpan(cellColIndex,
((nsTableCellFrame *)aNextFrame));
nscoord availWidth = 0;
for (PRInt32 numColSpan = 0; numColSpan < cellColSpan; numColSpan++)
{