Modifying nsIContent's AppendChild -> AppendChildTo to stop conflict with

DOM interfaces.
This commit is contained in:
joki%netscape.com 1998-08-21 21:38:26 +00:00
Родитель 47a542760e
Коммит 46137420c0
36 изменённых файлов: 187 добавлений и 120 удалений

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

@ -79,7 +79,7 @@ public:
PRInt32 aIndex,
PRBool aNotify) = 0;
NS_IMETHOD AppendChild(nsIContent* aKid,
NS_IMETHOD AppendChildTo(nsIContent* aKid,
PRBool aNotify) = 0;
NS_IMETHOD RemoveChildAt(PRInt32 aIndex,

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

@ -812,6 +812,13 @@ nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
// XXX TBI
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::CloneNode(nsIDOMNode** aReturn)
{

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

@ -227,6 +227,7 @@ public:
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
NS_IMETHOD CloneNode(nsIDOMNode** aReturn);
NS_IMETHOD Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn);

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

@ -424,7 +424,7 @@ HTMLContentSink::SetTitle(const nsString& aValue)
nsIHTMLContent* it = nsnull;
nsresult rv = NS_NewHTMLTitle(&it, atom, aValue);
if (NS_OK == rv) {
mHead->AppendChild(it, PR_FALSE);
mHead->AppendChildTo(it, PR_FALSE);
NS_RELEASE(it);
}
NS_RELEASE(atom);
@ -474,7 +474,7 @@ NS_ASSERTION(nsnull == mBody, "yikes");
// This is done here instead of earlier because we need the
// attributes from the real body tag before we initiate reflow.
mRoot->AppendChild(mBody, PR_FALSE);
mRoot->AppendChildTo(mBody, PR_FALSE);
StartLayout();
}
@ -639,7 +639,7 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
{
FlushText();
mRoot->AppendChild(mFrameset, PR_TRUE);
mRoot->AppendChildTo(mFrameset, PR_TRUE);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseFrameset", aNode);
@ -978,7 +978,7 @@ HTMLContentSink::WillBuildModel(void)
if (NS_OK != rv) {
return rv;
}
mRoot->AppendChild(mHead, PR_FALSE);
mRoot->AppendChildTo(mHead, PR_FALSE);
// Notify document that the load is beginning
mDocument->BeginLoad();
@ -1499,7 +1499,7 @@ HTMLContentSink::AppendToCorrectParent(nsHTMLTag aParentTag,
break;
}
realParent->AppendChild(aChild, aAllowReflow);
realParent->AppendChildTo(aChild, aAllowReflow);
if (aAllowReflow) {
// ScrollToRef();
}
@ -1704,7 +1704,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
rv = NS_NewHTMLMeta(&it, atom) ;
if (NS_OK == rv) {
rv = AddAttributes(aNode, it);
mHead->AppendChild(it, PR_FALSE);
mHead->AppendChildTo(it, PR_FALSE);
// Handle the Refresh Case. We could also handle
// the other http-equiv cases here such as "Content-type".

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

@ -233,9 +233,9 @@ nsImageDocument::CreateSyntheticDocument()
image->SetAttribute(nsHTMLAtoms::src, val);
image->SetAttribute(nsHTMLAtoms::alt, val);
root->AppendChild(body, PR_FALSE);
center->AppendChild(image, PR_FALSE);
body->AppendChild(center, PR_FALSE);
root->AppendChildTo(body, PR_FALSE);
center->AppendChildTo(image, PR_FALSE);
body->AppendChildTo(center, PR_FALSE);
NS_RELEASE(image);
NS_RELEASE(center);

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

@ -79,7 +79,7 @@ public:
PRInt32 aIndex,
PRBool aNotify) = 0;
NS_IMETHOD AppendChild(nsIContent* aKid,
NS_IMETHOD AppendChildTo(nsIContent* aKid,
PRBool aNotify) = 0;
NS_IMETHOD RemoveChildAt(PRInt32 aIndex,

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

@ -812,6 +812,13 @@ nsDocument::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
// XXX TBI
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::CloneNode(nsIDOMNode** aReturn)
{

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

@ -227,6 +227,7 @@ public:
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
NS_IMETHOD CloneNode(nsIDOMNode** aReturn);
NS_IMETHOD Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn);

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

@ -66,7 +66,7 @@ public:
PRBool aNotify) { return NS_OK; }
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
PRBool aNotify){ return NS_OK; }
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify) {return NS_OK;}
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) {return NS_OK;}
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {return NS_OK;}
NS_IMETHOD IsSynthetic(PRBool& aResult) {

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

@ -211,6 +211,12 @@ nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMAttribute::CloneNode(nsIDOMNode** aReturn)
{

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

@ -58,6 +58,7 @@ public:
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
NS_IMETHOD CloneNode(nsIDOMNode** aReturn);
NS_IMETHOD Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn);

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

@ -184,7 +184,7 @@ nsHTMLContainer::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
}
NS_IMETHODIMP
nsHTMLContainer::AppendChild(nsIContent* aKid, PRBool aNotify)
nsHTMLContainer::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
NS_PRECONDITION((nsnull != aKid) && (aKid != this), "null ptr");
PRBool rv = mChildren.AppendElement(aKid);
@ -998,7 +998,7 @@ nsHTMLContainer::InsertBefore(nsIDOMNode* aNewChild,
if (nsnull == aRefChild) {
// Append the new child to the end
SetDocumentInChildrenOf(newContent, mDocument);
res = AppendChild(newContent, PR_TRUE);
res = AppendChildTo(newContent, PR_TRUE);
}
else {
// Get the index of where to insert the new child
@ -1075,3 +1075,9 @@ nsHTMLContainer::RemoveChild(nsIDOMNode* aOldChild,
return res;
}
NS_IMETHODIMP
nsHTMLContainer::AppendChild(nsIDOMNode* aNewChild,
nsIDOMNode** aReturn)
{
return InsertBefore(aNewChild, nsnull, aReturn);
}

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

@ -36,7 +36,7 @@ public:
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
virtual void Compact();
@ -62,6 +62,8 @@ public:
nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild,
nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild,
nsIDOMNode** aReturn);
protected:
nsHTMLContainer();

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

@ -271,7 +271,7 @@ nsHTMLContent::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify)
}
NS_IMETHODIMP
nsHTMLContent::AppendChild(nsIContent* aKid, PRBool aNotify)
nsHTMLContent::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
return NS_OK;
}
@ -588,6 +588,12 @@ nsHTMLContent::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsHTMLContent::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return NS_ERROR_FAILURE;
}
nsresult nsHTMLContent::GetListenerManager(nsIEventListenerManager **aInstancePtrResult)
{
if (nsnull != mListenerManager) {

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

@ -70,7 +70,7 @@ public:
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD IsSynthetic(PRBool& aResult);
@ -133,6 +133,7 @@ public:
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListener(nsIDOMEventListener *aListener, const nsIID& aIID);

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

@ -852,6 +852,12 @@ nsHTMLTagContent::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return nsHTMLContent::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP
nsHTMLTagContent::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return nsHTMLContent::AppendChild(aNewChild, aReturn);
}
//
// Implementation of nsIDOMElement interface

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

@ -277,6 +277,7 @@ public:
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
// nsIDOMData interface
NS_IMETHOD GetData(nsString& aData);
@ -2071,6 +2072,12 @@ Text::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
return nsHTMLContent::RemoveChild(aOldChild, aReturn);
}
NS_IMETHODIMP
Text::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return nsHTMLContent::AppendChild(aNewChild, aReturn);
}
//
// nsIDOMData interface
//

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

@ -424,7 +424,7 @@ HTMLContentSink::SetTitle(const nsString& aValue)
nsIHTMLContent* it = nsnull;
nsresult rv = NS_NewHTMLTitle(&it, atom, aValue);
if (NS_OK == rv) {
mHead->AppendChild(it, PR_FALSE);
mHead->AppendChildTo(it, PR_FALSE);
NS_RELEASE(it);
}
NS_RELEASE(atom);
@ -474,7 +474,7 @@ NS_ASSERTION(nsnull == mBody, "yikes");
// This is done here instead of earlier because we need the
// attributes from the real body tag before we initiate reflow.
mRoot->AppendChild(mBody, PR_FALSE);
mRoot->AppendChildTo(mBody, PR_FALSE);
StartLayout();
}
@ -639,7 +639,7 @@ HTMLContentSink::CloseFrameset(const nsIParserNode& aNode)
{
FlushText();
mRoot->AppendChild(mFrameset, PR_TRUE);
mRoot->AppendChildTo(mFrameset, PR_TRUE);
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"HTMLContentSink::CloseFrameset", aNode);
@ -978,7 +978,7 @@ HTMLContentSink::WillBuildModel(void)
if (NS_OK != rv) {
return rv;
}
mRoot->AppendChild(mHead, PR_FALSE);
mRoot->AppendChildTo(mHead, PR_FALSE);
// Notify document that the load is beginning
mDocument->BeginLoad();
@ -1499,7 +1499,7 @@ HTMLContentSink::AppendToCorrectParent(nsHTMLTag aParentTag,
break;
}
realParent->AppendChild(aChild, aAllowReflow);
realParent->AppendChildTo(aChild, aAllowReflow);
if (aAllowReflow) {
// ScrollToRef();
}
@ -1704,7 +1704,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
rv = NS_NewHTMLMeta(&it, atom) ;
if (NS_OK == rv) {
rv = AddAttributes(aNode, it);
mHead->AppendChild(it, PR_FALSE);
mHead->AppendChildTo(it, PR_FALSE);
// Handle the Refresh Case. We could also handle
// the other http-equiv cases here such as "Content-type".

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

@ -233,9 +233,9 @@ nsImageDocument::CreateSyntheticDocument()
image->SetAttribute(nsHTMLAtoms::src, val);
image->SetAttribute(nsHTMLAtoms::alt, val);
root->AppendChild(body, PR_FALSE);
center->AppendChild(image, PR_FALSE);
body->AppendChild(center, PR_FALSE);
root->AppendChildTo(body, PR_FALSE);
center->AppendChildTo(image, PR_FALSE);
body->AppendChildTo(center, PR_FALSE);
NS_RELEASE(image);
NS_RELEASE(center);

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

@ -36,10 +36,12 @@
#include "nsHTMLForms.h"
#include "nsStyleConsts.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsITextWidget.h"
#define ALIGN_UNSET PRUint8(-1)
static NS_DEFINE_IID(kSupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID);
// Note: we inherit a base class operator new that zeros our memory
nsInput::nsInput(nsIAtom* aTag, nsIFormManager* aManager)
@ -733,22 +735,36 @@ nsInput::SetValue(const nsString& aValue)
NS_IMETHODIMP
nsInput::Blur()
{
//XXX TBI
return NS_ERROR_NOT_IMPLEMENTED;
if (nsnull != mWidget) {
nsIWidget *mParentWidget = mWidget->GetParent();
if (nsnull != mParentWidget) {
mParentWidget->SetFocus();
NS_RELEASE(mParentWidget);
}
}
return NS_OK;
}
NS_IMETHODIMP
nsInput::Focus()
{
//XXX TBI
return NS_ERROR_NOT_IMPLEMENTED;
if (nsnull != mWidget) {
mWidget->SetFocus();
}
return NS_OK;
}
NS_IMETHODIMP
nsInput::Select()
{
//XXX TBI
return NS_ERROR_NOT_IMPLEMENTED;
if (nsnull != mWidget) {
nsITextWidget *mTextWidget;
if (NS_OK == mWidget->QueryInterface(kITextWidgetIID, (void**)&mTextWidget)) {
mTextWidget->SelectAll();
NS_RELEASE(mTextWidget);
}
}
return NS_OK;
}
NS_IMETHODIMP

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

@ -799,7 +799,7 @@ void HACK(nsSelect* aSel, PRInt32 aIndex)
sprintf(&buf[0], "option %d", i);
nsString label(&buf[0]);
option->SetContent(label);
aSel->AppendChild(option, PR_FALSE);
aSel->AppendChildTo(option, PR_FALSE);
}
}

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

@ -116,7 +116,7 @@ void nsTableColGroup::ResetColumns ()
}
NS_IMETHODIMP
nsTableColGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
nsTableColGroup::AppendChildTo (nsIContent *aContent, PRBool aNotify)
{
NS_ASSERTION(nsnull!=aContent, "bad arg");
@ -157,7 +157,7 @@ nsTableColGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
}
}
if (PR_FALSE==contentHandled)
result = nsTableContent::AppendChild (aContent, aNotify);
result = nsTableContent::AppendChildTo (aContent, aNotify);
if (NS_OK==result)
{
((nsTableCol *)aContent)->SetColGroup (this);

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

@ -122,9 +122,9 @@ public:
/** can only append objects that are columns (implement nsITableContent and are .
* of type nsITableContent::kTableColType.)
* @see nsIContent::AppendChild
* @see nsIContent::AppendChildTo
*/
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
/** can only insert objects that are columns (implement nsITableContent and are .
* of type nsITableContent::kTableColType.)

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

@ -215,9 +215,9 @@ nsTableContent::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify)
}
NS_IMETHODIMP
nsTableContent::AppendChild(nsIContent* aKid, PRBool aNotify)
nsTableContent::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv = nsHTMLContainer::AppendChild(aKid, aNotify);
nsresult rv = nsHTMLContainer::AppendChildTo(aKid, aNotify);
if (NS_OK == rv)
SetTableForTableContent(aKid,mTable);
return rv;

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

@ -29,7 +29,7 @@
* within a table.
*
* @author sclark
* @version $Revision: 3.6 $
* @version $Revision: 3.7 $
* @see
*/
class nsTableContent : public nsHTMLContainer, public nsITableContent
@ -100,7 +100,7 @@ public:
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);

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

