Fix for bug 347524 (Refactor adoptNode, importNode and cloneNode to share implementation). r/sr=bz.

This commit is contained in:
peterv%propagandism.org 2006-09-05 10:22:54 +00:00
parent 492710966f
commit 64ec124ee5
115 changed files with 876 additions and 958 deletions

View File

@ -660,21 +660,6 @@ public:
return NS_ERROR_NOT_IMPLEMENTED;
}
/**
* Clones this node, using aNodeInfoManager to get the nodeinfo for the
* clone. When cloning an element, all attributes of the element will be
* cloned. If aDeep is set, all descendants will also be cloned (by calling
* the DOM method cloneNode on them if aNodeInfoManager is the same as
* the nodeinfo manager of the mNodeInfo of this content node or by calling
* the DOM method importNode if they differ).
*
* @param aNodeInfoManager the nodeinfo manager to get the nodeinfo for the
* clone, it should not be null
* @param aDeep whether to clone the descendants of this node
*/
virtual nsresult CloneContent(nsNodeInfoManager *aNodeInfoManager,
PRBool aDeep, nsIContent **aResult) const = 0;
/**
* Get the ID of this content node (the atom corresponding to the
* value of the null-namespace attribute whose name is given by

View File

@ -557,6 +557,17 @@ public:
*/
virtual void RemoveMutationObserver(nsIMutationObserver* aMutationObserver);
/**
* Clones this node. This needs to be overriden by all node classes. aNodeInfo
* should be identical to this node's nodeInfo, except for the document which
* may be different. When cloning an element, all attributes of the element
* will be cloned. The children of the node will not be cloned.
*
* @param aNodeInfo the nodeinfo to use for the clone
* @param aResult the clone
*/
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const = 0;
// This class can be extended by subclasses that wish to store more
// information in the slots.
class nsSlots
@ -650,7 +661,6 @@ protected:
*flags &= ~aFlagsToUnset;
}
friend class nsDocument;
nsCOMPtr<nsINodeInfo> mNodeInfo;
enum { PARENT_BIT_INDOCUMENT = 1 << 0, PARENT_BIT_PARENT_IS_CONTENT = 1 << 1 };

View File

