minor updates and fixes

This commit is contained in:
buster
1998-06-17 19:51:51 +00:00
parent 035fc05529
commit ab6b2bcb32
17 changed files with 40 additions and 206 deletions

View File

@@ -236,6 +236,7 @@ CAPTION {
text-align: center; text-align: center;
display: table-caption; display: table-caption;
} }
TR { display: table-row;}
TBODY { display: table-row-group; } TBODY { display: table-row-group; }
THEAD { display: table-header-group; } THEAD { display: table-header-group; }
TFOOT { display: table-footer-group; } TFOOT { display: table-footer-group; }

View File

@@ -70,7 +70,7 @@ public:
/** returns PR_TRUE if there is an actual input tag corresponding to /** returns PR_TRUE if there is an actual input tag corresponding to
* this content object. * this content object.
*/ */
virtual PRBool IsImplicit () const =0; NS_IMETHOD IsSynthetic(PRBool& aResult) = 0;
/** returns PR_TRUE if this content object should NOT be written to the output stream. /** returns PR_TRUE if this content object should NOT be written to the output stream.
* for example, we don't generally want to output implicit tags when saving. * for example, we don't generally want to output implicit tags when saving.

View File

@@ -355,8 +355,6 @@ void nsTableCell::SetRowSpan(int aRowSpan)
NS_ASSERTION(0<aRowSpan, "bad row span"); NS_ASSERTION(0<aRowSpan, "bad row span");
int oldSpan = mRowSpan; int oldSpan = mRowSpan;
mRowSpan = aRowSpan; mRowSpan = aRowSpan;
if (mRowSpan != oldSpan)
ResetCellMap ();
} }
void nsTableCell::SetColSpan (int aColSpan) void nsTableCell::SetColSpan (int aColSpan)
@@ -364,14 +362,6 @@ void nsTableCell::SetColSpan (int aColSpan)
NS_ASSERTION(0<aColSpan, "bad col span"); NS_ASSERTION(0<aColSpan, "bad col span");
int oldSpan = mColSpan; int oldSpan = mColSpan;
mColSpan = aColSpan; mColSpan = aColSpan;
if (mColSpan != oldSpan)
ResetCellMap ();
}
void nsTableCell::ResetCellMap ()
{
if (nsnull != mRow)
mRow->ResetCellMap ();
} }
nsresult nsresult

View File

@@ -125,8 +125,6 @@ public:
/** set the starting column for this cell. Always >= 1 */ /** set the starting column for this cell. Always >= 1 */
virtual void SetColIndex (int aColIndex); virtual void SetColIndex (int aColIndex);
virtual void ResetCellMap ();
protected: protected:
virtual nsContentAttr AttributeToString(nsIAtom* aAttribute, virtual nsContentAttr AttributeToString(nsIAtom* aAttribute,
nsHTMLValue& aValue, nsHTMLValue& aValue,

View File

@@ -37,11 +37,6 @@ static const PRBool gsDebug = PR_FALSE;
static const PRBool gsNoisyRefs = PR_FALSE; static const PRBool gsNoisyRefs = PR_FALSE;
#endif #endif
// hack, remove when hack in nsTableCol constructor is removed
static PRInt32 HACKcounter=0;
static nsIAtom *HACKattribute=nsnull;
#include "prprf.h" // remove when nsTableCol constructor hack is removed
// end hack code
nsTableColFrame::nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame) nsTableColFrame::nsTableColFrame(nsIContent* aContent, nsIFrame* aParentFrame)
: nsFrame(aContent, aParentFrame) : nsFrame(aContent, aParentFrame)
@@ -133,17 +128,6 @@ nsTableCol::nsTableCol (PRBool aImplicit)
void nsTableCol::Init() void nsTableCol::Init()
{ {
/* begin hack */
// temporary hack to get around style sheet optimization that folds all
// col style context into one, unless there is a unique HTML attribute set
char out[40];
PR_snprintf(out, 40, "%d", HACKcounter);
const nsString value(out);
if (nsnull==HACKattribute)
HACKattribute = NS_NewAtom("Steve's unbelievable hack attribute");
SetAttribute(HACKattribute, value);
HACKcounter++;
/* end hack */
} }
nsTableCol::~nsTableCol() nsTableCol::~nsTableCol()

View File

@@ -35,12 +35,6 @@ static const PRBool gsDebug = PR_FALSE;
static const PRBool gsNoisyRefs = PR_FALSE; static const PRBool gsNoisyRefs = PR_FALSE;
#endif #endif
// hack, remove when hack in nsTableCol constructor is removed
static PRInt32 HACKcounter=0;
static nsIAtom *HACKattribute=nsnull;
#include "prprf.h" // remove when nsTableCol constructor hack is removed
// end hack code
nsTableColGroup::nsTableColGroup(nsIAtom* aTag, int aSpan) nsTableColGroup::nsTableColGroup(nsIAtom* aTag, int aSpan)
: nsTableContent(aTag), : nsTableContent(aTag),
@@ -48,17 +42,6 @@ nsTableColGroup::nsTableColGroup(nsIAtom* aTag, int aSpan)
mStartColIndex(0), mStartColIndex(0),
mColCount(0) mColCount(0)
{ {
/* begin hack */
// temporary hack to get around style sheet optimization that folds all
// col style context into one, unless there is a unique HTML attribute set
char out[40];
PR_snprintf(out, 40, "%d", HACKcounter);
const nsString value(out);
if (nsnull==HACKattribute)
HACKattribute = NS_NewAtom("Steve's unbelievable hack attribute");
SetAttribute(HACKattribute, value);
HACKcounter++;
/* end hack */
} }
nsTableColGroup::nsTableColGroup (PRBool aImplicit) nsTableColGroup::nsTableColGroup (PRBool aImplicit)
@@ -68,17 +51,6 @@ nsTableColGroup::nsTableColGroup (PRBool aImplicit)
mColCount(0) mColCount(0)
{ {
mImplicit = aImplicit; mImplicit = aImplicit;
/* begin hack */
// temporary hack to get around style sheet optimization that folds all
// col style context into one, unless there is a unique HTML attribute set
char out[40];
PR_snprintf(out, 40, "%d", HACKcounter);
const nsString value(out);
if (nsnull==HACKattribute)
HACKattribute = NS_NewAtom("Steve's unbelievable hack attribute");
SetAttribute(HACKattribute, value);
HACKcounter++;
/* end hack */
} }
@@ -161,7 +133,9 @@ nsTableColGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
PRBool contentHandled = PR_FALSE; PRBool contentHandled = PR_FALSE;
// SEC: TODO verify that aContent is table content // SEC: TODO verify that aContent is table content
nsTableContent *tableContent = (nsTableContent *)aContent; nsTableContent *tableContent = (nsTableContent *)aContent;
if (PR_FALSE==tableContent->IsImplicit()) PRBool isImplicit;
tableContent->IsSynthetic(isImplicit);
if (PR_FALSE==isImplicit)
{ {
/* if aContent is not implicit, /* if aContent is not implicit,
* and if we already have an implicit column for this actual column, * and if we already have an implicit column for this actual column,
@@ -172,7 +146,9 @@ nsTableColGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
{ {
nsTableContent *col = (nsTableContent*)ChildAt(colIndex); nsTableContent *col = (nsTableContent*)ChildAt(colIndex);
NS_ASSERTION(nsnull!=col, "bad child"); NS_ASSERTION(nsnull!=col, "bad child");
if (PR_TRUE==col->IsImplicit()) PRBool colIsImplicit;
col->IsSynthetic(colIsImplicit);
if (PR_TRUE==colIsImplicit)
{ {
ReplaceChildAt(aContent, colIndex, aNotify); ReplaceChildAt(aContent, colIndex, aNotify);
contentHandled = PR_TRUE; contentHandled = PR_TRUE;

View File

@@ -130,9 +130,10 @@ void nsTableContent::SetTable (nsTablePart *aTable)
mTable = aTable; mTable = aTable;
} }
PRBool nsTableContent::IsImplicit () const NS_METHOD nsTableContent::IsSynthetic(PRBool& aResult)
{ {
return mImplicit; aResult = mImplicit;
return NS_OK;
} }
/** /**
@@ -169,7 +170,7 @@ void nsTableContent::List(FILE* out, PRInt32 aIndent) const
} }
char *isImplicitString = ""; char *isImplicitString = "";
if (PR_TRUE==IsImplicit()) if (PR_TRUE==mImplicit)
isImplicitString = " (I)"; isImplicitString = " (I)";
ListAttributes(out); ListAttributes(out);

View File

@@ -29,7 +29,7 @@
* within a table. * within a table.
* *
* @author sclark * @author sclark
* @version $Revision: 3.5 $ * @version $Revision: 3.6 $
* @see * @see
*/ */
class nsTableContent : public nsHTMLContainer, public nsITableContent class nsTableContent : public nsHTMLContainer, public nsITableContent
@@ -87,7 +87,7 @@ public:
/** @see nsITableContent::IsImplicit */ /** @see nsITableContent::IsImplicit */
virtual PRBool IsImplicit () const; NS_IMETHOD IsSynthetic(PRBool& aResult);
/** @see nsITableContent::SkipSelfForSaving */ /** @see nsITableContent::SkipSelfForSaving */
virtual PRBool SkipSelfForSaving (); virtual PRBool SkipSelfForSaving ();

View File

@@ -464,7 +464,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
// need to find the generic way to stamp out this content, and ::AppendChild it // need to find the generic way to stamp out this content, and ::AppendChild it
// this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid? // this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid?
// QQQ needs a ref count?
lastColGroup = new nsTableColGroup (PR_TRUE); lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not? // XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
@@ -629,7 +628,6 @@ void nsTableFrame::BuildCellMap ()
} }
if (gsDebug==PR_TRUE) if (gsDebug==PR_TRUE)
DumpCellMap (); DumpCellMap ();
//QQQ EnsureColumns();
} }
/** /**
@@ -810,7 +808,6 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
void nsTableFrame::RecalcLayoutData() void nsTableFrame::RecalcLayoutData()
{ {
//QQQ should we ensureCellMap here?
PRInt32 colCount = mCellMap->GetColCount(); PRInt32 colCount = mCellMap->GetColCount();
PRInt32 rowCount = mCellMap->GetRowCount(); PRInt32 rowCount = mCellMap->GetRowCount();
PRInt32 row = 0; PRInt32 row = 0;
@@ -1261,9 +1258,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
} }
} }
// BuildColumnCache calls EnsureCellMap. If that ever changes, be sure to call EnsureCellMap
// here first.
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus); BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
EnsureCellMap();//QQQ have to determine where the right place for this is now that it's a frame-side operation
//QQQ cell map used to be forced before loop
// Recalculate Layout Dependencies // Recalculate Layout Dependencies
RecalcLayoutData(); RecalcLayoutData();

View File

@@ -112,22 +112,10 @@ const char *nsTablePart::kHeaderCellTagString="TH";
* I do not check or addref aTag because my superclass does that for me * I do not check or addref aTag because my superclass does that for me
*/ */
nsTablePart::nsTablePart(nsIAtom* aTag) nsTablePart::nsTablePart(nsIAtom* aTag)
: nsHTMLContainer(aTag), : nsHTMLContainer(aTag)
mColCount(0),
mSpecifiedColCount(0)
{ {
} }
/** constructor
* I do not check or addref aTag because my superclass does that for me
*/
nsTablePart::nsTablePart (nsIAtom* aTag, PRInt32 aColumnCount)
: nsHTMLContainer(aTag),
mColCount(aColumnCount),
mSpecifiedColCount(0)
{
}
/** /**
*/ */
nsTablePart::~nsTablePart() nsTablePart::~nsTablePart()
@@ -161,13 +149,6 @@ nsrefcnt nsTablePart::Release(void)
return mRefCnt; return mRefCnt;
} }
/** assumes that mColCount has been set */
///QQQQQ can be removed?
PRInt32 nsTablePart::GetMaxColumns ()
{
return mColCount;
}
/** add a child to the table content. /** add a child to the table content.
* tables are special because they require the content to be normalized, in order. * tables are special because they require the content to be normalized, in order.
* so this function doesn't really "append" the content, but adds it in the proper place, * so this function doesn't really "append" the content, but adds it in the proper place,
@@ -229,7 +210,10 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
} }
NS_RELEASE(child); // child: REFCNT-- NS_RELEASE(child); // child: REFCNT--
} }
if ((nsnull == group) || (! group->IsImplicit ())) PRBool groupIsImplicit = PR_FALSE;
if (nsnull!=group)
group->IsSynthetic(groupIsImplicit);
if ((nsnull == group) || (PR_FALSE==groupIsImplicit))
{ {
if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChild -- creating an implicit row group.\n"); if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChild -- creating an implicit row group.\n");
nsIAtom * rowGroupTag = NS_NewAtom(kRowGroupBodyTagString); // rowGroupTag: REFCNT++ nsIAtom * rowGroupTag = NS_NewAtom(kRowGroupBodyTagString); // rowGroupTag: REFCNT++
@@ -285,7 +269,10 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
caption = (nsTableCaption *)content; caption = (nsTableCaption *)content;
NS_RELEASE(lastChild); // lastChild: REFCNT-- NS_RELEASE(lastChild); // lastChild: REFCNT--
} }
if ((nsnull == caption) || (! caption->IsImplicit ())) PRBool captionIsImplicit = PR_FALSE;
if (nsnull!=caption)
caption->IsSynthetic(captionIsImplicit);
if ((nsnull == caption) || (PR_FALSE==captionIsImplicit))
{ {
if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChild -- adding an implicit caption.\n"); if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChild -- adding an implicit caption.\n");
caption = new nsTableCaption (PR_TRUE); caption = new nsTableCaption (PR_TRUE);
@@ -535,7 +522,10 @@ PRBool nsTablePart::AppendColumn(nsTableCol *aContent)
NS_RELEASE(child); // child: REFCNT-- NS_RELEASE(child); // child: REFCNT--
} }
} }
if ((PR_FALSE == foundColGroup) || (! group->IsImplicit ())) PRBool groupIsImplicit = PR_FALSE;
if (nsnull!=group)
group->IsSynthetic(groupIsImplicit);
if ((PR_FALSE == foundColGroup) || (PR_FALSE==groupIsImplicit))
{ {
if (gsDebug==PR_TRUE) if (gsDebug==PR_TRUE)
printf ("nsTablePart::AppendChild -- creating an implicit column group.\n"); printf ("nsTablePart::AppendChild -- creating an implicit column group.\n");

View File

@@ -98,13 +98,6 @@ public:
virtual void MapAttributesInto(nsIStyleContext* aContext, virtual void MapAttributesInto(nsIStyleContext* aContext,
nsIPresContext* aPresContext); nsIPresContext* aPresContext);
/* public Table methods */
/** returns the actual number of columns in this table.<br>
* as a side effect, will call BuildCellMap to constuct mCellMap if needed.
*/
virtual PRInt32 GetMaxColumns();
/* overrides from nsHTMLContainer */ /* overrides from nsHTMLContainer */
@@ -152,8 +145,6 @@ protected:
private: private:
PRInt32 mColCount;
PRInt32 mSpecifiedColCount;
static nsIAtom *kDefaultTag; static nsIAtom *kDefaultTag;
}; };

