Backout troy's last set of changes. Caused bug #15790, 'opening bookmarks window and expanding mail folders crashes'. r=waterson.

This commit is contained in:
slamm%netscape.com 1999-10-08 18:52:19 +00:00
parent d09ee731d4
commit 26d787fa8c
6 changed files with 86 additions and 178 deletions

View File

@ -44,23 +44,6 @@ NS_DEF_PTR(nsIStyleContext);
static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID);
static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
/**
* Additional frame-state bits
*/
#define NS_TABLE_CELL_FRAME_CONTENT_EMPTY 0x80000000
nsTableCellFrame::nsTableCellFrame()
{
// We initialize mMargin to all -1 so we can easily tell in GetMargin() whether
// it has been initialized
mMargin.SizeTo(-1, -1, -1, -1);
}
nsTableCellFrame::~nsTableCellFrame()
{
delete mBorderEdges;
}
NS_IMETHODIMP
nsTableCellFrame::Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -86,20 +69,6 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext,
return rv;
}
inline PRBool nsTableCellFrame::GetContentEmpty()
{
return NS_TABLE_CELL_FRAME_CONTENT_EMPTY == (mState & NS_TABLE_CELL_FRAME_CONTENT_EMPTY);
}
inline void nsTableCellFrame::SetContentEmpty(PRBool aContentEmpty)
{
if (aContentEmpty) {
mState |= NS_TABLE_CELL_FRAME_CONTENT_EMPTY;
} else {
mState &= ~NS_TABLE_CELL_FRAME_CONTENT_EMPTY;
}
}
void nsTableCellFrame::SetPass1MaxElementSize(const nsSize& aMaxElementSize)
{
mPass1MaxElementSize.height = aMaxElementSize.height;
@ -161,31 +130,29 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{
NS_PRECONDITION(0<=aColIndex, "bad col index arg");
SetColIndex(aColIndex); // this also sets the contents col index
mBorderEdges.mOutsideEdge=PR_FALSE;
nsTableFrame* tableFrame=nsnull; // I should be checking my own style context, but border-collapse isn't inheriting correctly
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
{
if (NS_STYLE_BORDER_COLLAPSE == tableFrame->GetBorderCollapseStyle())
{
mBorderEdges = new nsBorderEdges;
mBorderEdges->mOutsideEdge=PR_FALSE;
PRInt32 rowspan = GetRowSpan();
PRInt32 i;
for (i=0; i<rowspan; i++)
{
nsBorderEdge *borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_LEFT].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_LEFT].AppendElement(borderToAdd);
borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_RIGHT].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_RIGHT].AppendElement(borderToAdd);
}
PRInt32 colspan = GetColSpan();
for (i=0; i<colspan; i++)
{
nsBorderEdge *borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_TOP].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_TOP].AppendElement(borderToAdd);
borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_BOTTOM].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_BOTTOM].AppendElement(borderToAdd);
}
}
mCollapseOffset = nsPoint(0,0);
@ -224,11 +191,10 @@ void nsTableCellFrame::SetBorderEdgeLength(PRUint8 aSide,
{
if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide))
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength;
}
else {
@ -288,7 +254,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
else
{
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, mBorderEdges, mStyleContext, skipSides);
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
}
}
}
@ -375,7 +341,6 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
nsBorderEdge *aBorder,
nscoord aOddAmountToAdd)
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
nsBorderEdge *border = nsnull;
switch (aSide)
{
@ -384,8 +349,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
mBorderEdges->mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.top);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break;
}
@ -394,8 +359,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
mBorderEdges->mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.bottom);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break;
}
@ -404,8 +369,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
mBorderEdges->mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.left);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break;
}
@ -414,8 +379,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
mBorderEdges->mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.right);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break;
}
}
@ -1127,8 +1092,7 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
}
if (NS_STYLE_BORDER_COLLAPSE==aTableFrame->GetBorderCollapseStyle()) {
NS_PRECONDITION(mBorderEdges, "no border edges struct");
aBorder = mBorderEdges->mMaxBorderWidth;
aBorder = mBorderEdges.mMaxBorderWidth;
} else {
const nsStyleSpacing* spacing;
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
@ -1138,13 +1102,12 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
void nsTableCellFrame::RecalcLayoutData(nsMargin& aMargin)
{
// -1 is our special value we use to tell whether the margin has been
// been initialized
NS_ASSERTION(aMargin.left != -1, "unexpected margin value");
mMargin.left = aMargin.left;
mMargin.top = aMargin.top;
mMargin.right = aMargin.right;
mMargin.bottom = aMargin.bottom;
mCalculated = NS_OK;
}

View File

@ -46,8 +46,7 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
nsTableCellFrame();
~nsTableCellFrame();
// default constructor supplied by the compiler
NS_IMETHOD Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -245,12 +244,17 @@ protected:
nsSize mPass1DesiredSize;
nsSize mPass1MaxElementSize;
nsresult mCalculated;
nsMargin mMargin;
PRBool mIsContentEmpty; // PR_TRUE if the cell's contents take up no space
//XXX: mIsContentEmpty should get yanked in favor of using free a bit on the frame base class
// the FrameState slot (mState; GetFrameState/SetFrameState)
nsPoint mCollapseOffset;
public:
nsBorderEdges* mBorderEdges; // one list of border segments for each side of the table frame
// used only for the collapsing border model
nsBorderEdges mBorderEdges; // one list of border segments for each side of the table frame
// used only for the collapsing border model
};
@ -308,7 +312,7 @@ inline nsSize nsTableCellFrame::GetPass1MaxElementSize() const
inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
{
if (mMargin.left != -1)
if (mCalculated == NS_OK)
{
aMargin = mMargin;
return NS_OK;
@ -316,6 +320,16 @@ inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
return NS_ERROR_NOT_INITIALIZED;
}
inline PRBool nsTableCellFrame::GetContentEmpty()
{
return mIsContentEmpty;
}
inline void nsTableCellFrame::SetContentEmpty(PRBool aContentEmpty)
{
mIsContentEmpty = aContentEmpty;
}
#endif

View File

@ -149,10 +149,6 @@ public:
eColWidthType_Proportional = 3 // (int) value has proportional meaning
};
#ifdef DEBUG
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
#endif
private:
PRInt32 mColCounts [4];
PRInt32 *mColIndexes[4];
@ -256,23 +252,6 @@ void ColumnInfoCache::GetColumnsByType(const nsStyleUnit aType,
}
}
#ifdef DEBUG
void ColumnInfoCache::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
NS_PRECONDITION(aResult, "null OUT parameter pointer");
PRUint32 sum = sizeof(*this);
// Now add in the space talen up by the arrays
for (int i = 0; i < 4; i++) {
if (mColIndexes[i]) {
sum += mNumColumns * sizeof(PRInt32);
}
}
*aResult = sum;
}
#endif
NS_IMETHODIMP
nsTableFrame::GetFrameType(nsIAtom** aType) const
{
@ -1259,7 +1238,7 @@ void nsTableFrame::ComputeLeftBorderForEdgeAt(nsIPresContext& aPresContext,
widthToAdd = NSToCoordCeil(p2t);
border->mWidth *= NSToCoordCeil(p2t);
border->mLength = rowRect.height;
border->mInsideNeighbor = cellFrame->mBorderEdges;
border->mInsideNeighbor = &cellFrame->mBorderEdges;
// we need to factor in the table's horizontal borders.
// but we can't compute that length here because we don't know how thick top and bottom borders are
// see DidComputeHorizontalCollapsingBorders
@ -1393,7 +1372,7 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{
nsBorderEdge * tableBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_RIGHT].ElementAt(aRowIndex));
*tableBorder = border;
tableBorder->mInsideNeighbor = cellFrame->mBorderEdges;
tableBorder->mInsideNeighbor = &cellFrame->mBorderEdges;
mBorderEdges->mMaxBorderWidth.right = PR_MAX(border.mWidth, mBorderEdges->mMaxBorderWidth.right);
// since the table is our right neightbor, we need to factor in the table's horizontal borders.
// can't compute that length here because we don't know how thick top and bottom borders are
@ -1471,7 +1450,7 @@ void nsTableFrame::ComputeTopBorderForEdgeAt(nsIPresContext& aPresContext,
widthToAdd = NSToCoordCeil(p2t);
border->mWidth *= NSToCoordCeil(p2t);
border->mLength = GetColumnWidth(aColIndex);
border->mInsideNeighbor = cellFrame->mBorderEdges;
border->mInsideNeighbor = &cellFrame->mBorderEdges;
if (0==aColIndex)
{ // if we're the first column, factor in the thickness of the left table border
nsBorderEdge *leftBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_LEFT].ElementAt(0));
@ -1612,7 +1591,7 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{
nsBorderEdge * tableBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_BOTTOM].ElementAt(aColIndex));
*tableBorder = border;
tableBorder->mInsideNeighbor = cellFrame->mBorderEdges;
tableBorder->mInsideNeighbor = &cellFrame->mBorderEdges;
mBorderEdges->mMaxBorderWidth.bottom = PR_MAX(border.mWidth, mBorderEdges->mMaxBorderWidth.bottom);
// since the table is our bottom neightbor, we need to factor in the table's vertical borders.
PRInt32 lastColIndex = mCellMap->GetColCount()-1;
@ -5530,11 +5509,9 @@ nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
// Add in the amount of space for the column width array
sum += mColumnWidthsLength * sizeof(PRInt32);
// And in size of column info cache
// And the column info cache
if (mColCache) {
PRUint32 colCacheSize;
mColCache->SizeOf(aHandler, &colCacheSize);
aHandler->AddSize(nsLayoutAtoms::tableColCache, colCacheSize);
sum += sizeof(*mColCache);
}
// Add in size of cell map

