Bug 346744: Get rid of implementations of nsIContent::AppendChildTo and let it just forward to nsIContent::InsertChildAt. r/sr=bz

This commit is contained in:
cvshook%sicking.cc 2006-07-31 22:38:07 +00:00
Родитель a556d7b3eb
Коммит 933ccd157e
17 изменённых файлов: 4 добавлений и 156 удалений

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

@ -262,7 +262,10 @@ public:
*
* @throws NS_ERROR_OUT_OF_MEMORY in some cases (from BindToTree).
*/
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify) = 0;
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
return InsertChildAt(aKid, GetChildCount(), aNotify);
}
/**
* Remove a child from this node. This method handles calling UnbindFromTree

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

@ -824,12 +824,6 @@ nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return NS_OK;
}
nsresult
nsGenericDOMDataNode::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
return NS_OK;
}
nsresult
nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -189,7 +189,6 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);

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

@ -2435,17 +2435,6 @@ nsGenericElement::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return NS_OK;
}
nsresult
nsGenericElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
// Make sure to _not_ call the subclass InsertChildAt here. If
// subclasses wanted to hook into this stuff, they would have
// overridden AppendChildTo.
// XXXbz maybe this should just be a non-virtual method on nsINode?
// Feels that way to me...
return nsGenericElement::InsertChildAt(aKid, GetChildCount(), aNotify);
}
nsresult
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -325,7 +325,6 @@ public:
virtual PRInt32 IndexOf(nsINode* aPossibleChild) const;
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);

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

@ -77,7 +77,6 @@ public:
// nsGenericElement
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
// nsIContent
@ -215,12 +214,6 @@ nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
return nsGenericHTMLElement::InsertChildAt(aKid, aIndex, aNotify);
}
nsresult
nsHTMLOptGroupElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
return nsHTMLOptGroupElement::InsertChildAt(aKid, GetChildCount(), aNotify);
}
nsresult
nsHTMLOptGroupElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -366,7 +366,6 @@ public:
PRBool aCompileEventHandlers);
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
@ -486,17 +485,6 @@ nsHTMLScriptElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsHTMLScriptElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv = nsGenericHTMLElement::AppendChildTo(aKid, aNotify);
if (NS_SUCCEEDED(rv) && aNotify) {
MaybeProcessScript();
}
return rv;
}
nsresult
nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const

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

@ -255,7 +255,6 @@ public:
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
// Overriden nsIFormControl methods
@ -563,12 +562,6 @@ nsHTMLSelectElement::InsertChildAt(nsIContent* aKid,
return NS_OK;
}
nsresult
nsHTMLSelectElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
return InsertChildAt(aKid, GetChildCount(), aNotify);
}
nsresult
nsHTMLSelectElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -76,7 +76,6 @@ public:
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -186,17 +185,6 @@ nsHTMLStyleElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsHTMLStyleElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv = nsGenericHTMLElement::AppendChildTo(aKid, aNotify);
if (NS_SUCCEEDED(rv)) {
UpdateStyleSheet();
}
return rv;
}
nsresult
nsHTMLStyleElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -123,7 +123,6 @@ public:
// nsIContent
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
@ -511,17 +510,6 @@ nsHTMLTextAreaElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsHTMLTextAreaElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv;
rv = nsGenericHTMLFormElement::AppendChildTo(aKid, aNotify);
if (!mValueChanged && mDoneAddingChildren) {
Reset();
}
return rv;
}
nsresult
nsHTMLTextAreaElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -221,16 +221,6 @@ nsSVGFilterElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsSVGFilterElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
WillModify();
nsresult rv = nsSVGFilterElementBase::AppendChildTo(aKid, aNotify);
DidModify();
return rv;
}
nsresult
nsSVGFilterElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -74,7 +74,6 @@ public:
// nsIContent
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,

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

@ -659,7 +659,6 @@ public:
// nsIContent
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
protected:
@ -843,22 +842,6 @@ nsSVGFEComponentTransferElement::InsertChildAt(nsIContent* aKid,
return rv;
}
nsresult
nsSVGFEComponentTransferElement::AppendChildTo(nsIContent* aKid,
PRBool aNotify)
{
nsCOMPtr<nsIDOMSVGFilterElement> filter = do_QueryInterface(GetParent());
nsCOMPtr<nsISVGValue> value = do_QueryInterface(GetParent());
if (filter && value)
value->BeginBatchUpdate();
nsresult rv = nsSVGFEComponentTransferElementBase::AppendChildTo(aKid,
aNotify);
if (filter && value)
value->EndBatchUpdate();
return rv;
}
nsresult
nsSVGFEComponentTransferElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{
@ -1367,7 +1350,6 @@ public:
// nsIContent
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
protected:
@ -1529,20 +1511,6 @@ nsSVGFEMergeElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsSVGFEMergeElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsCOMPtr<nsIDOMSVGFilterElement> filter = do_QueryInterface(GetParent());
nsCOMPtr<nsISVGValue> value = do_QueryInterface(GetParent());
if (filter && value)
value->BeginBatchUpdate();
nsresult rv = nsSVGFEMergeElementBase::AppendChildTo(aKid, aNotify);
if (filter && value)
value->EndBatchUpdate();
return rv;
}
nsresult
nsSVGFEMergeElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -103,7 +103,6 @@ public:
PRBool aCompileEventHandlers);
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
protected:
/**
@ -399,17 +398,6 @@ nsSVGScriptElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsSVGScriptElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv = nsSVGScriptElementBase::AppendChildTo(aKid, aNotify);
if (NS_SUCCEEDED(rv) && aNotify) {
MaybeProcessScript();
}
return rv;
}
//----------------------------------------------------------------------
// implementation helpers

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

@ -66,7 +66,6 @@ public:
// nsIContent
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
@ -153,17 +152,6 @@ nsSVGStyleElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsSVGStyleElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv = nsSVGStyleElementBase::AppendChildTo(aKid, aNotify);
if (NS_SUCCEEDED(rv)) {
UpdateStyleSheet();
}
return rv;
}
nsresult
nsSVGStyleElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -225,24 +225,6 @@ nsXTFElementWrapper::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
return rv;
}
nsresult
nsXTFElementWrapper::AppendChildTo(nsIContent* aKid, PRBool aNotify)
{
nsresult rv;
nsCOMPtr<nsIDOMNode> domKid;
if (mNotificationMask & (nsIXTFElement::NOTIFY_WILL_APPEND_CHILD |
nsIXTFElement::NOTIFY_CHILD_APPENDED))
domKid = do_QueryInterface(aKid);
if (mNotificationMask & nsIXTFElement::NOTIFY_WILL_APPEND_CHILD)
GetXTFElement()->WillAppendChild(domKid);
rv = nsXTFElementWrapperBase::AppendChildTo(aKid, aNotify);
if (mNotificationMask & nsIXTFElement::NOTIFY_CHILD_APPENDED)
GetXTFElement()->ChildAppended(domKid);
return rv;
}
nsresult
nsXTFElementWrapper::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
{

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

@ -84,7 +84,6 @@ public:
PRBool aNullParent = PR_TRUE);
nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
nsIAtom *GetIDAttributeName() const;
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,