Part 9 of fix for bug 560273 (Stop using DOM tearoffs from quickstubs) - use nsNode3Tearoff for all nodes. r=jst.

--HG--
extra : rebase_source : 4f073ae38036328091d2d4cf1e0ffbac2a06e98b
This commit is contained in:
Peter Van der Beken 2010-04-19 17:41:37 +02:00
parent b480e94b8d
commit d062d2ec2d
12 changed files with 35 additions and 258 deletions

View File

@ -46,8 +46,8 @@ class nsDOMAttributeMap;
class nsIContent;
#define NS_IATTRIBUTE_IID \
{ 0x68b13198, 0x6d81, 0x4ab6, \
{ 0xb9, 0x98, 0xd0, 0xa4, 0x55, 0x82, 0x5f, 0xb1 } }
{ 0x9bb7e4f2, 0xf89d, 0x46ee, \
{ 0xa4, 0x62, 0x68, 0xcb, 0x0b, 0xf5, 0x71, 0x53 } }
class nsIAttribute : public nsINode
{

View File

@ -71,8 +71,8 @@ enum nsLinkState {
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x51dcc330, 0x78f0, 0x47c9, \
{ 0x95, 0x6f, 0xf9, 0x8a, 0x04, 0xb9, 0x74, 0x51 } }
{ 0x9e3b1a15, 0x72d5, 0x4e4f, \
{ 0x8f, 0x4b, 0x75, 0xde, 0x07, 0x9c, 0x16, 0xdc } }
/**
* A node of content in a document's content model. This interface

View File

@ -116,8 +116,8 @@ class Element;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x56d981ce, 0x7f03, 0x4d90, \
{ 0xb2, 0x40, 0x72, 0x08, 0xb6, 0x28, 0x73, 0x06 } }
{ 0xa979dabe, 0x75de, 0x4c2d, \
{ 0x8b, 0x83, 0x17, 0xb2, 0xde, 0x9d, 0x9d, 0x37 } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)

View File

@ -271,8 +271,8 @@ private:
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0xbc347b50, 0xa9b8, 0x419e, \
{ 0xb1, 0x21, 0x76, 0x8f, 0x90, 0x05, 0x8d, 0xbf } }
{ 0x58695b2f, 0x39bd, 0x434d, \
{ 0xa2, 0x0b, 0xde, 0xd3, 0xa8, 0xa0, 0xb6, 0x95 } }
/**
* An internal interface that abstracts some DOMNode-related parts that both

View File

@ -115,9 +115,8 @@ DOMCI_DATA(Attr, nsDOMAttribute)
// QueryInterface implementation for nsDOMAttribute
NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_NODE_INTERFACE_TABLE8(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsINode,
nsIDOMNode, nsIDOM3Node, nsIDOM3Attr,
nsPIDOMEventTarget, nsIDOMXPathNSResolver)
NS_NODE_INTERFACE_TABLE5(nsDOMAttribute, nsIDOMAttr, nsIAttribute, nsIDOMNode,
nsIDOM3Attr, nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMAttribute)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
@ -127,6 +126,9 @@ NS_INTERFACE_TABLE_HEAD(nsDOMAttribute)
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
new nsNode3Tearoff(this))
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Attr)
NS_INTERFACE_MAP_END
@ -511,47 +513,6 @@ nsDOMAttribute::GetBaseURI() const
return parent ? parent->GetBaseURI() : nsnull;
}
NS_IMETHODIMP
nsDOMAttribute::GetBaseURI(nsAString &aURI)
{
nsINode::GetBaseURI(aURI);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::CompareDocumentPosition(nsIDOMNode* aOther,
PRUint16* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
NS_ENSURE_TRUE(other, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nsINode::CompareDocumentPosition(other, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::IsSameNode(nsIDOMNode* aOther,
PRBool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
NS_ENSURE_TRUE(other, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
*aReturn = nsINode::IsSameNode(other);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::IsEqualNode(nsIDOMNode* aOther,
PRBool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = other && IsEqualNode(other);
return NS_OK;
}
PRBool
nsDOMAttribute::IsEqualNode(nsINode* aOther)
{
@ -574,65 +535,18 @@ nsDOMAttribute::IsEqualNode(nsINode* aOther)
return ourValue.Equals(otherValue);
}
NS_IMETHODIMP
nsDOMAttribute::IsDefaultNamespace(const nsAString& aNamespaceURI,
PRBool* aReturn)
{
*aReturn = nsINode::IsDefaultNamespace(aNamespaceURI);
return NS_OK;
}
void
nsDOMAttribute::GetTextContent(nsAString &aTextContent)
{
GetNodeValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::GetTextContent(nsAString &aTextContent)
{
nsINode::GetTextContent(aTextContent);
return NS_OK;
}
nsresult
nsDOMAttribute::SetTextContent(const nsAString& aTextContent)
{
return SetNodeValue(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::SetTextContent(const nsAString& aTextContent)
{
return nsINode::SetTextContent(aTextContent);
}
NS_IMETHODIMP
nsDOMAttribute::GetFeature(const nsAString& aFeature,
const nsAString& aVersion,
nsISupports** aReturn)
{
return nsINode::GetFeature(aFeature, aVersion, aReturn);
}
NS_IMETHODIMP
nsDOMAttribute::SetUserData(const nsAString& aKey, nsIVariant* aData,
nsIDOMUserDataHandler* aHandler,
nsIVariant** aResult)
{
return nsINode::SetUserData(aKey, aData, aHandler, aResult);
}
NS_IMETHODIMP
nsDOMAttribute::GetUserData(const nsAString& aKey, nsIVariant** aResult)
{
NS_IF_ADDREF(*aResult = nsINode::GetUserData(aKey));
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::GetIsId(PRBool* aReturn)
@ -661,24 +575,6 @@ nsDOMAttribute::GetSchemaTypeInfo(nsIDOM3TypeInfo** aReturn)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDOMAttribute::LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix)
{
nsINode::LookupPrefix(aNamespaceURI, aPrefix);
return NS_OK;
}
NS_IMETHODIMP
nsDOMAttribute::LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI)
{
nsINode::LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
return NS_OK;
}
PRBool
nsDOMAttribute::IsNodeOfType(PRUint32 aFlags) const
{

View File

@ -49,21 +49,16 @@
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsINodeInfo.h"
#include "nsIDOM3Node.h"
#include "nsIDOM3Attr.h"
#include "nsDOMAttributeMap.h"
#include "nsCycleCollectionParticipant.h"
#include "nsContentUtils.h"
#include "nsIDOMXPathNSResolver.h"
class nsDOMAttribute;
// Attribute helper class used to wrap up an attribute with a dom
// object that implements nsIDOMAttr, nsIDOM3Attr, nsIDOMNode, nsIDOM3Node
class nsDOMAttribute : public nsIAttribute,
public nsIDOMAttr,
public nsIDOM3Attr,
public nsIDOMXPathNSResolver
public nsIDOM3Attr
{
public:
nsDOMAttribute(nsDOMAttributeMap* aAttrMap, nsINodeInfo *aNodeInfo,
@ -75,9 +70,6 @@ public:
// nsIDOMNode interface
NS_DECL_NSIDOMNODE
// nsIDOM3Node interface
NS_DECL_NSIDOM3NODE
// nsIDOMAttr interface
NS_DECL_NSIDOMATTR

View File

@ -1524,7 +1524,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument)
NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsINode)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3DocumentEvent)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
@ -1540,10 +1539,12 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIMutationObserver)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNodeSelector)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIApplicationCacheContainer)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMXPathNSResolver)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDocument)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
new nsNode3Tearoff(this))
if (aIID.Equals(NS_GET_IID(nsIDOMXPathEvaluator)) ||
aIID.Equals(NS_GET_IID(nsIXPathEvaluatorInternal))) {
if (!mXPathEvaluatorTearoff) {
@ -5631,55 +5632,12 @@ nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion,
aFeature, aVersion, aReturn);
}
NS_IMETHODIMP
nsDocument::GetBaseURI(nsAString &aURI)
{
nsINode::GetBaseURI(aURI);
return NS_OK;
}
void
nsDocument::GetTextContent(nsAString &aTextContent)
{
SetDOMStringToNull(aTextContent);
}
NS_IMETHODIMP
nsDocument::GetTextContent(nsAString &aTextContent)
{
nsINode::GetTextContent(aTextContent);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetTextContent(const nsAString& aTextContent)
{
return nsINode::SetTextContent(aTextContent);
}
NS_IMETHODIMP
nsDocument::CompareDocumentPosition(nsIDOMNode* aOther, PRUint16* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
NS_ENSURE_TRUE(other, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nsINode::CompareDocumentPosition(other, aReturn);
}
NS_IMETHODIMP
nsDocument::IsSameNode(nsIDOMNode* aOther, PRBool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
NS_ENSURE_TRUE(other, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
*aReturn = nsINode::IsSameNode(other);
return NS_OK;
}
PRBool
nsDocument::IsEqualNode(nsINode* aOther)
{
@ -5705,68 +5663,6 @@ nsDocument::IsEqualNode(nsINode* aOther)
return PR_TRUE;
}
NS_IMETHODIMP
nsDocument::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = other && IsEqualNode(other);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::IsDefaultNamespace(const nsAString& aNamespaceURI,
PRBool* aReturn)
{
*aReturn = nsINode::IsDefaultNamespace(aNamespaceURI);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetFeature(const nsAString& aFeature,
const nsAString& aVersion,
nsISupports** aReturn)
{
return nsINode::GetFeature(aFeature, aVersion, aReturn);
}
NS_IMETHODIMP
nsDocument::SetUserData(const nsAString &aKey,
nsIVariant *aData,
nsIDOMUserDataHandler *aHandler,
nsIVariant **aResult)
{
return nsINode::SetUserData(aKey, aData, aHandler, aResult);
}
NS_IMETHODIMP
nsDocument::GetUserData(const nsAString &aKey,
nsIVariant **aResult)
{
NS_IF_ADDREF(*aResult = nsINode::GetUserData(aKey));
return NS_OK;
}
NS_IMETHODIMP
nsDocument::LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix)
{
nsINode::LookupPrefix(aNamespaceURI, aPrefix);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI)
{
nsINode::LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetInputEncoding(nsAString& aInputEncoding)
{

View File

@ -496,7 +496,6 @@ class nsDocument : public nsIDocument,
public nsIRadioGroupContainer,
public nsIDOMNodeSelector,
public nsIApplicationCacheContainer,
public nsIDOMXPathNSResolver,
public nsStubMutationObserver
{
public:
@ -768,9 +767,6 @@ public:
// nsIDOMNode
NS_DECL_NSIDOMNODE
// nsIDOM3Node
NS_DECL_NSIDOM3NODE
// nsIDOMDocument
NS_DECL_NSIDOMDOCUMENT
@ -1226,7 +1222,6 @@ protected:
nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNode, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOM3Node, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOM3Document, nsDocument)
#endif /* nsDocument_h___ */

View File

@ -980,12 +980,12 @@ nsChildContentList::IndexOf(nsIContent* aContent)
//----------------------------------------------------------------------
NS_IMPL_CYCLE_COLLECTION_1(nsNode3Tearoff, mContent)
NS_IMPL_CYCLE_COLLECTION_1(nsNode3Tearoff, mNode)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNode3Tearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
NS_INTERFACE_MAP_END_AGGREGATED(mContent)
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNode3Tearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff)
@ -993,7 +993,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff)
NS_IMETHODIMP
nsNode3Tearoff::GetBaseURI(nsAString& aURI)
{
mContent->GetBaseURI(aURI);
mNode->GetBaseURI(aURI);
return NS_OK;
}
@ -1019,7 +1019,7 @@ nsNode3Tearoff::CompareDocumentPosition(nsIDOMNode* aOther,
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
NS_ENSURE_ARG(other);
*aReturn = mContent->CompareDocumentPosition(other);
*aReturn = mNode->CompareDocumentPosition(other);
return NS_OK;
}
@ -1029,7 +1029,7 @@ nsNode3Tearoff::IsSameNode(nsIDOMNode* aOther,
PRBool* aReturn)
{
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = mContent->IsSameNode(other);
*aReturn = mNode->IsSameNode(other);
return NS_OK;
}
@ -1147,7 +1147,7 @@ nsNode3Tearoff::IsEqualNode(nsIDOMNode* aOther, PRBool* aReturn)
// Since we implement nsINode, aOther must as well.
nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
*aReturn = other && mContent->IsEqualNode(other);
*aReturn = other && mNode->IsEqualNode(other);
return NS_OK;
}
@ -1157,7 +1157,7 @@ nsNode3Tearoff::GetFeature(const nsAString& aFeature,
const nsAString& aVersion,
nsISupports** aReturn)
{
return mContent->GetFeature(aFeature, aVersion, aReturn);
return mNode->GetFeature(aFeature, aVersion, aReturn);
}
NS_IMETHODIMP
@ -1166,14 +1166,14 @@ nsNode3Tearoff::SetUserData(const nsAString& aKey,
nsIDOMUserDataHandler* aHandler,
nsIVariant** aResult)
{
return mContent->SetUserData(aKey, aData, aHandler, aResult);
return mNode->SetUserData(aKey, aData, aHandler, aResult);
}
NS_IMETHODIMP
nsNode3Tearoff::GetUserData(const nsAString& aKey,
nsIVariant** aResult)
{
NS_IF_ADDREF(*aResult = mContent->GetUserData(aKey));
NS_IF_ADDREF(*aResult = mNode->GetUserData(aKey));
return NS_OK;
}
@ -1212,7 +1212,7 @@ NS_IMETHODIMP
nsNode3Tearoff::LookupPrefix(const nsAString& aNamespaceURI,
nsAString& aPrefix)
{
static_cast<nsINode*>(mContent)->LookupPrefix(aNamespaceURI, aPrefix);
mNode->LookupPrefix(aNamespaceURI, aPrefix);
return NS_OK;
}
@ -1220,7 +1220,7 @@ NS_IMETHODIMP
nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI)
{
mContent->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
return NS_OK;
}
@ -1228,7 +1228,7 @@ NS_IMETHODIMP
nsNode3Tearoff::IsDefaultNamespace(const nsAString& aNamespaceURI,
PRBool* aReturn)
{
*aReturn = mContent->IsDefaultNamespace(aNamespaceURI);
*aReturn = mNode->IsDefaultNamespace(aNamespaceURI);
return NS_OK;
}