@ -44,8 +44,6 @@
#include "nsLayoutAtoms.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
class nsCommentNode : public nsGenericDOMDataNode,
public nsIDOMComment
@ -164,7 +162,7 @@ nsCommentNode::GetNodeType(PRUint16* aNodeType)
}
nsGenericDOMDataNode*
nsCommentNode::Clone(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
nsCommentNode::CloneDataNode(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
{
nsCommentNode *it = new nsCommentNode(aNodeInfo);
if (it && aCloneText) {

View File

@ -372,48 +372,28 @@ nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
nsresult
nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aReturn = nsnull;
nsAutoString value;
GetValue(value);
NS_CONST_CAST(nsDOMAttribute*, this)->GetValue(value);
nsCOMPtr<nsIDOMNode> newAttr = new nsDOMAttribute(nsnull, mNodeInfo, value);
if (!newAttr) {
*aResult = new nsDOMAttribute(nsnull, aNodeInfo, value);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsIDocument *document = GetOwnerDoc();
if (document) {
// XXX For now, nsDOMAttribute has only one child. We need to notify about
// cloning it, so we force creation here.
nsCOMPtr<nsIDOMNode> child;
GetFirstChild(getter_AddRefs(child));
nsCOMPtr<nsINode> childNode = do_QueryInterface(child);
if (childNode && childNode->HasProperties()) {
nsCOMPtr<nsIDOMNode> newChild;
newAttr->GetFirstChild(getter_AddRefs(newChild));
if (newChild) {
nsContentUtils::CallUserDataHandler(document,
nsIDOMUserDataHandler::NODE_CLONED,
childNode, child, newChild);
}
}
if (HasProperties()) {
nsContentUtils::CallUserDataHandler(document,
nsIDOMUserDataHandler::NODE_CLONED,
this, this, newAttr);
}
}
newAttr.swap(*aReturn);
NS_ADDREF(*aResult);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aResult)
{
return nsNodeUtils::CloneNodeImpl(this, aDeep, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{

View File

@ -121,6 +121,8 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
static void Initialize();
static void Shutdown();

View File

@ -43,13 +43,11 @@
#ifndef nsDOMAttributeMap_h___
#define nsDOMAttributeMap_h___
#include "nsIAtom.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsVoidArray.h"
#include "nsString.h"
#include "plhash.h"
#include "nsInterfaceHashtable.h"
class nsIAtom;
class nsIContent;
class nsDOMAttribute;
class nsINodeInfo;

View File

@ -232,7 +232,7 @@ nsDOMDocumentType::GetNodeType(PRUint16* aNodeType)
}
nsGenericDOMDataNode*
nsDOMDocumentType::Clone(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
nsDOMDocumentType::CloneDataNode(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
{
return new nsDOMDocumentType(aNodeInfo, mName, mEntities, mNotations,
mPublicId, mSystemId, mInternalSubset);

View File

@ -2868,59 +2868,10 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
return rv;
}
nsIDocument *document;
PRUint16 nodeType;
aImportedNode->GetNodeType(&nodeType);
switch (nodeType) {
case nsIDOMNode::ATTRIBUTE_NODE:
{
nsCOMPtr<nsIAttribute> attr = do_QueryInterface(aImportedNode);
NS_ENSURE_TRUE(attr, NS_ERROR_FAILURE);
document = attr->GetOwnerDoc();
nsCOMPtr<nsIDOMAttr> domAttr = do_QueryInterface(aImportedNode);
nsAutoString value;
rv = domAttr->GetValue(value);
NS_ENSURE_SUCCESS(rv, rv);
nsINodeInfo *nodeInfo = attr->NodeInfo();
nsCOMPtr<nsINodeInfo> newNodeInfo;
if (document != this) {
rv = mNodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
nodeInfo->GetPrefixAtom(),
nodeInfo->NamespaceID(),
getter_AddRefs(newNodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nodeInfo = newNodeInfo;
}
nsCOMPtr<nsIDOMNode> clone = new nsDOMAttribute(nsnull, nodeInfo, value);
if (!clone) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (document) {
// XXX For now, nsDOMAttribute has only one child. We need to notify
// about importing it, so we force creation here.
nsCOMPtr<nsIDOMNode> child;
aImportedNode->GetFirstChild(getter_AddRefs(child));
nsCOMPtr<nsINode> childNode = do_QueryInterface(child);
if (childNode && childNode->HasProperties()) {
nsCOMPtr<nsIDOMNode> newChild;
clone->GetFirstChild(getter_AddRefs(newChild));
if (newChild) {
nsContentUtils::CallUserDataHandler(document,
nsIDOMUserDataHandler::NODE_IMPORTED,
childNode, child, newChild);
}
}
}
clone.swap(*aResult);
break;
}
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
case nsIDOMNode::ELEMENT_NODE:
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
@ -2928,19 +2879,26 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
case nsIDOMNode::CDATA_SECTION_NODE:
case nsIDOMNode::COMMENT_NODE:
{
nsCOMPtr<nsIContent> imported = do_QueryInterface(aImportedNode);
nsCOMPtr<nsINode> imported = do_QueryInterface(aImportedNode);
NS_ENSURE_TRUE(imported, NS_ERROR_FAILURE);
document = imported->GetOwnerDoc();
nsCOMPtr<nsIContent> clone;
rv = imported->CloneContent(mNodeInfoManager, aDeep,
getter_AddRefs(clone));
nsCOMPtr<nsIDOMNode> newNode;
nsCOMArray<nsINode> nodesWithProperties;
rv = nsNodeUtils::Clone(imported, aDeep, mNodeInfoManager,
nodesWithProperties, getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
rv = CallQueryInterface(clone, aResult);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument *ownerDoc = imported->GetOwnerDoc();
if (ownerDoc) {
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, ownerDoc,
nsIDOMUserDataHandler::NODE_IMPORTED,
PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
}
break;
newNode.swap(*aResult);
return NS_OK;
}
case nsIDOMNode::ENTITY_NODE:
case nsIDOMNode::ENTITY_REFERENCE_NODE:
@ -2955,15 +2913,6 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
}
nsCOMPtr<nsINode> importedNode = do_QueryInterface(aImportedNode);
if (document && importedNode && importedNode->HasProperties()) {
nsContentUtils::CallUserDataHandler(document,
nsIDOMUserDataHandler::NODE_IMPORTED,
importedNode, aImportedNode, *aResult);
}
return NS_OK;
}
NS_IMETHODIMP
@ -3856,107 +3805,6 @@ nsDocument::SetDocumentURI(const nsAString& aDocumentURI)
return NS_ERROR_NOT_IMPLEMENTED;
}
class AdoptFuncData {
public:
AdoptFuncData(nsNodeInfoManager *aNewNodeInfoManager, JSContext *aCx,
JSObject *aOldScope, JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
: mNewNodeInfoManager(aNewNodeInfoManager),
mCx(aCx),
mOldScope(aOldScope),
mNewScope(aNewScope),
mNodesWithProperties(aNodesWithProperties)
{
};
nsNodeInfoManager *mNewNodeInfoManager;
JSContext *mCx;
JSObject *mOldScope;
JSObject *mNewScope;
nsCOMArray<nsINode> &mNodesWithProperties;
};
PLDHashOperator PR_CALLBACK
AdoptFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg)
{
nsCOMPtr<nsIAttribute> attr = do_QueryInterface(aData);
NS_ASSERTION(attr, "non-nsIAttribute somehow made it into the hashmap?!");
AdoptFuncData *data = NS_STATIC_CAST(AdoptFuncData*, aUserArg);
nsresult rv = nsDocument::Adopt(attr, data->mNewNodeInfoManager, data->mCx,
data->mOldScope, data->mNewScope,
data->mNodesWithProperties);
return NS_SUCCEEDED(rv) ? PL_DHASH_NEXT : PL_DHASH_STOP;
}
/* static */
nsresult
nsDocument::Adopt(nsINode *aNode, nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope, JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
{
NS_PRECONDITION(!aCx || (aOldScope && aNewScope), "Must have scopes");
// First walk aNode's attributes (and their children), then walk aNode's
// children (and recurse into their attributes and children) and finally deal
// with aNode.
if (aNode->IsNodeOfType(eELEMENT)) {
// aNode's attributes.
nsGenericElement *element = NS_STATIC_CAST(nsGenericElement*, aNode);
const nsDOMAttributeMap *map = element->GetAttributeMap();
if (map) {
AdoptFuncData data(aNewNodeInfoManager, aCx, aOldScope, aNewScope,
aNodesWithProperties);
PRUint32 count = map->Enumerate(AdoptFunc, &data);
NS_ENSURE_TRUE(count == map->Count(), NS_ERROR_FAILURE);
}
}
// aNode's children.
nsresult rv;
PRUint32 i, length = aNode->GetChildCount();
for (i = 0; i < length; ++i) {
rv = Adopt(aNode->GetChildAt(i), aNewNodeInfoManager, aCx, aOldScope,
aNewScope, aNodesWithProperties);
NS_ENSURE_SUCCESS(rv, rv);
}
// aNode.
if (aNewNodeInfoManager) {
nsINodeInfo *nodeInfo = aNode->mNodeInfo;
nsCOMPtr<nsINodeInfo> newNodeInfo;
rv = aNewNodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
nodeInfo->GetPrefixAtom(),
nodeInfo->NamespaceID(),
getter_AddRefs(newNodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
aNode->mNodeInfo.swap(newNodeInfo);
nsIXPConnect *xpc = nsContentUtils::XPConnect();
if (xpc && aCx) {
nsCOMPtr<nsIXPConnectJSObjectHolder> oldWrapper;
rv = xpc->ReparentWrappedNativeIfFound(aCx, aOldScope, aNewScope, aNode,
getter_AddRefs(oldWrapper));
if (NS_FAILED(rv)) {
newNodeInfo.swap(aNode->mNodeInfo);
return rv;
}
}
}
if (aNode->HasProperties()) {
PRBool ok = aNodesWithProperties.AppendObject(aNode);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
}
return NS_OK;
}
static void BlastSubtreeToPieces(nsINode *aNode);
PLDHashOperator PR_CALLBACK
@ -4115,8 +3963,8 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
}
nsCOMArray<nsINode> nodesWithProperties;
rv = Adopt(adoptedNode, sameDocument ? nsnull : mNodeInfoManager, cx,
oldScope, newScope, nodesWithProperties);
rv = nsNodeUtils::Adopt(adoptedNode, sameDocument ? nsnull : mNodeInfoManager,
cx, oldScope, newScope, nodesWithProperties);
if (NS_FAILED(rv)) {
// Disconnect all nodes from their parents, since some have the old document
// as their ownerDocument and some have this as their ownerDocument.
@ -4147,15 +3995,10 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
}
}
for (i = 0; i < count; ++i) {
nsINode *nodeWithProperties = nodesWithProperties[i];
nsCOMPtr<nsIDOMNode> source = do_QueryInterface(nodeWithProperties, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsContentUtils::CallUserDataHandler(this,
nsIDOMUserDataHandler::NODE_ADOPTED,
nodeWithProperties, source, nsnull);
}
rv = nsNodeUtils::CallUserDataHandlers(nodesWithProperties, this,
nsIDOMUserDataHandler::NODE_ADOPTED,
PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(adoptedNode, aResult);
}

View File

@ -517,6 +517,10 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIRadioGroupContainer
NS_IMETHOD WalkRadioGroup(const nsAString& aName,
@ -765,32 +769,6 @@ private:
already_AddRefed<nsIDOMElement>
CheckAncestryAndGetFrame(nsIDocument* aDocument) const;
/**
* Walks the attribute and descendant nodes of aNode. If aNewNodeInfoManager
* is not null, it is used to create new nodeinfos for the nodes. Also
* reparents the XPConnect wrappers for the nodes in aNewScope.
* aNodesWithProperties will be filled with all the nodes that have
* properties.
*
* @param aNode Node to adopt.
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
* nodeinfos for aNode and its attributes and
* descendants. May be null if the nodeinfos
* shouldn't be changed.
* @param aCx Context to use for reparenting the wrappers.
* @param aOldScope Old scope for the wrappers.
* @param aNewScope New scope for the wrappers.
* @param aNodesWithProperties All nodes (from amongst aNode and its
* descendants) with properties.
*/
static nsresult Adopt(nsINode *aNode, nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope,
JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties);
friend PLDHashOperator PR_CALLBACK
AdoptFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg);
// These are not implemented and not supported.
nsDocument(const nsDocument& aOther);
nsDocument& operator=(const nsDocument& aOther);

View File

@ -107,7 +107,8 @@ public:
{ return nsGenericElement::HasChildNodes(aReturn); }
NS_IMETHOD HasAttributes(PRBool* aReturn)
{ return nsGenericElement::HasAttributes(aReturn); }
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{ return nsGenericElement::CloneNode(aDeep, aReturn); }
NS_IMETHOD GetPrefix(nsAString& aPrefix)
{ return nsGenericElement::GetPrefix(aPrefix); }
NS_IMETHOD SetPrefix(const nsAString& aPrefix);
@ -158,8 +159,7 @@ public:
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
protected:
nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const;
nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
nsresult
@ -229,7 +229,7 @@ nsDocumentFragment::SetPrefix(const nsAString& aPrefix)
return NS_ERROR_DOM_NAMESPACE_ERR;
}
NS_IMPL_DOM_CLONENODE(nsDocumentFragment)
NS_IMPL_ELEMENT_CLONE(nsDocumentFragment)
NS_IMETHODIMP
nsDocumentFragment::GetBaseURI(nsAString& aURI)

View File

@ -257,29 +257,6 @@ nsGenericDOMDataNode::GetBaseURI(nsAString& aURI)
return NS_OK;
}
nsresult
nsGenericDOMDataNode::CloneNode(PRBool aDeep, nsIDOMNode *aSource,
nsIDOMNode **aResult) const
{
*aResult = nsnull;
nsCOMPtr<nsIContent> newContent;
nsresult rv = CloneContent(mNodeInfo->NodeInfoManager(), aDeep,
getter_AddRefs(newContent));
NS_ENSURE_SUCCESS(rv, rv);
rv = CallQueryInterface(newContent, aResult);
nsIDocument *ownerDoc = GetOwnerDoc();
if (NS_SUCCEEDED(rv) && ownerDoc && HasProperties()) {
nsContentUtils::CallUserDataHandler(ownerDoc,
nsIDOMUserDataHandler::NODE_CLONED,
this, aSource, *aResult);
}
return rv;
}
nsresult
nsGenericDOMDataNode::LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix)
@ -920,7 +897,7 @@ nsGenericDOMDataNode::SplitText(PRUint32 aOffset, nsIDOMText** aReturn)
* as this node!
*/
nsCOMPtr<nsIContent> newContent = Clone(mNodeInfo, PR_FALSE);
nsCOMPtr<nsIContent> newContent = CloneDataNode(mNodeInfo, PR_FALSE);
if (!newContent) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -1063,32 +1040,6 @@ nsGenericDOMDataNode::GetCurrentValueAtom()
return NS_NewAtom(val);
}
nsresult
nsGenericDOMDataNode::CloneContent(nsNodeInfoManager *aNodeInfoManager,
PRBool aDeep, nsIContent **aResult) const
{
nsINodeInfo *nodeInfo = NodeInfo();
nsCOMPtr<nsINodeInfo> newNodeInfo;
if (aNodeInfoManager != nodeInfo->NodeInfoManager()) {
nsresult rv = aNodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
nodeInfo->GetPrefixAtom(),
nodeInfo->NamespaceID(),
getter_AddRefs(newNodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nodeInfo = newNodeInfo;
}
*aResult = Clone(nodeInfo, PR_TRUE);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aResult);
return NS_OK;
}
nsIAtom*
nsGenericDOMDataNode::GetID() const
{

View File

@ -151,17 +151,6 @@ public:
PRBool* aReturn);
nsresult GetBaseURI(nsAString& aURI);
/**
* A basic implementation of the DOM cloneNode method. Calls CloneContent to
* do the actual cloning of the node.
*
* @param aDeep if true all descendants will be cloned too
* @param aSource nsIDOMNode pointer to this node
* @param aResult the clone
*/
nsresult CloneNode(PRBool aDeep, nsIDOMNode *aSource,
nsIDOMNode **aResult) const;
nsresult LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix);
nsresult LookupNamespaceURI(const nsAString& aNamespacePrefix,
@ -243,13 +232,6 @@ public:
virtual PRBool MayHaveFrame() const;
/**
* This calls Clone to do the actual cloning so that we end up with the
* right class for the clone.
*/
virtual nsresult CloneContent(nsNodeInfoManager *aNodeInfoManager,
PRBool aDeep, nsIContent **aResult) const;
virtual nsIAtom* GetID() const;
virtual const nsAttrValue* GetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
@ -260,6 +242,17 @@ public:
PRInt32 aModType) const;
virtual nsIAtom *GetClassAttributeName() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aResult = CloneDataNode(aNodeInfo, PR_TRUE);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aResult);
return NS_OK;
}
//----------------------------------------
@ -318,8 +311,8 @@ protected:
* @param aCloneText if true the text content will be cloned too
* @return the clone
*/
virtual nsGenericDOMDataNode *Clone(nsINodeInfo *aNodeInfo,
PRBool aCloneText) const = 0;
virtual nsGenericDOMDataNode *CloneDataNode(nsINodeInfo *aNodeInfo,
PRBool aCloneText) const = 0;
nsTextFragment mText;
@ -337,8 +330,8 @@ private:
*
* Note that classes using this macro will need to implement:
* NS_IMETHOD GetNodeType(PRUint16* aNodeType);
* nsGenericDOMDataNode *Clone(nsINodeInfo *aNodeInfo,
* PRBool aCloneText) const;
* nsGenericDOMDataNode *CloneDataNode(nsINodeInfo *aNodeInfo,
* PRBool aCloneText) const;
*/
#define NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA \
NS_IMETHOD GetNodeName(nsAString& aNodeName); \
@ -412,9 +405,9 @@ private:
return nsGenericDOMDataNode::IsSupported(aFeature, aVersion, aReturn); \
} \
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { \
return nsGenericDOMDataNode::CloneNode(aDeep, this, aReturn); \
return nsNodeUtils::CloneNodeImpl(this, aDeep, aReturn); \
} \
virtual nsGenericDOMDataNode *Clone(nsINodeInfo *aNodeInfo, \
PRBool aCloneText) const;
virtual nsGenericDOMDataNode *CloneDataNode(nsINodeInfo *aNodeInfo, \
PRBool aCloneText) const;
#endif /* nsGenericDOMDataNode_h___ */

View File

@ -3165,80 +3165,16 @@ nsGenericElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) co
}
nsresult
nsGenericElement::CopyInnerTo(nsGenericElement* aDst, PRBool aDeep) const
nsGenericElement::CopyInnerTo(nsGenericElement* aDst) const
{
nsresult rv = NS_OK;
PRUint32 i, count = mAttrsAndChildren.AttrCount();
for (i = 0; i < count; ++i) {
// XXX Once we have access to existing nsDOMAttributes for this element, we
// should call CloneNode or ImportNode on them.
const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue* value = mAttrsAndChildren.AttrAt(i);
nsAutoString valStr;
value->ToString(valStr);
rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
name->GetPrefix(), valStr, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
if (aDeep) {
nsIDocument *doc = GetOwnerDoc();
nsIDocument *newDoc = aDst->GetOwnerDoc();
if (doc == newDoc) {
rv = CloneChildrenTo(aDst);
}
else {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(newDoc);
rv = ImportChildrenTo(aDst, domDoc);
}
}
return rv;
}
nsresult
nsGenericElement::ImportChildrenTo(nsGenericElement *aDst,
nsIDOMDocument *aImportDocument) const
{
PRUint32 i, count = mAttrsAndChildren.ChildCount();
for (i = 0; i < count; ++i) {
nsresult rv;
nsCOMPtr<nsIDOMNode> node =
do_QueryInterface(mAttrsAndChildren.ChildAt(i), &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> newNode;
rv = aImportDocument->ImportNode(node, PR_TRUE, getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> newContent = do_QueryInterface(newNode, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = aDst->AppendChildTo(newContent, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
nsresult
nsGenericElement::CloneChildrenTo(nsGenericElement *aDst) const
{
PRUint32 i, count = mAttrsAndChildren.ChildCount();
for (i = 0; i < count; ++i) {
nsresult rv;
nsCOMPtr<nsIDOMNode> node =
do_QueryInterface(mAttrsAndChildren.ChildAt(i), &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> newNode;
rv = node->CloneNode(PR_TRUE, getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> newContent = do_QueryInterface(newNode, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = aDst->AppendChildTo(newContent, PR_FALSE);
nsresult rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
name->GetPrefix(), valStr, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -3804,45 +3740,3 @@ nsGenericElement::GetContentsAsText(nsAString& aText)
}
}
}
nsresult
nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode *aSource,
nsIDOMNode **aResult) const
{
*aResult = nsnull;
nsCOMPtr<nsIContent> newContent;
nsresult rv = CloneContent(mNodeInfo->NodeInfoManager(), aDeep,
getter_AddRefs(newContent));
NS_ENSURE_SUCCESS(rv, rv);
rv = CallQueryInterface(newContent, aResult);
nsIDocument *ownerDoc = GetOwnerDoc();
if (NS_SUCCEEDED(rv) && ownerDoc && HasProperties()) {
nsContentUtils::CallUserDataHandler(ownerDoc,
nsIDOMUserDataHandler::NODE_CLONED,
this, aSource, *aResult);
}
return rv;
}
nsresult
nsGenericElement::CloneContent(nsNodeInfoManager *aNodeInfoManager,
PRBool aDeep, nsIContent **aResult) const
{
nsINodeInfo *nodeInfo = NodeInfo();
nsCOMPtr<nsINodeInfo> newNodeInfo;
if (aNodeInfoManager != nodeInfo->NodeInfoManager()) {
nsresult rv = aNodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
nodeInfo->GetPrefixAtom(),
nodeInfo->NamespaceID(),
getter_AddRefs(newNodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nodeInfo = newNodeInfo;
}
return Clone(nodeInfo, aDeep, aResult);
}

View File

@ -56,6 +56,7 @@
#include "nsILinkHandler.h"
#include "nsGenericDOMNodeList.h"
#include "nsContentUtils.h"
#include "nsNodeUtils.h"
#include "nsAttrAndChildArray.h"
#include "mozFlushType.h"
#include "nsDOMAttributeMap.h"
@ -386,13 +387,6 @@ public:
virtual PRUint32 GetScriptTypeID() const;
virtual nsresult SetScriptTypeID(PRUint32 aLang);
/**
* This calls Clone to do the actual cloning so that we end up with the
* right class for the clone.
*/
nsresult CloneContent(nsNodeInfoManager *aNodeInfoManager, PRBool aDeep,
nsIContent **aResult) const;
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
@ -492,6 +486,10 @@ public:
NS_IMETHOD HasAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aLocalName,
PRBool* aReturn);
nsresult CloneNode(PRBool aDeep, nsIDOMNode **aResult)
{
return nsNodeUtils::CloneNodeImpl(this, aDeep, aResult);
}
//----------------------------------------
@ -856,28 +854,10 @@ protected:
virtual nsAttrInfo GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const;
/**
* Duplicate children by calling importNode and append them to another
* element.
*
* @param aDst the element to append the imported children to
* @param aImportDocument the document to use to call importNode
*/
nsresult ImportChildrenTo(nsGenericElement *aDst,
nsIDOMDocument *aImportDocument) const;
/**
* Clone children and append them to another element.
*
* @param aDst the element to append the imported children to
*/
nsresult CloneChildrenTo(nsGenericElement *aDst) const;
/**
* Copy attributes and children to another content object
* Copy attributes and state to another element
* @param aDest the object to copy to
* @param aDeep whether to copy children
*/
nsresult CopyInnerTo(nsGenericElement* aDest, PRBool aDeep) const;
nsresult CopyInnerTo(nsGenericElement* aDest) const;
/**
* Internal hook for converting an attribute name-string to an atomized name
@ -959,130 +939,19 @@ protected:
*/
void GetContentsAsText(nsAString& aText);
/**
* Method to clone this element. This needs to be overriden by all element
* classes. aNodeInfo should be identical to this element's nodeInfo, except
* for the document which may be different. If aDeep is true all descendants
* will be cloned too (by calling the DOM method cloneNode on them if the
* ownerDocument of aNodeInfo is the same as the ownerDocument of this
* element or by calling the DOM method importNode if they differ).
*
* @param aNodeInfo the nodeinfo to use for the clone
* @param aDeep if true all descendants will be cloned too (attributes are
* always cloned)
* @param aResult the clone
*/
virtual nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const = 0;
/**
* A basic implementation of the DOM cloneNode method. Calls CloneContent to
* do the actual cloning of the element.
*
* @param aDeep if true all descendants will be cloned too (attributes on the
* element are always cloned)
* @param aSource nsIDOMNode pointer to this node
* @param aResult the clone
*/
nsresult CloneNode(PRBool aDeep, nsIDOMNode *aSource,
nsIDOMNode **aResult) const;
/**
* Array containing all attributes and children for this element
*/
nsAttrAndChildArray mAttrsAndChildren;
};
#define NS_FORWARD_NSIDOMNODE_NO_CLONENODE(_to) \
NS_IMETHOD GetNodeName(nsAString& aNodeName) { \
return _to GetNodeName(aNodeName); \
} \
NS_IMETHOD GetNodeValue(nsAString& aNodeValue) { \
return _to GetNodeValue(aNodeValue); \
} \
NS_IMETHOD SetNodeValue(const nsAString& aNodeValue) { \
return _to SetNodeValue(aNodeValue); \
} \
NS_IMETHOD GetNodeType(PRUint16* aNodeType) { \
return _to GetNodeType(aNodeType); \
} \
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { \
return _to GetParentNode(aParentNode); \
} \
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) { \
return _to GetChildNodes(aChildNodes); \
} \
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) { \
return _to GetFirstChild(aFirstChild); \
} \
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) { \
return _to GetLastChild(aLastChild); \
} \
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) { \
return _to GetPreviousSibling(aPreviousSibling); \
} \
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) { \
return _to GetNextSibling(aNextSibling); \
} \
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \
return _to GetAttributes(aAttributes); \
} \
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \
return _to GetOwnerDocument(aOwnerDocument); \
} \
NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) { \
return _to GetNamespaceURI(aNamespaceURI); \
} \
NS_IMETHOD GetPrefix(nsAString& aPrefix) { \
return _to GetPrefix(aPrefix); \
} \
NS_IMETHOD SetPrefix(const nsAString& aPrefix) { \
return _to SetPrefix(aPrefix); \
} \
NS_IMETHOD GetLocalName(nsAString& aLocalName) { \
return _to GetLocalName(aLocalName); \
} \
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \
nsIDOMNode** aReturn) { \
return _to InsertBefore(aNewChild, aRefChild, aReturn); \
} \
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, \
nsIDOMNode** aReturn) { \
return _to ReplaceChild(aNewChild, aOldChild, aReturn); \
} \
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { \
return _to RemoveChild(aOldChild, aReturn); \
} \
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) { \
return _to AppendChild(aNewChild, aReturn); \
} \
NS_IMETHOD HasChildNodes(PRBool* aReturn) { \
return _to HasChildNodes(aReturn); \
} \
NS_IMETHOD Normalize() { \
return _to Normalize(); \
} \
NS_IMETHOD IsSupported(const nsAString& aFeature, \
const nsAString& aVersion, PRBool* aReturn) { \
return _to IsSupported(aFeature, aVersion, aReturn); \
} \
NS_IMETHOD HasAttributes(PRBool* aReturn) { \
return _to HasAttributes(aReturn); \
} \
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \
virtual nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult) const;
/**
* Macros to implement CloneNode(). _elementName is the class for which to
* implement CloneNode, _implClass is the class to use to cast to
* nsIDOMNode*.
* Macros to implement Clone(). _elementName is the class for which to implement
* Clone.
*/
#define NS_IMPL_DOM_CLONENODE_AMBIGUOUS(_elementName, _implClass) \
#define NS_IMPL_ELEMENT_CLONE(_elementName) \
nsresult \
_elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult) const \
_elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
{ \
*aResult = nsnull; \
\
@ -1091,29 +960,18 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
return NS_ERROR_OUT_OF_MEMORY; \
} \
\
nsCOMPtr<nsIContent> kungFuDeathGrip = it; \
nsresult rv = CopyInnerTo(it, aDeep); \
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
nsresult rv = CopyInnerTo(it); \
if (NS_SUCCEEDED(rv)) { \
kungFuDeathGrip.swap(*aResult); \
} \
\
return rv; \
} \
NS_IMETHODIMP \
_elementName::CloneNode(PRBool aDeep, nsIDOMNode **aResult) \
{ \
return nsGenericElement::CloneNode(aDeep, \
NS_STATIC_CAST(_implClass*, this), \
aResult); \
}
#define NS_IMPL_DOM_CLONENODE(_elementName) \
NS_IMPL_DOM_CLONENODE_AMBIGUOUS(_elementName, _elementName)
#define NS_IMPL_DOM_CLONENODE_WITH_INIT(_elementName) \
#define NS_IMPL_ELEMENT_CLONE_WITH_INIT(_elementName) \
nsresult \
_elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
nsIContent **aResult) const \
_elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
{ \
*aResult = nsnull; \
\
@ -1122,19 +980,14 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep, \
return NS_ERROR_OUT_OF_MEMORY; \
} \
\
nsCOMPtr<nsIContent> kungFuDeathGrip = it; \
nsCOMPtr<nsINode> kungFuDeathGrip = it; \
nsresult rv = it->Init(); \
rv |= CopyInnerTo(it, aDeep); \
rv |= CopyInnerTo(it); \
if (NS_SUCCEEDED(rv)) { \
kungFuDeathGrip.swap(*aResult); \
} \
\
return rv; \
} \
NS_IMETHODIMP \
_elementName::CloneNode(PRBool aDeep, nsIDOMNode **aResult) \
{ \
return nsGenericElement::CloneNode(aDeep, this, aResult); \
}
#endif /* nsGenericElement_h___ */

