This commit is contained in:
buster%netscape.com 1998-12-16 17:05:14 +00:00
Родитель 0d4267a93f
Коммит 7f8a8688c4
8 изменённых файлов: 158 добавлений и 122 удалений

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

@ -68,12 +68,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myColor, 0, 0);
//XXX: this could be calculated once and remembered
// get border padding values
//XXX: also check style for rule on rendering empty cells
/*
*/
// empty cells do not render their border
PRBool renderBorder = PR_TRUE;
if (PR_TRUE==GetContentEmpty())
@ -729,45 +723,6 @@ nscoord nsTableCellFrame::GetBorderWidth(nsIFrame* aFrame, PRUint8 aEdge) const
}
/**
* Given a style context and an edge, find the padding
*
**/
nscoord nsTableCellFrame::GetPadding(nsIFrame* aFrame, PRUint8 aEdge) const
{
nscoord result = 0;
if (aFrame)
{
const nsStyleSpacing* spacing;
aFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
nsMargin padding;
spacing->CalcPaddingFor(aFrame, padding);
switch (aEdge)
{
case NS_SIDE_TOP:
result = padding.top;
break;
case NS_SIDE_RIGHT:
result = padding.right;
break;
case NS_SIDE_BOTTOM:
result = padding.bottom;
break;
case NS_SIDE_LEFT:
result = padding.left;
break;
}
}
return result;
}
/**
* Given an Edge, find the opposing edge (top<-->bottom, left<-->right)
*
@ -876,6 +831,7 @@ void nsTableCellFrame::RecalcLayoutData(nsTableFrame* aTableFrame,
mCalculated = NS_OK;
}
/* ----- debugging methods ----- */
NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{

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

@ -137,8 +137,6 @@ private:
nscoord GetBorderWidth(nsIFrame* aFrame, PRUint8 aEdge) const;
nscoord GetPadding(nsIFrame* aFrame, PRUint8 aEdge) const;
PRUint8 GetOpposingEdge(PRUint8 aEdge);
void CalculateBorders(nsTableFrame* aTableFrame,

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

@ -1178,7 +1178,9 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
}
}
void nsTableFrame::RecalcLayoutData()
/* compute all the collapsed borders between aStartRowIndex and aEndRowIndex, inclusive */
void nsTableFrame::ComputeCollapsingBorders(PRInt32 aStartRowIndex,
PRInt32 aEndRowIndex)
{
nsCellMap *cellMap = GetCellMap();
if (nsnull==cellMap)
@ -1186,6 +1188,77 @@ void nsTableFrame::RecalcLayoutData()
PRInt32 colCount = cellMap->GetColCount();
PRInt32 rowCount = cellMap->GetRowCount();
if (aStartRowIndex>=rowCount)
{
NS_ASSERTION(PR_FALSE, "aStartRowIndex>=rowCount in ComputeCollapsingBorders");
return; // we don't have the requested row yet
}
// For every row between aStartRowIndex and aEndRowIndex (or the end of the table),
// walk across every edge and compute the border at that edge.
// Distribute half the computed border to the appropriate adjacent objects
// (always a cell frame or the table frame.) In the case of odd width,
// the object on the right/bottom gets the extra portion
PRInt32 rowIndex = aStartRowIndex;
for ( ; rowIndex<rowCount && rowIndex <=aEndRowIndex; rowIndex++)
{
PRInt32 colIndex=0;
for ( ; colIndex<colCount; colIndex++)
{
/*
// compute vertical edges
if (0==colIndex)
{ // table is left neighbor
ComputeLeftBorderForEdgeAt(rowIndex, colIndex);
}
ComputeRightBorderForEdgeAt(rowIndex, colIndex);
// compute horizontal edges
if (0==rowIndex)
{
ComputeTopBorderForEdgeAt(rowIndex, colIndex);
}
ComputeBottomBorderForEdgeAt(rowIndex, colIndex);
if ((colCount-1)==colIndex)
{ // table is right neighbor
}
else
{ // interior cell
}
if ((rowCount-1)==rowIndex)
{
}
else
{
}
*/
}
}
}
void nsTableFrame::RecalcLayoutData()
{
nsCellMap *cellMap = GetCellMap();
if (nsnull==cellMap)
return; // no info yet, so nothing useful to do
PRInt32 colCount = cellMap->GetColCount();
PRInt32 rowCount = cellMap->GetRowCount();
// compute all the collapsing border values for the entire table
// XXX: it would be nice to make this incremental!
const nsStyleTable *tableStyle=nsnull;
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
if (NS_STYLE_BORDER_COLLAPSE==tableStyle->mBorderCollapse)
ComputeCollapsingBorders(0, rowCount-1);
//XXX need to determine how much of what follows is really necessary
// it does collapsing margins between table elements
PRInt32 row = 0;
PRInt32 col = 0;
@ -3591,17 +3664,6 @@ void nsTableFrame::MapBorderMarginPadding(nsIPresContext& aPresContext)
}
// Subclass hook for style post processing
NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext& aPresContext)
{
#ifdef NOISY_STYLE
printf("nsTableFrame::DidSetStyleContext \n");
#endif
return NS_OK;
}
NS_METHOD nsTableFrame::GetCellMarginData(nsTableCellFrame* aKidFrame, nsMargin& aMargin)
{
nsresult result = NS_ERROR_NOT_INITIALIZED;

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

@ -207,6 +207,10 @@ public:
/** Calculate Layout Information */
void AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTableCell);
/* compute all the collapsed borders between aStartRowIndex and aEndRowIndex, inclusive */
void ComputeCollapsingBorders(PRInt32 aStartRowIndex, PRInt32 aEndRowIndex);
void RecalcLayoutData();
// Get cell margin information
@ -473,8 +477,6 @@ public:
virtual void InvalidateColumnWidths();
protected:
/** do post processing to setting up style information for the frame */
NS_IMETHOD DidSetStyleContext(nsIPresContext& aPresContext);
/** Support methods for DidSetStyleContext */
void MapBorderMarginPadding(nsIPresContext& aPresContext);

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