View File

@ -155,7 +155,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsNode3Tearoff, nsIDOM3Node)
nsNode3Tearoff(nsIContent *aContent) : mContent(aContent)
nsNode3Tearoff(nsINode *aNode) : mNode(aNode)
{
}
@ -163,7 +163,7 @@ protected:
virtual ~nsNode3Tearoff() {}
private:
nsCOMPtr<nsIContent> mContent;
nsCOMPtr<nsINode> mNode;
};
/**

View File

@ -35,11 +35,10 @@
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
#include "nsIDOM3Node.idl"
#include "nsIDOM3TypeInfo.idl"
[scriptable, uuid(a2216ddc-1bcd-4ec2-a292-371e09a6c377)]
interface nsIDOM3Attr : nsIDOM3Node
[scriptable, uuid(274ef301-065c-450d-a75b-e7673d257293)]
interface nsIDOM3Attr : nsISupports
{
// Introduced in DOM Level 3:
readonly attribute nsIDOM3TypeInfo schemaTypeInfo;

View File

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
#include "nsIDOM3Node.idl"
interface nsIDOMDOMConfiguration;
@ -44,8 +43,8 @@ interface nsIDOMDOMConfiguration;
* For more information on this interface, please see
* http://www.w3.org/TR/DOM-Level-3-Core/
*/
[scriptable, uuid(2e0e9ea1-72ab-4d9e-bdeb-ca64e1abeba4)]
interface nsIDOM3Document : nsIDOM3Node
[scriptable, uuid(c0568f22-b9d5-427a-9642-b6a797edc5cd)]
interface nsIDOM3Document : nsISupports
{
// Introduced in DOM Level 3:
readonly attribute DOMString inputEncoding;