View File

@@ -110,25 +110,6 @@ nsrefcnt nsTableRow::Release(void)
return mRefCnt; return mRefCnt;
} }
//QQQ could be removed
PRInt32 nsTableRow::GetMaxColumns()
{
int sum = 0;
for (int i = 0, n = ChildCount(); i < n; i++) {
nsTableCell *cell = (nsTableCell *) ChildAt(i); // cell: REFCNT++
sum += cell->GetColSpan();
NS_RELEASE(cell); // cell: REFCNT--
}
return sum;
}
void nsTableRow::ResetCellMap ()
{
if (nsnull != mRowGroup)
{
mRowGroup->ResetCellMap ();
}
}
NS_IMETHODIMP NS_IMETHODIMP
nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify) nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
@@ -150,7 +131,6 @@ nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
if (NS_OK == rv) if (NS_OK == rv)
{ {
((nsTableCell *)aContent)->SetRow (this); ((nsTableCell *)aContent)->SetRow (this);
ResetCellMap ();
} }
} }
} }
@@ -177,7 +157,6 @@ nsTableRow::InsertChildAt (nsIContent *aContent, PRInt32 aIndex,
if (NS_OK == rv) if (NS_OK == rv)
{ {
((nsTableCell *)aContent)->SetRow (this); ((nsTableCell *)aContent)->SetRow (this);
ResetCellMap ();
} }
} }
} }
@@ -216,7 +195,6 @@ nsTableRow::ReplaceChildAt (nsIContent *aContent, PRInt32 aIndex,
((nsTableCell *)aContent)->SetRow (this); ((nsTableCell *)aContent)->SetRow (this);
if (nsnull!=oldChild) if (nsnull!=oldChild)
((nsTableCell *)oldChild)->SetRow (nsnull); ((nsTableCell *)oldChild)->SetRow (nsnull);
ResetCellMap ();
} }
NS_IF_RELEASE(oldChild); // oldChild: REFCNT-- NS_IF_RELEASE(oldChild); // oldChild: REFCNT--
#endif #endif
@@ -244,7 +222,6 @@ nsTableRow::RemoveChildAt (int aIndex, PRBool aNotify)
{ {
if (nsnull != oldChild) if (nsnull != oldChild)
((nsTableCell *)oldChild)->SetRow (nsnull); ((nsTableCell *)oldChild)->SetRow (nsnull);
ResetCellMap ();
} }
} }
NS_IF_RELEASE(oldChild); // oldChild: REFCNT-- NS_IF_RELEASE(oldChild); // oldChild: REFCNT--

