added constructor to nsTableColGroupFrame, fixed a few places where

nsColGroupFrame assummed its children were nsColGroupFrames.
This commit is contained in:
karnaze%netscape.com 1999-08-10 02:45:18 +00:00
Родитель b71e1b0379
Коммит c598fc57e3
6 изменённых файлов: 108 добавлений и 86 удалений

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

@ -52,18 +52,20 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi
nsresult rv=NS_OK;
nsTableFrame* tableFrame=nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
{
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame)) {
// Process the newly added column frames
for (nsIFrame* kidFrame = aChildList; nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame)) {
// Set the preliminary values for the column frame
PRInt32 colIndex = mStartColIndex + mColCount;
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex);
PRInt32 repeat = ((nsTableColFrame *)(kidFrame))->GetSpan();
mColCount += repeat;
for (PRInt32 i=0; i<repeat; i++)
{
tableFrame->AddColumnFrame((nsTableColFrame *)kidFrame);
const nsStyleDisplay* display;
kidFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)display);
if (NS_STYLE_DISPLAY_TABLE_COLUMN == display->mDisplay) {
// Set the preliminary values for the column frame
PRInt32 colIndex = mStartColIndex + mColCount;
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex);
PRInt32 repeat = ((nsTableColFrame *)(kidFrame))->GetSpan();
mColCount += repeat;
for (PRInt32 i=0; i<repeat; i++) {
tableFrame->AddColumnFrame((nsTableColFrame *)kidFrame);
}
}
}
// colgroup's span attribute is how many columns the group represents

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

@ -112,6 +112,8 @@ public:
protected:
nsTableColGroupFrame();
/** implement abstract method on nsHTMLContainerFrame */
virtual PRIntn GetSkipSides() const;
@ -160,7 +162,11 @@ protected:
};
inline nsTableColGroupFrame::nsTableColGroupFrame()
: mColCount(0), mStartColIndex(0)
{}
inline int nsTableColGroupFrame::GetStartColumnIndex ()
{ return mStartColIndex;}
#endif

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

@ -2181,24 +2181,28 @@ void nsTableFrame::SetColumnDimensions(nscoord aHeight)
colGroupFrame->FirstChild(nsnull, &colFrame);
nsPoint colOrigin(0, 0);
while (nsnull != colFrame) {
NS_ASSERTION(colX < numCols, "invalid number of columns");
nscoord colWidth = mColumnWidths[colX];
if (numCols == 1) {
colWidth += cellSpacingX + cellSpacingX;
}
else if ((0 == colX) || (numCols - 1 == colX)) {
colWidth += cellSpacingX + halfCellSpacingX;
}
else if (GetNumCellsOriginatingIn(colX) > 0) {
colWidth += cellSpacingX;
}
const nsStyleDisplay* colDisplay;
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
NS_ASSERTION(colX < numCols, "invalid number of columns");
nscoord colWidth = mColumnWidths[colX];
if (numCols == 1) {
colWidth += cellSpacingX + cellSpacingX;
}
else if ((0 == colX) || (numCols - 1 == colX)) {
colWidth += cellSpacingX + halfCellSpacingX;
}
else if (GetNumCellsOriginatingIn(colX) > 0) {
colWidth += cellSpacingX;
}
colGroupWidth += colWidth;
nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight);
colFrame->SetRect(colRect);
colGroupWidth += colWidth;
nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight);
colFrame->SetRect(colRect);
colOrigin.x += colWidth;
colX++;
}
colFrame->GetNextSibling(&colFrame);
colOrigin.x += colWidth;
colX++;
}
nsRect colGroupRect(colGroupOrigin.x, colGroupOrigin.y, colGroupWidth, colHeight);
colGroupFrame->SetRect(colGroupRect);
@ -4468,24 +4472,23 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext,
void nsTableFrame::CacheColFramesInCellMap()
{
nsIFrame * childFrame = mColGroups.FirstChild();
while (nsnull!=childFrame)
{ // in this loop, we cache column info
nsTableColFrame *colFrame=nsnull;
while (nsnull != childFrame) { // in this loop, we cache column info
nsTableColFrame* colFrame = nsnull;
childFrame->FirstChild(nsnull, (nsIFrame **)&colFrame);
while (nsnull!=colFrame)
{
PRInt32 colIndex = colFrame->GetColumnIndex();
PRInt32 repeat = colFrame->GetSpan();
for (PRInt32 i=0; i<repeat; i++)
{
nsTableColFrame *cachedColFrame = mCellMap->GetColumnFrame(colIndex+i);
if (nsnull==cachedColFrame)
{
if (gsDebug)
printf("TIF BCB: adding column frame %p\n", colFrame);
mCellMap->AppendColumnFrame(colFrame);
while (nsnull != colFrame) {
const nsStyleDisplay* colDisplay;
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
PRInt32 colIndex = colFrame->GetColumnIndex();
PRInt32 repeat = colFrame->GetSpan();
for (PRInt32 i=0; i<repeat; i++) {
nsTableColFrame* cachedColFrame = mCellMap->GetColumnFrame(colIndex+i);
if (nsnull==cachedColFrame) {
if (gsDebug) printf("TIF BCB: adding column frame %p\n", colFrame);
mCellMap->AppendColumnFrame(colFrame);
}
colIndex++;
}
colIndex++;
}
colFrame->GetNextSibling((nsIFrame **)&colFrame);
}

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

@ -52,18 +52,20 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi
nsresult rv=NS_OK;
nsTableFrame* tableFrame=nsnull;
rv = nsTableFrame::GetTableFrame(this, tableFrame);
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
{
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame)) {
// Process the newly added column frames
for (nsIFrame* kidFrame = aChildList; nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame)) {
// Set the preliminary values for the column frame
PRInt32 colIndex = mStartColIndex + mColCount;
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex);
PRInt32 repeat = ((nsTableColFrame *)(kidFrame))->GetSpan();
mColCount += repeat;
for (PRInt32 i=0; i<repeat; i++)
{
tableFrame->AddColumnFrame((nsTableColFrame *)kidFrame);
const nsStyleDisplay* display;
kidFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)display);
if (NS_STYLE_DISPLAY_TABLE_COLUMN == display->mDisplay) {
// Set the preliminary values for the column frame
PRInt32 colIndex = mStartColIndex + mColCount;
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex);
PRInt32 repeat = ((nsTableColFrame *)(kidFrame))->GetSpan();
mColCount += repeat;
for (PRInt32 i=0; i<repeat; i++) {
tableFrame->AddColumnFrame((nsTableColFrame *)kidFrame);
}
}
}
// colgroup's span attribute is how many columns the group represents

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

@ -112,6 +112,8 @@ public:
protected:
nsTableColGroupFrame();
/** implement abstract method on nsHTMLContainerFrame */
virtual PRIntn GetSkipSides() const;
@ -160,7 +162,11 @@ protected:
};
inline nsTableColGroupFrame::nsTableColGroupFrame()
: mColCount(0), mStartColIndex(0)
{}
inline int nsTableColGroupFrame::GetStartColumnIndex ()
{ return mStartColIndex;}
#endif

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