View File

@ -44,6 +44,12 @@
#include "nsIDocument.h"
#include "nsIDOMUserDataHandler.h"
#include "nsIEventListenerManager.h"
#include "nsIAttribute.h"
#include "nsIXPConnect.h"
#include "nsGenericElement.h"
#include "pldhash.h"
#include "nsIDOMAttr.h"
#include "nsCOMArray.h"
#define IMPL_MUTATION_NOTIFICATION(func_, content_, params_) \
PR_BEGIN_MACRO \
@ -212,3 +218,255 @@ nsNodeUtils::LastRelease(nsINode* aNode, PRBool aDelete)
}
}
/* static */
nsresult
nsNodeUtils::CallUserDataHandlers(nsCOMArray<nsINode> &aNodesWithProperties,
nsIDocument *aOwnerDocument,
PRUint16 aOperation, PRBool aCloned)
{
NS_PRECONDITION(!aCloned || (aNodesWithProperties.Count() % 2 == 0),
"Expected aNodesWithProperties to contain original and "
"cloned nodes.");
// Keep the document alive, just in case one of the handlers causes it to go
// away.
nsCOMPtr<nsIDocument> ownerDoc = aOwnerDocument;
PRUint32 i, count = aNodesWithProperties.Count();
for (i = 0; i < count; ++i) {
nsINode *nodeWithProperties = aNodesWithProperties[i];
nsresult rv;
nsCOMPtr<nsIDOMNode> source = do_QueryInterface(nodeWithProperties, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> dest;
if (aCloned) {
dest = do_QueryInterface(aNodesWithProperties[++i], &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
nsContentUtils::CallUserDataHandler(aOwnerDocument, aOperation,
nodeWithProperties, source, dest);
}
return NS_OK;
}
/* static */
nsresult
nsNodeUtils::CloneNodeImpl(nsINode *aNode, PRBool aDeep, nsIDOMNode **aResult)
{
*aResult = nsnull;
nsCOMPtr<nsIDOMNode> newNode;
nsCOMArray<nsINode> nodesWithProperties;
nsresult rv = Clone(aNode, aDeep, nsnull, nodesWithProperties,
getter_AddRefs(newNode));
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument *ownerDoc = aNode->GetOwnerDoc();
if (ownerDoc) {
rv = CallUserDataHandlers(nodesWithProperties, ownerDoc,
nsIDOMUserDataHandler::NODE_CLONED, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
}
newNode.swap(*aResult);
return NS_OK;
}
class AdoptFuncData {
public:
AdoptFuncData(nsIDOMElement *aElement, nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope, JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
: mElement(aElement),
mNewNodeInfoManager(aNewNodeInfoManager),
mCx(aCx),
mOldScope(aOldScope),
mNewScope(aNewScope),
mNodesWithProperties(aNodesWithProperties)
{
};
nsIDOMElement *mElement;
nsNodeInfoManager *mNewNodeInfoManager;
JSContext *mCx;
JSObject *mOldScope;
JSObject *mNewScope;
nsCOMArray<nsINode> &mNodesWithProperties;
};
PLDHashOperator PR_CALLBACK
AdoptFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg)
{
nsCOMPtr<nsIAttribute> attr = do_QueryInterface(aData);
NS_ASSERTION(attr, "non-nsIAttribute somehow made it into the hashmap?!");
AdoptFuncData *data = NS_STATIC_CAST(AdoptFuncData*, aUserArg);
// If we were passed an element we need to clone the attribute nodes and
// insert them into the element.
PRBool clone = data->mElement != nsnull;
nsCOMPtr<nsIDOMNode> node;
nsresult rv = nsNodeUtils::CloneAndAdopt(attr, clone, PR_TRUE,
data->mNewNodeInfoManager,
data->mCx, data->mOldScope,
data->mNewScope,
data->mNodesWithProperties,
nsnull, getter_AddRefs(node));
if (NS_SUCCEEDED(rv) && clone) {
nsCOMPtr<nsIDOMAttr> dummy, attribute = do_QueryInterface(node, &rv);
if (NS_SUCCEEDED(rv)) {
rv = data->mElement->SetAttributeNode(attribute, getter_AddRefs(dummy));
}
}
return NS_SUCCEEDED(rv) ? PL_DHASH_NEXT : PL_DHASH_STOP;
}
/* static */
nsresult
nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope,
JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties,
nsINode *aParent, nsIDOMNode **aResult)
{
NS_PRECONDITION((!aClone && aNewNodeInfoManager) || !aCx,
"If cloning or not getting a new nodeinfo we shouldn't "
"rewrap");
NS_PRECONDITION(!aCx || (aOldScope && aNewScope), "Must have scopes");
NS_PRECONDITION(!aParent || !aNode->IsNodeOfType(nsINode::eDOCUMENT),
"Can't insert document nodes into a parent");
*aResult = nsnull;
// First deal with aNode and walk its attributes (and their children). Then,
// if aDeep is PR_TRUE, deal with aNode's children (and recurse into their
// attributes and children).
nsresult rv;
nsNodeInfoManager *nodeInfoManager = aNewNodeInfoManager;
// aNode.
nsINodeInfo *nodeInfo = aNode->mNodeInfo;
nsCOMPtr<nsINodeInfo> newNodeInfo;
if (nodeInfoManager) {
rv = nodeInfoManager->GetNodeInfo(nodeInfo->NameAtom(),
nodeInfo->GetPrefixAtom(),
nodeInfo->NamespaceID(),
getter_AddRefs(newNodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nodeInfo = newNodeInfo;
}
nsCOMPtr<nsINode> clone;
if (aClone) {
rv = aNode->Clone(nodeInfo, getter_AddRefs(clone));
NS_ENSURE_SUCCESS(rv, rv);
if (aParent) {
// If we're cloning we need to insert the cloned children into the cloned
// parent.
nsCOMPtr<nsIContent> cloneContent = do_QueryInterface(clone, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = aParent->AppendChildTo(cloneContent, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
else if (aDeep && clone->IsNodeOfType(nsINode::eDOCUMENT)) {
// After cloning the document itself, we want to clone the children into
// the cloned document (somewhat like cloning and importing them into the
// cloned document).
nodeInfoManager = clone->mNodeInfo->NodeInfoManager();
}
}
else if (nodeInfoManager) {
aNode->mNodeInfo.swap(newNodeInfo);
if (aCx) {
nsIXPConnect *xpc = nsContentUtils::XPConnect();
if (xpc) {
nsCOMPtr<nsIXPConnectJSObjectHolder> oldWrapper;
rv = xpc->ReparentWrappedNativeIfFound(aCx, aOldScope, aNewScope, aNode,
getter_AddRefs(oldWrapper));
if (NS_FAILED(rv)) {
aNode->mNodeInfo.swap(nodeInfo);
return rv;
}
}
}
}
if (aNode->IsNodeOfType(nsINode::eELEMENT)) {
// aNode's attributes.
nsGenericElement *elem = NS_STATIC_CAST(const nsGenericElement*, aNode);
const nsDOMAttributeMap *map = elem->GetAttributeMap();
if (map) {
nsCOMPtr<nsIDOMElement> element;
if (aClone) {
// If we're cloning we need to insert the cloned attribute nodes into
// the cloned element.
element = do_QueryInterface(clone, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
AdoptFuncData data(element, nodeInfoManager, aCx, aOldScope,
aNewScope, aNodesWithProperties);
PRUint32 count = map->Enumerate(AdoptFunc, &data);
NS_ENSURE_TRUE(count == map->Count(), NS_ERROR_FAILURE);
}
}
// The DOM spec says to always adopt/clone/import the children of attribute
// nodes.
// XXX The following block is here because our implementation of attribute
// nodes is broken when it comes to inserting children. Instead of cloning
// their children we force creation of the only child by calling
// GetChildAt(0). We can remove this when
// https://bugzilla.mozilla.org/show_bug.cgi?id=56758 is fixed.
if (aClone && aNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
nsCOMPtr<nsINode> attrChildNode = aNode->GetChildAt(0);
// We only need to do this if the child node has properties (because we
// might need to call a userdata handler).
if (attrChildNode && attrChildNode->HasProperties()) {
nsCOMPtr<nsINode> clonedAttrChildNode = clone->GetChildAt(0);
if (clonedAttrChildNode) {
PRBool ok = aNodesWithProperties.AppendObject(attrChildNode) &&
aNodesWithProperties.AppendObject(clonedAttrChildNode);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
}
}
}
// XXX End of workaround for broken attribute nodes.
else if (aDeep || aNode->IsNodeOfType(nsINode::eATTRIBUTE)) {
// aNode's children.
PRUint32 i, length = aNode->GetChildCount();
for (i = 0; i < length; ++i) {
nsCOMPtr<nsIDOMNode> child;
rv = CloneAndAdopt(aNode->GetChildAt(i), aClone, PR_TRUE, nodeInfoManager,
aCx, aOldScope, aNewScope, aNodesWithProperties,
clone, getter_AddRefs(child));
NS_ENSURE_SUCCESS(rv, rv);
}
}
if (aNode->HasProperties()) {
PRBool ok = aNodesWithProperties.AppendObject(aNode);
if (aClone) {
ok = ok && aNodesWithProperties.AppendObject(clone);
}
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
}
return clone ? CallQueryInterface(clone, aResult) : NS_OK;
}

View File

@ -38,12 +38,13 @@
#ifndef nsNodeUtils_h___
#define nsNodeUtils_h___
#include "prtypes.h"
#include "nsDOMAttributeMap.h"
struct JSContext;
struct JSObject;
class nsINode;
class nsIContent;
class nsIDocument;
class nsIAtom;
class nsNodeInfoManager;
template<class E> class nsCOMArray;
class nsNodeUtils
{
@ -105,6 +106,137 @@ public:
* @param aDelete If PR_TRUE, calling this method also deletes aNode.
*/
static void LastRelease(nsINode* aNode, PRBool aDelete);
/**
* Clones aNode, its attributes and, if aDeep is PR_TRUE, its descendant nodes
* If aNewNodeInfoManager is not null, it is used to create new nodeinfos for
* the clones. aNodesWithProperties will be filled with all the nodes that
* have properties, and every node in it will be followed by its clone.
*
* @param aNode Node to clone.
* @param aDeep If PR_TRUE the function will be called recursively on
* descendants of the node
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
* nodeinfos for aNode and its attributes and
* descendants. May be null if the nodeinfos
* shouldn't be changed.
* @param aNodesWithProperties All nodes (from amongst aNode and its
* descendants) with properties. Every node will
* be followed by its clone.
* @param aResult *aResult will contain the cloned node.
*/
static nsresult Clone(nsINode *aNode, PRBool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
nsCOMArray<nsINode> &aNodesWithProperties,
nsIDOMNode **aResult)
{
return CloneAndAdopt(aNode, PR_TRUE, aDeep, aNewNodeInfoManager, nsnull,
nsnull, nsnull, aNodesWithProperties, nsnull,
aResult);
}
/**
* Walks aNode, its attributes and descendant nodes. If aNewNodeInfoManager is
* not null, it is used to create new nodeinfos for the nodes. Also reparents
* the XPConnect wrappers for the nodes in aNewScope if aCx is not null.
* aNodesWithProperties will be filled with all the nodes that have
* properties.
*
* @param aNode Node to adopt.
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
* nodeinfos for aNode and its attributes and
* descendants. May be null if the nodeinfos
* shouldn't be changed.
* @param aCx Context to use for reparenting the wrappers, or null if no
* reparenting should be done. Must be null if aNewNodeInfoManager
* is null.
* @param aOldScope Old scope for the wrappers. May be null if aCx is null.
* @param aNewScope New scope for the wrappers. May be null if aCx is null.
* @param aNodesWithProperties All nodes (from amongst aNode and its
* descendants) with properties.
*/
static nsresult Adopt(nsINode *aNode, nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope,
JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties)
{
nsCOMPtr<nsIDOMNode> dummy;
return CloneAndAdopt(aNode, PR_FALSE, PR_TRUE, aNewNodeInfoManager, aCx,
aOldScope, aNewScope, aNodesWithProperties,
nsnull, getter_AddRefs(dummy));
}
/**
* Call registered userdata handlers for operation aOperation for the nodes in
* aNodesWithProperties. If aCloned is PR_TRUE aNodesWithProperties should
* contain both the original and the cloned nodes (and only the userdata
* handlers registered for the original nodes will be called).
*
* @param aNodesWithProperties Contains the nodes that might have properties
* registered on them. If aCloned is PR_TRUE every
* one of those nodes should be immediately
* followed in the array by the cloned node.
* @param aOwnerDocument The ownerDocument of the original nodes.
* @param aOperation The operation to call a userdata handler for.
* @param aCloned If PR_TRUE aNodesWithProperties will contain both original
* and cloned nodes.
*/
static nsresult CallUserDataHandlers(nsCOMArray<nsINode> &aNodesWithProperties,
nsIDocument *aOwnerDocument,
PRUint16 aOperation, PRBool aCloned);
/**
* A basic implementation of the DOM cloneNode method. Calls nsINode::Clone to
* do the actual cloning of the node.
*
* @param aNode the node to clone
* @param aDeep if true all descendants will be cloned too
* @param aResult the clone
*/
static nsresult CloneNodeImpl(nsINode *aNode, PRBool aDeep,
nsIDOMNode **aResult);
private:
friend PLDHashOperator PR_CALLBACK
AdoptFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg);
/**
* Walks aNode, its attributes and, if aDeep is PR_TRUE, its descendant nodes.
* If aClone is PR_TRUE the nodes will be cloned. If aNewNodeInfoManager is
* not null, it is used to create new nodeinfos for the nodes. Also reparents
* the XPConnect wrappers for the nodes in aNewScope if aCx is not null.
* aNodesWithProperties will be filled with all the nodes that have
* properties.
*
* @param aNode Node to adopt/clone.
* @param aClone If PR_TRUE the node will be cloned and the cloned node will
* be in aResult.
* @param aDeep If PR_TRUE the function will be called recursively on
* descendants of the node
* @param aNewNodeInfoManager The nodeinfo manager to use to create new
* nodeinfos for aNode and its attributes and
* descendants. May be null if the nodeinfos
* shouldn't be changed.
* @param aCx Context to use for reparenting the wrappers, or null if no
* reparenting should be done. Must be null if aClone is PR_TRUE or
* if aNewNodeInfoManager is null.
* @param aOldScope Old scope for the wrappers. May be null if aCx is null.
* @param aNewScope New scope for the wrappers. May be null if aCx is null.
* @param aNodesWithProperties All nodes (from amongst aNode and its
* descendants) with properties. If aClone is
* PR_TRUE every node will be followed by its
* clone.
* @param aParent If aClone is PR_TRUE the cloned node will be appended to
* aParent's children. May be null.
* @param aResult *aResult will contain the cloned node (if aClone is
* PR_TRUE).
*/
static nsresult CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
nsNodeInfoManager *aNewNodeInfoManager,
JSContext *aCx, JSObject *aOldScope,
JSObject *aNewScope,
nsCOMArray<nsINode> &aNodesWithProperties,
nsINode *aParent, nsIDOMNode **aResult);
};
#endif // nsNodeUtils_h___

View File

@ -125,8 +125,8 @@ public:
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual nsGenericDOMDataNode *Clone(nsINodeInfo *aNodeInfo,
PRBool aCloneText) const
virtual nsGenericDOMDataNode *CloneDataNode(nsINodeInfo *aNodeInfo,
PRBool aCloneText) const
{
nsAttributeTextNode *it = new nsAttributeTextNode(aNodeInfo);
if (it && aCloneText) {
@ -218,7 +218,7 @@ nsTextNode::IsNodeOfType(PRUint32 aFlags) const
}
nsGenericDOMDataNode*
nsTextNode::Clone(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
nsTextNode::CloneDataNode(nsINodeInfo *aNodeInfo, PRBool aCloneText) const
{
nsTextNode *it = new nsTextNode(aNodeInfo);
if (it && aCloneText) {

View File

@ -44,11 +44,13 @@ class nsXMLEventsElement : public nsXMLElement {
public:
nsXMLEventsElement(nsINodeInfo *aNodeInfo);
virtual ~nsXMLEventsElement();
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsXMLElement::)
NS_FORWARD_NSIDOMNODE(nsXMLElement::)
virtual nsIAtom *GetIDAttributeName() const;
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
nsXMLEventsElement::nsXMLEventsElement(nsINodeInfo *aNodeInfo)
@ -80,7 +82,7 @@ nsXMLEventsElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPref
aNotify);
}
NS_IMPL_DOM_CLONENODE(nsXMLEventsElement)
NS_IMPL_ELEMENT_CLONE(nsXMLEventsElement)
nsresult
NS_NewXMLEventsElement(nsIContent** aInstancePtrResult, nsINodeInfo *aNodeInfo)

View File

@ -277,15 +277,11 @@ nsGenericHTMLElement::Shutdown()
}
nsresult
nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst, PRBool aDeep) const
nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst) const
{
nsresult rv = NS_OK;
nsresult rv;
PRInt32 i, count = GetAttrCount();
nsAutoString value;
for (i = 0; i < count; ++i) {
// XXX Once we have access to existing nsDOMAttributes for this element, we
// should call CloneNode or ImportNode on them.
const nsAttrName *name = mAttrsAndChildren.AttrNameAt(i);
const nsAttrValue *value = mAttrsAndChildren.AttrAt(i);
if (name->Equals(nsHTMLAtoms::style, kNameSpaceID_None) &&
@ -330,20 +326,7 @@ nsGenericHTMLElement::CopyInnerTo(nsGenericElement* aDst, PRBool aDeep) const
}
}
nsIDocument *newDoc = aDst->GetOwnerDoc();
if (aDeep) {
nsIDocument *doc = GetOwnerDoc();
if (doc == newDoc) {
rv = CloneChildrenTo(aDst);
}
else {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(newDoc);
rv = ImportChildrenTo(aDst, domDoc);
}
}
return rv;
return NS_OK;
}
nsresult

View File

@ -105,7 +105,7 @@ public:
void **aInstancePtr);
// From nsGenericElement
nsresult CopyInnerTo(nsGenericElement* aDest, PRBool aDeep) const;
nsresult CopyInnerTo(nsGenericElement* aDest) const;
// Implementation for nsIDOMNode
NS_METHOD GetNodeName(nsAString& aNodeName);

View File

@ -79,7 +79,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -124,6 +124,8 @@ public:
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// The cached visited state
nsLinkState mLinkState;
@ -158,7 +160,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAnchorElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLAnchorElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAnchorElement)
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)

View File

@ -63,7 +63,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -107,6 +107,8 @@ public:
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// The cached visited state
nsLinkState mLinkState;
@ -140,7 +142,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAreaElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLAreaElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAreaElement)
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, AccessKey, accesskey)

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -71,6 +71,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -97,7 +98,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBRElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLBRElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLBRElement)
NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear)

