Eliminated one data member, moved one to flag frame state, and changed mBorderEdges
to be heap allocated (only for collapsing border model)
This commit is contained in:
troy%netscape.com 1999-10-07 20:38:50 +00:00
Родитель ffa210e89a
Коммит e5ae6a3cd9
6 изменённых файлов: 128 добавлений и 82 удалений

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

@ -44,6 +44,23 @@ 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,
@ -69,6 +86,20 @@ 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;
@ -130,29 +161,31 @@ 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);
@ -191,10 +224,11 @@ 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 {
@ -254,7 +288,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
else
{
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
aDirtyRect, rect, mBorderEdges, mStyleContext, skipSides);
}
}
}
@ -341,6 +375,7 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
nsBorderEdge *aBorder,
nscoord aOddAmountToAdd)
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
nsBorderEdge *border = nsnull;
switch (aSide)
{
@ -349,8 +384,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;
}
@ -359,8 +394,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;
}
@ -369,8 +404,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;
}
@ -379,8 +414,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;
}
}
@ -1092,7 +1127,8 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
}
if (NS_STYLE_BORDER_COLLAPSE==aTableFrame->GetBorderCollapseStyle()) {
aBorder = mBorderEdges.mMaxBorderWidth;
NS_PRECONDITION(mBorderEdges, "no border edges struct");
aBorder = mBorderEdges->mMaxBorderWidth;
} else {
const nsStyleSpacing* spacing;
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
@ -1102,12 +1138,13 @@ 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;
}

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

@ -46,7 +46,8 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// default constructor supplied by the compiler
nsTableCellFrame();
~nsTableCellFrame();
NS_IMETHOD Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -244,17 +245,12 @@ 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
};
@ -312,7 +308,7 @@ inline nsSize nsTableCellFrame::GetPass1MaxElementSize() const
inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
{
if (mCalculated == NS_OK)
if (mMargin.left != -1)
{
aMargin = mMargin;
return NS_OK;
@ -320,16 +316,6 @@ 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

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

@ -1238,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
@ -1372,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
@ -1450,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));
@ -1591,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;

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

@ -44,6 +44,23 @@ 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,
@ -69,6 +86,20 @@ 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;
@ -130,29 +161,31 @@ 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);
@ -191,10 +224,11 @@ 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 {
@ -254,7 +288,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
else
{
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
aDirtyRect, rect, &mBorderEdges, mStyleContext, skipSides);
aDirtyRect, rect, mBorderEdges, mStyleContext, skipSides);
}
}
}
@ -341,6 +375,7 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
nsBorderEdge *aBorder,
nscoord aOddAmountToAdd)
{
NS_PRECONDITION(mBorderEdges, "no border edges struct");
nsBorderEdge *border = nsnull;
switch (aSide)
{
@ -349,8 +384,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;
}
@ -359,8 +394,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;
}
@ -369,8 +404,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;
}
@ -379,8 +414,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;
}
}
@ -1092,7 +1127,8 @@ void nsTableCellFrame::GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFram
}
if (NS_STYLE_BORDER_COLLAPSE==aTableFrame->GetBorderCollapseStyle()) {
aBorder = mBorderEdges.mMaxBorderWidth;
NS_PRECONDITION(mBorderEdges, "no border edges struct");
aBorder = mBorderEdges->mMaxBorderWidth;
} else {
const nsStyleSpacing* spacing;
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
@ -1102,12 +1138,13 @@ 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;
}

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

@ -46,7 +46,8 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// default constructor supplied by the compiler
nsTableCellFrame();
~nsTableCellFrame();
NS_IMETHOD Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -244,17 +245,12 @@ 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
};
@ -312,7 +308,7 @@ inline nsSize nsTableCellFrame::GetPass1MaxElementSize() const
inline NS_METHOD nsTableCellFrame::GetMargin(nsMargin& aMargin)
{
if (mCalculated == NS_OK)
if (mMargin.left != -1)
{
aMargin = mMargin;
return NS_OK;
@ -320,16 +316,6 @@ 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

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

@ -1238,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
@ -1372,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
@ -1450,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));
@ -1591,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;