@ -2181,24 +2181,28 @@ void nsTableFrame::SetColumnDimensions(nscoord aHeight)
colGroupFrame->FirstChild(nsnull, &colFrame);
nsPoint colOrigin(0, 0);
while (nsnull != colFrame) {
NS_ASSERTION(colX < numCols, "invalid number of columns");
nscoord colWidth = mColumnWidths[colX];
if (numCols == 1) {
colWidth += cellSpacingX + cellSpacingX;
}
else if ((0 == colX) || (numCols - 1 == colX)) {
colWidth += cellSpacingX + halfCellSpacingX;
}
else if (GetNumCellsOriginatingIn(colX) > 0) {
colWidth += cellSpacingX;
}
const nsStyleDisplay* colDisplay;
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
NS_ASSERTION(colX < numCols, "invalid number of columns");
nscoord colWidth = mColumnWidths[colX];
if (numCols == 1) {
colWidth += cellSpacingX + cellSpacingX;
}
else if ((0 == colX) || (numCols - 1 == colX)) {
colWidth += cellSpacingX + halfCellSpacingX;
}
else if (GetNumCellsOriginatingIn(colX) > 0) {
colWidth += cellSpacingX;
}
colGroupWidth += colWidth;
nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight);
colFrame->SetRect(colRect);
colGroupWidth += colWidth;
nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight);
colFrame->SetRect(colRect);
colOrigin.x += colWidth;
colX++;
}
colFrame->GetNextSibling(&colFrame);
colOrigin.x += colWidth;
colX++;
}
nsRect colGroupRect(colGroupOrigin.x, colGroupOrigin.y, colGroupWidth, colHeight);
colGroupFrame->SetRect(colGroupRect);
@ -4468,24 +4472,23 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext,
void nsTableFrame::CacheColFramesInCellMap()
{
nsIFrame * childFrame = mColGroups.FirstChild();
while (nsnull!=childFrame)
{ // in this loop, we cache column info
nsTableColFrame *colFrame=nsnull;
while (nsnull != childFrame) { // in this loop, we cache column info
nsTableColFrame* colFrame = nsnull;
childFrame->FirstChild(nsnull, (nsIFrame **)&colFrame);
while (nsnull!=colFrame)
{
PRInt32 colIndex = colFrame->GetColumnIndex();
PRInt32 repeat = colFrame->GetSpan();
for (PRInt32 i=0; i<repeat; i++)
{
nsTableColFrame *cachedColFrame = mCellMap->GetColumnFrame(colIndex+i);
if (nsnull==cachedColFrame)
{
if (gsDebug)
printf("TIF BCB: adding column frame %p\n", colFrame);
mCellMap->AppendColumnFrame(colFrame);
while (nsnull != colFrame) {
const nsStyleDisplay* colDisplay;
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay) {
PRInt32 colIndex = colFrame->GetColumnIndex();
PRInt32 repeat = colFrame->GetSpan();
for (PRInt32 i=0; i<repeat; i++) {
nsTableColFrame* cachedColFrame = mCellMap->GetColumnFrame(colIndex+i);
if (nsnull==cachedColFrame) {
if (gsDebug) printf("TIF BCB: adding column frame %p\n", colFrame);
mCellMap->AppendColumnFrame(colFrame);
}
colIndex++;
}
colIndex++;
}
colFrame->GetNextSibling((nsIFrame **)&colFrame);
}