зеркало из https://github.com/mozilla/pjs.git
more cleanup and frame/content separation
This commit is contained in:
Родитель
97462bdc65
Коммит
95fd7aebf2
|
@ -229,8 +229,6 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
|
||||||
NS_ASSERTION(nsnull != colData, "bad column data");
|
NS_ASSERTION(nsnull != colData, "bad column data");
|
||||||
nsTableColFrame *colFrame = colData->GetColFrame();
|
nsTableColFrame *colFrame = colData->GetColFrame();
|
||||||
NS_ASSERTION(nsnull!=colFrame, "bad col frame");
|
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
|
// need to track min/max column width for setting min/max table widths
|
||||||
PRInt32 minColWidth = 0;
|
PRInt32 minColWidth = 0;
|
||||||
|
@ -448,7 +446,6 @@ PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth(nsIPresContext* aPresConte
|
||||||
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
|
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
|
||||||
{
|
{
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 minColWidth = 0;
|
PRInt32 minColWidth = 0;
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
|
@ -520,7 +517,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
// Get column information
|
// Get column information
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 numCells = cells->Count();
|
PRInt32 numCells = cells->Count();
|
||||||
|
|
||||||
|
@ -863,7 +859,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( nsIPresContext* aPre
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
// Get column information
|
// Get column information
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 numCells = cells->Count();
|
PRInt32 numCells = cells->Count();
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,12 @@
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
#include "nsColLayoutData.h"
|
#include "nsColLayoutData.h"
|
||||||
#include "nsTableCol.h"
|
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsCellLayoutData.h"
|
#include "nsCellLayoutData.h"
|
||||||
#include "nsTableCell.h"
|
#include "nsTableCell.h"
|
||||||
|
|
||||||
nsColLayoutData::nsColLayoutData(nsTableCol *aCol)
|
nsColLayoutData::nsColLayoutData()
|
||||||
{
|
{
|
||||||
mCol = aCol;
|
|
||||||
mCells = new nsVoidArray();
|
mCells = new nsVoidArray();
|
||||||
mColFrame = nsnull;
|
mColFrame = nsnull;
|
||||||
}
|
}
|
||||||
|
@ -43,11 +41,11 @@ nsColLayoutData::~nsColLayoutData()
|
||||||
mCells = 0;
|
mCells = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 nsColLayoutData::IndexOf(nsTableCell* aTableCell) const
|
PRInt32 nsColLayoutData::IndexOf(nsIContent* aCell) const
|
||||||
{
|
{
|
||||||
PRInt32 count = this->Count();
|
PRInt32 count = this->Count();
|
||||||
PRInt32 result = -1;
|
PRInt32 result = -1;
|
||||||
if (aTableCell != nsnull)
|
if (aCell != nsnull)
|
||||||
{
|
{
|
||||||
for (PRInt32 index = 0; index < count; index++)
|
for (PRInt32 index = 0; index < count; index++)
|
||||||
{
|
{
|
||||||
|
@ -57,10 +55,10 @@ PRInt32 nsColLayoutData::IndexOf(nsTableCell* aTableCell) const
|
||||||
nsTableCellFrame* frame = cellData->GetCellFrame();
|
nsTableCellFrame* frame = cellData->GetCellFrame();
|
||||||
if (frame != nsnull)
|
if (frame != nsnull)
|
||||||
{
|
{
|
||||||
nsTableCell* cell;
|
nsIContent* cell;
|
||||||
|
|
||||||
frame->GetContent((nsIContent*&)cell);
|
frame->GetContent(cell);
|
||||||
if (cell == aTableCell)
|
if (cell == aCell)
|
||||||
{
|
{
|
||||||
result = index;
|
result = index;
|
||||||
NS_RELEASE(cell);
|
NS_RELEASE(cell);
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsSize.h"
|
#include "nsSize.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsTableCol.h"
|
#include "nsVoidArray.h"
|
||||||
|
|
||||||
class nsVoidArray;
|
|
||||||
class nsCellLayoutData;
|
class nsCellLayoutData;
|
||||||
class nsTableFrame;
|
class nsTableFrame;
|
||||||
class nsTableColFrame;
|
class nsTableColFrame;
|
||||||
|
class nsIContent;
|
||||||
|
|
||||||
|
|
||||||
/** Simple data class that represents in-process reflow information about a column.
|
/** Simple data class that represents in-process reflow information about a column.
|
||||||
|
@ -34,15 +34,11 @@ class nsTableColFrame;
|
||||||
class nsColLayoutData
|
class nsColLayoutData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsColLayoutData(nsTableCol *aCol);
|
nsColLayoutData();
|
||||||
|
|
||||||
// NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
|
// NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
|
||||||
~nsColLayoutData();
|
~nsColLayoutData();
|
||||||
|
|
||||||
nsTableCol * GetCol();
|
|
||||||
|
|
||||||
void SetCol(nsTableCol * aCol);
|
|
||||||
|
|
||||||
nsTableColFrame *GetColFrame();
|
nsTableColFrame *GetColFrame();
|
||||||
|
|
||||||
void SetColFrame(nsTableColFrame *aColFrame);
|
void SetColFrame(nsTableColFrame *aColFrame);
|
||||||
|
@ -54,7 +50,7 @@ public:
|
||||||
nsCellLayoutData* ElementAt(PRInt32 aIndex) const;
|
nsCellLayoutData* ElementAt(PRInt32 aIndex) const;
|
||||||
|
|
||||||
PRInt32 IndexOf(nsCellLayoutData* aCellLayoutData) const;
|
PRInt32 IndexOf(nsCellLayoutData* aCellLayoutData) const;
|
||||||
PRInt32 IndexOf(nsTableCell* aTableCell) const;
|
PRInt32 IndexOf(nsIContent* aTableCell) const;
|
||||||
|
|
||||||
nsCellLayoutData* GetNext(nsCellLayoutData* aCellLayoutData) const;
|
nsCellLayoutData* GetNext(nsCellLayoutData* aCellLayoutData) const;
|
||||||
|
|
||||||
|
@ -71,7 +67,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
nsTableCol *mCol;
|
|
||||||
nsTableColFrame *mColFrame;
|
nsTableColFrame *mColFrame;
|
||||||
nsVoidArray *mCells;
|
nsVoidArray *mCells;
|
||||||
|
|
||||||
|
@ -79,22 +74,6 @@ private:
|
||||||
|
|
||||||
/* ---------- inlines ---------- */
|
/* ---------- 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()
|
inline nsTableColFrame * nsColLayoutData::GetColFrame()
|
||||||
{ return mColFrame;}
|
{ return mColFrame;}
|
||||||
|
|
||||||
|
|
|
@ -2123,9 +2123,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext,
|
||||||
// TODO: unify these 2 kinds of column data
|
// TODO: unify these 2 kinds of column data
|
||||||
// TODO: cache more column data, like the mWidth.GetUnit and what its value
|
// TODO: cache more column data, like the mWidth.GetUnit and what its value
|
||||||
|
|
||||||
nsTableColPtr col = (nsTableCol *)tableKid->ChildAt(j);
|
nsColLayoutData *colData = new nsColLayoutData();
|
||||||
NS_ASSERTION(col.IsNotNull(), "bad content");
|
|
||||||
nsColLayoutData *colData = new nsColLayoutData(col);
|
|
||||||
nsTableColFrame *colFrame=nsnull;
|
nsTableColFrame *colFrame=nsnull;
|
||||||
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
|
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
|
||||||
colData->SetColFrame(colFrame);
|
colData->SetColFrame(colFrame);
|
||||||
|
|
|
@ -229,8 +229,6 @@ PRBool BasicTableLayoutStrategy::AssignFixedColumnWidths(nsIPresContext* aPresCo
|
||||||
NS_ASSERTION(nsnull != colData, "bad column data");
|
NS_ASSERTION(nsnull != colData, "bad column data");
|
||||||
nsTableColFrame *colFrame = colData->GetColFrame();
|
nsTableColFrame *colFrame = colData->GetColFrame();
|
||||||
NS_ASSERTION(nsnull!=colFrame, "bad col frame");
|
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
|
// need to track min/max column width for setting min/max table widths
|
||||||
PRInt32 minColWidth = 0;
|
PRInt32 minColWidth = 0;
|
||||||
|
@ -448,7 +446,6 @@ PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth(nsIPresContext* aPresConte
|
||||||
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
|
for (PRInt32 colIndex = 0; colIndex<numCols; colIndex++)
|
||||||
{
|
{
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 minColWidth = 0;
|
PRInt32 minColWidth = 0;
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
|
@ -520,7 +517,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
// Get column information
|
// Get column information
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 numCells = cells->Count();
|
PRInt32 numCells = cells->Count();
|
||||||
|
|
||||||
|
@ -863,7 +859,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( nsIPresContext* aPre
|
||||||
PRInt32 maxColWidth = 0;
|
PRInt32 maxColWidth = 0;
|
||||||
// Get column information
|
// Get column information
|
||||||
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
nsColLayoutData * colData = (nsColLayoutData *)(columnLayoutData->ElementAt(colIndex));
|
||||||
nsTableColPtr col = colData->GetCol(); // col: ADDREF++
|
|
||||||
nsVoidArray *cells = colData->GetCells();
|
nsVoidArray *cells = colData->GetCells();
|
||||||
PRInt32 numCells = cells->Count();
|
PRInt32 numCells = cells->Count();
|
||||||
|
|
||||||
|
|
|
@ -2123,9 +2123,7 @@ PRBool nsTableFrame::SetCellLayoutData(nsIPresContext* aPresContext,
|
||||||
// TODO: unify these 2 kinds of column data
|
// TODO: unify these 2 kinds of column data
|
||||||
// TODO: cache more column data, like the mWidth.GetUnit and what its value
|
// TODO: cache more column data, like the mWidth.GetUnit and what its value
|
||||||
|
|
||||||
nsTableColPtr col = (nsTableCol *)tableKid->ChildAt(j);
|
nsColLayoutData *colData = new nsColLayoutData();
|
||||||
NS_ASSERTION(col.IsNotNull(), "bad content");
|
|
||||||
nsColLayoutData *colData = new nsColLayoutData(col);
|
|
||||||
nsTableColFrame *colFrame=nsnull;
|
nsTableColFrame *colFrame=nsnull;
|
||||||
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
|
colGroupFrame->ChildAt(j, (nsIFrame *&)colFrame);
|
||||||
colData->SetColFrame(colFrame);
|
colData->SetColFrame(colFrame);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче