Follow-up to fix for bug 251025, make Clone/CloneContent const again.

git-svn-id: svn://10.0.0.236/trunk@180011 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%propagandism.org 2005-09-12 07:34:25 +00:00
parent 48e5bfcc08
commit 31170dd919
18 changed files with 39 additions and 41 deletions

View File

@ -738,7 +738,7 @@ public:
* @param aDeep whether to clone the descendants of this node
*/
virtual nsresult CloneContent(nsIDocument *aOwnerDocument,
PRBool aDeep, nsIContent **aResult) = 0;
PRBool aDeep, nsIContent **aResult) const = 0;
#ifdef DEBUG
/**

View File

@ -159,7 +159,7 @@ nsCommentNode::GetNodeType(PRUint16* aNodeType)
}
nsGenericDOMDataNode*
nsCommentNode::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText)
nsCommentNode::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText) const
{
nsCommentNode *it = new nsCommentNode(aOwnerDocument);
if (it && aCloneText) {

View File

@ -193,7 +193,7 @@ nsDOMDocumentType::GetNodeType(PRUint16* aNodeType)
}
nsGenericDOMDataNode*
nsDOMDocumentType::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText)
nsDOMDocumentType::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText) const
{
// XXX ownerDocument
return new nsDOMDocumentType(mName, mEntities, mNotations, mPublicId,

View File

@ -167,7 +167,7 @@ public:
protected:
nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult);
nsIContent **aResult) const;
};
nsresult

View File

@ -276,7 +276,7 @@ nsGenericDOMDataNode::GetBaseURI(nsAString& aURI)
}
nsresult
nsGenericDOMDataNode::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
nsGenericDOMDataNode::CloneNode(PRBool aDeep, nsIDOMNode **aResult) const
{
*aResult = nsnull;
@ -1329,7 +1329,7 @@ nsGenericDOMDataNode::GetCurrentValueAtom()
nsresult
nsGenericDOMDataNode::CloneContent(nsIDocument *aOwnerDocument, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
// XXX We really want to pass the document to the constructor, but can't
// yet. See https://bugzilla.mozilla.org/show_bug.cgi?id=27382

View File

@ -155,7 +155,7 @@ public:
* @param aDeep if true all descendants will be cloned too
* @param aResult the clone
*/
nsresult CloneNode(PRBool aDeep, nsIDOMNode **aResult);
nsresult CloneNode(PRBool aDeep, nsIDOMNode **aResult) const;
nsresult LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix);
@ -258,7 +258,7 @@ public:
* right class for the clone.
*/
nsresult CloneContent(nsIDocument *aOwnerDocument, PRBool aDeep,
nsIContent **aResult);
nsIContent **aResult) const;
// nsITextContent
virtual const nsTextFragment *Text();
@ -289,7 +289,7 @@ protected:
* @return the clone
*/
virtual nsGenericDOMDataNode *Clone(nsIDocument *aOwnerDocument,
PRBool aCloneText) = 0;
PRBool aCloneText) const = 0;
nsTextFragment mText;
@ -342,7 +342,7 @@ private:
* Note that classes using this macro will need to implement:
* NS_IMETHOD GetNodeType(PRUint16* aNodeType);
* nsGenericDOMDataNode *Clone(nsIDocument *aOwnerDocument,
* PRBool aCloneText);
* PRBool aCloneText) const;
*/
#define NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA \
NS_IMETHOD GetNodeName(nsAString& aNodeName); \
@ -419,6 +419,6 @@ private:
return nsGenericDOMDataNode::CloneNode(aDeep, aReturn); \
} \
virtual nsGenericDOMDataNode *Clone(nsIDocument *aOwnerDocument, \
PRBool aCloneText);
PRBool aCloneText) const;
#endif /* nsGenericDOMDataNode_h___ */

View File

