This commit is contained in:
buster 1998-06-17 19:51:51 +00:00
Родитель 927c39b448
Коммит 3d98654938
17 изменённых файлов: 40 добавлений и 206 удалений

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

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

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

@ -70,7 +70,7 @@ public:
/** returns PR_TRUE if there is an actual input tag corresponding to
* 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.
* for example, we don't generally want to output implicit tags when saving.

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

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

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

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

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

@ -37,11 +37,6 @@ static const PRBool gsDebug = PR_FALSE;
static const PRBool gsNoisyRefs = PR_FALSE;
#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)
: nsFrame(aContent, aParentFrame)
@ -133,17 +128,6 @@ nsTableCol::nsTableCol (PRBool aImplicit)
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()

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

@ -35,12 +35,6 @@ static const PRBool gsDebug = PR_FALSE;
static const PRBool gsNoisyRefs = PR_FALSE;
#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)
: nsTableContent(aTag),
@ -48,17 +42,6 @@ nsTableColGroup::nsTableColGroup(nsIAtom* aTag, int aSpan)
mStartColIndex(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)
@ -68,17 +51,6 @@ nsTableColGroup::nsTableColGroup (PRBool aImplicit)
mColCount(0)
{
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;
// SEC: TODO verify that aContent is table content
nsTableContent *tableContent = (nsTableContent *)aContent;
if (PR_FALSE==tableContent->IsImplicit())
PRBool isImplicit;
tableContent->IsSynthetic(isImplicit);
if (PR_FALSE==isImplicit)
{
/* if aContent is not implicit,
* 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);
NS_ASSERTION(nsnull!=col, "bad child");
if (PR_TRUE==col->IsImplicit())
PRBool colIsImplicit;
col->IsSynthetic(colIsImplicit);
if (PR_TRUE==colIsImplicit)
{
ReplaceChildAt(aContent, colIndex, aNotify);
contentHandled = PR_TRUE;

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

@ -130,9 +130,10 @@ void nsTableContent::SetTable (nsTablePart *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 = "";
if (PR_TRUE==IsImplicit())
if (PR_TRUE==mImplicit)
isImplicitString = " (I)";
ListAttributes(out);

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

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

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

@ -464,7 +464,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
// 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?
// QQQ needs a ref count?
lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
@ -629,7 +628,6 @@ void nsTableFrame::BuildCellMap ()
}
if (gsDebug==PR_TRUE)
DumpCellMap ();
//QQQ EnsureColumns();
}
/**
@ -810,7 +808,6 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
void nsTableFrame::RecalcLayoutData()
{
//QQQ should we ensureCellMap here?
PRInt32 colCount = mCellMap->GetColCount();
PRInt32 rowCount = mCellMap->GetRowCount();
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);
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
RecalcLayoutData();

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

@ -112,22 +112,10 @@ const char *nsTablePart::kHeaderCellTagString="TH";
* I do not check or addref aTag because my superclass does that for me
*/
nsTablePart::nsTablePart(nsIAtom* aTag)
: nsHTMLContainer(aTag),
mColCount(0),
mSpecifiedColCount(0)
: nsHTMLContainer(aTag)
{
}
/** 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()
@ -161,13 +149,6 @@ nsrefcnt nsTablePart::Release(void)
return mRefCnt;
}
/** assumes that mColCount has been set */
///QQQQQ can be removed?
PRInt32 nsTablePart::GetMaxColumns ()
{
return mColCount;
}
/** add a child to the table content.
* 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,
@ -229,7 +210,10 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
}
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");
nsIAtom * rowGroupTag = NS_NewAtom(kRowGroupBodyTagString); // rowGroupTag: REFCNT++
@ -285,7 +269,10 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
caption = (nsTableCaption *)content;
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");
caption = new nsTableCaption (PR_TRUE);
@ -535,7 +522,10 @@ PRBool nsTablePart::AppendColumn(nsTableCol *aContent)
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)
printf ("nsTablePart::AppendChild -- creating an implicit column group.\n");

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

@ -98,13 +98,6 @@ public:
virtual void MapAttributesInto(nsIStyleContext* aContext,
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 */
@ -152,8 +145,6 @@ protected:
private:
PRInt32 mColCount;
PRInt32 mSpecifiedColCount;
static nsIAtom *kDefaultTag;
};

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

