From 4e1923d3ad6fcb0786c52cafc3e49c6f7f78a72f Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sat, 2 Oct 1999 00:02:54 +0000 Subject: [PATCH] Hooked up SizeOf() for cell map and table layout strategies. Also added in some table frame data that was missed git-svn-id: svn://10.0.0.236/trunk@49622 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/shared/public/nsLayoutAtomList.h | 8 +++-- mozilla/layout/base/nsLayoutAtomList.h | 8 +++-- mozilla/layout/base/public/nsLayoutAtomList.h | 8 +++-- .../html/table/src/BasicTableLayoutStrategy.h | 6 ++++ .../html/table/src/FixedTableLayoutStrategy.h | 6 ++++ mozilla/layout/html/table/src/nsCellMap.cpp | 30 +++++++++++++++++++ mozilla/layout/html/table/src/nsCellMap.h | 4 +++ .../html/table/src/nsITableLayoutStrategy.h | 5 ++++ .../html/table/src/nsTableCellFrame.cpp | 1 - .../layout/html/table/src/nsTableColFrame.cpp | 11 ++++++- .../layout/html/table/src/nsTableColFrame.h | 7 +++++ .../html/table/src/nsTableColGroupFrame.cpp | 11 ++++++- .../html/table/src/nsTableColGroupFrame.h | 7 +++++ .../layout/html/table/src/nsTableFrame.cpp | 16 +++++++++- .../html/table/src/nsTableOuterFrame.cpp | 1 - .../layout/html/table/src/nsTableRowFrame.cpp | 3 +- .../html/table/src/nsTableRowGroupFrame.cpp | 1 - .../layout/tables/BasicTableLayoutStrategy.h | 6 ++++ .../layout/tables/FixedTableLayoutStrategy.h | 6 ++++ mozilla/layout/tables/nsCellMap.cpp | 30 +++++++++++++++++++ mozilla/layout/tables/nsCellMap.h | 4 +++ .../layout/tables/nsITableLayoutStrategy.h | 5 ++++ mozilla/layout/tables/nsTableCellFrame.cpp | 1 - mozilla/layout/tables/nsTableColFrame.cpp | 11 ++++++- mozilla/layout/tables/nsTableColFrame.h | 7 +++++ .../layout/tables/nsTableColGroupFrame.cpp | 11 ++++++- mozilla/layout/tables/nsTableColGroupFrame.h | 7 +++++ mozilla/layout/tables/nsTableFrame.cpp | 16 +++++++++- mozilla/layout/tables/nsTableOuterFrame.cpp | 1 - mozilla/layout/tables/nsTableRowFrame.cpp | 3 +- .../layout/tables/nsTableRowGroupFrame.cpp | 1 - 31 files changed, 222 insertions(+), 20 deletions(-) diff --git a/mozilla/content/shared/public/nsLayoutAtomList.h b/mozilla/content/shared/public/nsLayoutAtomList.h index 6da6d9b66d2..92eaf9576cb 100644 --- a/mozilla/content/shared/public/nsLayoutAtomList.h +++ b/mozilla/content/shared/public/nsLayoutAtomList.h @@ -88,17 +88,21 @@ LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame") LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame") LAYOUT_ATOM(rootFrame, "RootFrame") LAYOUT_ATOM(scrollFrame, "ScrollFrame") -LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") +LAYOUT_ATOM(tableCellFrame, "TableCellFrame") +LAYOUT_ATOM(tableColFrame, "TableColFrame") +LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame") LAYOUT_ATOM(tableFrame, "TableFrame") +LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame") LAYOUT_ATOM(tableRowFrame, "TableRowFrame") -LAYOUT_ATOM(tableCellFrame, "TableCellFrame") LAYOUT_ATOM(textFrame, "TextFrame") LAYOUT_ATOM(viewportFrame, "ViewportFrame") #ifdef DEBUG // Alphabetical list of atoms used by debugging code +LAYOUT_ATOM(cellMap, "TableCellMap") LAYOUT_ATOM(imageMap, "ImageMap") LAYOUT_ATOM(lineBox, "LineBox") +LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy") LAYOUT_ATOM(textRun, "TextRun") #endif diff --git a/mozilla/layout/base/nsLayoutAtomList.h b/mozilla/layout/base/nsLayoutAtomList.h index 6da6d9b66d2..92eaf9576cb 100644 --- a/mozilla/layout/base/nsLayoutAtomList.h +++ b/mozilla/layout/base/nsLayoutAtomList.h @@ -88,17 +88,21 @@ LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame") LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame") LAYOUT_ATOM(rootFrame, "RootFrame") LAYOUT_ATOM(scrollFrame, "ScrollFrame") -LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") +LAYOUT_ATOM(tableCellFrame, "TableCellFrame") +LAYOUT_ATOM(tableColFrame, "TableColFrame") +LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame") LAYOUT_ATOM(tableFrame, "TableFrame") +LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame") LAYOUT_ATOM(tableRowFrame, "TableRowFrame") -LAYOUT_ATOM(tableCellFrame, "TableCellFrame") LAYOUT_ATOM(textFrame, "TextFrame") LAYOUT_ATOM(viewportFrame, "ViewportFrame") #ifdef DEBUG // Alphabetical list of atoms used by debugging code +LAYOUT_ATOM(cellMap, "TableCellMap") LAYOUT_ATOM(imageMap, "ImageMap") LAYOUT_ATOM(lineBox, "LineBox") +LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy") LAYOUT_ATOM(textRun, "TextRun") #endif diff --git a/mozilla/layout/base/public/nsLayoutAtomList.h b/mozilla/layout/base/public/nsLayoutAtomList.h index 6da6d9b66d2..92eaf9576cb 100644 --- a/mozilla/layout/base/public/nsLayoutAtomList.h +++ b/mozilla/layout/base/public/nsLayoutAtomList.h @@ -88,17 +88,21 @@ LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame") LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame") LAYOUT_ATOM(rootFrame, "RootFrame") LAYOUT_ATOM(scrollFrame, "ScrollFrame") -LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") +LAYOUT_ATOM(tableCellFrame, "TableCellFrame") +LAYOUT_ATOM(tableColFrame, "TableColFrame") +LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame") LAYOUT_ATOM(tableFrame, "TableFrame") +LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame") LAYOUT_ATOM(tableRowFrame, "TableRowFrame") -LAYOUT_ATOM(tableCellFrame, "TableCellFrame") LAYOUT_ATOM(textFrame, "TextFrame") LAYOUT_ATOM(viewportFrame, "ViewportFrame") #ifdef DEBUG // Alphabetical list of atoms used by debugging code +LAYOUT_ATOM(cellMap, "TableCellMap") LAYOUT_ATOM(imageMap, "ImageMap") LAYOUT_ATOM(lineBox, "LineBox") +LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy") LAYOUT_ATOM(textRun, "TextRun") #endif diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h index 31a16d7e371..a45870e9159 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h @@ -165,6 +165,12 @@ protected: nscoord aPrevCellMin, nscoord aPrevCellDes) const; +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { + *aResult = sizeof(*this); + } +#endif + protected: nsTableFrame * mTableFrame; PRInt32 mCols; diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h index 2ae18aa1276..0f01ad0765a 100644 --- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h @@ -71,6 +71,12 @@ public: nscoord aPrevCellMin, nscoord aPrevCellDes) const; +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { + *aResult = sizeof(*this); + } +#endif + protected: /* assign the width of all columns * if there is a colframe with a width attribute, use it as the column width. diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index cc86647b21f..d2e65e1dafd 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -701,4 +701,34 @@ PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex) const return PR_FALSE; } +#ifdef DEBUG +void nsCellMap::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const +{ + PRUint32 sum = sizeof(*this); + // Add in the size of the void arrays. Because we have emnbedded objects + // and not pointers to void arrays, we need to subtract out the size of the + // embedded object so it isn't double counted + PRUint32 voidArraySize; + + mRows.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mRows); + mColFrames.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mColFrames); + mNumCellsOrigInRow.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mNumCellsOrigInRow); + mNumCellsOrigInCol.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mNumCellsOrigInCol); + + // Add in the size of the collapsed rows and collapsed column + // packed bool arrays + if (mIsCollapsedRows) { + sum += mRowCount * sizeof(PRPackedBool); + } + if (mIsCollapsedCols) { + sum += mNumCellsOrigInCol.Count() * sizeof(PRPackedBool); + } + + *aResult = sum; +} +#endif diff --git a/mozilla/layout/html/table/src/nsCellMap.h b/mozilla/layout/html/table/src/nsCellMap.h index 97cd2464fac..51fe88f4d05 100644 --- a/mozilla/layout/html/table/src/nsCellMap.h +++ b/mozilla/layout/html/table/src/nsCellMap.h @@ -130,6 +130,10 @@ public: void Dump() const; #endif +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; +#endif + protected: /** set the CellMap to (aNumRows x aNumColumns) */ void Grow(PRInt32 aNumMapRows, diff --git a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h index 11e00249d59..33b0ca240f1 100644 --- a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h @@ -26,6 +26,7 @@ class nsIStyleContext; struct nsHTMLReflowState; class nsTableCellFrame; class nsStyleCoord; +class nsISizeOfHandler; class nsITableLayoutStrategy { @@ -88,6 +89,10 @@ public: virtual PRBool ColumnsAreValidFor(const nsTableCellFrame& aCellFrame, nscoord aPrevCellMin, nscoord aPrevCellDes) const = 0; + +#ifdef DEBUG + virtual void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; +#endif }; #endif diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 95c60c799d8..c9b9dff46b6 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -1149,7 +1149,6 @@ nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp index ccdf4426173..2c64128534b 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp @@ -24,6 +24,7 @@ #include "nsHTMLIIDs.h" #include "nsHTMLAtoms.h" #include "nsCSSRendering.h" +#include "nsLayoutAtoms.h" nsTableColFrame::nsTableColFrame() : nsFrame(), mIsAnonymous(PR_FALSE), mProportion(WIDTH_NOT_SET) @@ -169,6 +170,15 @@ NS_NewTableColFrame(nsIFrame** aNewFrame) return NS_OK; } +NS_IMETHODIMP +nsTableColFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::tableColFrame; + NS_ADDREF(*aType); + return NS_OK; +} + NS_IMETHODIMP nsTableColFrame::GetFrameName(nsString& aResult) const { @@ -183,7 +193,6 @@ nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableColFrame.h b/mozilla/layout/html/table/src/nsTableColFrame.h index 3bd43dc7cc5..612692c9211 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.h +++ b/mozilla/layout/html/table/src/nsTableColFrame.h @@ -81,6 +81,13 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + /** + * Get the "type" of the frame + * + * @see nsLayoutAtoms::tableColFrame + */ + NS_IMETHOD GetFrameType(nsIAtom** aType) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 7dfd108bc95..4f44318f158 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -31,6 +31,7 @@ #include "nsCOMPtr.h" #include "nsCSSRendering.h" #include "nsIPresShell.h" +#include "nsLayoutAtoms.h" NS_DEF_PTR(nsIContent); @@ -695,6 +696,15 @@ NS_NewTableColGroupFrame(nsIFrame** aNewFrame) return NS_OK; } +NS_IMETHODIMP +nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::tableColGroupFrame; + NS_ADDREF(*aType); + return NS_OK; +} + NS_IMETHODIMP nsTableColGroupFrame::GetFrameName(nsString& aResult) const { @@ -709,7 +719,6 @@ nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) cons return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.h b/mozilla/layout/html/table/src/nsTableColGroupFrame.h index 056113b2719..f9b56761435 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.h @@ -78,6 +78,13 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + /** + * Get the "type" of the frame + * + * @see nsLayoutAtoms::tableColGroupFrame + */ + NS_IMETHOD GetFrameType(nsIAtom** aType) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index add1afc7d77..ad81b41782d 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -50,6 +50,7 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLBodyElement.h" +#include "nsISizeOfHandler.h" NS_DEF_PTR(nsIStyleContext); NS_DEF_PTR(nsIContent); @@ -5473,7 +5474,20 @@ nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me + + // Add in the amount of space for the column width array + sum += mColumnWidthsLength * sizeof(PRInt32); + + // Add in size of cell map + PRUint32 cellMapSize; + mCellMap->SizeOf(aHandler, &cellMapSize); + aHandler->AddSize(nsLayoutAtoms::cellMap, cellMapSize); + + // Add in size of table layout strategy + PRUint32 strategySize; + mTableLayoutStrategy->SizeOf(aHandler, &strategySize); + aHandler->AddSize(nsLayoutAtoms::tableStrategy, strategySize); + *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index 790190ab558..38c464529ba 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -1170,7 +1170,6 @@ nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 16158eb293b..f9bada10431 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -1317,10 +1317,12 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, //XXX: this is a hack, shouldn't it be the case that a min size is // never larger than a desired size? +#if 0 if (kidMaxElementSize.width>desiredSize.width) desiredSize.width = kidMaxElementSize.width; if (kidMaxElementSize.height>desiredSize.height) desiredSize.height = kidMaxElementSize.height; +#endif // Update the cell layout data. ((nsTableCellFrame *)aNextFrame)->SetPass1MaxElementSize(kidMaxElementSize); @@ -1595,7 +1597,6 @@ nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 9e8fed915be..267c602100b 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -1632,7 +1632,6 @@ nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) cons return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.h b/mozilla/layout/tables/BasicTableLayoutStrategy.h index 31a16d7e371..a45870e9159 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.h +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.h @@ -165,6 +165,12 @@ protected: nscoord aPrevCellMin, nscoord aPrevCellDes) const; +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { + *aResult = sizeof(*this); + } +#endif + protected: nsTableFrame * mTableFrame; PRInt32 mCols; diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.h b/mozilla/layout/tables/FixedTableLayoutStrategy.h index 2ae18aa1276..0f01ad0765a 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.h +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.h @@ -71,6 +71,12 @@ public: nscoord aPrevCellMin, nscoord aPrevCellDes) const; +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const { + *aResult = sizeof(*this); + } +#endif + protected: /* assign the width of all columns * if there is a colframe with a width attribute, use it as the column width. diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index cc86647b21f..d2e65e1dafd 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -701,4 +701,34 @@ PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex) const return PR_FALSE; } +#ifdef DEBUG +void nsCellMap::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const +{ + PRUint32 sum = sizeof(*this); + // Add in the size of the void arrays. Because we have emnbedded objects + // and not pointers to void arrays, we need to subtract out the size of the + // embedded object so it isn't double counted + PRUint32 voidArraySize; + + mRows.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mRows); + mColFrames.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mColFrames); + mNumCellsOrigInRow.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mNumCellsOrigInRow); + mNumCellsOrigInCol.SizeOf(aHandler, &voidArraySize); + sum += voidArraySize - sizeof(mNumCellsOrigInCol); + + // Add in the size of the collapsed rows and collapsed column + // packed bool arrays + if (mIsCollapsedRows) { + sum += mRowCount * sizeof(PRPackedBool); + } + if (mIsCollapsedCols) { + sum += mNumCellsOrigInCol.Count() * sizeof(PRPackedBool); + } + + *aResult = sum; +} +#endif diff --git a/mozilla/layout/tables/nsCellMap.h b/mozilla/layout/tables/nsCellMap.h index 97cd2464fac..51fe88f4d05 100644 --- a/mozilla/layout/tables/nsCellMap.h +++ b/mozilla/layout/tables/nsCellMap.h @@ -130,6 +130,10 @@ public: void Dump() const; #endif +#ifdef DEBUG + void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; +#endif + protected: /** set the CellMap to (aNumRows x aNumColumns) */ void Grow(PRInt32 aNumMapRows, diff --git a/mozilla/layout/tables/nsITableLayoutStrategy.h b/mozilla/layout/tables/nsITableLayoutStrategy.h index 11e00249d59..33b0ca240f1 100644 --- a/mozilla/layout/tables/nsITableLayoutStrategy.h +++ b/mozilla/layout/tables/nsITableLayoutStrategy.h @@ -26,6 +26,7 @@ class nsIStyleContext; struct nsHTMLReflowState; class nsTableCellFrame; class nsStyleCoord; +class nsISizeOfHandler; class nsITableLayoutStrategy { @@ -88,6 +89,10 @@ public: virtual PRBool ColumnsAreValidFor(const nsTableCellFrame& aCellFrame, nscoord aPrevCellMin, nscoord aPrevCellDes) const = 0; + +#ifdef DEBUG + virtual void SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0; +#endif }; #endif diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 95c60c799d8..c9b9dff46b6 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -1149,7 +1149,6 @@ nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index ccdf4426173..2c64128534b 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -24,6 +24,7 @@ #include "nsHTMLIIDs.h" #include "nsHTMLAtoms.h" #include "nsCSSRendering.h" +#include "nsLayoutAtoms.h" nsTableColFrame::nsTableColFrame() : nsFrame(), mIsAnonymous(PR_FALSE), mProportion(WIDTH_NOT_SET) @@ -169,6 +170,15 @@ NS_NewTableColFrame(nsIFrame** aNewFrame) return NS_OK; } +NS_IMETHODIMP +nsTableColFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::tableColFrame; + NS_ADDREF(*aType); + return NS_OK; +} + NS_IMETHODIMP nsTableColFrame::GetFrameName(nsString& aResult) const { @@ -183,7 +193,6 @@ nsTableColFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableColFrame.h b/mozilla/layout/tables/nsTableColFrame.h index 3bd43dc7cc5..612692c9211 100644 --- a/mozilla/layout/tables/nsTableColFrame.h +++ b/mozilla/layout/tables/nsTableColFrame.h @@ -81,6 +81,13 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + /** + * Get the "type" of the frame + * + * @see nsLayoutAtoms::tableColFrame + */ + NS_IMETHOD GetFrameType(nsIAtom** aType) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 7dfd108bc95..4f44318f158 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -31,6 +31,7 @@ #include "nsCOMPtr.h" #include "nsCSSRendering.h" #include "nsIPresShell.h" +#include "nsLayoutAtoms.h" NS_DEF_PTR(nsIContent); @@ -695,6 +696,15 @@ NS_NewTableColGroupFrame(nsIFrame** aNewFrame) return NS_OK; } +NS_IMETHODIMP +nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const +{ + NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer"); + *aType = nsLayoutAtoms::tableColGroupFrame; + NS_ADDREF(*aType); + return NS_OK; +} + NS_IMETHODIMP nsTableColGroupFrame::GetFrameName(nsString& aResult) const { @@ -709,7 +719,6 @@ nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) cons return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableColGroupFrame.h b/mozilla/layout/tables/nsTableColGroupFrame.h index 056113b2719..f9b56761435 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.h +++ b/mozilla/layout/tables/nsTableColGroupFrame.h @@ -78,6 +78,13 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + /** + * Get the "type" of the frame + * + * @see nsLayoutAtoms::tableColGroupFrame + */ + NS_IMETHOD GetFrameType(nsIAtom** aType) const; + NS_IMETHOD GetFrameName(nsString& aResult) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index add1afc7d77..ad81b41782d 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -50,6 +50,7 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLBodyElement.h" +#include "nsISizeOfHandler.h" NS_DEF_PTR(nsIStyleContext); NS_DEF_PTR(nsIContent); @@ -5473,7 +5474,20 @@ nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me + + // Add in the amount of space for the column width array + sum += mColumnWidthsLength * sizeof(PRInt32); + + // Add in size of cell map + PRUint32 cellMapSize; + mCellMap->SizeOf(aHandler, &cellMapSize); + aHandler->AddSize(nsLayoutAtoms::cellMap, cellMapSize); + + // Add in size of table layout strategy + PRUint32 strategySize; + mTableLayoutStrategy->SizeOf(aHandler, &strategySize); + aHandler->AddSize(nsLayoutAtoms::tableStrategy, strategySize); + *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 790190ab558..38c464529ba 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -1170,7 +1170,6 @@ nsTableOuterFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 16158eb293b..f9bada10431 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -1317,10 +1317,12 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext, //XXX: this is a hack, shouldn't it be the case that a min size is // never larger than a desired size? +#if 0 if (kidMaxElementSize.width>desiredSize.width) desiredSize.width = kidMaxElementSize.width; if (kidMaxElementSize.height>desiredSize.height) desiredSize.height = kidMaxElementSize.height; +#endif // Update the cell layout data. ((nsTableCellFrame *)aNextFrame)->SetPass1MaxElementSize(kidMaxElementSize); @@ -1595,7 +1597,6 @@ nsTableRowFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; } diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 9e8fed915be..267c602100b 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -1632,7 +1632,6 @@ nsTableRowGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) cons return NS_ERROR_NULL_POINTER; } PRUint32 sum = sizeof(*this); - // XXX write me *aResult = sum; return NS_OK; }