@ -68,12 +68,6 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myColor, 0, 0);
//XXX: this could be calculated once and remembered
// get border padding values
//XXX: also check style for rule on rendering empty cells
/*
*/
// empty cells do not render their border
PRBool renderBorder = PR_TRUE;
if (PR_TRUE==GetContentEmpty())
@ -729,45 +723,6 @@ nscoord nsTableCellFrame::GetBorderWidth(nsIFrame* aFrame, PRUint8 aEdge) const
}
/**
* Given a style context and an edge, find the padding
*
**/
nscoord nsTableCellFrame::GetPadding(nsIFrame* aFrame, PRUint8 aEdge) const
{
nscoord result = 0;
if (aFrame)
{
const nsStyleSpacing* spacing;
aFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
nsMargin padding;
spacing->CalcPaddingFor(aFrame, padding);
switch (aEdge)
{
case NS_SIDE_TOP:
result = padding.top;
break;
case NS_SIDE_RIGHT:
result = padding.right;
break;
case NS_SIDE_BOTTOM:
result = padding.bottom;
break;
case NS_SIDE_LEFT:
result = padding.left;
break;
}
}
return result;
}
/**
* Given an Edge, find the opposing edge (top<-->bottom, left<-->right)
*
@ -876,6 +831,7 @@ void nsTableCellFrame::RecalcLayoutData(nsTableFrame* aTableFrame,
mCalculated = NS_OK;
}
/* ----- debugging methods ----- */
NS_METHOD nsTableCellFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
{

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

@ -137,8 +137,6 @@ private:
nscoord GetBorderWidth(nsIFrame* aFrame, PRUint8 aEdge) const;
nscoord GetPadding(nsIFrame* aFrame, PRUint8 aEdge) const;
PRUint8 GetOpposingEdge(PRUint8 aEdge);
void CalculateBorders(nsTableFrame* aTableFrame,

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

@ -1178,7 +1178,9 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
}
}
void nsTableFrame::RecalcLayoutData()
/* compute all the collapsed borders between aStartRowIndex and aEndRowIndex, inclusive */
void nsTableFrame::ComputeCollapsingBorders(PRInt32 aStartRowIndex,
PRInt32 aEndRowIndex)
{
nsCellMap *cellMap = GetCellMap();
if (nsnull==cellMap)
@ -1186,6 +1188,77 @@ void nsTableFrame::RecalcLayoutData()
PRInt32 colCount = cellMap->GetColCount();
PRInt32 rowCount = cellMap->GetRowCount();
if (aStartRowIndex>=rowCount)
{
NS_ASSERTION(PR_FALSE, "aStartRowIndex>=rowCount in ComputeCollapsingBorders");
return; // we don't have the requested row yet
}
// For every row between aStartRowIndex and aEndRowIndex (or the end of the table),
// walk across every edge and compute the border at that edge.
// Distribute half the computed border to the appropriate adjacent objects
// (always a cell frame or the table frame.) In the case of odd width,
// the object on the right/bottom gets the extra portion
PRInt32 rowIndex = aStartRowIndex;
for ( ; rowIndex<rowCount && rowIndex <=aEndRowIndex; rowIndex++)
{
PRInt32 colIndex=0;
for ( ; colIndex<colCount; colIndex++)
{
/*
// compute vertical edges
if (0==colIndex)
{ // table is left neighbor
ComputeLeftBorderForEdgeAt(rowIndex, colIndex);
}
ComputeRightBorderForEdgeAt(rowIndex, colIndex);
// compute horizontal edges
if (0==rowIndex)
{
ComputeTopBorderForEdgeAt(rowIndex, colIndex);
}
ComputeBottomBorderForEdgeAt(rowIndex, colIndex);
if ((colCount-1)==colIndex)
{ // table is right neighbor
}
else
{ // interior cell
}
if ((rowCount-1)==rowIndex)
{
}
else
{
}
*/
}
}
}
void nsTableFrame::RecalcLayoutData()
{
nsCellMap *cellMap = GetCellMap();
if (nsnull==cellMap)
return; // no info yet, so nothing useful to do
PRInt32 colCount = cellMap->GetColCount();
PRInt32 rowCount = cellMap->GetRowCount();
// compute all the collapsing border values for the entire table
// XXX: it would be nice to make this incremental!
const nsStyleTable *tableStyle=nsnull;
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
if (NS_STYLE_BORDER_COLLAPSE==tableStyle->mBorderCollapse)
ComputeCollapsingBorders(0, rowCount-1);
//XXX need to determine how much of what follows is really necessary
// it does collapsing margins between table elements
PRInt32 row = 0;
PRInt32 col = 0;
@ -3591,17 +3664,6 @@ void nsTableFrame::MapBorderMarginPadding(nsIPresContext& aPresContext)
}
// Subclass hook for style post processing
NS_METHOD nsTableFrame::DidSetStyleContext(nsIPresContext& aPresContext)
{
#ifdef NOISY_STYLE
printf("nsTableFrame::DidSetStyleContext \n");
#endif
return NS_OK;
}
NS_METHOD nsTableFrame::GetCellMarginData(nsTableCellFrame* aKidFrame, nsMargin& aMargin)
{
nsresult result = NS_ERROR_NOT_INITIALIZED;

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

@ -207,6 +207,10 @@ public:
/** Calculate Layout Information */
void AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTableCell);
/* compute all the collapsed borders between aStartRowIndex and aEndRowIndex, inclusive */
void ComputeCollapsingBorders(PRInt32 aStartRowIndex, PRInt32 aEndRowIndex);
void RecalcLayoutData();
// Get cell margin information
@ -473,8 +477,6 @@ public:
virtual void InvalidateColumnWidths();
protected:
/** do post processing to setting up style information for the frame */
NS_IMETHOD DidSetStyleContext(nsIPresContext& aPresContext);
/** Support methods for DidSetStyleContext */
void MapBorderMarginPadding(nsIPresContext& aPresContext);