View File

@ -44,23 +44,6 @@ NS_DEF_PTR(nsIStyleContext);
static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID);
static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
/**
* Additional frame-state bits
*/
#define NS_TABLE_CELL_FRAME_CONTENT_EMPTY 0x80000000
nsTableCellFrame::nsTableCellFrame()
{
// We initialize mMargin to all -1 so we can easily tell in GetMargin() whether
// it has been initialized
mMargin.SizeTo(-1, -1, -1, -1);
}
nsTableCellFrame::~nsTableCellFrame()
{
delete mBorderEdges;
}
NS_IMETHODIMP
nsTableCellFrame::Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -86,20 +69,6 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext,
return rv;
}
inline PRBool nsTableCellFrame::GetContentEmpty()
{
return NS_TABLE_CELL_FRAME_CONTENT_EMPTY == (mState & NS_TABLE_CELL_FRAME_CONTENT_EMPTY);
}
inline void nsTableCellFrame::SetContentEmpty(PRBool aContentEmpty)
{
if (aContentEmpty) {
mState |= NS_TABLE_CELL_FRAME_CONTENT_EMPTY;
} else {
mState &= ~NS_TABLE_CELL_FRAME_CONTENT_EMPTY;
}
}
void nsTableCellFrame::SetPass1MaxElementSize(const nsSize& aMaxElementSize)
{
mPass1MaxElementSize.height = aMaxElementSize.height;
@ -161,31 +130,29 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
{
NS_PRECONDITION(0<=aColIndex, "bad col index arg");
SetColIndex(aColIndex); // this also sets the contents col index
mBorderEdges.mOutsideEdge=PR_FALSE;
nsTableFrame* tableFrame=nsnull; // I should be checking my own style context, but border-collapse isn't inheriting correctly
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
{
if (NS_STYLE_BORDER_COLLAPSE == tableFrame->GetBorderCollapseStyle())
{
mBorderEdges = new nsBorderEdges;
mBorderEdges->mOutsideEdge=PR_FALSE;
PRInt32 rowspan = GetRowSpan();
PRInt32 i;
for (i=0; i<rowspan; i++)
{
nsBorderEdge *borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_LEFT].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_LEFT].AppendElement(borderToAdd);
borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_RIGHT].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_RIGHT].AppendElement(borderToAdd);
}
PRInt32 colspan = GetColSpan();
for (i=0; i<colspan; i++)
{
nsBorderEdge *borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_TOP].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_TOP].AppendElement(borderToAdd);
borderToAdd = new nsBorderEdge();
mBorderEdges->mEdges[NS_SIDE_BOTTOM].AppendElement(borderToAdd);
mBorderEdges.mEdges[NS_SIDE_BOTTOM].AppendElement(borderToAdd);
}
}
mCollapseOffset = nsPoint(0,0);
@ -224,11 +191,10 @@ void nsTableCellFrame::SetBorderEdgeLength(PRUint8 aSide,
{
if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide))
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aIndex-baseRowIndex;
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
border->mLength = aLength;
}
else {
@ -288,7 +254,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
else
{
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, mBorderEdges, mStyleContext, skipSides);
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
}
}
}
@ -375,7 +341,6 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
nsBorderEdge *aBorder,
nscoord aOddAmountToAdd)
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
nsBorderEdge *border = nsnull;
switch (aSide)
{
@ -384,8 +349,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
mBorderEdges->mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.top);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.top);
break;
}
@ -394,8 +359,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseColIndex;
GetColIndex(baseColIndex);
PRInt32 colIndex = aColIndex-baseColIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
mBorderEdges->mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.bottom);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(colIndex));
mBorderEdges.mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.bottom);
break;
}
@ -404,8 +369,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
mBorderEdges->mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.left);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.left);
break;
}
@ -414,8 +379,8 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
PRInt32 baseRowIndex;
GetRowIndex(baseRowIndex);
PRInt32 rowIndex = aRowIndex-baseRowIndex;
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
mBorderEdges->mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.right);
border = (nsBorderEdge *)(mBorderEdges.mEdges[aSide].ElementAt(rowIndex));
mBorderEdges.mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges.mMaxBorderWidth.right);
break;
}
}
@ -1127,8 +1092,7 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
}
if (NS_STYLE_BORDER_COLLAPSE==aTableFrame->GetBorderCollapseStyle()) {
NS_PRECONDITION(mBorderEdges, "no border edges struct");
aBorder = mBorderEdges->mMaxBorderWidth;
aBorder = mBorderEdges.mMaxBorderWidth;
} else {
const nsStyleSpacing* spacing;
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
@ -1138,13 +1102,12 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
void nsTableCellFrame::RecalcLayoutData(nsMargin& aMargin)
{
// -1 is our special value we use to tell whether the margin has been
// been initialized
NS_ASSERTION(aMargin.left != -1, "unexpected margin value");
mMargin.left = aMargin.left;
mMargin.top = aMargin.top;
mMargin.right = aMargin.right;
mMargin.bottom = aMargin.bottom;
mCalculated = NS_OK;
}

View File

@ -46,8 +46,7 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
nsTableCellFrame();
~nsTableCellFrame();
// default constructor supplied by the compiler
NS_IMETHOD Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -245,12 +244,17 @@ protected:
nsSize mPass1DesiredSize;
nsSize mPass1MaxElementSize;
nsresult mCalculated;
nsMargin mMargin;
PRBool mIsContentEmpty; // PR_TRUE if the cell's contents take up no space
//XXX: mIsContentEmpty should get yanked in favor of using free a bit on the frame base class
// the FrameState slot (mState; GetFrameState/SetFrameState)
nsPoint mCollapseOffset;
public:
nsBorderEdges* mBorderEdges; // one list of border segments for each side of the table frame
// used only for the collapsing border model
nsBorderEdges mBorderEdges; // one list of border segments for each side of the table frame
// used only for the collapsing border model
};
@ -308,7 +312,7 @@ inline nsSize nsTableCellFrame::GetPass1MaxElementSize() const
inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
{
if (mMargin.left != -1)
if (mCalculated == NS_OK)
{
aMargin = mMargin;
return NS_OK;
@ -316,6 +320,16 @@ inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
return NS_ERROR_NOT_INITIALIZED;
}
inline PRBool nsTableCellFrame::GetContentEmpty()
{
return mIsContentEmpty;
}
inline void nsTableCellFrame::SetContentEmpty(PRBool aContentEmpty)
{
mIsContentEmpty = aContentEmpty;
}
#endif

View File

@ -149,10 +149,6 @@ public:
eColWidthType_Proportional = 3 // (int) value has proportional meaning
};
#ifdef DEBUG
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
#endif
private:
PRInt32 mColCounts [4];
PRInt32 *mColIndexes[4];
@ -256,23 +252,6 @@ void ColumnInfoCache::GetColumnsByType(const nsStyleUnit aType,
}
}
#ifdef DEBUG
void ColumnInfoCache::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
{
NS_PRECONDITION(aResult, "null OUT parameter pointer");
PRUint32 sum = sizeof(*this);
// Now add in the space talen up by the arrays
for (int i = 0; i < 4; i++) {
if (mColIndexes[i]) {
sum += mNumColumns * sizeof(PRInt32);
}
}
*aResult = sum;
}
#endif
NS_IMETHODIMP
nsTableFrame::GetFrameType(nsIAtom** aType) const
{
@ -1259,7 +1238,7 @@ void nsTableFrame::ComputeLeftBorderForEdgeAt(nsIPresContext& aPresContext,
widthToAdd = NSToCoordCeil(p2t);
border->mWidth *= NSToCoordCeil(p2t);
border->mLength = rowRect.height;
border->mInsideNeighbor = cellFrame->mBorderEdges;
border->mInsideNeighbor = &cellFrame->mBorderEdges;
// we need to factor in the table's horizontal borders.
// but we can't compute that length here because we don't know how thick top and bottom borders are
// see DidComputeHorizontalCollapsingBorders
@ -1393,7 +1372,7 @@ void nsTableFrame::ComputeRightBorderForEdgeAt(nsIPresContext& aPresContext,
{
nsBorderEdge * tableBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_RIGHT].ElementAt(aRowIndex));
*tableBorder = border;
tableBorder->mInsideNeighbor = cellFrame->mBorderEdges;
tableBorder->mInsideNeighbor = &cellFrame->mBorderEdges;
mBorderEdges->mMaxBorderWidth.right = PR_MAX(border.mWidth, mBorderEdges->mMaxBorderWidth.right);
// since the table is our right neightbor, we need to factor in the table's horizontal borders.
// can't compute that length here because we don't know how thick top and bottom borders are
@ -1471,7 +1450,7 @@ void nsTableFrame::ComputeTopBorderForEdgeAt(nsIPresContext& aPresContext,
widthToAdd = NSToCoordCeil(p2t);
border->mWidth *= NSToCoordCeil(p2t);
border->mLength = GetColumnWidth(aColIndex);
border->mInsideNeighbor = cellFrame->mBorderEdges;
border->mInsideNeighbor = &cellFrame->mBorderEdges;
if (0==aColIndex)
{ // if we're the first column, factor in the thickness of the left table border
nsBorderEdge *leftBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_LEFT].ElementAt(0));
@ -1612,7 +1591,7 @@ void nsTableFrame::ComputeBottomBorderForEdgeAt(nsIPresContext& aPresContext,
{
nsBorderEdge * tableBorder = (nsBorderEdge *)(mBorderEdges->mEdges[NS_SIDE_BOTTOM].ElementAt(aColIndex));
*tableBorder = border;
tableBorder->mInsideNeighbor = cellFrame->mBorderEdges;
tableBorder->mInsideNeighbor = &cellFrame->mBorderEdges;
mBorderEdges->mMaxBorderWidth.bottom = PR_MAX(border.mWidth, mBorderEdges->mMaxBorderWidth.bottom);
// since the table is our bottom neightbor, we need to factor in the table's vertical borders.
PRInt32 lastColIndex = mCellMap->GetColCount()-1;
@ -5530,11 +5509,9 @@ nsTableFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
// Add in the amount of space for the column width array
sum += mColumnWidthsLength * sizeof(PRInt32);
// And in size of column info cache
// And the column info cache
if (mColCache) {
PRUint32 colCacheSize;
mColCache->SizeOf(aHandler, &colCacheSize);
aHandler->AddSize(nsLayoutAtoms::tableColCache, colCacheSize);
sum += sizeof(*mColCache);
}
// Add in size of cell map