View File

@ -96,7 +96,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -117,6 +117,7 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
BodyRule* mContentStyleRule;
@ -306,7 +307,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBodyElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLBodyElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLBodyElement)
NS_IMPL_URI_ATTR(nsHTMLBodyElement, Background, background)

View File

@ -73,7 +73,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -108,6 +108,8 @@ public:
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
PRInt8 mType;
PRPackedBool mHandlingClick;
@ -153,7 +155,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLButtonElement
NS_IMPL_DOM_CLONENODE(nsHTMLButtonElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLButtonElement)
// nsIDOMHTMLButtonElement

View File

@ -74,7 +74,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -111,6 +111,8 @@ public:
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsIntSize GetWidthHeight();
nsresult UpdateContext();
@ -158,7 +160,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLCanvasElement, nsGenericElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLCanvasElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLCanvasElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLCanvasElement)
nsIntSize
nsHTMLCanvasElement::GetWidthHeight()

View File

@ -53,7 +53,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -63,6 +63,8 @@ public:
// nsIDOMHTMLModElement
NS_DECL_NSIDOMHTMLMODELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -91,7 +93,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLModElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLModElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLModElement)
NS_IMPL_URI_ATTR(nsHTMLModElement, Cite, cite)

View File

@ -53,7 +53,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -70,6 +70,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -98,7 +99,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDivElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLDivElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLDivElement)
NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align)