View File

@@ -98,11 +98,6 @@ public:
/** set this row's starting row index */ /** set this row's starting row index */
virtual void SetRowIndex (int aRowIndex); virtual void SetRowIndex (int aRowIndex);
/** return the number of columns represented by the cells in this row */
virtual PRInt32 GetMaxColumns();
/** notify the containing nsTablePart that cell information has changed */
virtual void ResetCellMap ();
/* ----------- nsTableContent overrides ----------- */ /* ----------- nsTableContent overrides ----------- */

View File

@@ -43,27 +43,10 @@ static const PRBool gsNoisyRefs = PR_FALSE;
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kITableContentIID, NS_ITABLECONTENT_IID); static NS_DEFINE_IID(kITableContentIID, NS_ITABLECONTENT_IID);
// hack, remove when hack in nsTableCol constructor is removed
static PRInt32 HACKcounter=0;
static nsIAtom *HACKattribute=nsnull;
#include "prprf.h" // remove when nsTableCol constructor hack is removed
// end hack code
// nsTableContent checks aTag // nsTableContent checks aTag
nsTableRowGroup::nsTableRowGroup(nsIAtom* aTag) nsTableRowGroup::nsTableRowGroup(nsIAtom* aTag)
: nsTableContent(aTag) : nsTableContent(aTag)
{ {
/* begin hack */
// temporary hack to get around style sheet optimization that folds all
// col style context into one, unless there is a unique HTML attribute set
char out[40];
PR_snprintf(out, 40, "%d", HACKcounter);
const nsString value(out);
if (nsnull==HACKattribute)
HACKattribute = NS_NewAtom("Steve's unbelievable hack attribute");
SetAttribute(HACKattribute, value);
HACKcounter++;
/* end hack */
} }
// nsTableContent checks aTag // nsTableContent checks aTag
@@ -71,39 +54,12 @@ nsTableRowGroup::nsTableRowGroup(nsIAtom* aTag, PRBool aImplicit)
: nsTableContent(aTag) : nsTableContent(aTag)
{ {
mImplicit = aImplicit; mImplicit = aImplicit;
/* begin hack */
// temporary hack to get around style sheet optimization that folds all
// col style context into one, unless there is a unique HTML attribute set
char out[40];
PR_snprintf(out, 40, "%d", HACKcounter);
const nsString value(out);
if (nsnull==HACKattribute)
HACKattribute = NS_NewAtom("Steve's unbelievable hack attribute");
SetAttribute(HACKattribute, value);
HACKcounter++;
/* end hack */
} }
nsTableRowGroup::~nsTableRowGroup() nsTableRowGroup::~nsTableRowGroup()
{ {
} }
/** return the number of columns in the widest row in this group */
///QQQ could be removed
PRInt32 nsTableRowGroup::GetMaxColumns()
{ // computed every time for now, could be cached
PRInt32 result = 0;
PRInt32 numRows = ChildCount();
for (PRInt32 rowIndex = 0; rowIndex < numRows; rowIndex++)
{
nsTableRow *row = (nsTableRow*)ChildAt(rowIndex);
PRInt32 numCols = row->GetMaxColumns();
if (result < numCols)
result = numCols;
}
return result;
}
// Added for debuging purposes -- remove from final build // Added for debuging purposes -- remove from final build
nsrefcnt nsTableRowGroup::AddRef(void) nsrefcnt nsTableRowGroup::AddRef(void)
{ {
@@ -186,11 +142,6 @@ nsTableRowGroup::CreateFrame(nsIPresContext* aPresContext,
return rv; return rv;
} }
void nsTableRowGroup::ResetCellMap ()
{
}
NS_IMETHODIMP NS_IMETHODIMP
nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify) nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
{ {
@@ -210,7 +161,6 @@ nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
{ {
((nsTableRow *)aContent)->SetRowGroup (this); ((nsTableRow *)aContent)->SetRowGroup (this);
// make sure the table cell map gets rebuilt // make sure the table cell map gets rebuilt
ResetCellMap ();
} }
} }
// otherwise, if it's a cell, create an implicit row for it // otherwise, if it's a cell, create an implicit row for it
@@ -229,7 +179,10 @@ nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
NS_RELEASE(child); // child: REFCNT-- NS_RELEASE(child); // child: REFCNT--
} }
} }
if ((nsnull == row) || (! row->IsImplicit ())) PRBool rowIsImplicit = PR_FALSE;
if (nsnull!=row)
row->IsSynthetic(rowIsImplicit);
if ((nsnull == row) || (PR_FALSE==rowIsImplicit))
{ {
printf ("nsTableRow::AppendChild -- creating an implicit row.\n"); printf ("nsTableRow::AppendChild -- creating an implicit row.\n");
nsIAtom * trDefaultTag = NS_NewAtom(nsTablePart::kRowTagString); // trDefaultTag: REFCNT++ nsIAtom * trDefaultTag = NS_NewAtom(nsTablePart::kRowTagString); // trDefaultTag: REFCNT++
@@ -271,7 +224,6 @@ nsTableRowGroup::InsertChildAt (nsIContent *aContent, PRInt32 aIndex,
if (NS_OK==result) if (NS_OK==result)
{ {
((nsTableRow *)aContent)->SetRowGroup (this); ((nsTableRow *)aContent)->SetRowGroup (this);
ResetCellMap ();
} }
return result; return result;
@@ -304,7 +256,6 @@ nsTableRowGroup::ReplaceChildAt (nsIContent *aContent, PRInt32 aIndex,
((nsTableRow *)aContent)->SetRowGroup (this); ((nsTableRow *)aContent)->SetRowGroup (this);
if (nsnull != lastChild) if (nsnull != lastChild)
((nsTableRow *)lastChild)->SetRowGroup (nsnull); ((nsTableRow *)lastChild)->SetRowGroup (nsnull);
ResetCellMap ();
} }
NS_IF_RELEASE(lastChild); // lastChild: REFCNT-- NS_IF_RELEASE(lastChild); // lastChild: REFCNT--
return result; return result;
@@ -327,7 +278,6 @@ nsTableRowGroup::RemoveChildAt (PRInt32 aIndex, PRBool aNotify)
{ {
if (nsnull != lastChild) if (nsnull != lastChild)
((nsTableRow *)lastChild)->SetRowGroup (nsnull); ((nsTableRow *)lastChild)->SetRowGroup (nsnull);
ResetCellMap ();
} }
NS_IF_RELEASE(lastChild); // lastChild: REFCNT-- NS_IF_RELEASE(lastChild); // lastChild: REFCNT--
return result; return result;
@@ -381,9 +331,9 @@ NS_NewTableRowGroupPart(nsIHTMLContent** aInstancePtrResult,
if (nsnull == aInstancePtrResult) { if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
nsIHTMLContent* body = new nsTableRowGroup(aTag); nsIHTMLContent* content = new nsTableRowGroup(aTag);
if (nsnull == body) { if (nsnull == content) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
return body->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult); return content->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult);
} }

View File

@@ -55,10 +55,7 @@ public:
/** destructor, not responsible for any memory destruction itself */ /** destructor, not responsible for any memory destruction itself */
virtual ~nsTableRowGroup(); virtual ~nsTableRowGroup();
/** return the max of the number of columns represented by the contained rows */ // For debugging purposes only
virtual PRInt32 GetMaxColumns();
// For debugging purposes only
NS_IMETHOD_(nsrefcnt) AddRef(); NS_IMETHOD_(nsrefcnt) AddRef();
NS_IMETHOD_(nsrefcnt) Release(); NS_IMETHOD_(nsrefcnt) Release();
@@ -74,15 +71,9 @@ public:
nsIStyleContext* aStyleContext, nsIStyleContext* aStyleContext,
nsIFrame*& aResult); nsIFrame*& aResult);
/** return the number of contained rows */
int GetRowCount ();
/** returns nsITableContent::kTableRowGroupType */ /** returns nsITableContent::kTableRowGroupType */
int GetType(); int GetType();
/** notify the containing nsTablePart that cell information has changed */
virtual void ResetCellMap ();
/* ----------- overrides from nsTableContent ---------- */ /* ----------- overrides from nsTableContent ---------- */
/** can only append objects that are rows (implement nsITableContent and are . /** can only append objects that are rows (implement nsITableContent and are .
@@ -116,11 +107,6 @@ protected:
}; };
/** return the number of contained rows */
inline int nsTableRowGroup::GetRowCount ()
{
return ChildCount ();
}
/** returns nsITableContent::kTableRowGroupType */ /** returns nsITableContent::kTableRowGroupType */
inline int nsTableRowGroup::GetType() inline int nsTableRowGroup::GetType()

