diff --git a/layout/html/table/src/nsTableColFrame.h b/layout/html/table/src/nsTableColFrame.h index 22a2b7f27666..4841535b6c89 100644 --- a/layout/html/table/src/nsTableColFrame.h +++ b/layout/html/table/src/nsTableColFrame.h @@ -54,10 +54,10 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; /** return the index of the column the col represents. always >= 0 */ - virtual int GetColumnIndex (); + virtual PRInt32 GetColumnIndex (); /** return the number of the columns the col represents. always >= 0 */ - virtual int GetSpan (); + virtual PRInt32 GetSpan (); /** set the index of the column this content object represents. must be >= 0 */ virtual void SetColumnIndex (int aColIndex); @@ -115,7 +115,7 @@ inline void nsTableColFrame::InitColFrame(PRInt32 aColIndex) mColIndex = aColIndex; } -inline nsTableColFrame::GetColumnIndex() +inline PRInt32 nsTableColFrame::GetColumnIndex() { return mColIndex; } inline void nsTableColFrame::SetColumnIndex (int aColIndex) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 24f66654a51a..441665bfded0 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -1270,6 +1270,8 @@ void nsTableFrame::ComputeVerticalCollapsingBorders(nsIPresContext& aPresContext if (nsnull==cellMap) return; // no info yet, so nothing useful to do + CacheColFramesInCellMap(); + // compute all the collapsing border values for the entire table // XXX: we have to make this more incremental! const nsStyleTable *tableStyle=nsnull; @@ -3976,33 +3978,12 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext, } mColCache = new ColumnInfoCache(GetColCount()); - nsIFrame * childFrame = mColGroups.FirstChild(); - while (nsnull!=childFrame) - { // in this loop, we cache column info and set column style info from cells - nsTableColFrame *colFrame=nsnull; - childFrame->FirstChild(nsnull, (nsIFrame *&)colFrame); - while (nsnull!=colFrame) - { - PRInt32 repeat = colFrame->GetSpan(); - for (PRInt32 i=0; iGetColumnFrame(colIndex+i); - if (nsnull==cachedColFrame) - { - if (gsDebug) printf("TIF BCB: adding column frame %p\n", colFrame); - mCellMap->AppendColumnFrame(colFrame); - } - colIndex++; - } - colFrame->GetNextSibling((nsIFrame *&)colFrame); - } - childFrame->GetNextSibling(childFrame); - } + CacheColFramesInCellMap(); // handle rowgroups - childFrame = mFrames.FirstChild(); + nsIFrame * childFrame = mFrames.FirstChild(); while (nsnull!=childFrame) - { + { // in this loop, set column style info from cells const nsStyleDisplay *childDisplay; childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay)); if (PR_TRUE==IsRowGroup(childDisplay->mDisplay)) @@ -4070,6 +4051,34 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext, mColumnCacheValid=PR_TRUE; } +void nsTableFrame::CacheColFramesInCellMap() +{ + nsIFrame * childFrame = mColGroups.FirstChild(); + 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; iGetColumnFrame(colIndex+i); + if (nsnull==cachedColFrame) + { + if (gsDebug) + printf("TIF BCB: adding column frame %p\n", colFrame); + mCellMap->AppendColumnFrame(colFrame); + } + colIndex++; + } + colFrame->GetNextSibling((nsIFrame *&)colFrame); + } + childFrame->GetNextSibling(childFrame); + } +} + void nsTableFrame::InvalidateColumnWidths() { nsTableFrame * firstInFlow = (nsTableFrame *)GetFirstInFlow(); diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index 5c094c9a0678..9d79328006d2 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -697,6 +697,8 @@ protected: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + virtual void CacheColFramesInCellMap(); + /** called every time we discover we have a new cell to add to the table. * This could be because we got actual cell content, because of rowspan/colspan attributes, etc. * This method changes mCellMap as necessary to account for the new cell. diff --git a/layout/tables/nsTableColFrame.h b/layout/tables/nsTableColFrame.h index 22a2b7f27666..4841535b6c89 100644 --- a/layout/tables/nsTableColFrame.h +++ b/layout/tables/nsTableColFrame.h @@ -54,10 +54,10 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; /** return the index of the column the col represents. always >= 0 */ - virtual int GetColumnIndex (); + virtual PRInt32 GetColumnIndex (); /** return the number of the columns the col represents. always >= 0 */ - virtual int GetSpan (); + virtual PRInt32 GetSpan (); /** set the index of the column this content object represents. must be >= 0 */ virtual void SetColumnIndex (int aColIndex); @@ -115,7 +115,7 @@ inline void nsTableColFrame::InitColFrame(PRInt32 aColIndex) mColIndex = aColIndex; } -inline nsTableColFrame::GetColumnIndex() +inline PRInt32 nsTableColFrame::GetColumnIndex() { return mColIndex; } inline void nsTableColFrame::SetColumnIndex (int aColIndex) diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 24f66654a51a..441665bfded0 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1270,6 +1270,8 @@ void nsTableFrame::ComputeVerticalCollapsingBorders(nsIPresContext& aPresContext if (nsnull==cellMap) return; // no info yet, so nothing useful to do + CacheColFramesInCellMap(); + // compute all the collapsing border values for the entire table // XXX: we have to make this more incremental! const nsStyleTable *tableStyle=nsnull; @@ -3976,33 +3978,12 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext, } mColCache = new ColumnInfoCache(GetColCount()); - nsIFrame * childFrame = mColGroups.FirstChild(); - while (nsnull!=childFrame) - { // in this loop, we cache column info and set column style info from cells - nsTableColFrame *colFrame=nsnull; - childFrame->FirstChild(nsnull, (nsIFrame *&)colFrame); - while (nsnull!=colFrame) - { - PRInt32 repeat = colFrame->GetSpan(); - for (PRInt32 i=0; iGetColumnFrame(colIndex+i); - if (nsnull==cachedColFrame) - { - if (gsDebug) printf("TIF BCB: adding column frame %p\n", colFrame); - mCellMap->AppendColumnFrame(colFrame); - } - colIndex++; - } - colFrame->GetNextSibling((nsIFrame *&)colFrame); - } - childFrame->GetNextSibling(childFrame); - } + CacheColFramesInCellMap(); // handle rowgroups - childFrame = mFrames.FirstChild(); + nsIFrame * childFrame = mFrames.FirstChild(); while (nsnull!=childFrame) - { + { // in this loop, set column style info from cells const nsStyleDisplay *childDisplay; childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay)); if (PR_TRUE==IsRowGroup(childDisplay->mDisplay)) @@ -4070,6 +4051,34 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext, mColumnCacheValid=PR_TRUE; } +void nsTableFrame::CacheColFramesInCellMap() +{ + nsIFrame * childFrame = mColGroups.FirstChild(); + 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; iGetColumnFrame(colIndex+i); + if (nsnull==cachedColFrame) + { + if (gsDebug) + printf("TIF BCB: adding column frame %p\n", colFrame); + mCellMap->AppendColumnFrame(colFrame); + } + colIndex++; + } + colFrame->GetNextSibling((nsIFrame *&)colFrame); + } + childFrame->GetNextSibling(childFrame); + } +} + void nsTableFrame::InvalidateColumnWidths() { nsTableFrame * firstInFlow = (nsTableFrame *)GetFirstInFlow(); diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 5c094c9a0678..9d79328006d2 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -697,6 +697,8 @@ protected: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + virtual void CacheColFramesInCellMap(); + /** called every time we discover we have a new cell to add to the table. * This could be because we got actual cell content, because of rowspan/colspan attributes, etc. * This method changes mCellMap as necessary to account for the new cell.