View File

@ -56,7 +56,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -72,6 +72,7 @@ public:
NS_IMETHOD Reset();
NS_IMETHOD SubmitNamesValues(nsIFormSubmission* aFormSubmission,
nsIContent* aSubmitElement);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
// construction, destruction
@ -106,7 +107,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLFieldSetElement
NS_IMPL_DOM_CLONENODE(nsHTMLFieldSetElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement)
// nsIDOMHTMLFieldSetElement

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -75,6 +75,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -101,7 +102,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFontElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLFontElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFontElement)
NS_IMPL_STRING_ATTR(nsHTMLFontElement, Color, color)

View File

@ -146,7 +146,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -245,6 +245,8 @@ public:
nsIDOMNode* b,
PRInt32* retval);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsresult DoSubmitOrReset(nsEvent* aEvent,
PRInt32 aMessage);
@ -567,7 +569,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLFormElement
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsHTMLFormElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsHTMLFormElement)
NS_IMETHODIMP
nsHTMLFormElement::GetElements(nsIDOMHTMLCollection** aElements)

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
@ -72,6 +72,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -100,7 +101,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFrameElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLFrameElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFrameElement)
NS_IMPL_STRING_ATTR(nsHTMLFrameElement, FrameBorder, frameborder)