View File

@@ -236,6 +236,7 @@ CAPTION {
text-align: center; text-align: center;
display: table-caption; display: table-caption;
} }
TR { display: table-row;}
TBODY { display: table-row-group; } TBODY { display: table-row-group; }
THEAD { display: table-header-group; } THEAD { display: table-header-group; }
TFOOT { display: table-footer-group; } TFOOT { display: table-footer-group; }

View File

@@ -464,7 +464,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
// need to find the generic way to stamp out this content, and ::AppendChild it // need to find the generic way to stamp out this content, and ::AppendChild it
// this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid? // this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid?
// QQQ needs a ref count?
lastColGroup = new nsTableColGroup (PR_TRUE); lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not? // XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
@@ -629,7 +628,6 @@ void nsTableFrame::BuildCellMap ()
} }
if (gsDebug==PR_TRUE) if (gsDebug==PR_TRUE)
DumpCellMap (); DumpCellMap ();
//QQQ EnsureColumns();
} }
/** /**
@@ -810,7 +808,6 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
void nsTableFrame::RecalcLayoutData() void nsTableFrame::RecalcLayoutData()
{ {
//QQQ should we ensureCellMap here?
PRInt32 colCount = mCellMap->GetColCount(); PRInt32 colCount = mCellMap->GetColCount();
PRInt32 rowCount = mCellMap->GetRowCount(); PRInt32 rowCount = mCellMap->GetRowCount();
PRInt32 row = 0; PRInt32 row = 0;
@@ -1261,9 +1258,9 @@ nsReflowStatus nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext,
} }
} }
// BuildColumnCache calls EnsureCellMap. If that ever changes, be sure to call EnsureCellMap
// here first.
BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus); BuildColumnCache(aPresContext, aDesiredSize, aReflowState, aStatus);
EnsureCellMap();//QQQ have to determine where the right place for this is now that it's a frame-side operation
//QQQ cell map used to be forced before loop
// Recalculate Layout Dependencies // Recalculate Layout Dependencies
RecalcLayoutData(); RecalcLayoutData();