@ -571,12 +571,12 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
if (nsnull==lastColGroupFrame)
{
//QQQ
// 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 ::AppendChildTo it
// this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid?
lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
// XXX: how do I know whether AppendChildTo should notify or not?
mContent->AppendChildTo(lastColGroup, PR_FALSE); // was AppendColGroup
NS_ADDREF(lastColGroup); // ADDREF a: lastColGroup++
// Resolve style for the child
nsIStyleContext* colGroupStyleContext =
@ -617,9 +617,9 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
PRInt32 excessColumns = GetColCount() - actualColumns;
for ( ; excessColumns > 0; excessColumns--)
{//QQQ
// 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 ::AppendChildTo it
nsTableCol *col = new nsTableCol(PR_TRUE);
lastColGroup->AppendChild (col, PR_FALSE);
lastColGroup->AppendChildTo (col, PR_FALSE);
}
NS_RELEASE(lastColGroup); // ADDREF: lastColGroup--
lastColGroupFrame->Reflow(*aPresContext, aDesiredSize, aReflowState, aStatus);

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

@ -163,7 +163,7 @@ nsrefcnt nsTablePart::Release(void)
*
*/
NS_IMETHODIMP
nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
nsTablePart::AppendChildTo (nsIContent * aContent, PRBool aNotify)
{
NS_PRECONDITION(nsnull!=aContent, "bad arg");
PRBool contentHandled = PR_FALSE;
@ -188,9 +188,9 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
if (gsDebug==PR_TRUE)
{
if (contentType == nsITableContent::kTableRowType)
printf ("nsTablePart::AppendChild -- adding a row.\n");
printf ("nsTablePart::AppendChildTo -- adding a row.\n");
else
printf ("nsTablePart::AppendChild -- adding a cell.\n");
printf ("nsTablePart::AppendChildTo -- adding a cell.\n");
}
// find last row group, if ! implicit, make one, append there
nsTableRowGroup *group = nsnull;
@ -215,17 +215,17 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
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::AppendChildTo -- creating an implicit row group.\n");
nsIAtom * rowGroupTag = NS_NewAtom(kRowGroupBodyTagString); // rowGroupTag: REFCNT++
group = new nsTableRowGroup (rowGroupTag, PR_TRUE);
NS_ADDREF(group); // group: REFCNT++
rv = AppendChild (group, PR_FALSE);
rv = AppendChildTo (group, PR_FALSE);
if (NS_OK==rv)
group->SetTable(this);
NS_RELEASE(rowGroupTag); // rowGroupTag: REFCNT--
}
// group is guaranteed to be allocated at this point
rv = group->AppendChild(aContent, PR_FALSE);
rv = group->AppendChildTo(aContent, PR_FALSE);
contentHandled = PR_TRUE;
NS_RELEASE(group); // group: REFCNT--
}
@ -259,7 +259,7 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
// SEC the logic here is very suspicious!!!!
if (PR_FALSE==contentHandled)
{
if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChild -- content not handled!!!\n");
if (gsDebug==PR_TRUE) printf ("nsTablePart::AppendChildTo -- content not handled!!!\n");
nsTableCaption *caption = nsnull;
nsIContent *lastChild = ChildAt (ChildCount() - 1); // lastChild: REFCNT++
if (nsnull != lastChild)
@ -274,12 +274,12 @@ nsTablePart::AppendChild (nsIContent * aContent, PRBool aNotify)
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::AppendChildTo -- adding an implicit caption.\n");
caption = new nsTableCaption (PR_TRUE);
result = AppendCaption (caption);
// check result
}
result = caption->AppendChild (aContent, PR_FALSE);
result = caption->AppendChildTo (aContent, PR_FALSE);
}
}
NS_RELEASE(tableContentInterface); // tableContentInterface: REFCNT--
@ -489,7 +489,7 @@ PRBool nsTablePart::AppendColGroup(nsTableColGroup *aContent)
for (PRInt32 i=0; i<span; i++)
{
nsTableCol *col = new nsTableCol(PR_TRUE);
rv = aContent->AppendChild (col, PR_FALSE);
rv = aContent->AppendChildTo (col, PR_FALSE);
if (NS_OK!=rv)
{
result = PR_FALSE;
@ -528,14 +528,14 @@ PRBool nsTablePart::AppendColumn(nsTableCol *aContent)
if ((PR_FALSE == foundColGroup) || (PR_FALSE==groupIsImplicit))
{
if (gsDebug==PR_TRUE)
printf ("nsTablePart::AppendChild -- creating an implicit column group.\n");
printf ("nsTablePart::AppendChildTo -- creating an implicit column group.\n");
group = new nsTableColGroup (PR_TRUE);
rv = AppendChild (group, PR_FALSE);
rv = AppendChildTo (group, PR_FALSE);
if (NS_OK==rv)
group->SetTable(this);
}
if (NS_OK==rv)
rv = group->AppendChild (aContent, PR_FALSE);
rv = group->AppendChildTo (aContent, PR_FALSE);
return (PRBool)(NS_OK==rv);
}

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

@ -79,7 +79,7 @@ public:
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
virtual nsresult CreateFrame(nsIPresContext* aPresContext,

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

@ -111,7 +111,7 @@ nsrefcnt nsTableRow::Release(void)
NS_IMETHODIMP
nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
nsTableRow::AppendChildTo (nsIContent *aContent, PRBool aNotify)
{
NS_PRECONDITION(nsnull != aContent, "null ptr");
nsresult rv = NS_OK;
@ -119,14 +119,14 @@ nsTableRow::AppendChild (nsIContent *aContent, PRBool aNotify)
{
if (!IsTableCell(aContent))
{
if (gsDebug==PR_TRUE) printf ("nsTableRow::AppendChild -- didn't get a cell, giving up to parent.\n");
if (gsDebug==PR_TRUE) printf ("nsTableRow::AppendChildTo -- didn't get a cell, giving up to parent.\n");
if (nsnull != mRowGroup)
return mRowGroup->AppendChild (aContent, aNotify); // let parent have it
return mRowGroup->AppendChildTo (aContent, aNotify); // let parent have it
return PR_FALSE;
}
else
{
rv = nsTableContent::AppendChild (aContent, aNotify);
rv = nsTableContent::AppendChildTo (aContent, aNotify);
if (NS_OK == rv)
{
((nsTableCell *)aContent)->SetRow (this);

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

@ -103,9 +103,9 @@ public:
/** can only append objects that are cells (implement nsITableContent and are .
* of type nsITableContent::kTableCellType.)
* @see nsIContent::AppendChild
* @see nsIContent::AppendChildTo
*/
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
/** can only insert objects that are cells (implement nsITableContent and are .
* of type nsITableContent::kTableCellType.)

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

@ -143,9 +143,9 @@ nsTableRowGroup::CreateFrame(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
nsTableRowGroup::AppendChildTo (nsIContent *aContent, PRBool aNotify)
{
NS_PRECONDITION(nsnull!=aContent, "bad arg to AppendChild");
NS_PRECONDITION(nsnull!=aContent, "bad arg to AppendChildTo");
nsresult result = NS_OK;
// is aContent a TableRow?
@ -154,9 +154,9 @@ nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
// if so, simply add it
if (PR_TRUE==isRow)
{
if (gsDebug==PR_TRUE) printf ("nsTableRowGroup::AppendChild -- inserting a row into this row group.\n");
if (gsDebug==PR_TRUE) printf ("nsTableRowGroup::AppendChildTo -- inserting a row into this row group.\n");
// if it is, we'll add it here
result = nsTableContent::AppendChild (aContent, PR_FALSE);
result = nsTableContent::AppendChildTo (aContent, PR_FALSE);
if (NS_OK==result)
{
((nsTableRow *)aContent)->SetRowGroup (this);
@ -184,15 +184,15 @@ nsTableRowGroup::AppendChild (nsIContent *aContent, PRBool aNotify)
row->IsSynthetic(rowIsImplicit);
if ((nsnull == row) || (PR_FALSE==rowIsImplicit))
{
printf ("nsTableRow::AppendChild -- creating an implicit row.\n");
printf ("nsTableRow::AppendChildTo -- creating an implicit row.\n");
nsIAtom * trDefaultTag = NS_NewAtom(nsTablePart::kRowTagString); // trDefaultTag: REFCNT++
row = new nsTableRow (trDefaultTag, PR_TRUE);
NS_RELEASE(trDefaultTag); // trDefaultTag: REFCNT--
result = AppendChild (row, PR_FALSE);
result = AppendChildTo (row, PR_FALSE);
// SEC: check result
}
// group is guaranteed to be allocated at this point
result = row->AppendChild(aContent, PR_FALSE);
result = row->AppendChildTo(aContent, PR_FALSE);
}
// otherwise, punt and let the table try to insert it. Or maybe just return a failure?
else

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

@ -78,9 +78,9 @@ public:
/** can only append objects that are rows (implement nsITableContent and are .
* of type nsITableContent::kTableRowType.)
* @see nsIContent::AppendChild
* @see nsIContent::AppendChildTo
*/
NS_IMETHOD AppendChild(nsIContent* aKid, PRBool aNotify);
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
/** can only insert objects that are rows (implement nsITableContent and are .
* of type nsITableContent::kTableRowType.)

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

@ -258,7 +258,7 @@ int main(int argc, char** argv)
NS_ASSERTION(container->CanContainChildren(),"");
container->SetDocument(myDoc);
container->AppendChild(text, PR_FALSE);
container->AppendChildTo(text, PR_FALSE);
if (container->ChildCount() != 1) {
printf("Container has wrong number of children.");
}

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

@ -273,9 +273,9 @@ TestReflowUnmapped(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Append three fixed width elements.
b->AppendChild(new FixedSizeContent(100, 100));
b->AppendChild(new FixedSizeContent(300, 300));
b->AppendChild(new FixedSizeContent(200, 200));
b->AppendChildTo(new FixedSizeContent(100, 100));
b->AppendChildTo(new FixedSizeContent(300, 300));
b->AppendChildTo(new FixedSizeContent(200, 200));
// Create an inline frame for the HTML container and set its
// style context
@ -368,7 +368,7 @@ TestChildrenThatDontFit(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Add one fixed width element.
b->AppendChild(new FixedSizeContent(100, 100));
b->AppendChildTo(new FixedSizeContent(100, 100));
// Create an inline frame for the HTML container and set its
// style context
@ -404,8 +404,8 @@ TestChildrenThatDontFit(nsIPresContext* presContext)
// Test #1b
// Append two more fixed width elements.
b->AppendChild(new FixedSizeContent(300, 300));
b->AppendChild(new FixedSizeContent(200, 200));
b->AppendChildTo(new FixedSizeContent(300, 300));
b->AppendChildTo(new FixedSizeContent(200, 200));
// Create a new inline frame for the HTML container
InlineFrame* f1 = new InlineFrame(b, 0, nsnull);
@ -538,9 +538,9 @@ TestOverflow(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Append three fixed width elements.
b->AppendChild(new FixedSizeContent(100, 100));
b->AppendChild(new FixedSizeContent(300, 300));
b->AppendChild(new FixedSizeContent(200, 200));
b->AppendChildTo(new FixedSizeContent(100, 100));
b->AppendChildTo(new FixedSizeContent(300, 300));
b->AppendChildTo(new FixedSizeContent(200, 200));
// Create an inline frame for the HTML container and set its
// style context
@ -650,9 +650,9 @@ TestPushingPulling(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Append three fixed width elements.
b->AppendChild(new FixedSizeContent(100, 100));
b->AppendChild(new FixedSizeContent(300, 300));
b->AppendChild(new FixedSizeContent(200, 200));
b->AppendChildTo(new FixedSizeContent(100, 100));
b->AppendChildTo(new FixedSizeContent(300, 300));
b->AppendChildTo(new FixedSizeContent(200, 200));
// Create an inline frame for the HTML container and set its
// style context
@ -1071,9 +1071,9 @@ TestSplittableChildren(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Append three fixed width elements that can split
b->AppendChild(new FixedSizeContent(100, 100, PR_TRUE));
b->AppendChild(new FixedSizeContent(300, 300, PR_TRUE));
b->AppendChild(new FixedSizeContent(200, 200, PR_TRUE));
b->AppendChildTo(new FixedSizeContent(100, 100, PR_TRUE));
b->AppendChildTo(new FixedSizeContent(300, 300, PR_TRUE));
b->AppendChildTo(new FixedSizeContent(200, 200, PR_TRUE));
// Create an inline frame for the HTML container and set its
// style context
@ -1430,9 +1430,9 @@ TestMaxElementSize(nsIPresContext* presContext)
NS_NewHTMLContainer(&b, NS_NewAtom("SPAN"));
// Append three fixed width elements.
b->AppendChild(new FixedSizeContent(100, 100));
b->AppendChild(new FixedSizeContent(300, 300));
b->AppendChild(new FixedSizeContent(200, 200));
b->AppendChildTo(new FixedSizeContent(100, 100));
b->AppendChildTo(new FixedSizeContent(300, 300));
b->AppendChildTo(new FixedSizeContent(200, 200));
// Create an inline frame for the HTML container and set its
// style context

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

@ -146,10 +146,10 @@ nsresult BasicTest::AppendSimpleSpan(nsIContent* aContainer, const char* aTag, c
tmp.Append(aText);
rv = NS_NewHTMLText(&text, tmp.GetUnicode(), tmp.Length());
if (NS_OK == rv) {
span->AppendChild(text);
span->AppendChildTo(text);
NS_RELEASE(text);
}
aContainer->AppendChild(span);
aContainer->AppendChildTo(span);
NS_RELEASE(span);
}
NS_RELEASE(atom);
@ -197,18 +197,18 @@ void BasicTest::CreateCorrectContent(int aRows, int aCols)
if (NS_OK == rv) {
rv = AppendSimpleSpan (cell, "P", "test");
}
row->AppendChild(cell);
row->AppendChildTo(cell);
NS_RELEASE(cell);
}
table->AppendChild(row);
table->AppendChildTo(row);
NS_RELEASE(row);
}
}
((nsTablePart *)table)->GetMaxColumns(); // has important side effect of creating pseudo-columns
body->AppendChild(table);
body->AppendChildTo(table);
NS_RELEASE(table);
}
root->AppendChild(body);
root->AppendChildTo(body);
NS_RELEASE(body);
}
@ -246,20 +246,20 @@ void BasicTest::CreateCorrectFullContent(int aRows, int aCols)
nsIAtom* captionAtom = NS_NewAtom("CAPTION");
rv = NS_NewTableCaptionPart(&caption, captionAtom);
NS_RELEASE(captionAtom);
table->AppendChild(caption);
table->AppendChildTo(caption);
// add column group
PRInt32 colIndex;
nsIAtom* colGroupAtom = NS_NewAtom("COLGROUP");
rv = NS_NewTableColGroupPart(&colGroup, colGroupAtom);
NS_RELEASE(colGroupAtom);
table->AppendChild(colGroup);
table->AppendChildTo(colGroup);
// add columns
nsIAtom* colAtom = NS_NewAtom("COL");
for (colIndex = 0; (NS_OK == rv) && (colIndex < aCols); colIndex++) {
rv = NS_NewTableColPart(&col, colAtom);
colGroup->AppendChild(col);
colGroup->AppendChildTo(col);
}
NS_RELEASE(colAtom);
@ -278,17 +278,17 @@ void BasicTest::CreateCorrectFullContent(int aRows, int aCols)
if (NS_OK == rv) {
rv = AppendSimpleSpan (cell, "P", "test");
}
row->AppendChild(cell);
row->AppendChildTo(cell);
NS_RELEASE(cell);
}
table->AppendChild(row);
table->AppendChildTo(row);
NS_RELEASE(row);
}
}
body->AppendChild(table);
body->AppendChildTo(table);
NS_RELEASE(table);
}
root->AppendChild(body);
root->AppendChildTo(body);
NS_RELEASE(body);
}
@ -338,7 +338,7 @@ void BasicTest::CreateOutOfOrderContent(int aRows, int aCols)
if (NS_OK == rv) {
rv = AppendSimpleSpan (cell, "P", "test");
}
row->AppendChild(cell);
row->AppendChildTo(cell);
NS_RELEASE(cell);
if (1==rowIndex && 0==colIndex)
{
@ -347,29 +347,29 @@ void BasicTest::CreateOutOfOrderContent(int aRows, int aCols)
nsIAtom* colGroupAtom = NS_NewAtom("COLGROUP");
rv = NS_NewTableColGroupPart(&colGroup, colGroupAtom);
NS_RELEASE(colGroupAtom);
table->AppendChild(colGroup);
table->AppendChildTo(colGroup);
}
}
table->AppendChild(row);
table->AppendChildTo(row);
NS_RELEASE(row);
}
}
((nsTablePart *)table)->GetMaxColumns(); // has important side effect of creating pseudo-columns
body->AppendChild(table);
body->AppendChildTo(table);
}
root->AppendChild(body);
root->AppendChildTo(body);
// add caption in middle
nsIAtom* captionAtom = NS_NewAtom("CAPTION");
rv = NS_NewTableCaptionPart(&caption, captionAtom);
NS_RELEASE(captionAtom);
table->AppendChild(caption);
table->AppendChildTo(caption);
// add columns
nsIAtom* colAtom = NS_NewAtom("COL");
for (PRInt32 colIndex = 0; (NS_OK == rv) && (colIndex < aCols); colIndex++) {
rv = NS_NewTableColPart(&col, colAtom);
colGroup->AppendChild(col);
colGroup->AppendChildTo(col);
}
NS_RELEASE(colAtom);
@ -377,7 +377,7 @@ void BasicTest::CreateOutOfOrderContent(int aRows, int aCols)
captionAtom = NS_NewAtom("CAPTION");
rv = NS_NewTableCaptionPart(&caption, captionAtom);
NS_RELEASE(captionAtom);
table->AppendChild(caption);
table->AppendChildTo(caption);
NS_RELEASE(table);
NS_RELEASE(body);

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

@ -571,12 +571,12 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
if (nsnull==lastColGroupFrame)
{
//QQQ
// 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 ::AppendChildTo it
// this might be ok. no matter what my mcontent is, I know it needs a colgroup as a kid?
lastColGroup = new nsTableColGroup (PR_TRUE);
// XXX: how do I know whether AppendChild should notify or not?
mContent->AppendChild(lastColGroup, PR_FALSE); // was AppendColGroup
// XXX: how do I know whether AppendChildTo should notify or not?
mContent->AppendChildTo(lastColGroup, PR_FALSE); // was AppendColGroup
NS_ADDREF(lastColGroup); // ADDREF a: lastColGroup++
// Resolve style for the child
nsIStyleContext* colGroupStyleContext =
@ -617,9 +617,9 @@ void nsTableFrame::EnsureColumns(nsIPresContext* aPresContext,
PRInt32 excessColumns = GetColCount() - actualColumns;
for ( ; excessColumns > 0; excessColumns--)
{//QQQ
// 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 ::AppendChildTo it
nsTableCol *col = new nsTableCol(PR_TRUE);
lastColGroup->AppendChild (col, PR_FALSE);
lastColGroup->AppendChildTo (col, PR_FALSE);
}
NS_RELEASE(lastColGroup); // ADDREF: lastColGroup--
lastColGroupFrame->Reflow(*aPresContext, aDesiredSize, aReflowState, aStatus);