View File

@ -56,7 +56,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -88,6 +88,9 @@ public:
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
private:
nsresult ParseRowCol(const nsAString& aValue,
PRInt32& aNumSpecs,
@ -143,7 +146,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFrameSetElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLFrameSetElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLFrameSetElement)
NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Cols, cols)

View File

@ -56,7 +56,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -76,6 +76,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -104,7 +105,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHRElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLHRElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHRElement)
NS_IMPL_STRING_ATTR(nsHTMLHRElement, Align, align)

View File

@ -53,7 +53,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -63,6 +63,8 @@ public:
// nsIDOMHTMLHeadElement
NS_DECL_NSIDOMHTMLHEADELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -90,7 +92,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHeadElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLHeadElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHeadElement)
NS_IMPL_URI_ATTR(nsHTMLHeadElement, Profile, profile)

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -71,6 +71,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -98,7 +99,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHeadingElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLHeadingElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHeadingElement)
NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align)

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -64,6 +64,8 @@ public:
// nsIDOMHTMLHtmlElement
NS_DECL_NSIDOMHTMLHTMLELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -92,7 +94,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHtmlElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLHtmlElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHtmlElement)
NS_IMPL_STRING_ATTR(nsHTMLHtmlElement, Version, version)

View File

@ -55,7 +55,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFrameElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFrameElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFrameElement::)
@ -73,6 +73,8 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -99,7 +101,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLIFrameElement, nsGenericHTMLFrameEleme
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLIFrameElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLIFrameElement)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Align, align)

View File

@ -95,7 +95,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -146,6 +146,7 @@ public:
PRBool aCompileEventHandlers);
virtual PRInt32 IntrinsicState() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
void GetImageFrame(nsIImageFrame** aImageFrame);
@ -203,7 +204,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLImageElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLImageElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLImageElement)
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Name, name)

View File

@ -161,7 +161,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -237,6 +237,8 @@ public:
*/
virtual already_AddRefed<nsIRadioGroupContainer> GetRadioGroupContainer();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// Helper method
nsresult SetValueInternal(const nsAString& aValue,
@ -393,8 +395,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMNode
nsresult
nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const
nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aResult = nsnull;
@ -403,8 +404,8 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIContent> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it, aDeep);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);
NS_ENSURE_SUCCESS(rv, rv);
switch (mType) {
@ -445,12 +446,6 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
return NS_OK;
}
NS_IMETHODIMP
nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
{
return nsGenericElement::CloneNode(aDeep, this, aResult);
}
nsresult
nsHTMLInputElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue,

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -71,6 +71,7 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -98,7 +99,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLLIElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLLIElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLLIElement)
NS_IMPL_STRING_ATTR(nsHTMLLIElement, Type, type)

View File

@ -64,7 +64,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -101,6 +101,7 @@ public:
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
already_AddRefed<nsIContent> GetForContent();
@ -144,7 +145,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLLabelElement
NS_IMPL_DOM_CLONENODE(nsHTMLLabelElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLLabelElement)
NS_IMETHODIMP

View File

@ -61,7 +61,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -101,6 +101,8 @@ public:
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -132,7 +134,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLLegendElement
NS_IMPL_DOM_CLONENODE(nsHTMLLegendElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLLegendElement)
NS_IMETHODIMP

View File

@ -72,7 +72,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -109,6 +109,8 @@ public:
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual void GetStyleSheetURL(PRBool* aIsInline,
nsIURI** aURI);
@ -150,7 +152,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLLinkElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLLinkElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLLinkElement)
NS_IMETHODIMP

View File

@ -56,7 +56,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -72,6 +72,8 @@ public:
PRBool aCompileEventHandlers);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsRefPtr<nsContentList> mAreas;
};
@ -127,7 +129,7 @@ nsHTMLMapElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
NS_IMPL_DOM_CLONENODE(nsHTMLMapElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLMapElement)
NS_IMETHODIMP

View File

@ -53,7 +53,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -63,6 +63,8 @@ public:
// nsIDOMHTMLMetaElement
NS_DECL_NSIDOMHTMLMETAELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -92,7 +94,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLMetaElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLMetaElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLMetaElement)
NS_IMPL_STRING_ATTR(nsHTMLMetaElement, Content, content)

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -81,6 +81,7 @@ public:
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -115,8 +116,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedListElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedListElement,
nsIDOMHTMLOListElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSharedListElement)
NS_IMPL_BOOL_ATTR(nsHTMLSharedListElement, Compact, compact)

View File