@ -110,25 +110,6 @@ nsrefcnt nsTableRow::Release(void)
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
nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
@ -150,7 +131,6 @@ nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
if (NS_OK == rv)
{
((nsTableCell *)aContent)->SetRow (this);
ResetCellMap ();
}
}
}
@ -177,7 +157,6 @@ nsTableRow::InsertChildAt (nsIContent *aContent, PRInt32 aIndex,
if (NS_OK == rv)
{
((nsTableCell *)aContent)->SetRow (this);
ResetCellMap ();
}
}
}
@ -216,7 +195,6 @@ nsTableRow::ReplaceChildAt (nsIContent *aContent, PRInt32 aIndex,
((nsTableCell *)aContent)->SetRow (this);
if (nsnull!=oldChild)
((nsTableCell *)oldChild)->SetRow (nsnull);
ResetCellMap ();
}
NS_IF_RELEASE(oldChild); // oldChild: REFCNT--
#endif
@ -244,7 +222,6 @@ nsTableRow::RemoveChildAt (int aIndex, PRBool aNotify)
{
if (nsnull != oldChild)
((nsTableCell *)oldChild)->SetRow (nsnull);
ResetCellMap ();
}
}
NS_IF_RELEASE(oldChild); // oldChild: REFCNT--

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

@ -98,11 +98,6 @@ public:
/** set this row's starting row index */
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 ----------- */

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

@ -43,27 +43,10 @@ static const PRBool gsNoisyRefs = PR_FALSE;
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_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
nsTableRowGroup::nsTableRowGroup(nsIAtom* 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
@ -71,39 +54,12 @@ nsTableRowGroup::nsTableRowGroup(nsIAtom* aTag, PRBool aImplicit)
: nsTableContent(aTag)
{
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()
{
}
/** 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
nsrefcnt nsTableRowGroup::AddRef(void)
{
@ -186,11 +142,6 @@ nsTableRowGroup::CreateFrame(nsIPresContext* aPresContext,
return rv;
}
void nsTableRowGroup::ResetCellMap ()
{
}
NS_IMETHODIMP
nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
{
@ -210,7 +161,6 @@ nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
{
((nsTableRow *)aContent)->SetRowGroup (this);
// make sure the table cell map gets rebuilt
ResetCellMap ();
}
}
// 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--
}
}
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");
nsIAtom * trDefaultTag = NS_NewAtom(nsTablePart::kRowTagString); // trDefaultTag: REFCNT++
@ -271,7 +224,6 @@ nsTableRowGroup::InsertChildAt (nsIContent *aContent, PRInt32 aIndex,
if (NS_OK==result)
{
((nsTableRow *)aContent)->SetRowGroup (this);
ResetCellMap ();
}
return result;
@ -304,7 +256,6 @@ nsTableRowGroup::ReplaceChildAt (nsIContent *aContent, PRInt32 aIndex,
((nsTableRow *)aContent)->SetRowGroup (this);
if (nsnull != lastChild)
((nsTableRow *)lastChild)->SetRowGroup (nsnull);
ResetCellMap ();
}
NS_IF_RELEASE(lastChild); // lastChild: REFCNT--
return result;
@ -327,7 +278,6 @@ nsTableRowGroup::RemoveChildAt (PRInt32 aIndex, PRBool aNotify)
{
if (nsnull != lastChild)
((nsTableRow *)lastChild)->SetRowGroup (nsnull);
ResetCellMap ();
}
NS_IF_RELEASE(lastChild); // lastChild: REFCNT--
return result;
@ -381,9 +331,9 @@ NS_NewTableRowGroupPart(nsIHTMLContent** aInstancePtrResult,
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* body = new nsTableRowGroup(aTag);
if (nsnull == body) {
nsIHTMLContent* content = new nsTableRowGroup(aTag);
if (nsnull == content) {
return NS_ERROR_OUT_OF_MEMORY;
}
return body->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult);
return content->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult);
}

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

@ -55,10 +55,7 @@ public:
/** destructor, not responsible for any memory destruction itself */
virtual ~nsTableRowGroup();
/** return the max of the number of columns represented by the contained rows */
virtual PRInt32 GetMaxColumns();
// For debugging purposes only
// For debugging purposes only
NS_IMETHOD_(nsrefcnt) AddRef();
NS_IMETHOD_(nsrefcnt) Release();
@ -74,15 +71,9 @@ public:
nsIStyleContext* aStyleContext,
nsIFrame*& aResult);
/** return the number of contained rows */
int GetRowCount ();
/** returns nsITableContent::kTableRowGroupType */
int GetType();
/** notify the containing nsTablePart that cell information has changed */
virtual void ResetCellMap ();
/* ----------- overrides from nsTableContent ---------- */
/** 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 */
inline int nsTableRowGroup::GetType()

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

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

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

@ -464,7 +464,6 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
// 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?
// QQQ needs a ref count?
lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
@ -629,7 +628,6 @@ void nsTableFrame::BuildCellMap ()
}
if (gsDebug==PR_TRUE)
DumpCellMap ();
//QQQ EnsureColumns();
}
/**
@ -810,7 +808,6 @@ void nsTableFrame::AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTable
void nsTableFrame::RecalcLayoutData()
{
//QQQ should we ensureCellMap here?
PRInt32 colCount = mCellMap->GetColCount();
PRInt32 rowCount = mCellMap->GetRowCount();
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);
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
RecalcLayoutData();