@ -4012,7 +4012,7 @@ nsGenericElement::UnsetProperty(nsIAtom *aPropertyName, nsresult *aStatus)
}
nsresult
nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode **aResult) const
{
*aResult = nsnull;
@ -4027,7 +4027,7 @@ nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
nsresult
nsGenericElement::CloneContent(nsIDocument *aOwnerDocument, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
if (GetOwnerDoc() == aOwnerDocument) {
return Clone(mNodeInfo, aDeep, aResult);

View File

@ -456,7 +456,7 @@ public:
* right class for the clone.
*/
nsresult CloneContent(nsIDocument *aOwnerDocument, PRBool aDeep,
nsIContent **aResult);
nsIContent **aResult) const;
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
@ -815,12 +815,7 @@ protected:
* @param aResult the clone
*/
virtual nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult)
{
NS_ERROR("This shouldn't be called!");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIContent **aResult) const = 0;
/**
* A basic implementation of the DOM cloneNode method. Calls CloneContent to
@ -830,7 +825,7 @@ protected:
* element are always cloned)
* @param aResult the clone
*/
nsresult CloneNode(PRBool aDeep, nsIDOMNode **aResult);
nsresult CloneNode(PRBool aDeep, nsIDOMNode **aResult) const;
/**
* Information about this type of node
@ -963,7 +958,7 @@ public:
} \
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \
virtual nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult);
nsIContent **aResult) const;
/**
@ -972,7 +967,7 @@ public:
#define NS_IMPL_DOM_CLONENODE(_elementName) \
nsresult \
_elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult) \
nsIContent **aResult) const \
{ \
*aResult = nsnull; \
\
@ -998,7 +993,7 @@ _elementName::CloneNode(PRBool aDeep, nsIDOMNode **aResult) \
#define NS_IMPL_DOM_CLONENODE_WITH_INIT(_elementName) \
nsresult \
_elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult) \
nsIContent **aResult) const \
{ \
*aResult = nsnull; \
\

View File

@ -122,7 +122,7 @@ public:
PRBool aNullParent = PR_TRUE);
virtual nsGenericDOMDataNode *Clone(nsIDocument *aOwnerDocument,
PRBool aCloneText)
PRBool aCloneText) const
{
nsAttributeTextNode *it = new nsAttributeTextNode(aOwnerDocument);
if (it && aCloneText) {
@ -212,7 +212,7 @@ nsTextNode::IsContentOfType(PRUint32 aFlags) const
}
nsGenericDOMDataNode*
nsTextNode::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText)
nsTextNode::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText) const
{
nsTextNode *it = new nsTextNode(aOwnerDocument);
if (it && aCloneText) {

View File

@ -387,7 +387,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
nsresult
nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
*aResult = nsnull;
@ -407,8 +407,9 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
if (GET_BOOLBIT(mBitField, BF_VALUE_CHANGED)) {
// We don't have our default value anymore. Set our value on
// the clone.
// XXX GetValue should be const
nsAutoString value;
GetValue(value);
NS_CONST_CAST(nsHTMLInputElement*, this)->GetValue(value);
// SetValueInternal handles setting the VALUE_CHANGED bit for us
it->SetValueInternal(value, nsnull);
}
@ -418,8 +419,9 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
if (GET_BOOLBIT(mBitField, BF_CHECKED_CHANGED)) {
// We no longer have our original checked state. Set our
// checked state on the clone.
// XXX GetChecked should be const
PRBool checked;
GetChecked(&checked);
NS_CONST_CAST(nsHTMLInputElement*, this)->GetChecked(&checked);
it->DoSetChecked(checked, PR_FALSE);
}
break;

View File

@ -486,7 +486,7 @@ nsHTMLScriptElement::AppendChildTo(nsIContent* aKid, PRBool aNotify)
nsresult
nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
*aResult = nsnull;

View File

@ -125,7 +125,7 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult);
nsIContent **aResult) const;
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode **aResult);
};

View File

@ -150,7 +150,7 @@ nsXMLCDATASection::GetNodeType(PRUint16* aNodeType)
}
nsGenericDOMDataNode*
nsXMLCDATASection::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText)
nsXMLCDATASection::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText) const
{
nsXMLCDATASection* it = new nsXMLCDATASection(aOwnerDocument);
if (it && aCloneText) {

View File

@ -168,10 +168,10 @@ nsXMLProcessingInstruction::GetNodeType(PRUint16* aNodeType)
nsGenericDOMDataNode*
nsXMLProcessingInstruction::Clone(nsIDocument *aOwnerDocument,
PRBool aCloneText)
PRBool aCloneText) const
{
nsAutoString data;
GetData(data);
nsGenericDOMDataNode::GetData(data);
return new nsXMLProcessingInstruction(mTarget, data, aOwnerDocument);
}

View File

@ -78,7 +78,7 @@ protected:
nsAString& aMedia,
PRBool* aIsAlternate);
virtual nsGenericDOMDataNode* Clone(nsIDocument *aOwnerDocument,
PRBool aCloneText);
PRBool aCloneText) const;
};
// nsISupports implementation
@ -235,10 +235,10 @@ nsXMLStylesheetPI::GetStyleSheetInfo(nsAString& aTitle,
}
nsGenericDOMDataNode*
nsXMLStylesheetPI::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText)
nsXMLStylesheetPI::Clone(nsIDocument *aOwnerDocument, PRBool aCloneText) const
{
nsAutoString data;
GetData(data);
nsGenericDOMDataNode::GetData(data);
return new nsXMLStylesheetPI(data, aOwnerDocument);
}

View File

@ -424,7 +424,7 @@ nsXTFElementWrapper::IntrinsicState() const
nsresult
nsXTFElementWrapper::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
*aResult = nsnull;
nsCOMPtr<nsIContent> it;
@ -455,7 +455,8 @@ nsXTFElementWrapper::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
it.swap(*aResult);
}
wrapper->CloneState(this);
// XXX CloneState should take |const nIDOMElement*|
wrapper->CloneState(NS_CONST_CAST(nsXTFElementWrapper*, this));
return rv;
}

View File

@ -124,7 +124,7 @@ public:
return GetXTFElement()->CloneState(aElement);
}
nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult);
nsIContent **aResult) const;
protected:
// to be implemented by subclasses:

View File

@ -509,7 +509,7 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsXULElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult)
nsIContent **aResult) const
{
*aResult = nsnull;