@ -60,7 +60,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -107,6 +107,8 @@ public:
// nsObjectLoadingContent
virtual PRUint32 GetCapabilities() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
private:
/**
* Calls LoadObject with the correct arguments to start the plugin load.
@ -168,7 +170,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLObjectElement,
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLObjectElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLObjectElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLObjectElement)
NS_IMETHODIMP

View File

@ -63,7 +63,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -93,6 +93,7 @@ public:
AfterSetAttr(aNameSpaceID, aAttribute, nsnull, aNotify);
return rv;
}
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
@ -135,7 +136,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLOptGroupElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLOptGroupElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLOptGroupElement)
NS_IMPL_BOOL_ATTR(nsHTMLOptGroupElement, Disabled, disabled)

View File

@ -87,7 +87,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -123,6 +123,7 @@ public:
AfterSetAttr(aNameSpaceID, aAttribute, nsnull, aNotify);
return rv;
}
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
/**
@ -194,7 +195,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLOptionElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLOptionElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLOptionElement)
NS_IMETHODIMP

View File

@ -57,7 +57,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -74,6 +74,8 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -102,7 +104,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLParagraphElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLParagraphElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLParagraphElement)
NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -76,6 +76,8 @@ public:
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -103,7 +105,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLPreElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLPreElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLPreElement)
NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width)

View File

@ -327,7 +327,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -372,6 +372,8 @@ public:
virtual void DoneAddingChildren(PRBool aHaveNotified);
virtual PRBool IsDoneAddingChildren();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
PRBool IsOnloadEventForWindow();
@ -486,8 +488,7 @@ nsHTMLScriptElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
}
nsresult
nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const
nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aResult = nsnull;
@ -496,8 +497,8 @@ nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIContent> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it, aDeep);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);
NS_ENSURE_SUCCESS(rv, rv);
// The clone should be marked evaluated if we are. It should also be marked
@ -512,12 +513,6 @@ nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
return NS_OK;
}
NS_IMETHODIMP
nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
{
return nsGenericElement::CloneNode(aDeep, this, aResult);
}
NS_IMETHODIMP
nsHTMLScriptElement::GetText(nsAString& aValue)
{

View File

@ -231,7 +231,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -283,6 +283,7 @@ public:
PRInt32 aModType) const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// Helper Methods
@ -525,7 +526,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLSelectElement
NS_IMPL_DOM_CLONENODE(nsHTMLSelectElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSelectElement)
NS_IMETHODIMP

View File

@ -69,7 +69,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -105,6 +105,8 @@ public:
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -151,7 +153,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedElement, nsIDOMHTMLParamElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSharedElement)
// nsIDOMHTMLParamElement
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Name, name)

View File

@ -73,7 +73,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -126,6 +126,8 @@ public:
// nsObjectLoadingContent
virtual PRUint32 GetCapabilities() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
private:
/**
* Calls LoadObject with the correct arguments to start the plugin load.
@ -217,8 +219,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedObjectElement,
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE_AMBIGUOUS(nsHTMLSharedObjectElement,
nsIDOMHTMLAppletElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSharedObjectElement)
nsresult
nsHTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -64,6 +64,8 @@ public:
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -90,7 +92,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLSpanElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLSpanElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSpanElement)
nsresult
@ -124,9 +126,7 @@ public:
nsHTMLUnknownElement(nsINodeInfo *aNodeInfo);
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
nsresult Clone(nsINodeInfo *aNodeInfo, PRBool aDeep,
nsIContent **aResult) const;
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode **aResult);
nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_INTERFACE_MAP_BEGIN(nsHTMLUnknownElement)
@ -142,4 +142,4 @@ nsHTMLUnknownElement::nsHTMLUnknownElement(nsINodeInfo *aNodeInfo)
NS_IMPL_NS_NEW_HTML_ELEMENT(Unknown)
NS_IMPL_DOM_CLONENODE(nsHTMLUnknownElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLUnknownElement)

View File

@ -63,7 +63,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -96,6 +96,8 @@ public:
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
void GetStyleSheetURL(PRBool* aIsInline,
nsIURI** aURI);
@ -132,7 +134,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLStyleElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLStyleElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLStyleElement)
NS_IMETHODIMP

View File

@ -54,7 +54,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -71,6 +71,8 @@ public:
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -99,7 +101,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableCaptionElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableCaptionElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableCaptionElement)
NS_IMPL_STRING_ATTR(nsHTMLTableCaptionElement, Align, align)

View File

@ -57,7 +57,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -76,6 +76,8 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// This does not return a nsresult since all we care about is if we
// found the row element that this cell is in or not.
@ -108,7 +110,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableCellElement, nsGenericHTMLElement
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableCellElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableCellElement)
// protected method

View File

@ -58,7 +58,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -75,6 +75,8 @@ public:
nsAttrValue& aResult);
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -103,7 +105,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableColElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableColElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableColElement)
NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableColElement, Align, align, "left")

View File

@ -70,7 +70,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -88,6 +88,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
already_AddRefed<nsIDOMHTMLTableSectionElement> GetSection(nsIAtom *aTag);
@ -342,7 +344,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableElement)
// the DOM spec says border, cellpadding, cellSpacing are all "wstring"

View File

@ -64,7 +64,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -82,6 +82,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsresult GetSection(nsIDOMHTMLTableSectionElement** aSection);
nsresult GetTable(nsIDOMHTMLTableElement** aTable);
@ -134,7 +136,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableRowElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableRowElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableRowElement)
// protected method

View File

@ -59,7 +59,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -77,6 +77,8 @@ public:
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsRefPtr<nsContentList> mRows;
};
@ -102,7 +104,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableSectionElement,
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTableSectionElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTableSectionElement)
NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableSectionElement, Align, align, "left")

View File

@ -91,7 +91,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@ -141,6 +141,8 @@ public:
virtual void DoneAddingChildren(PRBool aHaveNotified);
virtual PRBool IsDoneAddingChildren();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsCOMPtr<nsIControllers> mControllers;
/** The current value. This is null if the frame owns the value. */
@ -208,7 +210,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
// nsIDOMHTMLTextAreaElement
NS_IMPL_DOM_CLONENODE(nsHTMLTextAreaElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTextAreaElement)
NS_IMETHODIMP

View File

@ -56,7 +56,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
@ -66,6 +66,8 @@ public:
// nsIDOMHTMLTitleElement
NS_DECL_NSIDOMHTMLTITLEELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
@ -93,7 +95,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTitleElement, nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_DOM_CLONENODE(nsHTMLTitleElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLTitleElement)
NS_IMETHODIMP

View File

@ -58,13 +58,15 @@ public:
NS_DECL_NSIDOMSVGCIRCLEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGCircleElementBase::)
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -108,7 +110,7 @@ nsSVGCircleElement::nsSVGCircleElement(nsINodeInfo *aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGCircleElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGCircleElement)
//----------------------------------------------------------------------
// nsIDOMSVGCircleElement methods

View File

@ -58,10 +58,12 @@ public:
NS_DECL_NSIDOMSVGCLIPPATHELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGClipPathElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGClipPathElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGClipPathElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGClipPathElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// nsIDOMSVGClipPathElement values
@ -140,5 +142,5 @@ NS_IMETHODIMP nsSVGClipPathElement::GetClipPathUnits(nsIDOMSVGAnimatedEnumeratio
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGClipPathElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGClipPathElement)

View File

@ -57,13 +57,14 @@ public:
NS_DECL_NSIDOMSVGDEFSELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGDefsElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGDefsElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGDefsElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDefsElementBase::)
// nsIContent
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
////////////////////////////////////////////////////////////////////////
@ -99,7 +100,7 @@ nsSVGDefsElement::nsSVGDefsElement(nsINodeInfo *aNodeInfo)
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGDefsElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGDefsElement)
//----------------------------------------------------------------------

View File

@ -57,9 +57,11 @@ public:
NS_DECL_NSIDOMSVGDESCELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGDescElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGDescElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGDescElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGDescElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(Desc)
@ -99,5 +101,5 @@ nsSVGDescElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGDescElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGDescElement)

View File

@ -59,13 +59,15 @@ public:
NS_DECL_NSIDOMSVGELLIPSEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGEllipseElementBase::)
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -110,7 +112,7 @@ nsSVGEllipseElement::nsSVGEllipseElement(nsINodeInfo *aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGEllipseElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGEllipseElement)
//----------------------------------------------------------------------
// nsIDOMSVGEllipseElement methods

View File

@ -135,7 +135,7 @@ nsSVGFilterElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFilterElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFilterElement)
//----------------------------------------------------------------------

View File

@ -67,7 +67,7 @@ public:
NS_DECL_NSIDOMSVGFILTERELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFilterElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFilterElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFilterElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFilterElementBase::)
@ -79,6 +79,8 @@ public:
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

View File

@ -219,12 +219,13 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEGaussianBlurElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEGaussianBlurElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEGaussianBlurElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEGaussianBlurElementBase::)
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual NumberAttributesInfo GetNumberInfo();
@ -289,7 +290,7 @@ nsSVGFEGaussianBlurElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEGaussianBlurElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEGaussianBlurElement)
//----------------------------------------------------------------------
@ -653,7 +654,7 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEComponentTransferElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEComponentTransferElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEComponentTransferElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEComponentTransferElementBase::)
// nsIContent
@ -661,6 +662,8 @@ public:
PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsCOMPtr<nsIDOMSVGAnimatedString> mIn1;
@ -712,7 +715,7 @@ nsSVGFEComponentTransferElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEComponentTransferElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEComponentTransferElement)
//----------------------------------------------------------------------
// nsIDOMSVGFEComponentTransferElement methods
@ -1173,10 +1176,10 @@ public:
NS_DECL_NSIDOMSVGFEFUNCRELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::)
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_ADDREF_INHERITED(nsSVGFEFuncRElement,nsSVGComponentTransferFunctionElement)
@ -1192,7 +1195,7 @@ NS_INTERFACE_MAP_BEGIN(nsSVGFEFuncRElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElement)
NS_IMPL_NS_NEW_SVG_ELEMENT(FEFuncR)
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEFuncRElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEFuncRElement)
class nsSVGFEFuncGElement : public nsSVGComponentTransferFunctionElement,
@ -1213,10 +1216,10 @@ public:
NS_DECL_NSIDOMSVGFEFUNCGELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::)
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_ADDREF_INHERITED(nsSVGFEFuncGElement,nsSVGComponentTransferFunctionElement)
@ -1232,7 +1235,7 @@ NS_INTERFACE_MAP_BEGIN(nsSVGFEFuncGElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElement)
NS_IMPL_NS_NEW_SVG_ELEMENT(FEFuncG)
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEFuncGElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEFuncGElement)
class nsSVGFEFuncBElement : public nsSVGComponentTransferFunctionElement,
@ -1253,10 +1256,10 @@ public:
NS_DECL_NSIDOMSVGFEFUNCBELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::)
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_ADDREF_INHERITED(nsSVGFEFuncBElement,nsSVGComponentTransferFunctionElement)
@ -1272,7 +1275,7 @@ NS_INTERFACE_MAP_BEGIN(nsSVGFEFuncBElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElement)
NS_IMPL_NS_NEW_SVG_ELEMENT(FEFuncB)
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEFuncBElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEFuncBElement)
class nsSVGFEFuncAElement : public nsSVGComponentTransferFunctionElement,
@ -1293,10 +1296,10 @@ public:
NS_DECL_NSIDOMSVGFEFUNCAELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE(nsSVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGComponentTransferFunctionElement::)
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_ADDREF_INHERITED(nsSVGFEFuncAElement,nsSVGComponentTransferFunctionElement)
@ -1312,7 +1315,7 @@ NS_INTERFACE_MAP_BEGIN(nsSVGFEFuncAElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElement)
NS_IMPL_NS_NEW_SVG_ELEMENT(FEFuncA)
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEFuncAElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEFuncAElement)
//---------------------Merge------------------------
@ -1344,7 +1347,7 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMergeElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEMergeElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEMergeElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEMergeElementBase::)
// nsIContent
@ -1352,8 +1355,7 @@ public:
PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(FEMerge)
@ -1389,7 +1391,7 @@ nsSVGFEMergeElement::~nsSVGFEMergeElement()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEMergeElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMergeElement)
NS_IMETHODIMP
nsSVGFEMergeElement::Filter(nsSVGFilterInstance *instance)
@ -1552,9 +1554,11 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMergeNodeElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEMergeNodeElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEMergeNodeElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEMergeNodeElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsCOMPtr<nsIDOMSVGAnimatedString> mIn1;
};
@ -1603,7 +1607,7 @@ nsSVGFEMergeNodeElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEMergeNodeElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMergeNodeElement)
NS_IMETHODIMP
nsSVGFEMergeNodeElement::WillModifySVGObservable(nsISVGValue* observable,
@ -1679,9 +1683,11 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEOffsetElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEOffsetElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEOffsetElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEOffsetElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual NumberAttributesInfo GetNumberInfo();
@ -1744,7 +1750,7 @@ nsSVGFEOffsetElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEOffsetElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEOffsetElement)
//----------------------------------------------------------------------
@ -1896,11 +1902,10 @@ public:
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEUnimplementedMOZElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGFEUnimplementedMOZElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGFEUnimplementedMOZElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGFEUnimplementedMOZElementBase::)
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(FEUnimplementedMOZ)
@ -1936,7 +1941,7 @@ nsSVGFEUnimplementedMOZElement::~nsSVGFEUnimplementedMOZElement()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGFEUnimplementedMOZElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEUnimplementedMOZElement)
NS_IMETHODIMP
nsSVGFEUnimplementedMOZElement::Filter(nsSVGFilterInstance *instance)

