From fd98991136f0d96f567e3fb4bb377848abba6fcc Mon Sep 17 00:00:00 2001 From: "caillon%returnzero.com" Date: Tue, 24 Jun 2003 21:39:39 +0000 Subject: [PATCH] 210451 - Implement getting Node.textContent (see the DOM3 WD) r+sr=jst@netscape.com --- content/base/src/nsDOMAttribute.cpp | 83 +++++++++++-- content/base/src/nsDocument.cpp | 67 +++++++++- content/base/src/nsDocumentFragment.cpp | 107 ++++++++++++++-- content/base/src/nsGenericDOMDataNode.cpp | 7 +- content/base/src/nsGenericDOMDataNode.h | 12 +- content/base/src/nsGenericElement.cpp | 116 +++++++++++++++++- content/base/src/nsGenericElement.h | 7 ++ content/html/document/src/nsHTMLDocument.cpp | 33 ----- content/html/document/src/nsHTMLDocument.h | 2 +- content/xul/content/src/nsXULAttributes.cpp | 44 ------- content/xul/content/src/nsXULAttributes.h | 7 +- dom/public/idl/core/Makefile.in | 1 + dom/public/idl/core/nsIDOM3Node.idl | 39 +++++- dom/public/idl/core/nsIDOMUserDataHandler.idl | 58 +++++++++ 14 files changed, 457 insertions(+), 126 deletions(-) create mode 100644 dom/public/idl/core/nsIDOMUserDataHandler.idl diff --git a/content/base/src/nsDOMAttribute.cpp b/content/base/src/nsDOMAttribute.cpp index 53be98774716..2058d78b9358 100644 --- a/content/base/src/nsDOMAttribute.cpp +++ b/content/base/src/nsDOMAttribute.cpp @@ -646,19 +646,82 @@ nsDOMAttribute::IsSameNode(nsIDOMNode* aOther, return NS_OK; } -NS_IMETHODIMP -nsDOMAttribute::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) +NS_IMETHODIMP +nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther, + PRBool* aReturn) { - aPrefix.Truncate(); - nsresult rv = NS_OK; - nsCOMPtr node(do_QueryInterface(mContent)); - if (node) - rv = node->LookupNamespacePrefix(aNamespaceURI, aPrefix); - return rv; + NS_NOTYETIMPLEMENTED("nsDocument::IsEqualNode()"); + + return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP +NS_IMETHODIMP +nsDOMAttribute::IsDefaultNamespace(const nsAString& aNamespaceURI, + PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDOMAttribute::IsDefaultNamespace()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDOMAttribute::GetTextContent(nsAString &aTextContent) +{ + return GetNodeValue(aTextContent); +} + +NS_IMETHODIMP +nsDOMAttribute::SetTextContent(const nsAString& aTextContent) +{ + return SetNodeValue(aTextContent); +} + + +NS_IMETHODIMP +nsDOMAttribute::GetFeature(const nsAString& aFeature, + const nsAString& aVersion, + nsISupports** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::GetFeature()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDOMAttribute::SetUserData(const nsAString& aKey, + nsIVariant* aData, + nsIDOMUserDataHandler* aHandler, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::SetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDOMAttribute::GetUserData(const nsAString& aKey, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::GetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDOMAttribute::LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix) +{ + aPrefix.Truncate(); + + nsCOMPtr node(do_QueryInterface(mContent)); + if (node) { + return node->LookupPrefix(aNamespaceURI, aPrefix); + } + + return NS_OK; +} + +NS_IMETHODIMP nsDOMAttribute::LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI) { diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 1d80a74e4bf8..42a4c34ff76a 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3413,6 +3413,21 @@ nsDocument::GetBaseURI(nsAString &aURI) return NS_OK; } +NS_IMETHODIMP +nsDocument::GetTextContent(nsAString &aTextContent) +{ + SetDOMStringToNull(aTextContent); + + return NS_OK; +} + +NS_IMETHODIMP +nsDocument::SetTextContent(const nsAString& aTextContent) +{ + return NS_OK; +} + + NS_IMETHODIMP nsDocument::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn) { @@ -3500,8 +3515,56 @@ nsDocument::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn) } NS_IMETHODIMP -nsDocument::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) +nsDocument::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::IsEqualNode()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocument::IsDefaultNamespace(const nsAString& aNamespaceURI, + PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::IsDefaultNamespace()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocument::GetFeature(const nsAString& aFeature, + const nsAString& aVersion, + nsISupports** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::GetFeature()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocument::SetUserData(const nsAString& aKey, + nsIVariant* aData, + nsIDOMUserDataHandler* aHandler, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::SetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocument::GetUserData(const nsAString& aKey, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocument::GetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + + +NS_IMETHODIMP +nsDocument::LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix) { aPrefix.Truncate(); diff --git a/content/base/src/nsDocumentFragment.cpp b/content/base/src/nsDocumentFragment.cpp index fa859813c83e..507e94b32f65 100644 --- a/content/base/src/nsDocumentFragment.cpp +++ b/content/base/src/nsDocumentFragment.cpp @@ -124,19 +124,7 @@ public: aReturn); } // nsIDOM3Node - NS_IMETHOD GetBaseURI(nsAString& aURI) - { aURI.Truncate(); return NS_OK; } - NS_IMETHOD CompareDocumentPosition(nsIDOMNode *aOther, - PRUint16* aReturn); - NS_IMETHOD IsSameNode(nsIDOMNode *aOther, PRBool* aReturn); - NS_IMETHOD LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) { - aPrefix.Truncate(); return NS_OK; - } - NS_IMETHOD LookupNamespaceURI(const nsAString& aNamespacePrefix, - nsAString& aNamespaceURI) { - aNamespaceURI.Truncate(); return NS_OK; - } + NS_DECL_NSIDOM3NODE // nsIContent NS_IMETHOD SetParent(nsIContent* aParent) @@ -386,6 +374,41 @@ nsDocumentFragment::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) return CallQueryInterface(newFragment, aReturn); } +NS_IMETHODIMP +nsDocumentFragment::GetBaseURI(nsAString& aURI) +{ + aURI.Truncate(); + + return NS_OK; +} + +NS_IMETHODIMP +nsDocumentFragment::LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix) +{ + aPrefix.Truncate(); + + return NS_OK; +} + +NS_IMETHODIMP +nsDocumentFragment::LookupNamespaceURI(const nsAString& aNamespacePrefix, + nsAString& aNamespaceURI) +{ + aNamespaceURI.Truncate(); + + return NS_OK; +} + +NS_IMETHODIMP +nsDocumentFragment::IsDefaultNamespace(const nsAString& aNamespaceURI, + PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocumentFragment::IsDefaultNamespace()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP nsDocumentFragment::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn) @@ -455,3 +478,61 @@ nsDocumentFragment::IsSameNode(nsIDOMNode* aOther, return NS_OK; } +NS_IMETHODIMP +nsDocumentFragment::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocumentFragment::IsEqualNode()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocumentFragment::GetFeature(const nsAString& aFeature, + const nsAString& aVersion, + nsISupports** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocumentFragment::GetFeature()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocumentFragment::SetUserData(const nsAString& aKey, + nsIVariant* aData, + nsIDOMUserDataHandler* aHandler, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocumentFragment::SetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocumentFragment::GetUserData(const nsAString& aKey, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsDocumentFragment::GetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsDocumentFragment::GetTextContent(nsAString &aTextContent) +{ + if (mOwnerDocument) { + return nsNode3Tearoff::GetTextContent(mOwnerDocument, + this, + aTextContent); + } + + SetDOMStringToNull(aTextContent); + + return NS_OK; +} + +NS_IMETHODIMP +nsDocumentFragment::SetTextContent(const nsAString& aTextContent) +{ + return NS_OK; +} + diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp index 63a50f4b2f86..76ced9333f6c 100644 --- a/content/base/src/nsGenericDOMDataNode.cpp +++ b/content/base/src/nsGenericDOMDataNode.cpp @@ -309,8 +309,8 @@ nsGenericDOMDataNode::GetBaseURI(nsAString& aURI) } nsresult -nsGenericDOMDataNode::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) +nsGenericDOMDataNode::LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix) { aPrefix.Truncate(); @@ -318,9 +318,8 @@ nsGenericDOMDataNode::LookupNamespacePrefix(const nsAString& aNamespaceURI, // DOM Data Node passes the query on to its parent nsCOMPtr node(do_QueryInterface(parent_weak)); - if (node) { - return node->LookupNamespacePrefix(aNamespaceURI, aPrefix); + return node->LookupPrefix(aNamespaceURI, aPrefix); } return NS_OK; diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 869b64708001..8746da1c7501 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -150,8 +150,8 @@ public: const nsAString& aVersion, PRBool* aReturn); nsresult GetBaseURI(nsAString& aURI); - nsresult LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix); + nsresult LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix); nsresult LookupNamespaceURI(const nsAString& aNamespacePrefix, nsAString& aNamespaceURI); @@ -392,10 +392,10 @@ private: NS_IMETHOD GetBaseURI(nsAString& aURI) { \ return nsGenericDOMDataNode::GetBaseURI(aURI); \ } \ - NS_IMETHOD LookupNamespacePrefix(const nsAString& aNamespaceURI, \ - nsAString& aPrefix) { \ - return nsGenericDOMDataNode::LookupNamespacePrefix(aNamespaceURI, \ - aPrefix); \ + NS_IMETHOD LookupPrefix(const nsAString& aNamespaceURI, \ + nsAString& aPrefix) { \ + return nsGenericDOMDataNode::LookupPrefix(aNamespaceURI, \ + aPrefix); \ } \ NS_IMETHOD LookupNamespaceURI(const nsAString& aNamespacePrefix, \ nsAString& aNamespaceURI) { \ diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index d8acba4cfdc9..3fa92d265856 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -42,6 +42,7 @@ #include "nsIAtom.h" #include "nsINodeInfo.h" #include "nsIDocument.h" +#include "nsIDocumentEncoder.h" #include "nsIDOMNodeList.h" #include "nsIDOMDocument.h" #include "nsIDOMRange.h" @@ -234,6 +235,71 @@ nsNode3Tearoff::GetBaseURI(nsAString& aURI) return NS_OK; } +NS_IMETHODIMP +nsNode3Tearoff::GetTextContent(nsAString &aTextContent) +{ + nsCOMPtr node(do_QueryInterface(mContent)); + NS_ASSERTION(node, "We have an nsIContent which doesn't support nsIDOMNode"); + + PRUint16 nodeType; + node->GetNodeType(&nodeType); + if (nodeType == nsIDOMNode::DOCUMENT_TYPE_NODE || + nodeType == nsIDOMNode::NOTATION_NODE) { + SetDOMStringToNull(aTextContent); + + return NS_OK; + } + + if (nodeType == nsIDOMNode::TEXT_NODE || + nodeType == nsIDOMNode::CDATA_SECTION_NODE || + nodeType == nsIDOMNode::COMMENT_NODE || + nodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) { + return node->GetNodeValue(aTextContent); + } + + nsCOMPtr doc; + mContent->GetDocument(getter_AddRefs(doc)); + if (!doc) { + NS_ERROR("Need a document to do text serialization"); + + return NS_ERROR_FAILURE; + } + + return GetTextContent(doc, node, aTextContent); +} + +// static +nsresult +nsNode3Tearoff::GetTextContent(nsIDocument *aDocument, + nsIDOMNode *aNode, + nsAString &aTextContent) +{ + NS_ENSURE_ARG_POINTER(aDocument); + NS_ENSURE_ARG_POINTER(aNode); + + nsCOMPtr docEncoder = + do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "text/plain"); + + if (!docEncoder) { + NS_ERROR("Could not get a document encoder."); + + return NS_ERROR_FAILURE; + } + + docEncoder->Init(aDocument, NS_LITERAL_STRING("text/plain"), + nsIDocumentEncoder::OutputRaw); + + docEncoder->SetNode(aNode); + + return docEncoder->EncodeToString(aTextContent); +} + +NS_IMETHODIMP +nsNode3Tearoff::SetTextContent(const nsAString &aTextContent) +{ + return NS_OK; +} + NS_IMETHODIMP nsNode3Tearoff::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn) @@ -310,8 +376,46 @@ nsNode3Tearoff::IsSameNode(nsIDOMNode* aOther, } NS_IMETHODIMP -nsNode3Tearoff::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) +nsNode3Tearoff::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsNode3Tearoff::IsEqualNode()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsNode3Tearoff::GetFeature(const nsAString& aFeature, + const nsAString& aVersion, + nsISupports** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsNode3Tearoff::GetFeature()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsNode3Tearoff::SetUserData(const nsAString& aKey, + nsIVariant* aData, + nsIDOMUserDataHandler* aHandler, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsNode3Tearoff::SetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsNode3Tearoff::GetUserData(const nsAString& aKey, + nsIVariant** aReturn) +{ + NS_NOTYETIMPLEMENTED("nsNode3Tearoff::GetUserData()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsNode3Tearoff::LookupPrefix(const nsAString& aNamespaceURI, + nsAString& aPrefix) { SetDOMStringToNull(aPrefix); @@ -395,6 +499,14 @@ nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix, return NS_OK; } +NS_IMETHODIMP +nsNode3Tearoff::IsDefaultNamespace(const nsAString& aNamespaceURI, + PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("nsNode3Tearoff::IsDefaultNamespace()"); + + return NS_ERROR_NOT_IMPLEMENTED; +} nsDOMEventRTTearoff * nsDOMEventRTTearoff::mCachedEventTearoff[NS_EVENT_TEAROFF_CACHE_SIZE]; diff --git a/content/base/src/nsGenericElement.h b/content/base/src/nsGenericElement.h index 60bdfb5147e1..833e7e7ee2ea 100644 --- a/content/base/src/nsGenericElement.h +++ b/content/base/src/nsGenericElement.h @@ -230,6 +230,7 @@ public: */ class nsNode3Tearoff : public nsIDOM3Node { +public: NS_DECL_ISUPPORTS NS_DECL_NSIDOM3NODE @@ -237,6 +238,12 @@ class nsNode3Tearoff : public nsIDOM3Node nsNode3Tearoff(nsIContent *aContent) : mContent(aContent) { } + + static nsresult GetTextContent(nsIDocument *aDoc, + nsIDOMNode *aNode, + nsAString &aTextContent); + +protected: virtual ~nsNode3Tearoff() {}; private: diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 7a80089f4dca..f250119dd7e2 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1871,42 +1871,9 @@ nsHTMLDocument::GetBaseURI(nsAString &aURI) return NS_OK; } -NS_IMETHODIMP -nsHTMLDocument::CompareDocumentPosition(nsIDOMNode* aOther, - PRUint16* aReturn) -{ - return nsDocument::CompareDocumentPosition(aOther, aReturn); -} - -NS_IMETHODIMP -nsHTMLDocument::IsSameNode(nsIDOMNode* aOther, - PRBool* aReturn) -{ - return nsDocument::IsSameNode(aOther, aReturn); -} - - -NS_IMETHODIMP -nsHTMLDocument::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) -{ - return nsDocument::LookupNamespacePrefix(aNamespaceURI, aPrefix); -} - -NS_IMETHODIMP -nsHTMLDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix, - nsAString& aNamespaceURI) -{ - return nsDocument::LookupNamespaceURI(aNamespacePrefix, aNamespaceURI); -} - - // // nsIDOMHTMLDocument interface implementation // -// see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#ID-1006298752 -// for full specification. -// NS_IMETHODIMP nsHTMLDocument::GetTitle(nsAString& aTitle) { diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 1388fc301218..521099f4fa86 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -163,7 +163,7 @@ public: NS_DECL_NSIDOMNODE // nsIDOM3Node interface - NS_DECL_NSIDOM3NODE + NS_IMETHOD GetBaseURI(nsAString& aBaseURI); // nsIDOMHTMLDocument interface NS_IMETHOD GetTitle(nsAString & aTitle); diff --git a/content/xul/content/src/nsXULAttributes.cpp b/content/xul/content/src/nsXULAttributes.cpp index cf99c648e46a..1f32c276208e 100644 --- a/content/xul/content/src/nsXULAttributes.cpp +++ b/content/xul/content/src/nsXULAttributes.cpp @@ -193,7 +193,6 @@ nsXULAttribute::Create(nsIContent* aContent, NS_INTERFACE_MAP_BEGIN(nsXULAttribute) NS_INTERFACE_MAP_ENTRY(nsIDOMAttr) NS_INTERFACE_MAP_ENTRY(nsIDOMNode) - NS_INTERFACE_MAP_ENTRY(nsIDOM3Node) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMAttr) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XULAttr) NS_INTERFACE_MAP_END @@ -391,49 +390,6 @@ nsXULAttribute::IsSupported(const nsAString& aFeature, return NS_ERROR_NOT_IMPLEMENTED; } -// nsIDOM3Node interface - -NS_IMETHODIMP -nsXULAttribute::GetBaseURI(nsAString &aURI) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULAttribute::CompareDocumentPosition(nsIDOMNode* aOther, - PRUint16* aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULAttribute::IsSameNode(nsIDOMNode* aOther, - PRBool* aReturn) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP -nsXULAttribute::LookupNamespacePrefix(const nsAString& aNamespaceURI, - nsAString& aPrefix) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsXULAttribute::LookupNamespaceURI(const nsAString& aNamespacePrefix, - nsAString& aNamespaceURI) -{ - NS_NOTYETIMPLEMENTED("write me"); - return NS_ERROR_NOT_IMPLEMENTED; -} - - // nsIDOMAttr interface NS_IMETHODIMP diff --git a/content/xul/content/src/nsXULAttributes.h b/content/xul/content/src/nsXULAttributes.h index fc054b8a3d65..91a201f7037b 100644 --- a/content/xul/content/src/nsXULAttributes.h +++ b/content/xul/content/src/nsXULAttributes.h @@ -53,7 +53,6 @@ #include "nsIAtom.h" #include "nsVoidArray.h" #include "nsXULAttributeValue.h" -#include "nsIDOM3Node.h" class nsIURI; class nsINodeInfo; @@ -111,8 +110,7 @@ public: //////////////////////////////////////////////////////////////////////// -class nsXULAttribute : public nsIDOMAttr, - public nsIDOM3Node +class nsXULAttribute : public nsIDOMAttr { protected: nsXULAttribute(nsIContent* aContent, @@ -134,9 +132,6 @@ public: // nsIDOMNode interface NS_DECL_NSIDOMNODE - // nsIDOM3Node interface - NS_DECL_NSIDOM3NODE - // nsIDOMAttr interface NS_DECL_NSIDOMATTR diff --git a/dom/public/idl/core/Makefile.in b/dom/public/idl/core/Makefile.in index 1fd678ce16bd..1d487422633a 100644 --- a/dom/public/idl/core/Makefile.in +++ b/dom/public/idl/core/Makefile.in @@ -54,6 +54,7 @@ XPIDLSRCS = \ nsIDOM3Node.idl \ nsIDOMNSDocument.idl \ nsIDOMXMLDocument.idl \ + nsIDOMUserDataHandler.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/public/idl/core/nsIDOM3Node.idl b/dom/public/idl/core/nsIDOM3Node.idl index cae8105fbcbb..9071ba936da2 100644 --- a/dom/public/idl/core/nsIDOM3Node.idl +++ b/dom/public/idl/core/nsIDOM3Node.idl @@ -40,14 +40,15 @@ #include "domstubs.idl" +interface nsIVariant; +interface nsIDOMUserDataHandler; + + [scriptable, uuid(29fb2a18-1dd2-11b2-8dd9-a6fd5d5ad12f)] interface nsIDOM3Node : nsISupports { - readonly attribute DOMString baseURI; - unsigned short compareDocumentPosition(in nsIDOMNode other); - boolean isSameNode(in nsIDOMNode other); - DOMString lookupNamespacePrefix(in DOMString namespaceURI); - DOMString lookupNamespaceURI(in DOMString prefix); + // Introduced in DOM Level 3: + readonly attribute DOMString baseURI; // DocumentPosition const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; @@ -56,4 +57,32 @@ interface nsIDOM3Node : nsISupports const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + + // Introduced in DOM Level 3: + unsigned short compareDocumentPosition(in nsIDOMNode other) + raises(DOMException); + // Introduced in DOM Level 3: + attribute DOMString textContent; + // raises(DOMException) on setting + // raises(DOMException) on retrieval + + // Introduced in DOM Level 3: + boolean isSameNode(in nsIDOMNode other); + // Introduced in DOM Level 3: + DOMString lookupPrefix(in DOMString namespaceURI); + // Introduced in DOM Level 3: + boolean isDefaultNamespace(in DOMString namespaceURI); + // Introduced in DOM Level 3: + DOMString lookupNamespaceURI(in DOMString prefix); + // Introduced in DOM Level 3: + boolean isEqualNode(in nsIDOMNode arg); + // Introduced in DOM Level 3: + nsISupports getFeature(in DOMString feature, + in DOMString version); + // Introduced in DOM Level 3: + nsIVariant setUserData(in DOMString key, + in nsIVariant data, + in nsIDOMUserDataHandler handler); + // Introduced in DOM Level 3: + nsIVariant getUserData(in DOMString key); }; diff --git a/dom/public/idl/core/nsIDOMUserDataHandler.idl b/dom/public/idl/core/nsIDOMUserDataHandler.idl new file mode 100644 index 000000000000..756e039d840d --- /dev/null +++ b/dom/public/idl/core/nsIDOMUserDataHandler.idl @@ -0,0 +1,58 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org Code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Christopher A. Aillon (Original Author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "domstubs.idl" +#include "nsIVariant.idl" + + +// Introduced in DOM Level 3: + +[scriptable, function, uuid(5470deff-03c9-41b7-a824-e3225266b343)] +interface nsIDOMUserDataHandler +{ + // OperationType + const unsigned short NODE_CLONED = 1; + const unsigned short NODE_IMPORTED = 2; + const unsigned short NODE_DELETED = 3; + const unsigned short NODE_RENAMED = 4; + + void handle(in unsigned short operation, + in DOMString key, + in nsIVariant data, + in nsIDOMNode src, + in nsIDOMNode dst); +};