From 7e064bbd3a53249b00ded964fec89e471ba7a972 Mon Sep 17 00:00:00 2001 From: "joki%netscape.com" Date: Fri, 21 Aug 1998 21:38:26 +0000 Subject: [PATCH] Modifying nsIContent's AppendChild -> AppendChildTo to stop conflict with DOM interfaces. git-svn-id: svn://10.0.0.236/trunk@8340 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/nsIContent.h | 2 +- mozilla/content/base/src/nsDocument.cpp | 7 ++++ mozilla/content/base/src/nsDocument.h | 1 + .../html/document/src/nsHTMLContentSink.cpp | 12 +++--- .../html/document/src/nsImageDocument.cpp | 6 +-- mozilla/layout/base/public/nsIContent.h | 2 +- mozilla/layout/base/src/nsDocument.cpp | 7 ++++ mozilla/layout/base/src/nsDocument.h | 1 + .../layout/base/tests/TestContainerFrame.cpp | 2 +- .../layout/html/base/src/nsDOMAttributes.cpp | 6 +++ .../layout/html/base/src/nsDOMAttributes.h | 1 + .../layout/html/base/src/nsHTMLContainer.cpp | 10 ++++- .../layout/html/base/src/nsHTMLContainer.h | 4 +- .../layout/html/base/src/nsHTMLContent.cpp | 8 +++- mozilla/layout/html/base/src/nsHTMLContent.h | 3 +- .../layout/html/base/src/nsHTMLTagContent.cpp | 6 +++ .../layout/html/base/src/nsTextContent.cpp | 7 ++++ .../html/document/src/nsHTMLContentSink.cpp | 12 +++--- .../html/document/src/nsImageDocument.cpp | 6 +-- mozilla/layout/html/forms/src/nsInput.cpp | 28 ++++++++++--- mozilla/layout/html/forms/src/nsSelect.cpp | 2 +- .../layout/html/table/src/nsTableColGroup.cpp | 4 +- .../layout/html/table/src/nsTableColGroup.h | 4 +- .../layout/html/table/src/nsTableContent.cpp | 4 +- .../layout/html/table/src/nsTableContent.h | 4 +- .../layout/html/table/src/nsTableFrame.cpp | 10 ++--- mozilla/layout/html/table/src/nsTablePart.cpp | 26 ++++++------ mozilla/layout/html/table/src/nsTablePart.h | 2 +- mozilla/layout/html/table/src/nsTableRow.cpp | 8 ++-- mozilla/layout/html/table/src/nsTableRow.h | 4 +- .../layout/html/table/src/nsTableRowGroup.cpp | 14 +++---- .../layout/html/table/src/nsTableRowGroup.h | 4 +- mozilla/layout/html/tests/TestAttributes.cpp | 2 +- mozilla/layout/html/tests/TestInlineFrame.cpp | 36 ++++++++-------- .../TableContentTest/TableContentTest.cpp | 42 +++++++++---------- mozilla/layout/tables/nsTableFrame.cpp | 10 ++--- 36 files changed, 187 insertions(+), 120 deletions(-) diff --git a/mozilla/content/base/public/nsIContent.h b/mozilla/content/base/public/nsIContent.h index b06314a838d..5c580e94b32 100644 --- a/mozilla/content/base/public/nsIContent.h +++ b/mozilla/content/base/public/nsIContent.h @@ -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, diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 23158b906e9..7f0705169eb 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -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) { diff --git a/mozilla/content/base/src/nsDocument.h b/mozilla/content/base/src/nsDocument.h index 05ac7c26e24..5e01323ecf1 100644 --- a/mozilla/content/base/src/nsDocument.h +++ b/mozilla/content/base/src/nsDocument.h @@ -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); diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index dfef3e17a0f..0dd7af170b9 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -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". diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index fc1642efde4..c5a45c72ec7 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -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); diff --git a/mozilla/layout/base/public/nsIContent.h b/mozilla/layout/base/public/nsIContent.h index b06314a838d..5c580e94b32 100644 --- a/mozilla/layout/base/public/nsIContent.h +++ b/mozilla/layout/base/public/nsIContent.h @@ -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, diff --git a/mozilla/layout/base/src/nsDocument.cpp b/mozilla/layout/base/src/nsDocument.cpp index 23158b906e9..7f0705169eb 100644 --- a/mozilla/layout/base/src/nsDocument.cpp +++ b/mozilla/layout/base/src/nsDocument.cpp @@ -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) { diff --git a/mozilla/layout/base/src/nsDocument.h b/mozilla/layout/base/src/nsDocument.h index 05ac7c26e24..5e01323ecf1 100644 --- a/mozilla/layout/base/src/nsDocument.h +++ b/mozilla/layout/base/src/nsDocument.h @@ -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); diff --git a/mozilla/layout/base/tests/TestContainerFrame.cpp b/mozilla/layout/base/tests/TestContainerFrame.cpp index 4c664c84086..b071e77cbd0 100644 --- a/mozilla/layout/base/tests/TestContainerFrame.cpp +++ b/mozilla/layout/base/tests/TestContainerFrame.cpp @@ -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) { diff --git a/mozilla/layout/html/base/src/nsDOMAttributes.cpp b/mozilla/layout/html/base/src/nsDOMAttributes.cpp index d69815e063a..2541d875af5 100644 --- a/mozilla/layout/html/base/src/nsDOMAttributes.cpp +++ b/mozilla/layout/html/base/src/nsDOMAttributes.cpp @@ -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) { diff --git a/mozilla/layout/html/base/src/nsDOMAttributes.h b/mozilla/layout/html/base/src/nsDOMAttributes.h index bbebabeea9f..9b650b916ce 100644 --- a/mozilla/layout/html/base/src/nsDOMAttributes.h +++ b/mozilla/layout/html/base/src/nsDOMAttributes.h @@ -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); diff --git a/mozilla/layout/html/base/src/nsHTMLContainer.cpp b/mozilla/layout/html/base/src/nsHTMLContainer.cpp index 6b7d00bd051..2aea3605e46 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainer.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainer.cpp @@ -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); +} diff --git a/mozilla/layout/html/base/src/nsHTMLContainer.h b/mozilla/layout/html/base/src/nsHTMLContainer.h index 21967d3df2b..2e9a1ec4858 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainer.h +++ b/mozilla/layout/html/base/src/nsHTMLContainer.h @@ -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(); diff --git a/mozilla/layout/html/base/src/nsHTMLContent.cpp b/mozilla/layout/html/base/src/nsHTMLContent.cpp index 15f49e70b89..e2b26a050f4 100644 --- a/mozilla/layout/html/base/src/nsHTMLContent.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContent.cpp @@ -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) { diff --git a/mozilla/layout/html/base/src/nsHTMLContent.h b/mozilla/layout/html/base/src/nsHTMLContent.h index 020c28059cd..eb9ca4f4be3 100644 --- a/mozilla/layout/html/base/src/nsHTMLContent.h +++ b/mozilla/layout/html/base/src/nsHTMLContent.h @@ -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); diff --git a/mozilla/layout/html/base/src/nsHTMLTagContent.cpp b/mozilla/layout/html/base/src/nsHTMLTagContent.cpp index 6213b30ff60..c27c08968fa 100644 --- a/mozilla/layout/html/base/src/nsHTMLTagContent.cpp +++ b/mozilla/layout/html/base/src/nsHTMLTagContent.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsTextContent.cpp b/mozilla/layout/html/base/src/nsTextContent.cpp index 178812732b7..60d276cd5fb 100644 --- a/mozilla/layout/html/base/src/nsTextContent.cpp +++ b/mozilla/layout/html/base/src/nsTextContent.cpp @@ -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 // diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index dfef3e17a0f..0dd7af170b9 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -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". diff --git a/mozilla/layout/html/document/src/nsImageDocument.cpp b/mozilla/layout/html/document/src/nsImageDocument.cpp index fc1642efde4..c5a45c72ec7 100644 --- a/mozilla/layout/html/document/src/nsImageDocument.cpp +++ b/mozilla/layout/html/document/src/nsImageDocument.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsInput.cpp b/mozilla/layout/html/forms/src/nsInput.cpp index 54f89b5cb88..70703cf0689 100644 --- a/mozilla/layout/html/forms/src/nsInput.cpp +++ b/mozilla/layout/html/forms/src/nsInput.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsSelect.cpp b/mozilla/layout/html/forms/src/nsSelect.cpp index f816ca2001b..85329624bee 100644 --- a/mozilla/layout/html/forms/src/nsSelect.cpp +++ b/mozilla/layout/html/forms/src/nsSelect.cpp @@ -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); } } diff --git a/mozilla/layout/html/table/src/nsTableColGroup.cpp b/mozilla/layout/html/table/src/nsTableColGroup.cpp index f7ad092e9ea..afd9a00e980 100644 --- a/mozilla/layout/html/table/src/nsTableColGroup.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroup.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableColGroup.h b/mozilla/layout/html/table/src/nsTableColGroup.h index fcf4f282b50..5610d1c2d35 100644 --- a/mozilla/layout/html/table/src/nsTableColGroup.h +++ b/mozilla/layout/html/table/src/nsTableColGroup.h @@ -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.) diff --git a/mozilla/layout/html/table/src/nsTableContent.cpp b/mozilla/layout/html/table/src/nsTableContent.cpp index f469f907c30..f0bb6081d8b 100644 --- a/mozilla/layout/html/table/src/nsTableContent.cpp +++ b/mozilla/layout/html/table/src/nsTableContent.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableContent.h b/mozilla/layout/html/table/src/nsTableContent.h index ee666d1a54a..dc77d69cc9b 100644 --- a/mozilla/layout/html/table/src/nsTableContent.h +++ b/mozilla/layout/html/table/src/nsTableContent.h @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index a4607729bf7..505868dbe50 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsTablePart.cpp b/mozilla/layout/html/table/src/nsTablePart.cpp index f86de8dcacb..f6adf24b012 100644 --- a/mozilla/layout/html/table/src/nsTablePart.cpp +++ b/mozilla/layout/html/table/src/nsTablePart.cpp @@ -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; iAppendChild (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); } diff --git a/mozilla/layout/html/table/src/nsTablePart.h b/mozilla/layout/html/table/src/nsTablePart.h index 479c4def322..64ccc822718 100644 --- a/mozilla/layout/html/table/src/nsTablePart.h +++ b/mozilla/layout/html/table/src/nsTablePart.h @@ -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, diff --git a/mozilla/layout/html/table/src/nsTableRow.cpp b/mozilla/layout/html/table/src/nsTableRow.cpp index 1460980ecf1..edfa40371f4 100644 --- a/mozilla/layout/html/table/src/nsTableRow.cpp +++ b/mozilla/layout/html/table/src/nsTableRow.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableRow.h b/mozilla/layout/html/table/src/nsTableRow.h index 99c2a7fbfad..5a6aa30ee20 100644 --- a/mozilla/layout/html/table/src/nsTableRow.h +++ b/mozilla/layout/html/table/src/nsTableRow.h @@ -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.) diff --git a/mozilla/layout/html/table/src/nsTableRowGroup.cpp b/mozilla/layout/html/table/src/nsTableRowGroup.cpp index 6e4fa8b740c..dcab8c6c937 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroup.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroup.cpp @@ -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 diff --git a/mozilla/layout/html/table/src/nsTableRowGroup.h b/mozilla/layout/html/table/src/nsTableRowGroup.h index 75c3cceffe5..ee8680af63e 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroup.h +++ b/mozilla/layout/html/table/src/nsTableRowGroup.h @@ -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.) diff --git a/mozilla/layout/html/tests/TestAttributes.cpp b/mozilla/layout/html/tests/TestAttributes.cpp index 7bae72cf46b..f6723be8651 100644 --- a/mozilla/layout/html/tests/TestAttributes.cpp +++ b/mozilla/layout/html/tests/TestAttributes.cpp @@ -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."); } diff --git a/mozilla/layout/html/tests/TestInlineFrame.cpp b/mozilla/layout/html/tests/TestInlineFrame.cpp index c7c153f44c0..422ecb9ff28 100644 --- a/mozilla/layout/html/tests/TestInlineFrame.cpp +++ b/mozilla/layout/html/tests/TestInlineFrame.cpp @@ -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 diff --git a/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp b/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp index 9bd7da2f7be..516b9d1576d 100644 --- a/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp +++ b/mozilla/layout/html/tests/table/TableContentTest/TableContentTest.cpp @@ -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); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index a4607729bf7..505868dbe50 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -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);