more cleanup and frame/content separation

This commit is contained in:
buster 1998-06-11 00:41:09 +00:00
Родитель 97462bdc65
Коммит 95fd7aebf2
6 изменённых файлов: 12 добавлений и 49 удалений

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

@ -229,8 +229,6 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
NS_ASSERTION(nsnull != colData, "bad column data");
nsTableColFrame *colFrame = colData->GetColFrame();
NS_ASSERTION(nsnull!=colFrame, "bad col frame");
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
NS_ASSERTION(col.IsNotNull(), "bad col");
// need to track min/max column width for setting min/max table widths
PRInt32 minColWidth = 0;
@ -448,7 +446,6 @@ PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth(nsIPresContext* aPresConte
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
{
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 minColWidth = 0;
PRInt32 maxColWidth = 0;
@ -520,7 +517,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
PRInt32 maxColWidth = 0;
// Get column information
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 numCells = cells->Count();
@ -863,7 +859,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( nsIPresContext* aPre
PRInt32 maxColWidth = 0;
// Get column information
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 numCells = cells->Count();

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

@ -16,14 +16,12 @@
* Reserved.
*/
#include "nsColLayoutData.h"
#include "nsTableCol.h"
#include "nsVoidArray.h"
#include "nsCellLayoutData.h"
#include "nsTableCell.h"
nsColLayoutData::nsColLayoutData(nsTableCol *aCol)
nsColLayoutData::nsColLayoutData()
{
mCol = aCol;
mCells = new nsVoidArray();
mColFrame = nsnull;
}
@ -43,11 +41,11 @@ nsColLayoutData::~nsColLayoutData()
mCells = 0;
}
PRInt32 nsColLayoutData::IndexOf(nsTableCell* aTableCell) const
PRInt32 nsColLayoutData::IndexOf(nsIContent* aCell) const
{
PRInt32 count = this->Count();
PRInt32 result = -1;
if (aTableCell != nsnull)
if (aCell != nsnull)
{
for (PRInt32 index = 0; index < count; index++)
{
@ -57,10 +55,10 @@ PRInt32 nsColLayoutData::IndexOf(nsTableCell* aTableCell) const
nsTableCellFrame* frame = cellData->GetCellFrame();
if (frame != nsnull)
{
nsTableCell* cell;
nsIContent* cell;
frame->GetContent((nsIContent*&)cell);
if (cell == aTableCell)
frame->GetContent(cell);
if (cell == aCell)
{
result = index;
NS_RELEASE(cell);

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

@ -21,12 +21,12 @@
#include "nscore.h"
#include "nsSize.h"
#include "nsIFrame.h"
#include "nsTableCol.h"
#include "nsVoidArray.h"
class nsVoidArray;
class nsCellLayoutData;
class nsTableFrame;
class nsTableColFrame;
class nsIContent;
/** Simple data class that represents in-process reflow information about a column.
@ -34,15 +34,11 @@ class nsTableColFrame;
class nsColLayoutData
{
public:
nsColLayoutData(nsTableCol *aCol);
nsColLayoutData();
// NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
~nsColLayoutData();
nsTableCol * GetCol();
void SetCol(nsTableCol * aCol);
nsTableColFrame *GetColFrame();
void SetColFrame(nsTableColFrame *aColFrame);
@ -54,7 +50,7 @@ public:
nsCellLayoutData* ElementAt(PRInt32 aIndex) const;
PRInt32 IndexOf(nsCellLayoutData* aCellLayoutData) const;
PRInt32 IndexOf(nsTableCell* aTableCell) const;
PRInt32 IndexOf(nsIContent* aTableCell) const;
nsCellLayoutData* GetNext(nsCellLayoutData* aCellLayoutData) const;
@ -71,7 +67,6 @@ public:
private:
nsTableCol *mCol;
nsTableColFrame *mColFrame;
nsVoidArray *mCells;
@ -79,22 +74,6 @@ private:
/* ---------- inlines ---------- */
inline nsTableCol * nsColLayoutData::GetCol()
{
NS_IF_ADDREF(mCol);
return mCol;
};
inline void nsColLayoutData::SetCol(nsTableCol * aCol)
{
if (aCol != mCol)
{
NS_IF_ADDREF(aCol);
NS_IF_RELEASE(mCol);
mCol = aCol;
}
}
inline nsTableColFrame * nsColLayoutData::GetColFrame()
{ return mColFrame;}

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

@ -2123,9 +2123,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext,
// TODO: unify these 2 kinds of column data
// TODO: cache more column data, like the mWidth.GetUnit and what its value
nsTableColPtr col = (nsTableCol *)tableKid->ChildAt(j);
NS_ASSERTION(col.IsNotNull(), "bad content");
nsColLayoutData *colData = new nsColLayoutData(col);
nsColLayoutData *colData = new nsColLayoutData();
nsTableColFrame *colFrame=nsnull;
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
colData->SetColFrame(colFrame);

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

@ -229,8 +229,6 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
NS_ASSERTION(nsnull != colData, "bad column data");
nsTableColFrame *colFrame = colData->GetColFrame();
NS_ASSERTION(nsnull!=colFrame, "bad col frame");
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
NS_ASSERTION(col.IsNotNull(), "bad col");
// need to track min/max column width for setting min/max table widths
PRInt32 minColWidth = 0;
@ -448,7 +446,6 @@ PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth(nsIPresContext* aPresConte
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
{
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 minColWidth = 0;
PRInt32 maxColWidth = 0;
@ -520,7 +517,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
PRInt32 maxColWidth = 0;
// Get column information
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 numCells = cells->Count();
@ -863,7 +859,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( nsIPresContext* aPre
PRInt32 maxColWidth = 0;
// Get column information
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
nsVoidArray *cells = colData->GetCells();
PRInt32 numCells = cells->Count();

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

@ -2123,9 +2123,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext,
// TODO: unify these 2 kinds of column data
// TODO: cache more column data, like the mWidth.GetUnit and what its value
nsTableColPtr col = (nsTableCol *)tableKid->ChildAt(j);
NS_ASSERTION(col.IsNotNull(), "bad content");
nsColLayoutData *colData = new nsColLayoutData(col);
nsColLayoutData *colData = new nsColLayoutData();
nsTableColFrame *colFrame=nsnull;
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
colData->SetColFrame(colFrame);