View File

@ -78,7 +78,7 @@ nsSVGForeignObjectElement::nsSVGForeignObjectElement(nsINodeInfo *aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGForeignObjectElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGForeignObjectElement)
//----------------------------------------------------------------------
// nsIDOMSVGForeignObjectElement methods:

View File

@ -62,13 +62,15 @@ public:
NS_DECL_NSIDOMSVGFOREIGNOBJECTELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGForeignObjectElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGForeignObjectElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGForeignObjectElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
// nsIContent interface
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

View File

@ -57,13 +57,14 @@ public:
NS_DECL_NSIDOMSVGGELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGGElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGGElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGGElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGGElementBase::)
// nsIContent
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
protected:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
////////////////////////////////////////////////////////////////////////
@ -101,7 +102,7 @@ nsSVGGElement::nsSVGGElement(nsINodeInfo *aNodeInfo)
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGGElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGGElement)
//----------------------------------------------------------------------

View File

@ -245,7 +245,7 @@ nsSVGLinearGradientElement::nsSVGLinearGradientElement(nsINodeInfo* aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGLinearGradientElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGLinearGradientElement)
//----------------------------------------------------------------------
// nsIDOMSVGLinearGradientElement methods
@ -324,7 +324,7 @@ nsSVGRadialGradientElement::nsSVGRadialGradientElement(nsINodeInfo* aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGRadialGradientElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGRadialGradientElement)
//----------------------------------------------------------------------
// nsIDOMSVGRadialGradientElement methods

View File

@ -110,9 +110,11 @@ public:
// The Gradient Element base class implements these
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLinearGradientElementBase::)
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGLinearGradientElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGLinearGradientElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGLinearGradientElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -149,10 +151,12 @@ public:
NS_DECL_NSIDOMSVGRADIALGRADIENTELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGRadialGradientElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGRadialGradientElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGRadialGradientElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRadialGradientElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

View File

@ -79,7 +79,7 @@ public:
NS_DECL_NSIDOMSVGURIREFERENCE
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGImageElementBase::)
@ -99,6 +99,8 @@ public:
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -193,7 +195,7 @@ nsSVGImageElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGImageElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGImageElement)
//----------------------------------------------------------------------

View File

@ -58,7 +58,7 @@ public:
NS_DECL_NSIDOMSVGLINEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGLineElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGLineElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGLineElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLineElementBase::)
@ -70,6 +70,8 @@ public:
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -114,7 +116,7 @@ nsSVGLineElement::nsSVGLineElement(nsINodeInfo *aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGLineElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGLineElement)
//----------------------------------------------------------------------
// nsIDOMSVGLineElement methods

View File

@ -152,7 +152,7 @@ nsSVGMarkerElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGMarkerElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGMarkerElement)
//----------------------------------------------------------------------
// nsIDOMSVGFitToViewBox methods

View File

@ -64,7 +64,7 @@ public:
NS_DECL_NSIDOMSVGFITTOVIEWBOX
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::)
NS_FORWARD_NSIDOMNODE(nsSVGElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
@ -88,6 +88,8 @@ public:
nsIDOMSVGMatrix **_retval);
nsresult GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
void SetParentCoordCtxProvider(nsSVGCoordCtxProvider *aContext);

View File

@ -121,7 +121,7 @@ nsSVGMaskElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode method
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGMaskElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGMaskElement)
//----------------------------------------------------------------------
// nsIDOMSVGMaskElement methods

View File

@ -63,10 +63,12 @@ public:
// Mask Element
NS_DECL_NSIDOMSVGMASKELEMENT
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::)
NS_FORWARD_NSIDOMNODE(nsSVGElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

View File

@ -57,9 +57,11 @@ public:
NS_DECL_NSIDOMSVGMETADATAELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::)
NS_FORWARD_NSIDOMNODE(nsSVGElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(Metadata)
@ -99,4 +101,4 @@ nsSVGMetadataElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGMetadataElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGMetadataElement)

View File

@ -86,7 +86,7 @@ nsSVGPathElement::~nsSVGPathElement()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGPathElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPathElement)
//----------------------------------------------------------------------
// nsIDOMSVGPathElement methods:

View File

@ -104,7 +104,7 @@ public:
NS_DECL_NSIDOMSVGANIMATEDPATHDATA
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::)
@ -123,6 +123,8 @@ public:
virtual nsSVGFlattenedPath *GetFlattenedPath(nsIDOMSVGMatrix *aMatrix);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual NumberAttributesInfo GetNumberInfo();

View File

@ -186,7 +186,7 @@ nsSVGPatternElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode method
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGPatternElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPatternElement)
//----------------------------------------------------------------------
// nsIDOMSVGFitToViewBox methods

View File

@ -80,13 +80,15 @@ public:
// Mutation Observer
NS_DECL_NSIMUTATIONOBSERVER
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::)
NS_FORWARD_NSIDOMNODE(nsSVGElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
// nsIContent interface
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
void PushUpdate();

View File

@ -56,13 +56,15 @@ public:
NS_DECL_NSIDOMSVGPOLYGONELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPolygonElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGPolygonElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGPolygonElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolygonElementBase::)
// nsSVGPathGeometryElement methods:
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(Polygon)
@ -93,7 +95,7 @@ nsSVGPolygonElement::nsSVGPolygonElement(nsINodeInfo* aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGPolygonElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPolygonElement)
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods

View File

@ -56,10 +56,12 @@ public:
NS_DECL_NSIDOMSVGPOLYLINEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPolylineElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGPolylineElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGPolylineElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolylineElementBase::)
// nsIContent interface
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(Polyline)
@ -90,5 +92,4 @@ nsSVGPolylineElement::nsSVGPolylineElement(nsINodeInfo* aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGPolylineElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPolylineElement)

View File

@ -58,13 +58,15 @@ public:
NS_DECL_NSIDOMSVGRECTELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRectElementBase::)
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(cairo_t *aCtx);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -111,7 +113,7 @@ nsSVGRectElement::nsSVGRectElement(nsINodeInfo *aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGRectElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGRectElement)
//----------------------------------------------------------------------
// nsIDOMSVGRectElement methods

View File

@ -193,7 +193,7 @@ nsSVGSVGElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGSVGElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSVGElement)
//----------------------------------------------------------------------

View File

@ -81,7 +81,7 @@ public:
NS_DECL_NSIDOMSVGZOOMANDPAN
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGSVGElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGSVGElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGSVGElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSVGElementBase::)
@ -116,6 +116,7 @@ public:
// public helpers:
nsresult GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// nsSVGElement overrides

View File

@ -79,7 +79,7 @@ public:
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGScriptElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGScriptElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGScriptElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGScriptElementBase::)
@ -103,6 +103,8 @@ public:
PRBool aCompileEventHandlers);
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
/**
@ -180,7 +182,7 @@ nsSVGScriptElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGScriptElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGScriptElement)
//----------------------------------------------------------------------
// nsIDOMSVGScriptElement methods

View File

@ -61,7 +61,7 @@ public:
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGStopElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGStopElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGStopElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGStopElementBase::)
@ -70,6 +70,7 @@ public:
PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
@ -109,7 +110,7 @@ nsSVGStopElement::nsSVGStopElement(nsINodeInfo* aNodeInfo)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGStopElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGStopElement)
//----------------------------------------------------------------------
// nsIDOMSVGStopElement methods

View File

@ -59,7 +59,7 @@ public:
NS_DECL_NSIDOMSVGSTYLEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGStyleElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGStyleElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGStyleElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGStyleElementBase::)
@ -82,9 +82,12 @@ public:
PRBool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// Dummy init method to make the NS_IMPL_NS_NEW_SVG_ELEMENT and
// NS_IMPL_DOM_CLONENODE_WITH_INIT usable with this class. This should be
// NS_IMPL_ELEMENT_CLONE_WITH_INIT usable with this class. This should be
// completely optimized away.
inline nsresult Init()
{
@ -134,7 +137,7 @@ nsSVGStyleElement::nsSVGStyleElement(nsINodeInfo *aNodeInfo)
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGStyleElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGStyleElement)
//----------------------------------------------------------------------

View File

@ -65,13 +65,15 @@ public:
NS_DECL_NSIDOMSVGFITTOVIEWBOX
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::)
NS_FORWARD_NSIDOMNODE(nsSVGElement::)
NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
// nsIContent interface
NS_IMETHODIMP_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
nsCOMPtr<nsIDOMSVGAnimatedRect> mViewBox;
@ -142,7 +144,7 @@ nsSVGSymbolElement::Init()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGSymbolElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSymbolElement)
//----------------------------------------------------------------------
// nsIDOMSVGFitToViewBox methods

View File

@ -70,7 +70,7 @@ public:
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMNODE(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
@ -80,6 +80,8 @@ public:
// nsISVGContent specializations:
virtual void ParentChainChanged();
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
// nsSVGElement overrides
virtual PRBool IsEventName(nsIAtom* aName);
@ -187,7 +189,7 @@ nsSVGTSpanElement::Init()
// nsIDOMNode methods
NS_IMPL_DOM_CLONENODE_WITH_INIT(nsSVGTSpanElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
//----------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More