Changing the way content elements store their name information, previously the elements generally stored a name atom and a namespace ID, now they store a pointer to a shared structure containing the name atom, the prefix atom and the namespace ID. This structure is shared between nodes with unique names (ie same name, prefix and ns ID) within a document. Documents now hold a hash table of the names in the document. The changes to mozilla/rdf are not reviewed but they are approved by waterson@netscape.com and the changes to mozilla/layout are reviewed by buster@netscape.com.

This commit is contained in:
jst%netscape.com 2000-05-10 13:13:39 +00:00
Родитель c4cbd87862
Коммит ee4b181034
197 изменённых файлов: 3128 добавлений и 2424 удалений

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

@ -57,6 +57,7 @@ class nsIWordBreaker;
class nsIDOMSelection;
class nsIChannel;
class nsIPrincipal;
class nsINodeInfoManager;
class nsIDOMDocument;
class nsIDOMDocumentType;
class nsIBindingManager;
@ -330,6 +331,8 @@ public:
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID) = 0;
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult) = 0;
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
};

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

@ -25,7 +25,7 @@
#include "nsISupports.h"
class nsIContent;
class nsString;
class nsINodeInfo;
/* a6cf90fb-15b3-11d2-932e-00805f8add32 */
#define NS_IELEMENT_FACTORY_IID \
@ -38,7 +38,7 @@ class nsIElementFactory : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IELEMENT_FACTORY_IID; return iid; }
NS_IMETHOD CreateInstanceByTag(const nsString& aTag,
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult) = 0;
};

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

@ -86,6 +86,7 @@
#include "nsIScrollableView.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsNodeInfoManager.h"
#include "nsNetUtil.h" // for NS_MakeAbsoluteURI
@ -797,8 +798,20 @@ NS_IMPL_RELEASE(nsDocument)
nsresult nsDocument::Init()
{
if (mNameSpaceManager) {
return NS_ERROR_ALREADY_INITIALIZED;
}
nsresult rv = NS_NewHeapArena(&mArena, nsnull);
NS_NewNameSpaceManager(&mNameSpaceManager);
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
NS_ENSURE_SUCCESS(rv, rv);
mNodeInfoManager = new nsNodeInfoManager();
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
mNodeInfoManager->Init(mNameSpaceManager);
return rv;
}
@ -2339,29 +2352,28 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
NS_IMETHODIMP
nsDocument::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsDocument::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aLocalName.Truncate();
return NS_OK;
}
NS_IMETHODIMP
@ -3319,6 +3331,19 @@ nsDocument::IncrementModCount(PRInt32 aNumMods)
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager)
{
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);
aNodeInfoManager = mNodeInfoManager;
NS_ADDREF(aNodeInfoManager);
return NS_OK;
}
//
// FindContent does a depth-first search from aStartNode
// and returns the first of aTest1 or aTest2 which it finds.

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

@ -41,6 +41,7 @@
#include "nsGenericDOMNodeList.h"
#include "nsIPrincipal.h"
#include "nsIBindingManager.h"
#include "nsINodeInfo.h"
class nsIEventListenerManager;
class nsDOMStyleSheetList;
@ -332,6 +333,7 @@ public:
NS_IMETHOD FlushPendingNotifications();
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
public:
@ -474,6 +476,7 @@ protected:
PRInt32 mModCount;
nsCOMPtr<nsIBindingManager> mBindingManager;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // OWNER
};
#endif /* nsDocument_h___ */

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

@ -26,6 +26,8 @@
#include "nsIScriptObjectOwner.h"
#include "nsGenericElement.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsNodeInfoManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMScriptObjectFactory.h"
@ -40,7 +42,7 @@ class nsDocumentFragment : public nsIContent,
public nsIScriptObjectOwner
{
public:
nsDocumentFragment(nsIDocument* aOwnerDocument);
nsDocumentFragment(nsIDocument* aOwnerDocument, nsINodeInfo *aNodeInfo);
virtual ~nsDocumentFragment();
// nsISupports
@ -242,11 +244,26 @@ nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
nsIDocument* aOwnerDocument)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsCOMPtr<nsINodeInfoManager> nimgr;
nsCOMPtr<nsINodeInfo> nodeInfo;
nsresult rv;
if (aOwnerDocument) {
rv = aOwnerDocument->GetNodeInfoManager(*getter_AddRefs(nimgr));
} else {
rv = nsNodeInfoManager::GetAnonymousManager(*getter_AddRefs(nimgr));
}
nsDocumentFragment* it = new nsDocumentFragment(aOwnerDocument);
NS_ENSURE_SUCCESS(rv, rv);
rv = nimgr->GetNodeInfo(NS_ConvertASCIItoUCS2("#document-fragment"),
nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsDocumentFragment* it = new nsDocumentFragment(aOwnerDocument, nodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -254,10 +271,11 @@ NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
(void**) aInstancePtrResult);
}
nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument)
nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument,
nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, nsnull);
mInner.Init(this, aNodeInfo);
mScriptObject = nsnull;
mOwnerDocument = aOwnerDocument;
NS_IF_ADDREF(mOwnerDocument);
@ -382,7 +400,7 @@ NS_IMETHODIMP
nsDocumentFragment::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsDocumentFragment* it;
it = new nsDocumentFragment(mOwnerDocument);
it = new nsDocumentFragment(mOwnerDocument, mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -24,6 +24,7 @@
#include "nsDOMAttribute.h"
#include "nsDOMAttributeMap.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMNodeList.h"
@ -376,21 +377,16 @@ nsGenericElement::GetScriptObjectFactory(nsIDOMScriptObjectFactory **aResult)
return result;
}
nsGenericElement::nsGenericElement()
nsGenericElement::nsGenericElement() : mContent(nsnull), mDocument(nsnull),
mParent(nsnull), mNodeInfo(nsnull),
mDOMSlots(nsnull), mContentID(0)
{
mDocument = nsnull;
mParent = nsnull;
mTag = nsnull;
mContent = nsnull;
mDOMSlots = nsnull;
mContentID = 0;
}
nsGenericElement::~nsGenericElement()
{
// pop any enclosed ranges out
// nsRange::OwnerGone(mContent); not used for now
NS_IF_RELEASE(mTag);
if (nsnull != mDOMSlots) {
if (nsnull != mDOMSlots->mChildNodes) {
mDOMSlots->mChildNodes->DropReference();
@ -409,6 +405,7 @@ nsGenericElement::~nsGenericElement()
// XXX Should really be arena managed
PR_DELETE(mDOMSlots);
}
NS_IF_RELEASE(mNodeInfo);
}
nsDOMSlots *
@ -445,26 +442,17 @@ nsGenericElement::MaybeClearDOMSlots()
void
nsGenericElement::Init(nsIContent* aOuterContentObject,
nsIAtom* aTag)
nsINodeInfo *aNodeInfo)
{
NS_ABORT_IF_FALSE(aOuterContentObject, "We need a outer content object!");
NS_ABORT_IF_FALSE(aNodeInfo, "This can't be used without node info!");
NS_ASSERTION((nsnull == mContent) && (nsnull != aOuterContentObject),
"null ptr");
mContent = aOuterContentObject;
mTag = aTag;
NS_IF_ADDREF(aTag);
}
nsresult
nsGenericElement::GetNodeName(nsString& aNodeName)
{
return GetTagName(aNodeName);
}
nsresult
nsGenericElement::GetLocalName(nsString& aNodeName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
mNodeInfo = aNodeInfo;
NS_IF_ADDREF(mNodeInfo);
}
nsresult
@ -595,6 +583,50 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
}
nsresult
nsGenericElement::GetNamespaceURI(nsString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
nsresult
nsGenericElement::GetPrefix(nsString& aPrefix)
{
return mNodeInfo->GetPrefix(aPrefix);
}
nsresult
nsGenericElement::SetPrefix(const nsString& aPrefix)
{
// XXX: Validate the prefix string!
nsINodeInfo *newNodeInfo = nsnull;
nsCOMPtr<nsIAtom> prefix;
if (aPrefix.Length()) {
prefix = dont_AddRef(NS_NewAtom(aPrefix));
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
}
nsresult rv = mNodeInfo->PrefixChanged(prefix, newNodeInfo);
NS_ENSURE_SUCCESS(rv, rv);
NS_RELEASE(mNodeInfo);
mNodeInfo = newNodeInfo;
return NS_OK;
}
nsresult
nsGenericElement::Supports(const nsString& aFeature, const nsString& aVersion,
PRBool* aReturn)
{
// XXX: TBI
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
@ -617,10 +649,8 @@ nsresult
nsGenericElement::GetTagName(nsString& aTagName)
{
aTagName.Truncate();
if (nsnull != mTag) {
// note that we assume no namespace here, subclasses that support
// namespaces must override
mTag->ToString(aTagName);
if (mNodeInfo) {
mNodeInfo->GetName(aTagName);
}
return NS_OK;
}
@ -998,9 +1028,7 @@ nsGenericElement::GetNameSpaceID(PRInt32& aResult) const
nsresult
nsGenericElement::GetTag(nsIAtom*& aResult) const
{
aResult = mTag;
NS_IF_ADDREF(aResult);
return NS_OK;
return mNodeInfo->GetNameAtom(aResult);
}
@ -1238,7 +1266,7 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
}
nsAutoString tag;
mTag->ToString(tag);
mNodeInfo->GetQualifiedName(tag);
res = factory->NewScriptElement(tag, aContext, mContent,
mParent ? (nsISupports*)mParent : (nsISupports*)mDocument,
(void**)&slots->mScriptObject);
@ -1983,7 +2011,8 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute,
mDocument->GetScriptGlobalObject(getter_AddRefs(global));
if (global) {
if (NS_OK == global->GetContext(&context)) {
if (nsHTMLAtoms::body == mTag || nsHTMLAtoms::frameset == mTag) {
if (mNodeInfo->Equals(nsHTMLAtoms::body) ||
mNodeInfo->Equals(nsHTMLAtoms::frameset)) {
nsIDOMEventReceiver *receiver;
if (nsnull != global && NS_OK == global->QueryInterface(kIDOMEventReceiverIID, (void**)&receiver)) {
@ -2427,14 +2456,10 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const
PRInt32 index;
for (index = aIndent; --index >= 0; ) fputs(" ", out);
nsIAtom* tag;
GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
}
nsAutoString buf;
mNodeInfo->GetQualifiedName(buf);
fputs(buf, out);
fprintf(out, "@%p", mContent);
ListAttributes(out);

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

@ -34,6 +34,7 @@
#include "nsILinkHandler.h"
#include "nsGenericDOMNodeList.h"
#include "nsIEventListenerManager.h"
#include "nsINodeInfo.h"
extern const nsIID kIDOMNodeIID;
extern const nsIID kIDOMElementIID;
@ -53,6 +54,7 @@ class nsDOMCSSDeclaration;
class nsIDOMCSSStyleDeclaration;
class nsDOMAttributeMap;
class nsIURI;
class nsINodeInfo;
// Class that holds the child list of a content element and also
@ -124,10 +126,9 @@ public:
nsGenericElement();
~nsGenericElement();
void Init(nsIContent* aOuterContentObject, nsIAtom* aTag);
void Init(nsIContent* aOuterContentObject, nsINodeInfo *aNodeInfo);
// Implementation for nsIDOMNode
nsresult GetNodeName(nsString& aNodeName);
nsresult GetNodeValue(nsString& aNodeValue);
nsresult SetNodeValue(const nsString& aNodeValue);
nsresult GetNodeType(PRUint16* aNodeType);
@ -136,8 +137,12 @@ public:
nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult GetLocalName(nsString& aLocalName);
nsresult GetNamespaceURI(nsString& aNamespaceURI);
nsresult GetPrefix(nsString& aPrefix);
nsresult SetPrefix(const nsString& aPrefix);
nsresult Normalize();
nsresult Supports(const nsString& aFeature,
const nsString& aVersion, PRBool* aReturn);
// Implementation for nsIDOMElement
nsresult GetTagName(nsString& aTagName);
@ -252,12 +257,12 @@ public:
// supporting. Sometimes there is work that we just can't do
// ourselves, so this is needed to ask the real object to do the
// work.
nsIContent* mContent;
nsIContent* mContent; // WEAK
nsIDocument* mDocument; // WEAK
nsIContent* mParent; // WEAK
nsIAtom* mTag;
nsDOMSlots *mDOMSlots;
nsINodeInfo* mNodeInfo; // OWNER
nsDOMSlots *mDOMSlots; // OWNER
PRUint32 mContentID;
};
@ -346,9 +351,6 @@ public:
*
* Note that classes using this macro will need to implement:
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
* Note:
* GetNamespaceURI, GetPrefix, SetPrefix, Normalize and Supports must be
* implemented in a super class of this one.
*/
#define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \
NS_IMETHOD GetNodeName(nsString& aNodeName) { \

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

@ -22,6 +22,7 @@
#include "nsGenericHTMLElement.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsICSSParser.h"
#include "nsICSSLoader.h"
#include "nsICSSStyleRule.h"
@ -416,12 +417,6 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent,
return result;
}
nsresult
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
{
return GetTagName(aNodeName);
}
nsresult
nsGenericHTMLElement::GetTagName(nsString& aTagName)
{
@ -430,6 +425,40 @@ nsGenericHTMLElement::GetTagName(nsString& aTagName)
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
{
// This whole method needs revriting to work properly with XHTML...
#ifdef MOZILLA_IS_READY_FOR_THIS
mNodeInfo->GetPrefix(aNodeName);
if (aNodeName.Length()) {
aNodeName.Append(PRUnichar(':'));
}
#else
aNodeName.Truncate();
#endif
nsCOMPtr<nsIAtom> atom;
mNodeInfo->GetNameAtom(*getter_AddRefs(atom));
atom->ToString(aNodeName);
aNodeName.ToUpperCase();
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetLocalName(nsString& aLocalName)
{
mNodeInfo->GetLocalName(aLocalName);
// This doesn't work for XHTML
aLocalName.ToUpperCase();
return NS_OK;
}
// Implementation for nsIDOMHTMLElement
nsresult
nsGenericHTMLElement::GetId(nsString& aId)
@ -1716,9 +1745,9 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
{
aBuf.AssignWithConversion('<');
if (nsnull != mTag) {
if (mNodeInfo) {
nsAutoString tmp;
mTag->ToString(tmp);
mNodeInfo->GetQualifiedName(tmp);
aBuf.Append(tmp);
} else {
aBuf.AppendWithConversion("?NULL");
@ -2906,10 +2935,10 @@ nsresult
nsGenericHTMLLeafElement::BeginConvertToXIF(nsXIFConverter& aConverter) const
{
nsresult rv = NS_OK;
if (nsnull != mTag)
if (mNodeInfo)
{
nsAutoString name;
mTag->ToString(name);
mNodeInfo->GetQualifiedName(name);
aConverter.BeginLeaf(name);
}
@ -2944,10 +2973,10 @@ nsGenericHTMLLeafElement::ConvertContentToXIF(nsXIFConverter& aConverter) const
nsresult
nsGenericHTMLLeafElement::FinishConvertToXIF(nsXIFConverter& aConverter) const
{
if (nsnull != mTag)
if (mNodeInfo)
{
nsAutoString name;
mTag->ToString(name);
mNodeInfo->GetQualifiedName(name);
aConverter.EndLeaf(name);
}
return NS_OK;
@ -3070,10 +3099,10 @@ nsresult
nsGenericHTMLContainerElement::BeginConvertToXIF(nsXIFConverter& aConverter) const
{
nsresult rv = NS_OK;
if (nsnull != mTag)
if (mNodeInfo)
{
nsAutoString name;
mTag->ToString(name);
mNodeInfo->GetQualifiedName(name);
aConverter.BeginContainer(name);
}
@ -3108,10 +3137,10 @@ nsGenericHTMLContainerElement::ConvertContentToXIF(nsXIFConverter& aConverter) c
nsresult
nsGenericHTMLContainerElement::FinishConvertToXIF(nsXIFConverter& aConverter) const
{
if (nsnull != mTag)
if (mNodeInfo)
{
nsAutoString name;
mTag->ToString(name);
mNodeInfo->GetQualifiedName(name);
aConverter.EndContainer(name);
}
return NS_OK;

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

@ -68,11 +68,7 @@ public:
// Implementation for nsIDOMNode
nsresult GetNodeName(nsString& aNodeName);
nsresult GetNamespaceURI(nsString& aNamespaceURI) { return NS_OK; }; //xxxxxx
nsresult GetPrefix(nsString& aPrefix) { return NS_OK; }; //xxxxxx
nsresult SetPrefix(const nsString& aPrefix) { return NS_OK; }; //xxxxxx
nsresult Supports(const nsString& aFeature, const nsString& aVersion,
PRBool* aReturn) { return NS_OK; } // xxxxxx
nsresult GetLocalName(nsString& aLocalName);
// Implementation for nsIDOMElement
nsresult GetAttribute(const nsString& aName, nsString& aReturn)

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

@ -56,7 +56,7 @@ class nsHTMLAnchorElement : public nsIDOMHTMLAnchorElement,
public nsIHTMLContent
{
public:
nsHTMLAnchorElement(nsIAtom* aTag);
nsHTMLAnchorElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLAnchorElement();
// nsISupports
@ -123,13 +123,13 @@ protected:
};
nsresult
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLAnchorElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLAnchorElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -137,10 +137,10 @@ NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLAnchorElement::nsHTMLAnchorElement(nsIAtom* aTag)
nsHTMLAnchorElement::nsHTMLAnchorElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLAnchorElement::~nsHTMLAnchorElement()
@ -172,7 +172,7 @@ nsHTMLAnchorElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLAnchorElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLAnchorElement* it = new nsHTMLAnchorElement(mInner.mTag);
nsHTMLAnchorElement* it = new nsHTMLAnchorElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -56,7 +56,7 @@ class nsHTMLAppletElement : public nsIDOMHTMLAppletElement,
public nsIHTMLContent
{
public:
nsHTMLAppletElement(nsIAtom* aTag);
nsHTMLAppletElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLAppletElement();
// nsISupports
@ -141,13 +141,13 @@ protected:
};
nsresult
NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLAppletElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLAppletElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -155,10 +155,10 @@ NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag)
nsHTMLAppletElement::nsHTMLAppletElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mReflectedApplet = PR_FALSE;
}
@ -186,7 +186,7 @@ nsHTMLAppletElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLAppletElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLAppletElement* it = new nsHTMLAppletElement(mInner.mTag);
nsHTMLAppletElement* it = new nsHTMLAppletElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -43,7 +43,7 @@ class nsHTMLAreaElement : public nsIDOMHTMLAreaElement,
public nsIHTMLContent
{
public:
nsHTMLAreaElement(nsIAtom* aTag);
nsHTMLAreaElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLAreaElement();
// nsISupports
@ -99,13 +99,13 @@ protected:
};
nsresult
NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLAreaElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLAreaElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -113,10 +113,10 @@ NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLAreaElement::nsHTMLAreaElement(nsIAtom* aTag)
nsHTMLAreaElement::nsHTMLAreaElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLAreaElement::~nsHTMLAreaElement()
@ -149,7 +149,7 @@ nsHTMLAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLAreaElement* it = new nsHTMLAreaElement(mInner.mTag);
nsHTMLAreaElement* it = new nsHTMLAreaElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLBRElement : public nsIDOMHTMLBRElement,
public nsIHTMLContent
{
public:
nsHTMLBRElement(nsIAtom* aTag);
nsHTMLBRElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLBRElement();
// nsISupports
@ -72,13 +72,13 @@ protected:
};
nsresult
NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLBRElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLBRElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -86,10 +86,10 @@ NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLBRElement::nsHTMLBRElement(nsIAtom* aTag)
nsHTMLBRElement::nsHTMLBRElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLBRElement::~nsHTMLBRElement()
@ -116,7 +116,7 @@ nsHTMLBRElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLBRElement* it = new nsHTMLBRElement(mInner.mTag);
nsHTMLBRElement* it = new nsHTMLBRElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLBaseElement : public nsIDOMHTMLBaseElement,
public nsIHTMLContent
{
public:
nsHTMLBaseElement(nsIAtom* aTag);
nsHTMLBaseElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLBaseElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo* aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLBaseElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLBaseElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLBaseElement::nsHTMLBaseElement(nsIAtom* aTag)
nsHTMLBaseElement::nsHTMLBaseElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLBaseElement::~nsHTMLBaseElement()
@ -117,7 +117,7 @@ nsHTMLBaseElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLBaseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLBaseElement* it = new nsHTMLBaseElement(mInner.mTag);
nsHTMLBaseElement* it = new nsHTMLBaseElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLBaseFontElement : public nsIDOMHTMLBaseFontElement,
public nsIHTMLContent
{
public:
nsHTMLBaseFontElement(nsIAtom* aTag);
nsHTMLBaseFontElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLBaseFontElement();
// nsISupports
@ -75,13 +75,13 @@ protected:
};
nsresult
NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLBaseFontElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLBaseFontElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -89,10 +89,10 @@ NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLBaseFontElement::nsHTMLBaseFontElement(nsIAtom* aTag)
nsHTMLBaseFontElement::nsHTMLBaseFontElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLBaseFontElement::~nsHTMLBaseFontElement()
@ -119,7 +119,7 @@ nsHTMLBaseFontElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement(mInner.mTag);
nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -175,7 +175,7 @@ class nsHTMLBodyElement : public nsIDOMHTMLBodyElement,
public nsIHTMLContent
{
public:
nsHTMLBodyElement(nsIAtom* aTag);
nsHTMLBodyElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLBodyElement();
// nsISupports
@ -623,13 +623,13 @@ void BodyFixupRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
//----------------------------------------------------------------------
nsresult
NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLBodyElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLBodyElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -637,10 +637,10 @@ NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLBodyElement::nsHTMLBodyElement(nsIAtom* aTag)
nsHTMLBodyElement::nsHTMLBodyElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLBodyElement::~nsHTMLBodyElement()
@ -667,7 +667,7 @@ nsHTMLBodyElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLBodyElement* it = new nsHTMLBodyElement(mInner.mTag);
nsHTMLBodyElement* it = new nsHTMLBodyElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -49,7 +49,7 @@ class nsHTMLButtonElement : public nsIDOMHTMLButtonElement,
public nsIFormControl
{
public:
nsHTMLButtonElement(nsIAtom* aTag);
nsHTMLButtonElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLButtonElement();
// nsISupports
@ -109,13 +109,13 @@ static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
// Construction, destruction
nsresult
NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLButtonElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLButtonElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -123,10 +123,10 @@ NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag)
nsHTMLButtonElement::nsHTMLButtonElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mForm = nsnull;
mType = NS_FORM_BUTTON_BUTTON; // default
}
@ -184,7 +184,7 @@ nsHTMLButtonElement::Release()
nsresult
nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLButtonElement* it = new nsHTMLButtonElement(mInner.mTag);
nsHTMLButtonElement* it = new nsHTMLButtonElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLDListElement : public nsIDOMHTMLDListElement,
public nsIHTMLContent
{
public:
nsHTMLDListElement(nsIAtom* aTag);
nsHTMLDListElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDListElement();
// nsISupports
@ -72,13 +72,13 @@ protected:
};
nsresult
NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLDListElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLDListElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -86,10 +86,10 @@ NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLDListElement::nsHTMLDListElement(nsIAtom* aTag)
nsHTMLDListElement::nsHTMLDListElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLDListElement::~nsHTMLDListElement()
@ -116,7 +116,7 @@ nsHTMLDListElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLDListElement* it = new nsHTMLDListElement(mInner.mTag);
nsHTMLDListElement* it = new nsHTMLDListElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLDelElement : public nsIDOMHTMLModElement,
public nsIHTMLContent
{
public:
nsHTMLDelElement(nsIAtom* aTag);
nsHTMLDelElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDelElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLDelElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLDelElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLDelElement::nsHTMLDelElement(nsIAtom* aTag)
nsHTMLDelElement::nsHTMLDelElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLDelElement::~nsHTMLDelElement()
@ -117,7 +117,7 @@ nsHTMLDelElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLDelElement* it = new nsHTMLDelElement(mInner.mTag);
nsHTMLDelElement* it = new nsHTMLDelElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -43,7 +43,7 @@ class nsHTMLDirectoryElement : public nsIDOMHTMLDirectoryElement,
public nsIHTMLContent
{
public:
nsHTMLDirectoryElement(nsIAtom* aTag);
nsHTMLDirectoryElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDirectoryElement();
// nsISupports
@ -76,13 +76,13 @@ protected:
};
nsresult
NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLDirectoryElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLDirectoryElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -90,10 +90,10 @@ NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLDirectoryElement::nsHTMLDirectoryElement(nsIAtom* aTag)
nsHTMLDirectoryElement::nsHTMLDirectoryElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLDirectoryElement::~nsHTMLDirectoryElement()
@ -120,7 +120,7 @@ nsHTMLDirectoryElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLDirectoryElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement(mInner.mTag);
nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -41,7 +41,7 @@ class nsHTMLDivElement : public nsIDOMHTMLDivElement,
public nsIHTMLContent
{
public:
nsHTMLDivElement(nsIAtom* aTag);
nsHTMLDivElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLDivElement();
// nsISupports
@ -74,13 +74,13 @@ protected:
};
nsresult
NS_NewHTMLDivElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLDivElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLDivElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLDivElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -88,10 +88,10 @@ NS_NewHTMLDivElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLDivElement::nsHTMLDivElement(nsIAtom* aTag)
nsHTMLDivElement::nsHTMLDivElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLDivElement::~nsHTMLDivElement()
@ -117,7 +117,7 @@ nsHTMLDivElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLDivElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLDivElement* it = new nsHTMLDivElement(mInner.mTag);
nsHTMLDivElement* it = new nsHTMLDivElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -53,7 +53,7 @@ class nsHTMLEmbedElement : public nsIDOMHTMLElement,
public nsIHTMLContent
{
public:
nsHTMLEmbedElement(nsIAtom* aTag);
nsHTMLEmbedElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLEmbedElement();
// nsISupports
@ -99,13 +99,13 @@ protected:
};
nsresult
NS_NewHTMLEmbedElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLEmbedElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLEmbedElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLEmbedElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -113,10 +113,10 @@ NS_NewHTMLEmbedElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLEmbedElement::nsHTMLEmbedElement(nsIAtom* aTag)
nsHTMLEmbedElement::nsHTMLEmbedElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLEmbedElement::~nsHTMLEmbedElement()
@ -145,7 +145,7 @@ nsHTMLEmbedElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLEmbedElement* it = new nsHTMLEmbedElement(mInner.mTag);
nsHTMLEmbedElement* it = new nsHTMLEmbedElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -46,7 +46,7 @@ class nsHTMLFieldSetElement : public nsIDOMHTMLFieldSetElement,
public nsIFormControl
{
public:
nsHTMLFieldSetElement(nsIAtom* aTag);
nsHTMLFieldSetElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFieldSetElement();
// nsISupports
@ -86,13 +86,13 @@ protected:
// construction, destruction
nsresult
NS_NewHTMLFieldSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLFieldSetElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFieldSetElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLFieldSetElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -100,10 +100,10 @@ NS_NewHTMLFieldSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsIAtom* aTag)
nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mForm = nsnull;
}
@ -159,7 +159,7 @@ nsHTMLFieldSetElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLFieldSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLFieldSetElement* it = new nsHTMLFieldSetElement(mInner.mTag);
nsHTMLFieldSetElement* it = new nsHTMLFieldSetElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -42,7 +42,7 @@ class nsHTMLFontElement : public nsIDOMHTMLFontElement,
public nsIHTMLContent
{
public:
nsHTMLFontElement(nsIAtom* aTag);
nsHTMLFontElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFontElement();
// nsISupports
@ -79,13 +79,13 @@ protected:
};
nsresult
NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFontElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLFontElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -93,10 +93,10 @@ NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLFontElement::nsHTMLFontElement(nsIAtom* aTag)
nsHTMLFontElement::nsHTMLFontElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLFontElement::~nsHTMLFontElement()
@ -123,7 +123,7 @@ nsHTMLFontElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLFontElement* it = new nsHTMLFontElement(mInner.mTag);
nsHTMLFontElement* it = new nsHTMLFontElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -65,7 +65,7 @@ class nsHTMLFormElement : public nsIDOMHTMLFormElement,
public nsIForm
{
public:
nsHTMLFormElement(nsIAtom* aTag);
nsHTMLFormElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFormElement();
// nsISupports
@ -162,13 +162,13 @@ protected:
// construction, destruction
nsresult
NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFormElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLFormElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -176,10 +176,10 @@ NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLFormElement::nsHTMLFormElement(nsIAtom* aTag)
nsHTMLFormElement::nsHTMLFormElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mControls = new nsFormControlList(this);
NS_ADDREF(mControls);
//nsTraceRefcnt::Create((nsIForm*)this, "nsHTMLFormElement", __FILE__, __LINE__);
@ -267,7 +267,7 @@ nsHTMLFormElement::Release()
nsresult
nsHTMLFormElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLFormElement* it = new nsHTMLFormElement(mInner.mTag);
nsHTMLFormElement* it = new nsHTMLFormElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -45,7 +45,7 @@ class nsHTMLFrameElement : public nsIDOMHTMLFrameElement,
public nsIChromeEventHandler
{
public:
nsHTMLFrameElement(nsIAtom* aTag);
nsHTMLFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameElement();
// nsISupports
@ -97,13 +97,13 @@ protected:
};
nsresult
NS_NewHTMLFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLFrameElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFrameElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLFrameElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -111,10 +111,10 @@ NS_NewHTMLFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLFrameElement::nsHTMLFrameElement(nsIAtom* aTag)
nsHTMLFrameElement::nsHTMLFrameElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLFrameElement::~nsHTMLFrameElement()
@ -146,7 +146,7 @@ nsHTMLFrameElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLFrameElement* it = new nsHTMLFrameElement(mInner.mTag);
nsHTMLFrameElement* it = new nsHTMLFrameElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLFrameSetElement : public nsIDOMHTMLFrameSetElement,
public nsIHTMLContent
{
public:
nsHTMLFrameSetElement(nsIAtom* aTag);
nsHTMLFrameSetElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLFrameSetElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLFrameSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLFrameSetElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLFrameSetElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLFrameSetElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLFrameSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLFrameSetElement::nsHTMLFrameSetElement(nsIAtom* aTag)
nsHTMLFrameSetElement::nsHTMLFrameSetElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLFrameSetElement::~nsHTMLFrameSetElement()
@ -117,7 +117,7 @@ nsHTMLFrameSetElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLFrameSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLFrameSetElement* it = new nsHTMLFrameSetElement(mInner.mTag);
nsHTMLFrameSetElement* it = new nsHTMLFrameSetElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLHRElement : public nsIDOMHTMLHRElement,
public nsIHTMLContent
{
public:
nsHTMLHRElement(nsIAtom* aTag);
nsHTMLHRElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLHRElement();
// nsISupports
@ -78,13 +78,13 @@ protected:
};
nsresult
NS_NewHTMLHRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLHRElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLHRElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLHRElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -92,10 +92,10 @@ NS_NewHTMLHRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLHRElement::nsHTMLHRElement(nsIAtom* aTag)
nsHTMLHRElement::nsHTMLHRElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLHRElement::~nsHTMLHRElement()
@ -122,7 +122,7 @@ nsHTMLHRElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLHRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLHRElement* it = new nsHTMLHRElement(mInner.mTag);
nsHTMLHRElement* it = new nsHTMLHRElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLHeadElement : public nsIDOMHTMLHeadElement,
public nsIHTMLContent
{
public:
nsHTMLHeadElement(nsIAtom* aTag);
nsHTMLHeadElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLHeadElement();
// nsISupports
@ -71,13 +71,13 @@ protected:
};
nsresult
NS_NewHTMLHeadElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLHeadElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLHeadElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLHeadElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -85,10 +85,10 @@ NS_NewHTMLHeadElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLHeadElement::nsHTMLHeadElement(nsIAtom* aTag)
nsHTMLHeadElement::nsHTMLHeadElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLHeadElement::~nsHTMLHeadElement()
@ -115,7 +115,7 @@ nsHTMLHeadElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLHeadElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLHeadElement* it = new nsHTMLHeadElement(mInner.mTag);
nsHTMLHeadElement* it = new nsHTMLHeadElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLHeadingElement : public nsIDOMHTMLHeadingElement,
public nsIHTMLContent
{
public:
nsHTMLHeadingElement(nsIAtom* aTag);
nsHTMLHeadingElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLHeadingElement();
// nsISupports
@ -72,13 +72,13 @@ protected:
};
nsresult
NS_NewHTMLHeadingElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLHeadingElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLHeadingElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLHeadingElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -86,10 +86,10 @@ NS_NewHTMLHeadingElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLHeadingElement::nsHTMLHeadingElement(nsIAtom* aTag)
nsHTMLHeadingElement::nsHTMLHeadingElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLHeadingElement::~nsHTMLHeadingElement()
@ -116,7 +116,7 @@ nsHTMLHeadingElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLHeadingElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLHeadingElement* it = new nsHTMLHeadingElement(mInner.mTag);
nsHTMLHeadingElement* it = new nsHTMLHeadingElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -70,22 +70,22 @@ public:
protected:
nsGenericHTMLContainerElement mInner;
friend nsresult NS_NewHTMLHtmlElement(nsIHTMLContent**, nsIAtom*);
friend nsresult NS_NewHTMLHtmlElement(nsIHTMLContent**, nsINodeInfo *);
};
nsresult
NS_NewHTMLHtmlElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLHtmlElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsHTMLHtmlElement* it;
NS_NEWXPCOM(it, nsHTMLHtmlElement);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->mInner.Init(it, aTag);
it->mInner.Init(it, aNodeInfo);
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
}
@ -124,7 +124,7 @@ nsHTMLHtmlElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->mInner.Init(it, mInner.mTag);
it->mInner.Init(it, mInner.mNodeInfo);
mInner.CopyInnerTo(this, &it->mInner, aDeep);
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}

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

@ -46,7 +46,7 @@ class nsHTMLIFrameElement : public nsIDOMHTMLIFrameElement,
public nsIChromeEventHandler
{
public:
nsHTMLIFrameElement(nsIAtom* aTag);
nsHTMLIFrameElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLIFrameElement();
// nsISupports
@ -102,13 +102,13 @@ protected:
};
nsresult
NS_NewHTMLIFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLIFrameElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLIFrameElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLIFrameElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -116,10 +116,10 @@ NS_NewHTMLIFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLIFrameElement::nsHTMLIFrameElement(nsIAtom* aTag)
nsHTMLIFrameElement::nsHTMLIFrameElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLIFrameElement::~nsHTMLIFrameElement()
@ -151,7 +151,7 @@ nsHTMLIFrameElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLIFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLIFrameElement* it = new nsHTMLIFrameElement(mInner.mTag);
nsHTMLIFrameElement* it = new nsHTMLIFrameElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -51,6 +51,7 @@
#include "nsIFrame.h"
#include "nsImageFrame.h"
#include "nsLayoutAtoms.h"
#include "nsNodeInfoManager.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -69,7 +70,7 @@ class nsHTMLImageElement : public nsIDOMHTMLImageElement,
public nsIJSNativeInitializer
{
public:
nsHTMLImageElement(nsIAtom* aTag);
nsHTMLImageElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLImageElement();
// nsISupports
@ -154,13 +155,30 @@ protected:
};
nsresult
NS_NewHTMLImageElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLImageElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
/*
* nsHTMLImageElement's will be created without a nsINodeInfo passed in
* if someone says "var img = new Image();" in JavaScript, in a case like
* that we request the nsINodeInfo from the anonymous nodeinfo list.
*/
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
if (!nodeInfo) {
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
nsresult rv;
rv = nsNodeInfoManager::GetAnonymousManager(*getter_AddRefs(nodeInfoManager));
NS_ENSURE_SUCCESS(rv, rv);
rv = nodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
}
nsIHTMLContent* it = new nsHTMLImageElement(aTag);
nsIHTMLContent* it = new nsHTMLImageElement(nodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -168,10 +186,10 @@ NS_NewHTMLImageElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLImageElement::nsHTMLImageElement(nsIAtom* aTag)
nsHTMLImageElement::nsHTMLImageElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mOwnerDocument = nsnull;
}
@ -221,7 +239,7 @@ nsHTMLImageElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLImageElement* it = new nsHTMLImageElement(mInner.mTag);
nsHTMLImageElement* it = new nsHTMLImageElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -74,7 +74,7 @@ class nsHTMLInputElement : public nsIDOMHTMLInputElement,
public nsIFormControl
{
public:
nsHTMLInputElement(nsIAtom* aTag);
nsHTMLInputElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLInputElement();
// nsISupports
@ -86,9 +86,9 @@ public:
// nsIDOMElement
// can't use the macro here because input type=text needs to notify up to
// frame system on SetAttribute("value");
NS_IMETHOD GetTagName(nsString& aTagName) {
return mInner.GetTagName(aTagName);
}
NS_IMETHOD GetTagName(nsString& aTagName) {
return mInner.GetTagName(aTagName);
}
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
return mInner.GetAttribute(aName, aReturn);
}
@ -169,13 +169,13 @@ protected:
// construction, destruction
nsresult
NS_NewHTMLInputElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLInputElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLInputElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLInputElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -183,10 +183,10 @@ NS_NewHTMLInputElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLInputElement::nsHTMLInputElement(nsIAtom* aTag)
nsHTMLInputElement::nsHTMLInputElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mType = NS_FORM_INPUT_TEXT; // default value
mForm = nsnull;
mSkipFocusEvent = PR_FALSE;
@ -250,7 +250,7 @@ nsHTMLInputElement::Release()
nsresult
nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLInputElement* it = new nsHTMLInputElement(mInner.mTag);
nsHTMLInputElement* it = new nsHTMLInputElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLInsElement : public nsIDOMHTMLModElement,
public nsIHTMLContent
{
public:
nsHTMLInsElement(nsIAtom* aTag);
nsHTMLInsElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLInsElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLInsElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLInsElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLInsElement::nsHTMLInsElement(nsIAtom* aTag)
nsHTMLInsElement::nsHTMLInsElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLInsElement::~nsHTMLInsElement()
@ -117,7 +117,7 @@ nsHTMLInsElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLInsElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLInsElement* it = new nsHTMLInsElement(mInner.mTag);
nsHTMLInsElement* it = new nsHTMLInsElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLIsIndexElement : public nsIDOMHTMLIsIndexElement,
public nsIHTMLContent
{
public:
nsHTMLIsIndexElement(nsIAtom* aTag);
nsHTMLIsIndexElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLIsIndexElement();
// nsISupports
@ -72,13 +72,13 @@ protected:
};
nsresult
NS_NewHTMLIsIndexElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLIsIndexElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLIsIndexElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLIsIndexElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -86,10 +86,10 @@ NS_NewHTMLIsIndexElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLIsIndexElement::nsHTMLIsIndexElement(nsIAtom* aTag)
nsHTMLIsIndexElement::nsHTMLIsIndexElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLIsIndexElement::~nsHTMLIsIndexElement()
@ -116,7 +116,7 @@ nsHTMLIsIndexElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLIsIndexElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLIsIndexElement* it = new nsHTMLIsIndexElement(mInner.mTag);
nsHTMLIsIndexElement* it = new nsHTMLIsIndexElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLLIElement : public nsIDOMHTMLLIElement,
public nsIHTMLContent
{
public:
nsHTMLLIElement(nsIAtom* aTag);
nsHTMLLIElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLLIElement();
// nsISupports
@ -74,13 +74,13 @@ protected:
};
nsresult
NS_NewHTMLLIElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLLIElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLLIElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLLIElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -88,10 +88,10 @@ NS_NewHTMLLIElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLLIElement::nsHTMLLIElement(nsIAtom* aTag)
nsHTMLLIElement::nsHTMLLIElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLLIElement::~nsHTMLLIElement()
@ -118,7 +118,7 @@ nsHTMLLIElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLLIElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLLIElement* it = new nsHTMLLIElement(mInner.mTag);
nsHTMLLIElement* it = new nsHTMLLIElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -53,7 +53,7 @@ class nsHTMLLabelElement : public nsIDOMHTMLLabelElement,
{
public:
nsHTMLLabelElement(nsIAtom* aTag);
nsHTMLLabelElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLLabelElement();
// nsISupports
@ -134,13 +134,13 @@ protected:
// construction, destruction
nsresult
NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLLabelElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLLabelElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -148,10 +148,10 @@ NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLLabelElement::nsHTMLLabelElement(nsIAtom* aTag)
nsHTMLLabelElement::nsHTMLLabelElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mForm = nsnull;
}
@ -207,7 +207,7 @@ nsHTMLLabelElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLLabelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLLabelElement* it = new nsHTMLLabelElement(mInner.mTag);
nsHTMLLabelElement* it = new nsHTMLLabelElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -45,7 +45,7 @@ class nsHTMLLegendElement : public nsIDOMHTMLLegendElement,
public nsIFormControl
{
public:
nsHTMLLegendElement(nsIAtom* aTag);
nsHTMLLegendElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLLegendElement();
// nsISupports
@ -88,13 +88,13 @@ protected:
};
nsresult
NS_NewHTMLLegendElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLLegendElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLLegendElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLLegendElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -102,10 +102,10 @@ NS_NewHTMLLegendElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLLegendElement::nsHTMLLegendElement(nsIAtom* aTag)
nsHTMLLegendElement::nsHTMLLegendElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mForm = nsnull;
}
@ -141,7 +141,7 @@ nsHTMLLegendElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLLegendElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLLegendElement* it = new nsHTMLLegendElement(mInner.mTag);
nsHTMLLegendElement* it = new nsHTMLLegendElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -44,7 +44,7 @@ class nsHTMLLinkElement : public nsIDOMHTMLLinkElement,
public nsIStyleSheetLinkingElement
{
public:
nsHTMLLinkElement(nsIAtom* aTag);
nsHTMLLinkElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLLinkElement();
// nsISupports
@ -98,13 +98,13 @@ protected:
};
nsresult
NS_NewHTMLLinkElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLLinkElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLLinkElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLLinkElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -112,10 +112,10 @@ NS_NewHTMLLinkElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLLinkElement::nsHTMLLinkElement(nsIAtom* aTag)
nsHTMLLinkElement::nsHTMLLinkElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mStyleSheet = nsnull;
}
@ -150,7 +150,7 @@ nsHTMLLinkElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLLinkElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLLinkElement* it = new nsHTMLLinkElement(mInner.mTag);
nsHTMLLinkElement* it = new nsHTMLLinkElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -43,7 +43,7 @@ class nsHTMLMapElement : public nsIDOMHTMLMapElement,
public nsIHTMLContent
{
public:
nsHTMLMapElement(nsIAtom* aTag);
nsHTMLMapElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLMapElement();
// nsISupports
@ -195,13 +195,13 @@ protected:
};
nsresult
NS_NewHTMLMapElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLMapElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLMapElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLMapElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -209,10 +209,10 @@ NS_NewHTMLMapElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLMapElement::nsHTMLMapElement(nsIAtom* aTag)
nsHTMLMapElement::nsHTMLMapElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mAreas = nsnull;
}
@ -274,7 +274,7 @@ nsHTMLMapElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
NS_IMETHODIMP
nsHTMLMapElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLMapElement* it = new nsHTMLMapElement(mInner.mTag);
nsHTMLMapElement* it = new nsHTMLMapElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -43,7 +43,7 @@ class nsHTMLMenuElement : public nsIDOMHTMLMenuElement,
public nsIHTMLContent
{
public:
nsHTMLMenuElement(nsIAtom* aTag);
nsHTMLMenuElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLMenuElement();
// nsISupports
@ -76,13 +76,13 @@ protected:
};
nsresult
NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLMenuElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLMenuElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -90,10 +90,10 @@ NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLMenuElement::nsHTMLMenuElement(nsIAtom* aTag)
nsHTMLMenuElement::nsHTMLMenuElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLMenuElement::~nsHTMLMenuElement()
@ -120,7 +120,7 @@ nsHTMLMenuElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLMenuElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLMenuElement* it = new nsHTMLMenuElement(mInner.mTag);
nsHTMLMenuElement* it = new nsHTMLMenuElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLMetaElement : public nsIDOMHTMLMetaElement,
public nsIHTMLContent
{
public:
nsHTMLMetaElement(nsIAtom* aTag);
nsHTMLMetaElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLMetaElement();
// nsISupports
@ -77,13 +77,13 @@ protected:
};
nsresult
NS_NewHTMLMetaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLMetaElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLMetaElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLMetaElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -91,10 +91,10 @@ NS_NewHTMLMetaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLMetaElement::nsHTMLMetaElement(nsIAtom* aTag)
nsHTMLMetaElement::nsHTMLMetaElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLMetaElement::~nsHTMLMetaElement()
@ -122,7 +122,7 @@ nsHTMLMetaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLMetaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLMetaElement* it = new nsHTMLMetaElement(mInner.mTag);
nsHTMLMetaElement* it = new nsHTMLMetaElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLModElement : public nsIDOMHTMLModElement,
public nsIHTMLContent
{
public:
nsHTMLModElement(nsIAtom* aTag);
nsHTMLModElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLModElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLModElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLModElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLModElement::nsHTMLModElement(nsIAtom* aTag)
nsHTMLModElement::nsHTMLModElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLModElement::~nsHTMLModElement()
@ -117,7 +117,7 @@ nsHTMLModElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLModElement* it = new nsHTMLModElement(mInner.mTag);
nsHTMLModElement* it = new nsHTMLModElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLOListElement : public nsIDOMHTMLOListElement,
public nsIHTMLContent
{
public:
nsHTMLOListElement(nsIAtom* aTag);
nsHTMLOListElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLOListElement();
// nsISupports
@ -76,13 +76,13 @@ protected:
};
nsresult
NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLOListElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLOListElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -90,10 +90,10 @@ NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLOListElement::nsHTMLOListElement(nsIAtom* aTag)
nsHTMLOListElement::nsHTMLOListElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLOListElement::~nsHTMLOListElement()
@ -120,7 +120,7 @@ nsHTMLOListElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLOListElement* it = new nsHTMLOListElement(mInner.mTag);
nsHTMLOListElement* it = new nsHTMLOListElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLObjectElement : public nsIDOMHTMLObjectElement,
public nsIHTMLContent
{
public:
nsHTMLObjectElement(nsIAtom* aTag);
nsHTMLObjectElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLObjectElement();
// nsISupports
@ -71,13 +71,13 @@ protected:
};
nsresult
NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLObjectElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLObjectElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -85,10 +85,10 @@ NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLObjectElement::nsHTMLObjectElement(nsIAtom* aTag)
nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLObjectElement::~nsHTMLObjectElement()
@ -115,7 +115,7 @@ nsHTMLObjectElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLObjectElement* it = new nsHTMLObjectElement(mInner.mTag);
nsHTMLObjectElement* it = new nsHTMLObjectElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLOptGroupElement : public nsIDOMHTMLOptGroupElement,
public nsIHTMLContent
{
public:
nsHTMLOptGroupElement(nsIAtom* aTag);
nsHTMLOptGroupElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLOptGroupElement();
// nsISupports
@ -73,13 +73,13 @@ protected:
};
nsresult
NS_NewHTMLOptGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLOptGroupElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLOptGroupElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLOptGroupElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -87,10 +87,10 @@ NS_NewHTMLOptGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLOptGroupElement::nsHTMLOptGroupElement(nsIAtom* aTag)
nsHTMLOptGroupElement::nsHTMLOptGroupElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLOptGroupElement::~nsHTMLOptGroupElement()
@ -117,7 +117,7 @@ nsHTMLOptGroupElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLOptGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLOptGroupElement* it = new nsHTMLOptGroupElement(mInner.mTag);
nsHTMLOptGroupElement* it = new nsHTMLOptGroupElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -52,6 +52,7 @@
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsNodeInfoManager.h"
#include "nsCOMPtr.h"
@ -73,7 +74,7 @@ class nsHTMLOptionElement : public nsIDOMHTMLOptionElement,
//public nsIFormControl
{
public:
nsHTMLOptionElement(nsIAtom* aTag);
nsHTMLOptionElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLOptionElement();
// nsISupports
@ -115,13 +116,30 @@ protected:
};
nsresult
NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
/*
* nsHTMLOptionElement's will be created without a nsINodeInfo passed in
* if someone creates new option elements in JavaScript, in a case like
* that we request the nsINodeInfo from the anonymous nodeinfo list.
*/
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
if (!nodeInfo) {
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
nsresult rv;
rv = nsNodeInfoManager::GetAnonymousManager(*getter_AddRefs(nodeInfoManager));
NS_ENSURE_SUCCESS(rv, rv);
rv = nodeInfoManager->GetNodeInfo(nsHTMLAtoms::option, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
}
nsIHTMLContent* it = new nsHTMLOptionElement(aTag);
nsIHTMLContent* it = new nsHTMLOptionElement(nodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -129,10 +147,10 @@ NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLOptionElement::nsHTMLOptionElement(nsIAtom* aTag)
nsHTMLOptionElement::nsHTMLOptionElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLOptionElement::~nsHTMLOptionElement()
@ -209,7 +227,7 @@ nsHTMLOptionElement::SetParent(nsIContent* aParent)
nsresult
nsHTMLOptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLOptionElement* it = new nsHTMLOptionElement(mInner.mTag);
nsHTMLOptionElement* it = new nsHTMLOptionElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -72,22 +72,22 @@ public:
protected:
nsGenericHTMLContainerElement mInner;
friend nsresult NS_NewHTMLParagraphElement(nsIHTMLContent**, nsIAtom*);
friend nsresult NS_NewHTMLParagraphElement(nsIHTMLContent**, nsINodeInfo *);
};
nsresult
NS_NewHTMLParagraphElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLParagraphElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsHTMLParagraphElement* it;
NS_NEWXPCOM(it, nsHTMLParagraphElement);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->mInner.Init(it, aTag);
it->mInner.Init(it, aNodeInfo);
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
}
@ -126,7 +126,7 @@ nsHTMLParagraphElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
it->mInner.Init(it, mInner.mTag);
it->mInner.Init(it, mInner.mNodeInfo);
mInner.CopyInnerTo(this, &it->mInner, aDeep);
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}

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

@ -38,7 +38,7 @@ class nsHTMLParamElement : public nsIDOMHTMLParamElement,
public nsIHTMLContent
{
public:
nsHTMLParamElement(nsIAtom* aTag);
nsHTMLParamElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLParamElement();
// nsISupports
@ -77,13 +77,13 @@ protected:
};
nsresult
NS_NewHTMLParamElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLParamElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLParamElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLParamElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -91,10 +91,10 @@ NS_NewHTMLParamElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLParamElement::nsHTMLParamElement(nsIAtom* aTag)
nsHTMLParamElement::nsHTMLParamElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLParamElement::~nsHTMLParamElement()
@ -121,7 +121,7 @@ nsHTMLParamElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLParamElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLParamElement* it = new nsHTMLParamElement(mInner.mTag);
nsHTMLParamElement* it = new nsHTMLParamElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -41,7 +41,7 @@ class nsHTMLPreElement : public nsIDOMHTMLPreElement,
public nsIHTMLContent
{
public:
nsHTMLPreElement(nsIAtom* aTag);
nsHTMLPreElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLPreElement();
// nsISupports
@ -74,13 +74,13 @@ protected:
};
nsresult
NS_NewHTMLPreElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLPreElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLPreElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLPreElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -88,10 +88,10 @@ NS_NewHTMLPreElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLPreElement::nsHTMLPreElement(nsIAtom* aTag)
nsHTMLPreElement::nsHTMLPreElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLPreElement::~nsHTMLPreElement()
@ -118,7 +118,7 @@ nsHTMLPreElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLPreElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLPreElement* it = new nsHTMLPreElement(mInner.mTag);
nsHTMLPreElement* it = new nsHTMLPreElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLQuoteElement : public nsIDOMHTMLQuoteElement,
public nsIHTMLContent
{
public:
nsHTMLQuoteElement(nsIAtom* aTag);
nsHTMLQuoteElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLQuoteElement();
// nsISupports
@ -71,13 +71,13 @@ protected:
};
nsresult
NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLQuoteElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLQuoteElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -85,10 +85,10 @@ NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLQuoteElement::nsHTMLQuoteElement(nsIAtom* aTag)
nsHTMLQuoteElement::nsHTMLQuoteElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLQuoteElement::~nsHTMLQuoteElement()
@ -115,7 +115,7 @@ nsHTMLQuoteElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLQuoteElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLQuoteElement* it = new nsHTMLQuoteElement(mInner.mTag);
nsHTMLQuoteElement* it = new nsHTMLQuoteElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,7 +38,7 @@ class nsHTMLScriptElement : public nsIDOMHTMLScriptElement,
public nsIHTMLContent
{
public:
nsHTMLScriptElement(nsIAtom* aTag);
nsHTMLScriptElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLScriptElement();
// nsISupports
@ -84,13 +84,13 @@ protected:
};
nsresult
NS_NewHTMLScriptElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLScriptElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLScriptElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLScriptElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -98,10 +98,10 @@ NS_NewHTMLScriptElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLScriptElement::nsHTMLScriptElement(nsIAtom* aTag)
nsHTMLScriptElement::nsHTMLScriptElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLScriptElement::~nsHTMLScriptElement()
@ -128,7 +128,7 @@ nsHTMLScriptElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLScriptElement* it = new nsHTMLScriptElement(mInner.mTag);
nsHTMLScriptElement* it = new nsHTMLScriptElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -130,7 +130,7 @@ class nsHTMLSelectElement : public nsIDOMHTMLSelectElement,
public nsISelectElement
{
public:
nsHTMLSelectElement(nsIAtom* aTag);
nsHTMLSelectElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLSelectElement();
// nsISupports
@ -222,13 +222,13 @@ protected:
// construction, destruction
nsresult
NS_NewHTMLSelectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLSelectElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLSelectElement* it = new nsHTMLSelectElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsHTMLSelectElement* it = new nsHTMLSelectElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -236,10 +236,10 @@ NS_NewHTMLSelectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag)
nsHTMLSelectElement::nsHTMLSelectElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mOptions = nsnull;
mForm = nsnull;
mIsDoneAddingContent = PR_TRUE;
@ -322,7 +322,7 @@ nsHTMLSelectElement::Release()
nsresult
nsHTMLSelectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLSelectElement* it = new nsHTMLSelectElement(mInner.mTag);
nsHTMLSelectElement* it = new nsHTMLSelectElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -479,8 +479,12 @@ nsHTMLSelectElement::SetLength(PRUint32 aLength)
} else if (aLength) {
// This violates the W3C DOM but we do this for backwards compatibility
nsCOMPtr<nsIHTMLContent> element;
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = NS_NewHTMLOptionElement(getter_AddRefs(element), nsHTMLAtoms::option);
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::option,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLOptionElement(getter_AddRefs(element), nodeInfo);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> text;

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

@ -39,7 +39,7 @@ class nsHTMLObjectElement : public nsIDOMHTMLObjectElement,
public nsIHTMLContent
{
public:
nsHTMLObjectElement(nsIAtom* aTag);
nsHTMLObjectElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLObjectElement();
// nsISupports
@ -71,13 +71,13 @@ protected:
};
nsresult
NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLObjectElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLObjectElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -85,10 +85,10 @@ NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLObjectElement::nsHTMLObjectElement(nsIAtom* aTag)
nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLObjectElement::~nsHTMLObjectElement()
@ -115,7 +115,7 @@ nsHTMLObjectElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLObjectElement* it = new nsHTMLObjectElement(mInner.mTag);
nsHTMLObjectElement* it = new nsHTMLObjectElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -62,7 +62,7 @@ class nsHTMLSpacerElement : public nsIDOMHTMLElement,
public nsIHTMLContent
{
public:
nsHTMLSpacerElement(nsIAtom* aTag);
nsHTMLSpacerElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLSpacerElement();
// nsISupports
@ -103,13 +103,13 @@ protected:
};
nsresult
NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLSpacerElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLSpacerElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -117,10 +117,10 @@ NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLSpacerElement::nsHTMLSpacerElement(nsIAtom* aTag)
nsHTMLSpacerElement::nsHTMLSpacerElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLSpacerElement::~nsHTMLSpacerElement()
@ -150,7 +150,7 @@ nsHTMLSpacerElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLSpacerElement* it = new nsHTMLSpacerElement(mInner.mTag);
nsHTMLSpacerElement* it = new nsHTMLSpacerElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -36,7 +36,7 @@ class nsHTMLSpanElement : public nsIDOMHTMLElement,
public nsIHTMLContent
{
public:
nsHTMLSpanElement(nsIAtom* aTag);
nsHTMLSpanElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLSpanElement();
// nsISupports
@ -65,13 +65,13 @@ protected:
};
nsresult
NS_NewHTMLSpanElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLSpanElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLSpanElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLSpanElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -79,10 +79,10 @@ NS_NewHTMLSpanElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLSpanElement::nsHTMLSpanElement(nsIAtom* aTag)
nsHTMLSpanElement::nsHTMLSpanElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLSpanElement::~nsHTMLSpanElement()
@ -103,7 +103,7 @@ nsHTMLSpanElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLSpanElement* it = new nsHTMLSpanElement(mInner.mTag);
nsHTMLSpanElement* it = new nsHTMLSpanElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -46,7 +46,7 @@ class nsHTMLStyleElement : public nsIDOMHTMLStyleElement,
public nsIStyleSheetLinkingElement
{
public:
nsHTMLStyleElement(nsIAtom* aTag);
nsHTMLStyleElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLStyleElement();
// nsISupports
@ -88,13 +88,13 @@ protected:
};
nsresult
NS_NewHTMLStyleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLStyleElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLStyleElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLStyleElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -102,10 +102,10 @@ NS_NewHTMLStyleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLStyleElement::nsHTMLStyleElement(nsIAtom* aTag)
nsHTMLStyleElement::nsHTMLStyleElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mStyleSheet = nsnull;
}
@ -140,7 +140,7 @@ nsHTMLStyleElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLStyleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLStyleElement* it = new nsHTMLStyleElement(mInner.mTag);
nsHTMLStyleElement* it = new nsHTMLStyleElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLTableCaptionElement : public nsIDOMHTMLTableCaptionElement,
public nsIHTMLContent
{
public:
nsHTMLTableCaptionElement(nsIAtom* aTag);
nsHTMLTableCaptionElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableCaptionElement();
// nsISupports
@ -72,13 +72,13 @@ protected:
};
nsresult
NS_NewHTMLTableCaptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableCaptionElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableCaptionElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableCaptionElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -86,10 +86,10 @@ NS_NewHTMLTableCaptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag
}
nsHTMLTableCaptionElement::nsHTMLTableCaptionElement(nsIAtom* aTag)
nsHTMLTableCaptionElement::nsHTMLTableCaptionElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLTableCaptionElement::~nsHTMLTableCaptionElement()
@ -116,7 +116,7 @@ nsHTMLTableCaptionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableCaptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableCaptionElement* it = new nsHTMLTableCaptionElement(mInner.mTag);
nsHTMLTableCaptionElement* it = new nsHTMLTableCaptionElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -45,7 +45,7 @@ class nsHTMLTableCellElement : public nsIHTMLTableCellElement,
public nsIHTMLContent
{
public:
nsHTMLTableCellElement(nsIAtom* aTag);
nsHTMLTableCellElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableCellElement();
// nsISupports
@ -118,13 +118,13 @@ protected:
};
nsresult
NS_NewHTMLTableCellElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableCellElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableCellElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableCellElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -132,10 +132,10 @@ NS_NewHTMLTableCellElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTableCellElement::nsHTMLTableCellElement(nsIAtom* aTag)
nsHTMLTableCellElement::nsHTMLTableCellElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mColIndex=0;
}
@ -169,7 +169,7 @@ nsHTMLTableCellElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableCellElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableCellElement* it = new nsHTMLTableCellElement(mInner.mTag);
nsHTMLTableCellElement* it = new nsHTMLTableCellElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -42,7 +42,7 @@ class nsHTMLTableColElement : public nsIDOMHTMLTableColElement,
public nsIHTMLContent
{
public:
nsHTMLTableColElement(nsIAtom* aTag);
nsHTMLTableColElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableColElement();
// nsISupports
@ -88,13 +88,13 @@ protected:
};
nsresult
NS_NewHTMLTableColElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableColElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableColElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableColElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -102,10 +102,10 @@ NS_NewHTMLTableColElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTableColElement::nsHTMLTableColElement(nsIAtom* aTag)
nsHTMLTableColElement::nsHTMLTableColElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLTableColElement::~nsHTMLTableColElement()
@ -138,7 +138,7 @@ nsHTMLTableColElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableColElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableColElement* it = new nsHTMLTableColElement(mInner.mTag);
nsHTMLTableColElement* it = new nsHTMLTableColElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -39,7 +39,7 @@ class nsHTMLTableColGroupElement : public nsIDOMHTMLTableColElement,
public nsIHTMLContent
{
public:
nsHTMLTableColGroupElement(nsIAtom* aTag);
nsHTMLTableColGroupElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableColGroupElement();
// nsISupports
@ -82,13 +82,13 @@ protected:
};
nsresult
NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableColGroupElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableColGroupElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -96,10 +96,10 @@ NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTa
}
nsHTMLTableColGroupElement::nsHTMLTableColGroupElement(nsIAtom* aTag)
nsHTMLTableColGroupElement::nsHTMLTableColGroupElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLTableColGroupElement::~nsHTMLTableColGroupElement()
@ -127,7 +127,7 @@ nsHTMLTableColGroupElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableColGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableColGroupElement* it = new nsHTMLTableColGroupElement(mInner.mTag);
nsHTMLTableColGroupElement* it = new nsHTMLTableColGroupElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -56,7 +56,7 @@ class nsHTMLTableElement : public nsIDOMHTMLTableElement,
public nsIHTMLContent
{
public:
nsHTMLTableElement(nsIAtom* aTag);
nsHTMLTableElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableElement();
// nsISupports
@ -322,13 +322,13 @@ TableRowsCollection::ParentDestroyed()
// the class declaration is at the top of this file
nsresult
NS_NewHTMLTableElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -336,10 +336,10 @@ NS_NewHTMLTableElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTableElement::nsHTMLTableElement(nsIAtom* aTag)
nsHTMLTableElement::nsHTMLTableElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mTBodies=nsnull;
mRows=nsnull;
}
@ -378,7 +378,7 @@ nsHTMLTableElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableElement* it = new nsHTMLTableElement(mInner.mTag);
nsHTMLTableElement* it = new nsHTMLTableElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -566,7 +566,12 @@ nsHTMLTableElement::CreateTHead(nsIDOMHTMLElement** aValue)
else
{ // create a new head rowgroup
nsCOMPtr<nsIHTMLContent> newHead;
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nsHTMLAtoms::thead);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::thead,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nodeInfo);
if (NS_SUCCEEDED(rv) && newHead)
{
nsCOMPtr<nsIDOMNode> child;
@ -612,7 +617,12 @@ nsHTMLTableElement::CreateTFoot(nsIDOMHTMLElement** aValue)
else
{ // create a new foot rowgroup
nsCOMPtr<nsIHTMLContent> newFoot;
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newFoot),nsHTMLAtoms::tfoot);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::tfoot,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newFoot),nodeInfo);
if (NS_SUCCEEDED(rv) && newFoot)
{
rv = mInner.AppendChildTo(newFoot, PR_TRUE);
@ -650,7 +660,12 @@ nsHTMLTableElement::CreateCaption(nsIDOMHTMLElement** aValue)
else
{ // create a new head rowgroup
nsCOMPtr<nsIHTMLContent> newCaption;
rv = NS_NewHTMLTableCaptionElement(getter_AddRefs(newCaption),nsHTMLAtoms::caption);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::caption,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableCaptionElement(getter_AddRefs(newCaption),nodeInfo);
if (NS_SUCCEEDED(rv) && newCaption)
{
rv = mInner.AppendChildTo(newCaption, PR_TRUE);
@ -704,7 +719,11 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
refRow->GetParentNode(&parent);
// create the row
nsIHTMLContent *newRow=nsnull;
rv = NS_NewHTMLTableRowElement(&newRow, nsHTMLAtoms::tr);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::tr, *getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableRowElement(&newRow, nodeInfo);
if (NS_SUCCEEDED(rv) && (nsnull!=newRow))
{
nsIDOMNode *newRowNode=nsnull;
@ -753,7 +772,12 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
if (nsnull==rowGroup)
{ // need to create a TBODY
nsIHTMLContent *newRowGroup=nsnull;
rv = NS_NewHTMLTableSectionElement(&newRowGroup, nsHTMLAtoms::tbody);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::tbody,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableSectionElement(&newRowGroup, nodeInfo);
if (NS_SUCCEEDED(rv) && (nsnull!=newRowGroup))
{
rv = mInner.AppendChildTo(newRowGroup, PR_TRUE);
@ -764,7 +788,12 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
if (nsnull!=rowGroup)
{
nsIHTMLContent *newRow=nsnull;
rv = NS_NewHTMLTableRowElement(&newRow, nsHTMLAtoms::tr);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::tr,
*getter_AddRefs(nodeInfo));
rv = NS_NewHTMLTableRowElement(&newRow, nodeInfo);
nsIContent *rowGroupContent=nsnull;
rowGroup->QueryInterface(kIContentIID, (void **)&rowGroupContent);
GenericElementCollection rowGroupRows(rowGroupContent, nsHTMLAtoms::tr);

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

@ -142,7 +142,7 @@ class nsHTMLTableRowElement : public nsIDOMHTMLTableRowElement,
public nsIHTMLContent
{
public:
nsHTMLTableRowElement(nsIAtom* aTag);
nsHTMLTableRowElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableRowElement();
// nsISupports
@ -223,13 +223,13 @@ void DebugList(nsIDOMHTMLTableElement* aTable) {
#endif
nsresult
NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableRowElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableRowElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -237,10 +237,10 @@ NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTableRowElement::nsHTMLTableRowElement(nsIAtom* aTag)
nsHTMLTableRowElement::nsHTMLTableRowElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mCells = nsnull;
}
@ -272,7 +272,7 @@ nsHTMLTableRowElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableRowElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableRowElement* it = new nsHTMLTableRowElement(mInner.mTag);
nsHTMLTableRowElement* it = new nsHTMLTableRowElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -532,7 +532,10 @@ nsHTMLTableRowElement::InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
// create the cell
nsIHTMLContent* cellContent = nsnull;
nsresult rv = NS_NewHTMLTableCellElement(&cellContent, nsHTMLAtoms::td);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::td, *getter_AddRefs(nodeInfo));
nsresult rv = NS_NewHTMLTableCellElement(&cellContent, nodeInfo);
if (NS_SUCCEEDED(rv) && (nsnull != cellContent)) {
nsIDOMNode* cellNode = nsnull;
rv = cellContent->QueryInterface(kIDOMNodeIID, (void **)&cellNode);

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

@ -44,7 +44,7 @@ class nsHTMLTableSectionElement : public nsIDOMHTMLTableSectionElement,
public nsIHTMLContent
{
public:
nsHTMLTableSectionElement(nsIAtom* aTag);
nsHTMLTableSectionElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTableSectionElement();
// nsISupports
@ -87,13 +87,13 @@ protected:
};
nsresult
NS_NewHTMLTableSectionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTableSectionElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTableSectionElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTableSectionElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -101,10 +101,10 @@ NS_NewHTMLTableSectionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag
}
nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsIAtom* aTag)
nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mRows = nsnull;
}
@ -136,7 +136,7 @@ nsHTMLTableSectionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTableSectionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTableSectionElement* it = new nsHTMLTableSectionElement(mInner.mTag);
nsHTMLTableSectionElement* it = new nsHTMLTableSectionElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -176,7 +176,10 @@ nsHTMLTableSectionElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
// create the row
nsIHTMLContent* rowContent = nsnull;
nsresult rv = NS_NewHTMLTableRowElement(&rowContent, nsHTMLAtoms::tr);
nsCOMPtr<nsINodeInfo> nodeInfo;
mInner.mNodeInfo->NameChanged(nsHTMLAtoms::tr, *getter_AddRefs(nodeInfo));
nsresult rv = NS_NewHTMLTableRowElement(&rowContent, nodeInfo);
if (NS_SUCCEEDED(rv) && (nsnull != rowContent)) {
nsIDOMNode* rowNode = nsnull;
rv = rowContent->QueryInterface(kIDOMNodeIID, (void **)&rowNode);

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

@ -59,7 +59,7 @@ class nsHTMLTextAreaElement : public nsIDOMHTMLTextAreaElement,
public nsIFormControl
{
public:
nsHTMLTextAreaElement(nsIAtom* aTag);
nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTextAreaElement();
// nsISupports
@ -123,13 +123,13 @@ protected:
};
nsresult
NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTextAreaElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTextAreaElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -137,10 +137,10 @@ NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsIAtom* aTag)
nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
mForm = nsnull;
}
@ -199,7 +199,7 @@ nsHTMLTextAreaElement::Release()
nsresult
nsHTMLTextAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTextAreaElement* it = new nsHTMLTextAreaElement(mInner.mTag);
nsHTMLTextAreaElement* it = new nsHTMLTextAreaElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -44,7 +44,7 @@ class nsHTMLTitleElement : public nsIDOMHTMLTitleElement,
public nsIHTMLContent
{
public:
nsHTMLTitleElement(nsIAtom* aTag);
nsHTMLTitleElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLTitleElement();
// nsISupports
@ -77,13 +77,13 @@ protected:
};
nsresult
NS_NewHTMLTitleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLTitleElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLTitleElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLTitleElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -91,10 +91,10 @@ NS_NewHTMLTitleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLTitleElement::nsHTMLTitleElement(nsIAtom* aTag)
nsHTMLTitleElement::nsHTMLTitleElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLTitleElement::~nsHTMLTitleElement()
@ -121,7 +121,7 @@ nsHTMLTitleElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLTitleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLTitleElement* it = new nsHTMLTitleElement(mInner.mTag);
nsHTMLTitleElement* it = new nsHTMLTitleElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -42,7 +42,7 @@ class nsHTMLUListElement : public nsIDOMHTMLUListElement,
public nsIHTMLContent
{
public:
nsHTMLUListElement(nsIAtom* aTag);
nsHTMLUListElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLUListElement();
// nsISupports
@ -77,13 +77,13 @@ protected:
};
nsresult
NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLUListElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLUListElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -91,10 +91,10 @@ NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLUListElement::nsHTMLUListElement(nsIAtom* aTag)
nsHTMLUListElement::nsHTMLUListElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLUListElement::~nsHTMLUListElement()
@ -121,7 +121,7 @@ nsHTMLUListElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLUListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLUListElement* it = new nsHTMLUListElement(mInner.mTag);
nsHTMLUListElement* it = new nsHTMLUListElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -45,7 +45,7 @@ class nsHTMLUnknownElement : public nsIDOMHTMLElement,
public nsIHTMLContent
{
public:
nsHTMLUnknownElement(nsIAtom* aTag);
nsHTMLUnknownElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLUnknownElement();
// nsISupports
@ -186,13 +186,13 @@ protected:
};
nsresult
NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLUnknownElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLUnknownElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -200,10 +200,10 @@ NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLUnknownElement::nsHTMLUnknownElement(nsIAtom* aTag)
nsHTMLUnknownElement::nsHTMLUnknownElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLUnknownElement::~nsHTMLUnknownElement()
@ -225,7 +225,7 @@ nsHTMLUnknownElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLUnknownElement* it = new nsHTMLUnknownElement(mInner.mTag);
nsHTMLUnknownElement* it = new nsHTMLUnknownElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -40,7 +40,7 @@ class nsHTMLWBRElement : public nsIDOMHTMLElement,
public nsIHTMLContent
{
public:
nsHTMLWBRElement(nsIAtom* aTag);
nsHTMLWBRElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLWBRElement();
// nsISupports
@ -69,13 +69,13 @@ protected:
};
nsresult
NS_NewHTMLWBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewHTMLWBRElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIHTMLContent* it = new nsHTMLWBRElement(aTag);
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsIHTMLContent* it = new nsHTMLWBRElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -83,10 +83,10 @@ NS_NewHTMLWBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
}
nsHTMLWBRElement::nsHTMLWBRElement(nsIAtom* aTag)
nsHTMLWBRElement::nsHTMLWBRElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, aTag);
mInner.Init(this, aNodeInfo);
}
nsHTMLWBRElement::~nsHTMLWBRElement()
@ -115,7 +115,7 @@ nsHTMLWBRElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
nsHTMLWBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsHTMLWBRElement* it = new nsHTMLWBRElement(mInner.mTag);
nsHTMLWBRElement* it = new nsHTMLWBRElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -37,6 +37,7 @@
#include "nsIViewManager.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsINodeInfo.h"
#include "nsHTMLTokens.h"
#include "nsHTMLEntities.h"
#include "nsCRT.h"
@ -302,6 +303,7 @@ public:
nsIDocument* mDocument;
nsIHTMLDocument* mHTMLDocument;
nsINodeInfoManager* mNodeInfoManager;
nsIURI* mDocumentURI;
nsIURI* mDocumentBaseURL;
nsCOMPtr<nsIURI> mScriptURI;
@ -514,10 +516,10 @@ HTMLContentSink::ReduceEntities(nsString& aString)
// so we should add a translate numeric entity method from the parser...
char cbuf[100];
PRInt32 i = 0;
while (i < aString.Length()) {
while ((PRUint32)i < aString.Length()) {
// If we have the start of an entity (and it's not at the end of
// our string) then translate the entity into it's unicode value.
if ((aString.CharAt(i++) == '&') && (i < aString.Length())) {
if ((aString.CharAt(i++) == '&') && ((PRUint32)i < aString.Length())) {
PRInt32 start = i - 1;
PRUnichar e = aString.CharAt(i);
if (e == '#') {
@ -686,57 +688,57 @@ void SetForm(nsIHTMLContent* aContent, nsIDOMHTMLFormElement* aForm)
// XXX compare switch statement against nsHTMLTags.h's list
static nsresult
MakeContentObject(nsHTMLTag aNodeType,
nsIAtom* aAtom,
nsIDOMHTMLFormElement* aForm,
nsIWebShell* aWebShell,
nsIHTMLContent** aResult,
const nsString* aContent = nsnull)
nsINodeInfo *aNodeInfo,
nsIDOMHTMLFormElement* aForm,
nsIWebShell* aWebShell,
nsIHTMLContent** aResult,
const nsString* aContent = nsnull)
{
nsresult rv = NS_OK;
switch (aNodeType) {
default:
rv = NS_NewHTMLSpanElement(aResult, aAtom);
rv = NS_NewHTMLSpanElement(aResult, aNodeInfo);
break;
case eHTMLTag_a:
rv = NS_NewHTMLAnchorElement(aResult, aAtom);
rv = NS_NewHTMLAnchorElement(aResult, aNodeInfo);
break;
case eHTMLTag_applet:
rv = NS_NewHTMLAppletElement(aResult, aAtom);
rv = NS_NewHTMLAppletElement(aResult, aNodeInfo);
break;
case eHTMLTag_area:
rv = NS_NewHTMLAreaElement(aResult, aAtom);
rv = NS_NewHTMLAreaElement(aResult, aNodeInfo);
break;
case eHTMLTag_base:
rv = NS_NewHTMLBaseElement(aResult, aAtom);
rv = NS_NewHTMLBaseElement(aResult, aNodeInfo);
break;
case eHTMLTag_basefont:
rv = NS_NewHTMLBaseFontElement(aResult, aAtom);
rv = NS_NewHTMLBaseFontElement(aResult, aNodeInfo);
break;
case eHTMLTag_blockquote:
rv = NS_NewHTMLQuoteElement(aResult, aAtom);
rv = NS_NewHTMLQuoteElement(aResult, aNodeInfo);
break;
case eHTMLTag_body:
rv = NS_NewHTMLBodyElement(aResult, aAtom);
rv = NS_NewHTMLBodyElement(aResult, aNodeInfo);
break;
case eHTMLTag_br:
rv = NS_NewHTMLBRElement(aResult, aAtom);
rv = NS_NewHTMLBRElement(aResult, aNodeInfo);
break;
case eHTMLTag_button:
rv = NS_NewHTMLButtonElement(aResult, aAtom);
rv = NS_NewHTMLButtonElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_caption:
rv = NS_NewHTMLTableCaptionElement(aResult, aAtom);
rv = NS_NewHTMLTableCaptionElement(aResult, aNodeInfo);
break;
case eHTMLTag_col:
rv = NS_NewHTMLTableColElement(aResult, aAtom);
rv = NS_NewHTMLTableColElement(aResult, aNodeInfo);
break;
case eHTMLTag_colgroup:
rv = NS_NewHTMLTableColGroupElement(aResult, aAtom);
rv = NS_NewHTMLTableColGroupElement(aResult, aNodeInfo);
break;
case eHTMLTag_dir:
rv = NS_NewHTMLDirectoryElement(aResult, aAtom);
rv = NS_NewHTMLDirectoryElement(aResult, aNodeInfo);
break;
case eHTMLTag_div:
case eHTMLTag_noembed:
@ -744,20 +746,20 @@ MakeContentObject(nsHTMLTag aNodeType,
case eHTMLTag_noscript:
case eHTMLTag_parsererror:
case eHTMLTag_sourcetext:
rv = NS_NewHTMLDivElement(aResult, aAtom);
rv = NS_NewHTMLDivElement(aResult, aNodeInfo);
break;
case eHTMLTag_dl:
rv = NS_NewHTMLDListElement(aResult, aAtom);
rv = NS_NewHTMLDListElement(aResult, aNodeInfo);
break;
case eHTMLTag_embed:
rv = NS_NewHTMLEmbedElement(aResult, aAtom);
rv = NS_NewHTMLEmbedElement(aResult, aNodeInfo);
break;
case eHTMLTag_fieldset:
rv = NS_NewHTMLFieldSetElement(aResult, aAtom);
rv = NS_NewHTMLFieldSetElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_font:
rv = NS_NewHTMLFontElement(aResult, aAtom);
rv = NS_NewHTMLFontElement(aResult, aNodeInfo);
break;
case eHTMLTag_form:
// the form was already created
@ -765,14 +767,14 @@ MakeContentObject(nsHTMLTag aNodeType,
rv = aForm->QueryInterface(kIHTMLContentIID, (void**)aResult);
}
else {
rv = NS_NewHTMLFormElement(aResult, aAtom);
rv = NS_NewHTMLFormElement(aResult, aNodeInfo);
}
break;
case eHTMLTag_frame:
rv = NS_NewHTMLFrameElement(aResult, aAtom);
rv = NS_NewHTMLFrameElement(aResult, aNodeInfo);
break;
case eHTMLTag_frameset:
rv = NS_NewHTMLFrameSetElement(aResult, aAtom);
rv = NS_NewHTMLFrameSetElement(aResult, aNodeInfo);
break;
case eHTMLTag_h1:
case eHTMLTag_h2:
@ -780,104 +782,104 @@ MakeContentObject(nsHTMLTag aNodeType,
case eHTMLTag_h4:
case eHTMLTag_h5:
case eHTMLTag_h6:
rv = NS_NewHTMLHeadingElement(aResult, aAtom);
rv = NS_NewHTMLHeadingElement(aResult, aNodeInfo);
break;
case eHTMLTag_head:
rv = NS_NewHTMLHeadElement(aResult, aAtom);
rv = NS_NewHTMLHeadElement(aResult, aNodeInfo);
break;
case eHTMLTag_hr:
rv = NS_NewHTMLHRElement(aResult, aAtom);
rv = NS_NewHTMLHRElement(aResult, aNodeInfo);
break;
case eHTMLTag_html:
rv = NS_NewHTMLHtmlElement(aResult, aAtom);
rv = NS_NewHTMLHtmlElement(aResult, aNodeInfo);
break;
case eHTMLTag_iframe:
rv = NS_NewHTMLIFrameElement(aResult, aAtom);
rv = NS_NewHTMLIFrameElement(aResult, aNodeInfo);
break;
case eHTMLTag_img:
rv = NS_NewHTMLImageElement(aResult, aAtom);
rv = NS_NewHTMLImageElement(aResult, aNodeInfo);
break;
case eHTMLTag_input:
rv = NS_NewHTMLInputElement(aResult, aAtom);
rv = NS_NewHTMLInputElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_isindex:
rv = NS_NewHTMLIsIndexElement(aResult, aAtom);
rv = NS_NewHTMLIsIndexElement(aResult, aNodeInfo);
break;
case eHTMLTag_label:
rv = NS_NewHTMLLabelElement(aResult, aAtom);
rv = NS_NewHTMLLabelElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_legend:
rv = NS_NewHTMLLegendElement(aResult, aAtom);
rv = NS_NewHTMLLegendElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_li:
rv = NS_NewHTMLLIElement(aResult, aAtom);
rv = NS_NewHTMLLIElement(aResult, aNodeInfo);
break;
case eHTMLTag_link:
rv = NS_NewHTMLLinkElement(aResult, aAtom);
rv = NS_NewHTMLLinkElement(aResult, aNodeInfo);
break;
case eHTMLTag_map:
rv = NS_NewHTMLMapElement(aResult, aAtom);
rv = NS_NewHTMLMapElement(aResult, aNodeInfo);
break;
case eHTMLTag_menu:
rv = NS_NewHTMLMenuElement(aResult, aAtom);
rv = NS_NewHTMLMenuElement(aResult, aNodeInfo);
break;
case eHTMLTag_meta:
rv = NS_NewHTMLMetaElement(aResult, aAtom);
rv = NS_NewHTMLMetaElement(aResult, aNodeInfo);
break;
case eHTMLTag_object:
rv = NS_NewHTMLObjectElement(aResult, aAtom);
rv = NS_NewHTMLObjectElement(aResult, aNodeInfo);
break;
case eHTMLTag_ol:
rv = NS_NewHTMLOListElement(aResult, aAtom);
rv = NS_NewHTMLOListElement(aResult, aNodeInfo);
break;
case eHTMLTag_optgroup:
rv = NS_NewHTMLOptGroupElement(aResult, aAtom);
rv = NS_NewHTMLOptGroupElement(aResult, aNodeInfo);
break;
case eHTMLTag_option:
rv = NS_NewHTMLOptionElement(aResult, aAtom);
rv = NS_NewHTMLOptionElement(aResult, aNodeInfo);
break;
case eHTMLTag_p:
rv = NS_NewHTMLParagraphElement(aResult, aAtom);
rv = NS_NewHTMLParagraphElement(aResult, aNodeInfo);
break;
case eHTMLTag_pre:
rv = NS_NewHTMLPreElement(aResult, aAtom);
rv = NS_NewHTMLPreElement(aResult, aNodeInfo);
break;
case eHTMLTag_param:
rv = NS_NewHTMLParamElement(aResult, aAtom);
rv = NS_NewHTMLParamElement(aResult, aNodeInfo);
break;
case eHTMLTag_q:
rv = NS_NewHTMLQuoteElement(aResult, aAtom);
rv = NS_NewHTMLQuoteElement(aResult, aNodeInfo);
break;
case eHTMLTag_script:
rv = NS_NewHTMLScriptElement(aResult, aAtom);
rv = NS_NewHTMLScriptElement(aResult, aNodeInfo);
break;
case eHTMLTag_select:
rv = NS_NewHTMLSelectElement(aResult, aAtom);
rv = NS_NewHTMLSelectElement(aResult, aNodeInfo);
SetForm(*aResult, aForm);
break;
case eHTMLTag_spacer:
rv = NS_NewHTMLSpacerElement(aResult, aAtom);
rv = NS_NewHTMLSpacerElement(aResult, aNodeInfo);
break;
case eHTMLTag_style:
rv = NS_NewHTMLStyleElement(aResult, aAtom);
rv = NS_NewHTMLStyleElement(aResult, aNodeInfo);
break;
case eHTMLTag_table:
rv = NS_NewHTMLTableElement(aResult, aAtom);
rv = NS_NewHTMLTableElement(aResult, aNodeInfo);
break;
case eHTMLTag_tbody:
case eHTMLTag_thead:
case eHTMLTag_tfoot:
rv = NS_NewHTMLTableSectionElement(aResult, aAtom);
rv = NS_NewHTMLTableSectionElement(aResult, aNodeInfo);
break;
case eHTMLTag_td:
case eHTMLTag_th:
rv = NS_NewHTMLTableCellElement(aResult, aAtom);
rv = NS_NewHTMLTableCellElement(aResult, aNodeInfo);
break;
case eHTMLTag_textarea:
rv = NS_NewHTMLTextAreaElement(aResult, aAtom);
rv = NS_NewHTMLTextAreaElement(aResult, aNodeInfo);
// XXX why is textarea not a container. If it were, this code would not be necessary
// If the text area has some content, set it
if (aContent && (aContent->Length() > 0)) {
@ -891,23 +893,23 @@ MakeContentObject(nsHTMLTag aNodeType,
SetForm(*aResult, aForm);
break;
case eHTMLTag_title:
rv = NS_NewHTMLTitleElement(aResult, aAtom);
rv = NS_NewHTMLTitleElement(aResult, aNodeInfo);
break;
case eHTMLTag_tr:
rv = NS_NewHTMLTableRowElement(aResult, aAtom);
rv = NS_NewHTMLTableRowElement(aResult, aNodeInfo);
break;
case eHTMLTag_ul:
rv = NS_NewHTMLUListElement(aResult, aAtom);
rv = NS_NewHTMLUListElement(aResult, aNodeInfo);
break;
case eHTMLTag_wbr:
rv = NS_NewHTMLWBRElement(aResult, aAtom);
rv = NS_NewHTMLWBRElement(aResult, aNodeInfo);
break;
case eHTMLTag_layer:
case eHTMLTag_ilayer:
case eHTMLTag_nolayer:
case eHTMLTag_unknown:
case eHTMLTag_userdefined:
rv = NS_NewHTMLUnknownElement(aResult, aAtom);
rv = NS_NewHTMLUnknownElement(aResult, aNodeInfo);
break;
}
@ -974,9 +976,12 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
}
if (NS_SUCCEEDED(rv)) {
nsIAtom* atom = NS_NewAtom(tmp);
if (nsnull == atom) {
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = mNodeInfoManager->GetNodeInfo(tmp, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
if (NS_FAILED(rv)) {
return rv;
}
// Make the content object
@ -985,14 +990,12 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
if (eHTMLTag_textarea == aNodeType) {
content.Assign(aNode.GetSkippedContent());
}
rv = MakeContentObject(aNodeType, atom, aForm, aWebShell,
rv = MakeContentObject(aNodeType, nodeInfo, aForm, aWebShell,
aResult, &content);
PRInt32 id;
mDocument->GetAndIncrementContentID(&id);
(*aResult)->SetContentID(id);
NS_RELEASE(atom);
}
return rv;
@ -1001,7 +1004,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
nsresult
NS_CreateHTMLElement(nsIHTMLContent** aResult, const nsString& aTag)
NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo)
{
nsresult rv = NS_OK;
@ -1011,9 +1014,11 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, const nsString& aTag)
&rv);
if (NS_SUCCEEDED(rv)) {
nsAutoString tmpName;
aNodeInfo->GetName(tmpName);
// Find tag in tag table
PRInt32 id;
rv = parserService->HTMLStringTagToId(aTag, &id);
rv = parserService->HTMLStringTagToId(tmpName, &id);
if (eHTMLTag_userdefined == nsHTMLTag(id)) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -1021,35 +1026,11 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, const nsString& aTag)
// Create atom for tag and then create content object
nsAutoString tag;
rv = parserService->HTMLIdToStringTag(id, tag);
nsIAtom* atom = NS_NewAtom(tag.GetUnicode());
rv = MakeContentObject(nsHTMLTag(id), atom, nsnull, nsnull, aResult);
NS_RELEASE(atom);
}
nsCOMPtr<nsIAtom> atom(dont_AddRef(NS_NewAtom(tag.GetUnicode())));
nsCOMPtr<nsINodeInfo> newName;
aNodeInfo->NameChanged(atom, *getter_AddRefs(newName));
return rv;
}
nsresult
NS_CreateHTMLElement(nsIHTMLContent** aResult, PRInt32 aID)
{
nsresult rv = NS_OK;
if (eHTMLTag_userdefined == nsHTMLTag(aID)) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_WITH_SERVICE(nsIParserService,
parserService,
kParserServiceCID,
&rv);
if (NS_SUCCEEDED(rv)) {
// Create atom for tag and then create content object
nsAutoString tag;
rv = parserService->HTMLIdToStringTag(aID, tag);
nsIAtom* atom = NS_NewAtom(tag.GetUnicode());
rv = MakeContentObject(nsHTMLTag(aID), atom, nsnull, nsnull, aResult);
NS_RELEASE(atom);
rv = MakeContentObject(nsHTMLTag(id), newName, nsnull, nsnull, aResult);
}
return rv;
@ -1065,7 +1046,7 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstanceByTag(const nsString& aTag,
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult);
};
@ -1096,12 +1077,15 @@ nsHTMLElementFactory::~nsHTMLElementFactory()
NS_IMPL_ISUPPORTS1(nsHTMLElementFactory, nsIElementFactory);
NS_IMETHODIMP
nsHTMLElementFactory::CreateInstanceByTag(const nsString& aTag,
nsHTMLElementFactory::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_ENSURE_ARG_POINTER(aNodeInfo);
nsresult rv;
nsCOMPtr<nsIHTMLContent> htmlContent;
rv = NS_CreateHTMLElement(getter_AddRefs(htmlContent), aTag);
rv = NS_CreateHTMLElement(getter_AddRefs(htmlContent), aNodeInfo);
nsCOMPtr<nsIContent> content = do_QueryInterface(htmlContent);
*aResult = content;
NS_IF_ADDREF(*aResult);
@ -2094,6 +2078,7 @@ HTMLContentSink::HTMLContentSink() {
mInNotification = 0;
mInMonolithicContainer = 0;
mInsideNoXXXTag = 0;
mNodeInfoManager = nsnull;
}
HTMLContentSink::~HTMLContentSink()
@ -2118,6 +2103,8 @@ HTMLContentSink::~HTMLContentSink()
NS_IF_RELEASE(mCurrentMap);
NS_IF_RELEASE(mRefContent);
NS_IF_RELEASE(mNodeInfoManager);
if (mNotificationTimer) {
mNotificationTimer->Cancel();
}
@ -2183,10 +2170,14 @@ HTMLContentSink::Init(nsIDocument* aDoc,
return NS_ERROR_NULL_POINTER;
}
nsresult rv;
mDocument = aDoc;
NS_ADDREF(aDoc);
aDoc->AddObserver(this);
aDoc->QueryInterface(kIHTMLDocumentIID, (void**)&mHTMLDocument);
rv = mDocument->GetNodeInfoManager(mNodeInfoManager);
NS_ENSURE_SUCCESS(rv, rv);
mDocumentURI = aURL;
NS_ADDREF(aURL);
mDocumentBaseURL = aURL;
@ -2194,7 +2185,6 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mWebShell = aContainer;
NS_ADDREF(aContainer);
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
if (NS_FAILED(rv)) {
@ -2225,8 +2215,14 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// XXX if it isn't we need to set it here...
mDocument->GetHeaderData(nsHTMLAtoms::headerDefaultStyle, mPreferredStyle);
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
// Make root part
rv = NS_NewHTMLHtmlElement(&mRoot, nsHTMLAtoms::html);
rv = NS_NewHTMLHtmlElement(&mRoot, nodeInfo);
if (NS_OK != rv) {
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
@ -2236,14 +2232,12 @@ HTMLContentSink::Init(nsIDocument* aDoc,
mDocument->SetRootContent(mRoot);
// Make head part
nsIAtom* atom = NS_NewAtom("head");
if (nsnull == atom) {
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_ERROR_OUT_OF_MEMORY;
}
rv = NS_NewHTMLHeadElement(&mHead, atom);
NS_RELEASE(atom);
rv = mNodeInfoManager->GetNodeInfo(NS_ConvertASCIItoUCS2("head"),
nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewHTMLHeadElement(&mHead, nodeInfo);
if (NS_OK != rv) {
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
MOZ_TIMER_STOP(mWatch);
@ -2295,7 +2289,7 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
}
if (nsnull == mTitle) {
mHTMLDocument->SetTitle(nsAutoString());
mHTMLDocument->SetTitle(nsString());
}
// XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me.
@ -2557,9 +2551,14 @@ HTMLContentSink::SetTitle(const nsString& aValue)
mTitle->CompressWhitespace(PR_TRUE, PR_TRUE);
mHTMLDocument->SetTitle(*mTitle);
nsIAtom* atom = NS_NewAtom("title");
nsCOMPtr<nsINodeInfo> nodeInfo;
nsresult rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::title, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* it = nsnull;
nsresult rv = NS_NewHTMLTitleElement(&it, atom);
rv = NS_NewHTMLTitleElement(&it, nodeInfo);
if (NS_OK == rv) {
nsIContent* text;
rv = NS_NewTextNode(&text);
@ -2577,7 +2576,7 @@ HTMLContentSink::SetTitle(const nsString& aValue)
mHead->AppendChildTo(it, PR_FALSE);
NS_RELEASE(it);
}
NS_RELEASE(atom);
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::SetTitle()\n"));
MOZ_TIMER_STOP(mWatch);
return NS_OK;
@ -2765,14 +2764,18 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
mCurrentContext->IsCurrentContainer(eHTMLTag_tr) ||
mCurrentContext->IsCurrentContainer(eHTMLTag_col) ||
mCurrentContext->IsCurrentContainer(eHTMLTag_colgroup)) {
nsAutoString tmp; tmp.AssignWithConversion("form");
nsIAtom* atom = NS_NewAtom(tmp);
result = NS_NewHTMLFormElement(&content, atom);
nsCOMPtr<nsINodeInfo> nodeInfo;
result = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::form, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(result, result);
result = NS_NewHTMLFormElement(&content, nodeInfo);
if (NS_SUCCEEDED(result) && content) {
content->QueryInterface(kIDOMHTMLFormElementIID, (void**)&mCurrentForm);
NS_RELEASE(content);
}
NS_RELEASE(atom);
result = AddLeaf(aNode);
}
@ -3145,7 +3148,7 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
name.AssignWithConversion("HTML");
}
rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(),
rv = domImpl->CreateDocumentType(name, publicId, nsString(),
getter_AddRefs(docType));
if (NS_FAILED(rv) || !docType) {
@ -3439,9 +3442,13 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
nsAutoString tag; tag.AssignWithConversion("BASE");
nsCOMPtr<nsIHTMLContent> element;
result = NS_CreateHTMLElement(getter_AddRefs(element), tag);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(NS_ConvertASCIItoUCS2("base"),
nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
result = NS_CreateHTMLElement(getter_AddRefs(element), nodeInfo);
if (NS_SUCCEEDED(result)) {
PRInt32 id;
mDocument->GetAndIncrementContentID(&id);
@ -3796,9 +3803,12 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
nsAutoString tag; tag.AssignWithConversion("LINK");
nsIHTMLContent* element = nsnull;
result = NS_CreateHTMLElement(&element, tag);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::link, nsnull, kNameSpaceID_HTML,
*getter_AddRefs(nodeInfo));
result = NS_CreateHTMLElement(&element, nodeInfo);
if (NS_SUCCEEDED(result)) {
PRInt32 id;
mDocument->GetAndIncrementContentID(&id);
@ -3913,14 +3923,14 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
if (nsnull != parent) {
// Create content object
nsAutoString tmp; tmp.AssignWithConversion("meta");
nsIAtom* atom = NS_NewAtom(tmp);
if (nsnull == atom) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = mNodeInfoManager->GetNodeInfo(NS_ConvertASCIItoUCS2("meta"), nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* it;
rv = NS_NewHTMLMetaElement(&it, atom);
NS_RELEASE(atom);
rv = NS_NewHTMLMetaElement(&it, nodeInfo);
if (NS_OK == rv) {
// Add in the attributes and add the meta content object to the
// head container.
@ -4543,9 +4553,12 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
return NS_ERROR_FAILURE;
}
nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
nsAutoString tag; tag.AssignWithConversion("SCRIPT");
nsIHTMLContent* element = nsnull;
rv = NS_CreateHTMLElement(&element, tag);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::script, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
rv = NS_CreateHTMLElement(&element, nodeInfo);
if (NS_SUCCEEDED(rv)) {
PRInt32 id;
mDocument->GetAndIncrementContentID(&id);
@ -4672,9 +4685,13 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
nsAutoString tag; tag.AssignWithConversion("STYLE");
nsIHTMLContent* element = nsnull;
rv = NS_CreateHTMLElement(&element, tag);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::style, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
rv = NS_CreateHTMLElement(&element, nodeInfo);
if (NS_SUCCEEDED(rv)) {
PRInt32 id;
mDocument->GetAndIncrementContentID(&id);

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

@ -1184,8 +1184,18 @@ NS_IMETHODIMP
nsHTMLDocument::CreateElement(const nsString& aTagName,
nsIDOMElement** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
NS_ENSURE_TRUE(aTagName.Length(), NS_ERROR_DOM_INVALID_CHARACTER_ERR);
nsCOMPtr<nsINodeInfo> nodeInfo;
nsAutoString tmp(aTagName);
tmp.ToLowerCase();
mNodeInfoManager->GetNodeInfo(aTagName, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
nsCOMPtr<nsIHTMLContent> content;
nsresult rv = NS_CreateHTMLElement(getter_AddRefs(content), aTagName);
nsresult rv = NS_CreateHTMLElement(getter_AddRefs(content), nodeInfo);
if (NS_SUCCEEDED(rv)) {
content->SetContentID(mNextContentID++);
rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn);

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

@ -20,8 +20,11 @@
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsIHTMLFragmentContentSink.h"
#include "nsIParser.h"
#include "nsIParserService.h"
#include "nsParserCIID.h"
#include "nsIHTMLContent.h"
#include "nsIHTMLContentContainer.h"
#include "nsHTMLAtoms.h"
@ -36,6 +39,7 @@
#include "nsINameSpace.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "prmem.h"
//
@ -50,6 +54,7 @@ static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static NS_DEFINE_IID(kIHTMLFragmentContentSinkIID, NS_IHTML_FRAGMENT_CONTENT_SINK_IID);
static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID);
static NS_DEFINE_IID(kIDOMDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
class nsHTMLFragmentContentSink : public nsIHTMLFragmentContentSink {
public:
@ -112,6 +117,8 @@ public:
void ProcessBaseTag(nsIHTMLContent* aContent);
void AddBaseTagInfo(nsIHTMLContent* aContent);
nsresult Init();
PRBool mHitSentinel;
PRBool mSeenBody;
@ -128,6 +135,8 @@ public:
nsString mBaseHREF;
nsString mBaseTarget;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
};
@ -143,6 +152,12 @@ NS_NewHTMLFragmentContentSink(nsIHTMLFragmentContentSink** aResult)
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init();
if (NS_FAILED(rv)) {
delete it;
return rv;
}
return it->QueryInterface(kIHTMLFragmentContentSinkIID, (void **)aResult);
}
@ -218,6 +233,19 @@ nsHTMLFragmentContentSink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
nsresult nsHTMLFragmentContentSink::Init()
{
nsresult rv = NS_NewNodeInfoManager(getter_AddRefs(mNodeInfoManager));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINameSpaceManager> nsmgr;
rv = NS_NewNameSpaceManager(getter_AddRefs(nsmgr));
NS_ENSURE_SUCCESS(rv, rv);
return mNodeInfoManager->Init(nsmgr);
}
NS_IMETHODIMP
nsHTMLFragmentContentSink::WillBuildModel(void)
{
@ -410,7 +438,28 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
nsIHTMLContent *content = nsnull;
result = NS_CreateHTMLElement(&content, nodeType);
NS_WITH_SERVICE(nsIParserService,
parserService,
kParserServiceCID,
&result);
NS_ENSURE_SUCCESS(result, result);
nsAutoString tmpName;
if (nodeType == eHTMLTag_userdefined) {
tmpName = aNode.GetText();
} else {
result = parserService->HTMLIdToStringTag(nodeType, tmpName);
NS_ENSURE_SUCCESS(result, result);
}
nsCOMPtr<nsINodeInfo> nodeInfo;
result =
mNodeInfoManager->GetNodeInfo(tmpName, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
result = NS_CreateHTMLElement(&content, nodeInfo);
if (NS_OK == result) {
result = AddAttributes(aNode, content);
@ -466,8 +515,30 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
// Create new leaf content object
nsCOMPtr<nsIHTMLContent> content;
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
result = NS_CreateHTMLElement(getter_AddRefs(content), nodeType);
NS_WITH_SERVICE(nsIParserService,
parserService,
kParserServiceCID,
&result);
NS_ENSURE_SUCCESS(result, result);
nsAutoString tmpName;
if (nodeType == eHTMLTag_userdefined) {
tmpName = aNode.GetText();
} else {
result = parserService->HTMLIdToStringTag(nodeType, tmpName);
NS_ENSURE_SUCCESS(result, result);
}
nsCOMPtr<nsINodeInfo> nodeInfo;
result =
mNodeInfoManager->GetNodeInfo(tmpName, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
result = NS_CreateHTMLElement(getter_AddRefs(content), nodeInfo);
if (NS_OK == result) {
result = AddAttributes(aNode, content);
if (NS_OK == result) {

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

@ -35,6 +35,8 @@
#include "nsIPresContext.h"
#include "nsIViewManager.h"
#include "nsIChannel.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
// XXX TODO:
@ -182,10 +184,14 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
nsIStreamListener **aDocListener,
PRBool aReset)
{
nsresult rv = nsDocument::StartDocumentLoad(aCommand,
aChannel, aLoadGroup,
aContainer,
aDocListener, aReset);
nsresult rv = Init();
if (NS_FAILED(rv) && rv != NS_ERROR_ALREADY_INITIALIZED) {
return rv;
}
rv = nsDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset);
if (NS_FAILED(rv)) {
return rv;
}
@ -243,34 +249,51 @@ nsImageDocument::CreateSyntheticDocument()
{
// Synthesize an html document that refers to the image
nsresult rv;
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* root;
rv = NS_NewHTMLHtmlElement(&root, nsHTMLAtoms::html);
rv = NS_NewHTMLHtmlElement(&root, nodeInfo);
if (NS_OK != rv) {
return rv;
}
root->SetDocument(this, PR_FALSE);
SetRootContent(root);
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::body, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* body;
rv = NS_NewHTMLBodyElement(&body, nsHTMLAtoms::body);
rv = NS_NewHTMLBodyElement(&body, nodeInfo);
if (NS_OK != rv) {
return rv;
}
body->SetDocument(this, PR_FALSE);
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::p, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* center;
nsIAtom* centerAtom = NS_NewAtom("p");
rv = NS_NewHTMLParagraphElement(&center, centerAtom);
NS_RELEASE(centerAtom);
rv = NS_NewHTMLParagraphElement(&center, nodeInfo);
if (NS_OK != rv) {
return rv;
}
center->SetDocument(this, PR_FALSE);
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,
kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsIHTMLContent* image;
nsIAtom* imgAtom = NS_NewAtom("img");
rv = NS_NewHTMLImageElement(&image, imgAtom);
NS_RELEASE(imgAtom);
rv = NS_NewHTMLImageElement(&image, nodeInfo);
if (NS_OK != rv) {
return rv;
}

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

@ -27,6 +27,7 @@
#include "nsIContent.h"
class nsINameSpace;
class nsINodeInfo;
class nsIWebShell;
#define NS_IXMLCONTENT_IID \
@ -46,8 +47,6 @@ public:
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace) = 0;
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const = 0;
NS_IMETHOD SetNameSpaceID(PRInt32 aNSIdentifier) = 0;
/**
* Give this element a change to fire its links that should be fired
* automatically when loaded. If the element was an autoloading link
@ -71,7 +70,7 @@ public:
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 7)
extern nsresult
NS_NewXMLElement(nsIXMLContent** aResult, nsIAtom* aTag);
NS_NewXMLElement(nsIXMLContent** aResult, nsINodeInfo* aNodeInfo);
// XXX These belongs elsewhere
extern nsresult

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

@ -31,6 +31,7 @@
#include "nsDOMEvent.h"
#include "nsINameSpace.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
@ -44,13 +45,13 @@
static NS_DEFINE_IID(kIXMLContentIID, NS_IXMLCONTENT_IID);
nsresult
NS_NewXMLElement(nsIXMLContent** aInstancePtrResult, nsIAtom* aTag)
NS_NewXMLElement(nsIXMLContent** aInstancePtrResult, nsINodeInfo *aNodeInfo)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsIXMLContent* it = new nsXMLElement(aTag);
nsIXMLContent* it = new nsXMLElement(aNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -67,10 +68,11 @@ static nsIAtom* kOnLoadAtom;
static nsIAtom* kEmbedAtom;
static PRUint32 kElementCount;
nsXMLElement::nsXMLElement(nsIAtom *aTag)
nsXMLElement::nsXMLElement(nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init((nsIContent *)(nsIXMLContent *)this, aTag);
mInner.Init(this, aNodeInfo);
mIsLink = PR_FALSE;
mContentID = 0;
@ -464,7 +466,7 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsXMLElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsXMLElement* it = new nsXMLElement(mInner.mTag);
nsXMLElement* it = new nsXMLElement(mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -33,6 +33,7 @@
class nsIDocument;
class nsIAtom;
class nsINodeInfo;
class nsIEventListenerManager;
class nsIHTMLAttributes;
class nsIURI;
@ -43,7 +44,7 @@ class nsXMLElement : public nsIDOMElement,
public nsIJSScriptObject
{
public:
nsXMLElement(nsIAtom *aTag);
nsXMLElement(nsINodeInfo *aNodeInfo);
virtual ~nsXMLElement();
// nsISupports
@ -201,9 +202,6 @@ public:
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const {
return mInner.GetNameSpacePrefix(aNameSpace);
}
NS_IMETHOD SetNameSpaceID(PRInt32 aNameSpaceId) {
return mInner.SetNameSpaceID(aNameSpaceId);
}
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
// nsIJSScriptObject

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

@ -244,7 +244,7 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
NS_RELEASE(htmlContainer);
}
return NS_OK;
return aDoc->GetNodeInfoManager(*getter_AddRefs(mNodeInfoManager));
}
#ifndef XSL
@ -705,6 +705,7 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
nsCOMPtr<nsIAtom> tagAtom = dont_AddRef(NS_NewAtom(tag));
// We must register namespace declarations found in the attribute list
// of an element before creating the element. This is because the
@ -713,16 +714,21 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
PushNameSpacesFrom(aNode);
nameSpaceID = GetNameSpaceId(nameSpacePrefix);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(tagAtom, nameSpacePrefix, nameSpaceID,
*getter_AddRefs(nodeInfo));
isHTML = IsHTMLNameSpace(nameSpaceID);
if (isHTML) {
nsCOMPtr<nsIAtom> tagAtom = getter_AddRefs(NS_NewAtom(tag));
if (nsHTMLAtoms::script == tagAtom.get()) {
result = ProcessStartSCRIPTTag(aNode);
}
nsCOMPtr<nsIHTMLContent> htmlContent;
result = NS_CreateHTMLElement(getter_AddRefs(htmlContent), tag);
result = NS_CreateHTMLElement(getter_AddRefs(htmlContent), nodeInfo);
content = do_QueryInterface(htmlContent);
}
else {
@ -730,21 +736,18 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
// own content element implementation (e.g., XUL or MathML).
// This is done based off a progid/namespace scheme.
nsCOMPtr<nsIElementFactory> elementFactory;
// This should *not* be done for every node, only when we find
// a new namespace!!! -- jst
GetElementFactory(nameSpaceID, getter_AddRefs(elementFactory));
if (elementFactory) {
// Create the content element using the element factory.
elementFactory->CreateInstanceByTag(tag, getter_AddRefs(content));
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
}
else {
nsCOMPtr<nsIAtom> tagAtom = getter_AddRefs(NS_NewAtom(tag));
nsCOMPtr<nsIXMLContent> xmlContent;
result = NS_NewXMLElement(getter_AddRefs(xmlContent), tagAtom);
result = NS_NewXMLElement(getter_AddRefs(xmlContent), nodeInfo);
// For XML elements, set the namespace
if (NS_OK == result) {
xmlContent->SetNameSpacePrefix(nameSpacePrefix);
xmlContent->SetNameSpaceID(nameSpaceID);
}
content = do_QueryInterface(xmlContent);
}
}
@ -800,6 +803,7 @@ nsXMLContentSink::CloseContainer(const nsIParserNode& aNode)
PR_ASSERT(eXMLContentSinkState_InDocumentElement == mState);
tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
nameSpaceID = GetNameSpaceId(nameSpacePrefix);
isHTML = IsHTMLNameSpace(nameSpaceID);
@ -1846,7 +1850,7 @@ public:
NS_DECL_ISUPPORTS
// nsIElementFactory interface
NS_IMETHOD CreateInstanceByTag(const nsString& aTag, nsIContent** aResult);
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo, nsIContent** aResult);
};
@ -1883,14 +1887,11 @@ NS_NewXMLElementFactory(nsIElementFactory** aResult)
NS_IMETHODIMP
XMLElementFactoryImpl::CreateInstanceByTag(const nsString& aTag, nsIContent** aResult)
XMLElementFactoryImpl::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult)
{
nsCOMPtr<nsIAtom> tag = dont_AddRef(NS_NewAtom(aTag));
if (! tag)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIXMLContent> xmlContent;
nsresult rv = NS_NewXMLElement(getter_AddRefs(xmlContent), tag);
nsresult rv = NS_NewXMLElement(getter_AddRefs(xmlContent), aNodeInfo);
nsCOMPtr<nsIContent> result = do_QueryInterface(xmlContent);
*aResult = result;
NS_IF_ADDREF(*aResult);

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

@ -34,6 +34,7 @@
#include "nsIUnicharInputStream.h"
#include "nsIStreamLoader.h"
#include "nsISupportsArray.h"
#include "nsINodeInfo.h"
class nsIDocument;
class nsIScriptObjectOwner;
@ -193,6 +194,7 @@ protected:
nsString mPreferredStyle;
PRInt32 mStyleSheetCount;
nsICSSLoader* mCSSLoader;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
#ifdef XSL
nsITransformMediator* mXSLTransformMediator; // Weak reference
#endif

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

@ -66,6 +66,7 @@
#include "nsICharsetAlias.h"
#include "nsIParserFilter.h"
#include "nsNetUtil.h"
#include "nsDOMError.h"
// XXX The XML world depends on the html atoms
@ -701,14 +702,20 @@ NS_IMETHODIMP
nsXMLDocument::CreateElement(const nsString& aTagName,
nsIDOMElement** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
NS_ENSURE_TRUE(aTagName.Length(), NS_ERROR_DOM_INVALID_CHARACTER_ERR);
nsIXMLContent* content;
nsIAtom* tag = NS_NewAtom(aTagName);
nsresult rv = NS_NewXMLElement(&content, tag);
NS_RELEASE(tag);
nsCOMPtr<nsINodeInfo> nodeInfo;
nsresult rv;
rv = mNodeInfoManager->GetNodeInfo(aTagName, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewXMLElement(&content, nodeInfo);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_OK != rv) {
return rv;
}
rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn);
NS_RELEASE(content);
@ -717,34 +724,29 @@ nsXMLDocument::CreateElement(const nsString& aTagName,
NS_IMETHODIMP
nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName,
const nsString& aNameSpace,
nsIDOMElement** aReturn)
const nsString& aNameSpace,
nsIDOMElement** aReturn)
{
PRInt32 namespaceID = kNameSpaceID_None;
nsresult rv = NS_OK;
if ((0 < aNameSpace.Length() && (nsnull != mNameSpaceManager))) {
mNameSpaceManager->GetNameSpaceID(aNameSpace, namespaceID);
}
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(aTagName, nsString(), aNameSpace,
*getter_AddRefs(nodeInfo));
PRInt32 namespaceID;
nodeInfo->GetNamespaceID(namespaceID);
nsIContent* content;
if (namespaceID == kNameSpaceID_HTML) {
nsIHTMLContent* htmlContent;
rv = NS_CreateHTMLElement(&htmlContent, aTagName);
rv = NS_CreateHTMLElement(&htmlContent, nodeInfo);
content = (nsIContent*)htmlContent;
}
else {
nsIXMLContent* xmlContent;
nsIAtom* tag;
tag = NS_NewAtom(aTagName);
rv = NS_NewXMLElement(&xmlContent, tag);
NS_RELEASE(tag);
if (NS_OK == rv) {
xmlContent->SetNameSpaceID(namespaceID);
}
content = (nsIXMLContent*)xmlContent;
rv = NS_NewXMLElement(&xmlContent, nodeInfo);
content = NS_STATIC_CAST(nsIXMLContent *, xmlContent);
}
if (NS_OK != rv) {

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

@ -51,6 +51,7 @@
#include "jsapi.h" // for JS_AddNamedRoot and JS_RemoveRootRT
#include "nsCOMPtr.h"
#include "nsDOMCID.h"
#include "nsDOMError.h"
#include "nsDOMEvent.h"
#include "nsForwardReference.h"
#include "nsHTMLValue.h"
@ -563,7 +564,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype,
}
nsresult
nsXULElement::Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult)
nsXULElement::Create(nsINodeInfo *aNodeInfo, nsIContent** aResult)
{
// Create an nsXULElement with the specified namespace and tag.
NS_PRECONDITION(aResult != nsnull, "null ptr");
@ -585,8 +586,7 @@ nsXULElement::Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult)
rv = element->EnsureSlots();
if (NS_FAILED(rv)) return rv;
element->mSlots->mNameSpaceID = aNameSpaceID;
element->mSlots->mTag = aTag;
element->mSlots->mNodeInfo = aNodeInfo;
*aResult = NS_REINTERPRET_CAST(nsIStyledContent*, element);
NS_ADDREF(*aResult);
@ -646,7 +646,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
*result = NS_STATIC_CAST(nsIChromeEventHandler*, this);
}
else if ((iid.Equals(NS_GET_IID(nsIDOMXULPopupElement))) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -667,7 +667,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
}
else if ((iid.Equals(NS_GET_IID(nsIDOMXULTreeElement)) ||
iid.Equals(NS_GET_IID(nsIXULTreeContent))) &&
(NameSpaceID() == kNameSpaceID_XUL)){
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))){
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -687,7 +687,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -707,7 +707,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -727,7 +727,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULTitledButtonElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -747,7 +747,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULCheckboxElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -767,7 +767,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -787,7 +787,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULRadioGroupElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -807,7 +807,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULMenuListElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -827,7 +827,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
(NameSpaceID() == kNameSpaceID_XUL)) {
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), getter_AddRefs(tag));
@ -862,8 +862,7 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
NS_IMETHODIMP
nsXULElement::GetNodeName(nsString& aNodeName)
{
Tag()->ToString(aNodeName);
return NS_OK;
return NodeInfo()->GetQualifiedName(aNodeName);
}
@ -877,7 +876,7 @@ nsXULElement::GetNodeValue(nsString& aNodeValue)
NS_IMETHODIMP
nsXULElement::SetNodeValue(const nsString& aNodeValue)
{
return NS_OK;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
@ -1083,33 +1082,47 @@ nsXULElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
NS_IMETHODIMP
nsXULElement::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
{
return NodeInfo()->GetNamespaceURI(aNamespaceURI);
}
NS_IMETHODIMP
nsXULElement::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NodeInfo()->GetPrefix(aPrefix);
}
NS_IMETHODIMP
nsXULElement::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
// XXX: Validate the prefix string!
nsINodeInfo *newNodeInfo = nsnull;
nsCOMPtr<nsIAtom> prefix;
if (aPrefix.Length()) {
prefix = dont_AddRef(NS_NewAtom(aPrefix));
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
}
nsresult rv = EnsureSlots();
NS_ENSURE_SUCCESS(rv, rv);
rv = mSlots->mNodeInfo->PrefixChanged(prefix, newNodeInfo);
NS_ENSURE_SUCCESS(rv, rv);
mSlots->mNodeInfo = newNodeInfo;
return NS_OK;
}
NS_IMETHODIMP
nsXULElement::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NodeInfo()->GetLocalName(aLocalName);
}
@ -1313,15 +1326,12 @@ nsXULElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
else if (mSlots) {
// We've faulted: create another heavyweight, and then copy
// stuff by hand.
rv = nsXULElement::Create(mSlots->mNameSpaceID, mSlots->mTag, getter_AddRefs(result));
rv = nsXULElement::Create(mSlots->mNodeInfo, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
// Copy namespace stuff.
nsCOMPtr<nsIXMLContent> xmlcontent = do_QueryInterface(result);
if (xmlcontent) {
rv = xmlcontent->SetNameSpacePrefix(mSlots->mNameSpacePrefix);
if (NS_FAILED(rv)) return rv;
rv = xmlcontent->SetContainingNameSpace(mSlots->mNameSpace);
if (NS_FAILED(rv)) return rv;
}
@ -1414,8 +1424,7 @@ nsXULElement::Supports(const nsString& aFeature, const nsString& aVersion,
NS_IMETHODIMP
nsXULElement::GetTagName(nsString& aTagName)
{
Tag()->ToString(aTagName);
return NS_OK;
return NodeInfo()->GetQualifiedName(aTagName);
}
@ -1649,28 +1658,18 @@ nsXULElement::SetNameSpacePrefix(nsIAtom* aNameSpacePrefix)
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
mSlots->mNameSpacePrefix = aNameSpacePrefix;
nsCOMPtr<nsINodeInfo> newNodeInfo;
mSlots->mNodeInfo->PrefixChanged(aNameSpacePrefix,
*getter_AddRefs(newNodeInfo));
mSlots->mNodeInfo = newNodeInfo;
return NS_OK;
}
NS_IMETHODIMP
nsXULElement::GetNameSpacePrefix(nsIAtom*& aNameSpacePrefix) const
{
aNameSpacePrefix = NameSpacePrefix();
NS_IF_ADDREF(aNameSpacePrefix);
return NS_OK;
}
NS_IMETHODIMP
nsXULElement::SetNameSpaceID(PRInt32 aNameSpaceID)
{
nsresult rv;
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
mSlots->mNameSpaceID = aNameSpaceID;
return NS_OK;
return NodeInfo()->GetPrefixAtom(aNameSpacePrefix);
}
NS_IMETHODIMP
@ -1758,7 +1757,7 @@ nsXULElement::AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REF
if (NS_FAILED(rv)) return rv;
}
if (Tag() == kWindowAtom) {
if (NodeInfo()->Equals(kWindowAtom)) {
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(global);
if (! receiver)
return NS_ERROR_UNEXPECTED;
@ -2636,16 +2635,13 @@ nsXULElement::IsSynthetic(PRBool& aResult)
NS_IMETHODIMP
nsXULElement::GetNameSpaceID(PRInt32& aNameSpaceID) const
{
aNameSpaceID = NameSpaceID();
return NS_OK;
return NodeInfo()->GetNamespaceID(aNameSpaceID);
}
NS_IMETHODIMP
nsXULElement::GetTag(nsIAtom*& aResult) const
{
aResult = Tag();
NS_ADDREF(aResult);
return NS_OK;
return NodeInfo()->GetNameAtom(aResult);
}
NS_IMETHODIMP
@ -3143,24 +3139,15 @@ nsXULElement::List(FILE* out, PRInt32 aIndent) const
if (mSlots) fputs("*", out);
fputs(" ", out);
if (NameSpaceID() == kNameSpaceID_XUL) {
fputs("xul:", out);
}
else if (NameSpaceID() == kNameSpaceID_HTML) {
fputs("html:", out);
}
else if (NameSpaceID() == kNameSpaceID_None) {
fputs("none:", out);
}
else if (NameSpaceID() == kNameSpaceID_Unknown) {
PRInt32 namespaceID;
NodeInfo()->GetNamespaceID(namespaceID);
if (namespaceID == kNameSpaceID_Unknown) {
fputs("unknown:", out);
}
else {
fputs("?:", out);
}
nsAutoString as;
Tag()->ToString(as);
NodeInfo()->GetQualifiedName(as);
fputs(as, out);
}
@ -3899,7 +3886,7 @@ NS_IMETHODIMP
nsXULElement::GetContentStyleRules(nsISupportsArray* aRules)
{
// For treecols, we support proportional widths using the WIDTH attribute.
if (Tag() == kTreeColAtom) {
if (NodeInfo()->Equals(kTreeColAtom)) {
// If the width attribute is set, then we should return ourselves as a style
// rule.
nsCOMPtr<nsIAtom> widthAtom = dont_AddRef(NS_NewAtom("width"));
@ -3949,19 +3936,17 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
{
aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style
nsIAtom* tag = Tag();
if (kTreeItemAtom == tag) {
if (NodeInfo()->Equals(kTreeItemAtom)) {
// Force a framechange if the 'open' atom changes on a <treeitem>
if (kOpenAtom == aAttribute)
aHint = NS_STYLE_HINT_FRAMECHANGE;
}
else if (kTreeColAtom == tag) {
else if (NodeInfo()->Equals(kTreeColAtom)) {
// Ignore 'width' and 'hidden' on a <treecol>
if (kWidthAtom == aAttribute || kHiddenAtom == aAttribute)
aHint = NS_STYLE_HINT_REFLOW;
}
else if (kWindowAtom == tag) {
else if (NodeInfo()->Equals(kWindowAtom)) {
// Ignore 'width' and 'height' on a <window>
if (kWidthAtom == aAttribute || kHeightAtom == aAttribute)
aHint = NS_STYLE_HINT_NONE;
@ -4262,7 +4247,7 @@ nsXULElement::MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext*
NS_IMETHODIMP
nsXULElement::MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
{
if (Tag() == kTreeColAtom) {
if (NodeInfo()->Equals(kTreeColAtom)) {
// Should only get called if we had a width attribute set. Retrieve it.
nsAutoString widthVal;
nsAutoString hiddenVal;
@ -4422,9 +4407,7 @@ nsXULElement::EnsureSlots()
mPrototype = nsnull;
mSlots->mNameSpace = proto->mNameSpace;
mSlots->mNameSpacePrefix = proto->mNameSpacePrefix;
mSlots->mNameSpaceID = proto->mNameSpaceID;
mSlots->mTag = proto->mTag;
mSlots->mNodeInfo = proto->mNodeInfo;
// Copy the attributes, if necessary. Arguably, we are over-eager
// about copying attributes. But eagerly copying the attributes
@ -4468,7 +4451,6 @@ nsXULElement::EnsureSlots()
nsXULElement::Slots::Slots(nsXULElement* aElement)
: mElement(aElement),
mNameSpaceID(0),
mBroadcastListeners(nsnull),
mBroadcaster(nsnull),
mBuilder(nsnull),

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

@ -39,6 +39,7 @@
#include "nsForwardReference.h"
#include "nsHTMLValue.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsIControllers.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventReceiver.h"
@ -218,9 +219,7 @@ public:
nsXULPrototypeNode** mChildren; // [OWNER]
nsCOMPtr<nsINameSpace> mNameSpace; // [OWNER]
nsCOMPtr<nsIAtom> mNameSpacePrefix; // [OWNER]
PRInt32 mNameSpaceID;
nsCOMPtr<nsIAtom> mTag; // [OWNER]
nsCOMPtr<nsINodeInfo> mNodeInfo; // [OWNER]
PRInt32 mNumAttributes;
nsXULPrototypeAttribute* mAttributes; // [OWNER]
@ -372,7 +371,7 @@ public:
Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, PRBool aIsScriptable, nsIContent** aResult);
static nsresult
Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult);
Create(nsINodeInfo* aNodeInfo, nsIContent** aResult);
// nsISupports
NS_DECL_ISUPPORTS
@ -436,7 +435,6 @@ public:
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const;
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace);
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const;
NS_IMETHOD SetNameSpaceID(PRInt32 aNameSpaceID);
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
// nsIXULContent
@ -575,10 +573,8 @@ protected:
~Slots();
nsXULElement* mElement; // [WEAK]
PRInt32 mNameSpaceID;
nsCOMPtr<nsINameSpace> mNameSpace; // [OWNER]
nsCOMPtr<nsIAtom> mNameSpacePrefix; // [OWNER]
nsCOMPtr<nsIAtom> mTag; // [OWNER]
nsCOMPtr<nsINodeInfo> mNodeInfo; // [OWNER]
nsVoidArray* mBroadcastListeners; // [WEAK]
nsIDOMXULElement* mBroadcaster; // [WEAK]
nsCOMPtr<nsIControllers> mControllers; // [OWNER]
@ -601,10 +597,8 @@ protected:
// Internal accessors. These shadow the 'Slots', and return
// appropriate default values if there are no slots defined in the
// delegate.
PRInt32 NameSpaceID() const { return mSlots ? mSlots->mNameSpaceID : mPrototype->mNameSpaceID; }
nsINameSpace* NameSpace() const { return mSlots ? mSlots->mNameSpace.get() : mPrototype->mNameSpace.get(); }
nsIAtom* NameSpacePrefix() const { return mSlots ? mSlots->mNameSpacePrefix.get() : mPrototype->mNameSpacePrefix.get(); }
nsIAtom* Tag() const { return mSlots ? mSlots->mTag.get() : mPrototype->mTag.get(); }
nsINodeInfo* NodeInfo() const { return mSlots ? mSlots->mNodeInfo : mPrototype->mNodeInfo; }
nsVoidArray* BroadcastListeners() const { return mSlots ? mSlots->mBroadcastListeners : nsnull; }
nsIDOMXULElement* Broadcaster() const { return mSlots ? mSlots->mBroadcaster : nsnull; }
nsIControllers* Controllers() const { return mSlots ? mSlots->mControllers.get() : nsnull; }

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

@ -55,6 +55,7 @@
#include "nsIHTMLContentContainer.h"
#include "nsINameSpace.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIParser.h"
#include "nsIPresShell.h"
#include "nsIRDFCompositeDataSource.h"
@ -172,16 +173,18 @@ protected:
nsresult GetTopNameSpace(nsCOMPtr<nsINameSpace>* aNameSpace);
nsVoidArray mNameSpaceStack;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
// RDF-specific parsing
nsresult GetXULIDAttribute(const nsIParserNode& aNode, nsString& aID);
nsresult AddAttributes(const nsIParserNode& aNode, nsXULPrototypeElement* aElement);
nsresult ParseTag(const nsString& aText, nsIAtom*& aTag, PRInt32& aNameSpaceID);
nsresult ParseTag(const nsString& aText, nsINodeInfo*& aNodeInfo);
nsresult ParseAttributeString(const nsString& aText, nsIAtom*& aAttr, PRInt32& aNameSpaceID);
nsresult CreateElement(PRInt32 aNameSpaceID, nsIAtom* aTag, nsXULPrototypeElement** aResult);
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsXULPrototypeElement** aResult);
nsresult OpenRoot(const nsIParserNode& aNode, PRInt32 aNameSpaceID, nsIAtom* aTag);
nsresult OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, nsIAtom* aTag);
nsresult OpenRoot(const nsIParserNode& aNode, nsINodeInfo *aNodeInfo);
nsresult OpenTag(const nsIParserNode& aNode, nsINodeInfo *aNodeInfo);
// Script tag handling
nsresult OpenScript(const nsIParserNode& aNode);
@ -339,8 +342,8 @@ XULContentSinkImpl::ContextStack::IsInsideXULTemplate()
nsXULPrototypeElement* element =
NS_REINTERPRET_CAST(nsXULPrototypeElement*, node);
if ((element->mNameSpaceID == kNameSpaceID_XUL) &&
(element->mTag.get() == kTemplateAtom)) {
if (element->mNodeInfo->Equals(kTemplateAtom,
kNameSpaceID_XUL)) {
return PR_TRUE;
}
}
@ -617,9 +620,8 @@ XULContentSinkImpl::OpenContainer(const nsIParserNode& aNode)
nsresult rv;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
rv = ParseTag(aNode.GetText(), *getter_AddRefs(tag), nameSpaceID);
nsCOMPtr<nsINodeInfo> nodeInfo;
rv = ParseTag(aNode.GetText(), *getter_AddRefs(nodeInfo));
if (NS_FAILED(rv)) {
#ifdef PR_LOGGING
nsCAutoString anodeC;
@ -636,11 +638,11 @@ XULContentSinkImpl::OpenContainer(const nsIParserNode& aNode)
switch (mState) {
case eInProlog:
// We're the root document element
rv = OpenRoot(aNode, nameSpaceID, tag);
rv = OpenRoot(aNode, nodeInfo);
break;
case eInDocumentElement:
rv = OpenTag(aNode, nameSpaceID, tag);
rv = OpenTag(aNode, nodeInfo);
break;
case eInEpilog:
@ -1140,6 +1142,8 @@ XULContentSinkImpl::Init(nsIDocument* aDocument, nsIXULPrototypeDocument* aProto
rv = htmlContainer->GetCSSLoader(*getter_AddRefs(mCSSLoader));
if (NS_FAILED(rv)) return rv;
rv = aDocument->GetNodeInfoManager(*getter_AddRefs(mNodeInfoManager));
if (NS_FAILED(rv)) return rv;
mState = eInProlog;
return NS_OK;
@ -1334,7 +1338,7 @@ XULContentSinkImpl::AddAttributes(const nsIParserNode& aNode, nsXULPrototypeElem
// XUL elements may require some additional work to compute
// derived information.
if (aElement->mNameSpaceID == kNameSpaceID_XUL) {
if (aElement->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {
nsAutoString value;
// Compute the element's class list if the element has a 'class' attribute.
@ -1375,7 +1379,7 @@ XULContentSinkImpl::AddAttributes(const nsIParserNode& aNode, nsXULPrototypeElem
nsresult
XULContentSinkImpl::ParseTag(const nsString& aText, nsIAtom*& aTag, PRInt32& aNameSpaceID)
XULContentSinkImpl::ParseTag(const nsString& aText, nsINodeInfo*& aNodeInfo)
{
nsresult rv;
@ -1397,14 +1401,15 @@ XULContentSinkImpl::ParseTag(const nsString& aText, nsIAtom*& aTag, PRInt32& aNa
rv = GetTopNameSpace(&ns);
if (NS_FAILED(rv)) return rv;
rv = ns->FindNameSpaceID(prefix, aNameSpaceID);
PRInt32 namespaceID;
rv = ns->FindNameSpaceID(prefix, namespaceID);
if (NS_FAILED(rv)) return rv;
aTag = NS_NewAtom(tagStr);
if (! aTag)
nsCOMPtr<nsIAtom> tag(dont_AddRef(NS_NewAtom(tagStr)));
if (! tag)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
return mNodeInfoManager->GetNodeInfo(tag, prefix, namespaceID, aNodeInfo);
}
@ -1446,8 +1451,7 @@ XULContentSinkImpl::ParseAttributeString(const nsString& aText, nsIAtom*& aAttr,
nsresult
XULContentSinkImpl::CreateElement(PRInt32 aNameSpaceID,
nsIAtom* aTag,
XULContentSinkImpl::CreateElement(nsINodeInfo *aNodeInfo,
nsXULPrototypeElement** aResult)
{
nsresult rv;
@ -1456,20 +1460,13 @@ XULContentSinkImpl::CreateElement(PRInt32 aNameSpaceID,
if (! element)
return NS_ERROR_OUT_OF_MEMORY;
element->mNameSpaceID = aNameSpaceID;
element->mTag = aTag;
element->mNodeInfo = aNodeInfo;
element->mDocument = mPrototype;
nsCOMPtr<nsINameSpace> ns;
rv = GetTopNameSpace(&ns);
if (NS_SUCCEEDED(rv)) {
element->mNameSpace = ns;
nsCOMPtr<nsIAtom> prefix;
rv = ns->FindNameSpacePrefix(aNameSpaceID, *getter_AddRefs(prefix));
if (NS_SUCCEEDED(rv)) {
element->mNameSpacePrefix = prefix;
}
}
*aResult = element;
@ -1479,7 +1476,7 @@ XULContentSinkImpl::CreateElement(PRInt32 aNameSpaceID,
nsresult
XULContentSinkImpl::OpenRoot(const nsIParserNode& aNode, PRInt32 aNameSpaceID, nsIAtom* aTag)
XULContentSinkImpl::OpenRoot(const nsIParserNode& aNode, nsINodeInfo *aNodeInfo)
{
NS_ASSERTION(mState == eInProlog, "how'd we get here?");
if (mState != eInProlog)
@ -1487,8 +1484,8 @@ XULContentSinkImpl::OpenRoot(const nsIParserNode& aNode, PRInt32 aNameSpaceID, n
nsresult rv;
if ((aNameSpaceID == kNameSpaceID_HTML ||
aNameSpaceID == kNameSpaceID_XUL) && (aTag == kScriptAtom)) {
if (aNodeInfo->Equals(kScriptAtom, kNameSpaceID_HTML) ||
aNodeInfo->Equals(kScriptAtom, kNameSpaceID_XUL)) {
PR_LOG(gLog, PR_LOG_ALWAYS,
("xul: script tag not allowed as root content element"));
@ -1497,7 +1494,7 @@ XULContentSinkImpl::OpenRoot(const nsIParserNode& aNode, PRInt32 aNameSpaceID, n
// Create the element
nsXULPrototypeElement* element;
rv = CreateElement(aNameSpaceID, aTag, &element);
rv = CreateElement(aNodeInfo, &element);
if (NS_FAILED(rv)) {
#ifdef PR_LOGGING
@ -1530,18 +1527,19 @@ XULContentSinkImpl::OpenRoot(const nsIParserNode& aNode, PRInt32 aNameSpaceID, n
nsresult
XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, nsIAtom* aTag)
XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, nsINodeInfo *aNodeInfo)
{
nsresult rv;
if ((aNameSpaceID == kNameSpaceID_HTML ||
aNameSpaceID == kNameSpaceID_XUL) && (aTag == kScriptAtom)) {
if (aNodeInfo->Equals(kScriptAtom, kNameSpaceID_HTML) ||
aNodeInfo->Equals(kScriptAtom, kNameSpaceID_XUL)) {
// Oops, it's a script!
return OpenScript(aNode);
}
// Create the element
nsXULPrototypeElement* element;
rv = CreateElement(aNameSpaceID, aTag, &element);
rv = CreateElement(aNodeInfo, &element);
if (NS_FAILED(rv)) {
nsCAutoString anodeC;

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

@ -56,6 +56,7 @@
#include "nsXULDocument.h"
#include "nsDOMCID.h"
#include "nsDOMError.h"
#include "nsIChromeRegistry.h"
#include "nsIComponentManager.h"
#include "nsICodebasePrincipal.h"
@ -121,6 +122,7 @@
#include "rdf.h"
#include "rdfutil.h"
#include "nsIFrame.h"
#include "nsINodeInfo.h"
//----------------------------------------------------------------------
//
@ -1810,6 +1812,17 @@ nsXULDocument::GetBindingManager(nsIBindingManager** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::GetNodeInfoManager(class nsINodeInfoManager *&aNodeInfoManager)
{
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);
aNodeInfoManager = mNodeInfoManager;
NS_ADDREF(aNodeInfoManager);
return NS_OK;
}
void
nsXULDocument::BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode)
{
@ -3167,32 +3180,31 @@ nsXULDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
NS_IMETHODIMP
nsXULDocument::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsXULDocument::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsXULDocument::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me");
return GetNodeName(aLocalName);
aLocalName.Truncate();
return NS_OK;
}
@ -3499,6 +3511,15 @@ nsXULDocument::Init()
getter_AddRefs(mNameSpaceManager));
if (NS_FAILED(rv)) return rv;
rv = nsComponentManager::CreateInstance(NS_NODEINFOMANAGER_PROGID,
nsnull,
NS_GET_IID(nsINodeInfoManager),
getter_AddRefs(mNodeInfoManager));
if (NS_FAILED(rv)) return rv;
mNodeInfoManager->Init(mNameSpaceManager);
if (!mIsKeyBindingDoc) {
// Create our focus tracker and hook it up.
rv = nsXULCommandDispatcher::Create(getter_AddRefs(mCommandDispatcher));
@ -4159,28 +4180,28 @@ nsXULDocument::CreateElement(PRInt32 aNameSpaceID,
nsresult rv;
nsCOMPtr<nsIContent> result;
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(aTag, nsnull, aNameSpaceID,
*getter_AddRefs(nodeInfo));
if (aNameSpaceID == kNameSpaceID_XUL) {
rv = nsXULElement::Create(aNameSpaceID, aTag, getter_AddRefs(result));
rv = nsXULElement::Create(nodeInfo, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
}
else if (aNameSpaceID == kNameSpaceID_HTML) {
const PRUnichar *tagName;
aTag->GetUnicode(&tagName);
rv = gHTMLElementFactory->CreateInstanceByTag(tagName, getter_AddRefs(result));
rv = gHTMLElementFactory->CreateInstanceByTag(nodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)
return NS_ERROR_UNEXPECTED;
}
else {
const PRUnichar *tagName;
aTag->GetUnicode(&tagName);
nsCOMPtr<nsIElementFactory> elementFactory;
GetElementFactory(aNameSpaceID, getter_AddRefs(elementFactory));
rv = elementFactory->CreateInstanceByTag(tagName, getter_AddRefs(result));
rv = elementFactory->CreateInstanceByTag(nodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)
@ -4596,10 +4617,14 @@ nsXULDocument::PrepareToWalk()
SetRootContent(root);
nsCOMPtr<nsINodeInfo> nodeInfo;
mNodeInfoManager->GetNodeInfo(NS_ConvertASCIItoUCS2("form"), nsnull,
kNameSpaceID_HTML,
*getter_AddRefs(nodeInfo));
// Create the document's "hidden form" element which will wrap all
// HTML form elements that turn up.
nsCOMPtr<nsIContent> form;
rv = gHTMLElementFactory->CreateInstanceByTag(NS_ConvertASCIItoUCS2("form"),
rv = gHTMLElementFactory->CreateInstanceByTag(nodeInfo,
getter_AddRefs(form));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create form element");
if (NS_FAILED(rv)) return rv;
@ -5189,12 +5214,12 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
if (! aPrototype)
return NS_ERROR_NULL_POINTER;
nsresult rv;
nsresult rv = NS_OK;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gXULLog, PR_LOG_ALWAYS)) {
nsAutoString tagstr;
aPrototype->mTag->ToString(tagstr);
aPrototype->mNodeInfo->GetQualifiedName(tagstr);
nsCAutoString tagstrC;
tagstrC.AssignWithConversion(tagstr);
@ -5206,15 +5231,13 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
nsCOMPtr<nsIContent> result;
if (aPrototype->mNameSpaceID == kNameSpaceID_HTML) {
if (aPrototype->mNodeInfo->NamespaceEquals(kNameSpaceID_HTML)) {
// If it's an HTML element, it's gonna be heavyweight no matter
// what. So we need to copy everything out of the prototype
// into the element.
nsAutoString tagStr;
rv = aPrototype->mTag->ToString(tagStr);
if (NS_FAILED(rv)) return rv;
gHTMLElementFactory->CreateInstanceByTag(tagStr.GetUnicode(), getter_AddRefs(result));
gHTMLElementFactory->CreateInstanceByTag(aPrototype->mNodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)
@ -5239,17 +5262,19 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
htmlformctrl->SetForm(docform);
}
}
else if (aPrototype->mNameSpaceID != kNameSpaceID_XUL) {
else if (!aPrototype->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {
// If it's not a XUL element, it's gonna be heavyweight no matter
// what. So we need to copy everything out of the prototype
// into the element.
nsAutoString tagStr;
rv = aPrototype->mTag->ToString(tagStr);
if (NS_FAILED(rv)) return rv;
PRInt32 namespaceID;
aPrototype->mNodeInfo->GetNamespaceID(namespaceID);
nsCOMPtr<nsIElementFactory> elementFactory;
GetElementFactory(aPrototype->mNameSpaceID, getter_AddRefs(elementFactory));
elementFactory->CreateInstanceByTag(tagStr.GetUnicode(), getter_AddRefs(result));
GetElementFactory(namespaceID,
getter_AddRefs(elementFactory));
elementFactory->CreateInstanceByTag(aPrototype->mNodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)
@ -5268,8 +5293,7 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
if (NS_FAILED(rv)) return rv;
// We also need to pay special attention to the keyset tag to set up a listener
if ((aPrototype->mNameSpaceID == kNameSpaceID_XUL) &&
(aPrototype->mTag.get() == kKeysetAtom) &&
if (aPrototype->mNodeInfo->Equals(kKeysetAtom, kNameSpaceID_XUL) &&
! mIsKeyBindingDoc) {
// Create our nsXULKeyListener and hook it up.
nsCOMPtr<nsIXULKeyListener> keyListener;
@ -6159,7 +6183,7 @@ public:
NS_DECL_ISUPPORTS
// nsIElementFactory interface
NS_IMETHOD CreateInstanceByTag(const nsString& aTag, nsIContent** aResult);
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo, nsIContent** aResult);
static PRUint32 gRefCnt;
static PRInt32 kNameSpaceID_XUL;
@ -6218,13 +6242,10 @@ NS_NewXULElementFactory(nsIElementFactory** aResult)
NS_IMETHODIMP
XULElementFactoryImpl::CreateInstanceByTag(const nsString& aTag, nsIContent** aResult)
XULElementFactoryImpl::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult)
{
nsCOMPtr<nsIAtom> tag = dont_AddRef(NS_NewAtom(aTag));
if (! tag)
return NS_ERROR_OUT_OF_MEMORY;
return nsXULElement::Create(kNameSpaceID_XUL, tag, aResult);
return nsXULElement::Create(aNodeInfo, aResult);
}

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

@ -66,6 +66,7 @@
#include "nsWeakReference.h"
#include "nsIStreamLoader.h"
#include "nsIBindingManager.h"
#include "nsINodeInfo.h"
class nsIAtom;
class nsIElementFactory;
@ -262,6 +263,8 @@ public:
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
NS_IMETHOD GetNodeInfoManager(class nsINodeInfoManager *&aNodeInfoManager);
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
@ -577,6 +580,7 @@ protected:
// this (pinkerton).
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER] element triggering the popup
nsCOMPtr<nsIDOMNode> mTooltipNode; // [OWNER] element triggering the tooltip
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // [OWNER] list of names in the document
/**
* Context stack, which maintains the state of the Builder and allows

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

@ -77,6 +77,7 @@
#include "nsIXMLContent.h"
#include "nsIXPConnect.h"
#include "nsIXULSortService.h"
#include "nsINodeInfo.h"
#include "nsLayoutCID.h"
#include "nsRDFCID.h"
#include "nsIXULContent.h"
@ -6121,27 +6122,31 @@ nsXULTemplateBuilder::CreateElement(PRInt32 aNameSpaceID,
nsresult rv;
nsCOMPtr<nsIContent> result;
nsCOMPtr<nsINodeInfoManager> nodeInfoManager;
doc->GetNodeInfoManager(*getter_AddRefs(nodeInfoManager));
NS_ENSURE_TRUE(nodeInfoManager, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfoManager->GetNodeInfo(aTag, nsnull, aNameSpaceID,
*getter_AddRefs(nodeInfo));
if (aNameSpaceID == kNameSpaceID_XUL) {
rv = nsXULElement::Create(aNameSpaceID, aTag, getter_AddRefs(result));
rv = nsXULElement::Create(nodeInfo, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
}
else if (aNameSpaceID == kNameSpaceID_HTML) {
const PRUnichar *tagName;
aTag->GetUnicode(&tagName);
rv = gHTMLElementFactory->CreateInstanceByTag(tagName, getter_AddRefs(result));
rv = gHTMLElementFactory->CreateInstanceByTag(nodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)
return NS_ERROR_UNEXPECTED;
}
else {
const PRUnichar *tagName;
aTag->GetUnicode(&tagName);
nsCOMPtr<nsIElementFactory> elementFactory;
GetElementFactory(aNameSpaceID, getter_AddRefs(elementFactory));
rv = elementFactory->CreateInstanceByTag(tagName, getter_AddRefs(result));
rv = elementFactory->CreateInstanceByTag(nodeInfo,
getter_AddRefs(result));
if (NS_FAILED(rv)) return rv;
if (! result)

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

@ -1112,7 +1112,16 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
// Create an HTML image content object, and set the SRC.
// XXX Check if it's an image type we can handle...
NS_NewHTMLImageElement(&imageContent, nsHTMLAtoms::img);
nsCOMPtr<nsINodeInfoManager> nimgr;
nsresult rv = aDocument->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINodeInfo> nodeInfo;
nimgr->GetNodeInfo(nsHTMLAtoms::img, nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_NewHTMLImageElement(&imageContent, nodeInfo);
imageContent->SetHTMLAttribute(nsHTMLAtoms::src, contentString, PR_FALSE);
// Set aContent as the parent content and set the document object. This

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

@ -25,6 +25,7 @@ nsIFrameManager.h
nsILayoutDebugger.h
nsINameSpace.h
nsINameSpaceManager.h
nsINodeInfo.h
nsIPageSequenceFrame.h
nsIPresContext.h
nsIPresShell.h

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

@ -51,6 +51,7 @@ nsIFrameManager.h \
nsILayoutDebugger.h \
nsINameSpace.h \
nsINameSpaceManager.h \
nsINodeInfo.h \
nsIFrameUtil.h \
nsIPageSequenceFrame.h \
nsIPresContext.h \

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

@ -44,6 +44,7 @@ EXPORTS = \
nsILayoutDebugger.h \
nsINameSpace.h \
nsINameSpaceManager.h \
nsINodeInfo.h \
nsIFrameUtil.h \
nsIPageSequenceFrame.h \
nsIPresContext.h \

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

@ -57,6 +57,7 @@ class nsIWordBreaker;
class nsIDOMSelection;
class nsIChannel;
class nsIPrincipal;
class nsINodeInfoManager;
class nsIDOMDocument;
class nsIDOMDocumentType;
class nsIBindingManager;
@ -330,6 +331,8 @@ public:
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID) = 0;
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult) = 0;
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
};

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

@ -25,7 +25,7 @@
#include "nsISupports.h"
class nsIContent;
class nsString;
class nsINodeInfo;
/* a6cf90fb-15b3-11d2-932e-00805f8add32 */
#define NS_IELEMENT_FACTORY_IID \
@ -38,7 +38,7 @@ class nsIElementFactory : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IELEMENT_FACTORY_IID; return iid; }
NS_IMETHOD CreateInstanceByTag(const nsString& aTag,
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult) = 0;
};

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

@ -2,3 +2,4 @@
# This is a list of local files which get copied to the mozilla:dist:layout directory
#
nsContentList.h
nsNodeInfoManager.h

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

@ -56,6 +56,8 @@ CPPSRCS = \
nsLayoutDebugger.cpp \
nsLayoutUtils.cpp \
nsNameSpaceManager.cpp \
nsNodeInfo.cpp \
nsNodeInfoManager.cpp \
nsPluginViewer.cpp \
nsPresContext.cpp \
nsPresState.cpp \
@ -77,6 +79,7 @@ CPPSRCS = \
EXPORTS = \
nsDocument.h \
nsNodeInfoManager.h \
nsXIFConverter.h \
$(NULL)

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

@ -28,7 +28,7 @@ DEFINES = $(DEFINES) -DXP_NEW_SELECTION
!endif
CPPSRCS = \
nsAutoCopy.cpp \
nsAutoCopy.cpp \
nsCommentNode.cpp \
nsGenericElement.cpp \
nsGenericDOMDataNode.cpp \
@ -48,11 +48,13 @@ CPPSRCS = \
nsFrameTraversal.cpp \
nsFrameUtil.cpp \
nsGalleyContext.cpp \
nsGeneratedIterator.cpp\
nsGeneratedIterator.cpp \
nsNameSpaceManager.cpp \
nsNodeInfo.cpp \
nsNodeInfoManager.cpp \
nsPluginViewer.cpp \
nsPresContext.cpp \
nsPresState.cpp \
nsPresState.cpp \
nsPrintContext.cpp \
nsPrintPreviewContext.cpp \
nsSpaceManager.cpp \
@ -78,7 +80,7 @@ REQUIRES=xpcom raptor dom
# EXPORTS=
CPP_OBJS= \
.\$(OBJDIR)\nsAutoCopy.obj \
.\$(OBJDIR)\nsAutoCopy.obj \
.\$(OBJDIR)\nsCommentNode.obj \
.\$(OBJDIR)\nsGenericDOMDataNode.obj \
.\$(OBJDIR)\nsGenericDOMNodeList.obj \
@ -99,9 +101,11 @@ CPP_OBJS= \
.\$(OBJDIR)\nsGalleyContext.obj \
.\$(OBJDIR)\nsGeneratedIterator.obj \
.\$(OBJDIR)\nsNameSpaceManager.obj \
.\$(OBJDIR)\nsNodeInfo.obj \
.\$(OBJDIR)\nsNodeInfoManager.obj \
.\$(OBJDIR)\nsPluginViewer.obj \
.\$(OBJDIR)\nsPresContext.obj \
.\$(OBJDIR)\nsPresState.obj \
.\$(OBJDIR)\nsPresState.obj \
.\$(OBJDIR)\nsPrintContext.obj \
.\$(OBJDIR)\nsPrintPreviewContext.obj \
.\$(OBJDIR)\nsSpaceManager.obj \
@ -114,7 +118,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsSelection.obj \
.\$(OBJDIR)\nsLayoutAtoms.obj \
.\$(OBJDIR)\nsLayoutDebugger.obj \
.\$(OBJDIR)\nsLayoutUtils.obj \
.\$(OBJDIR)\nsLayoutUtils.obj \
.\$(OBJDIR)\nsCaret.obj \
.\$(OBJDIR)\nsRange.obj \
.\$(OBJDIR)\nsTextContentChangeData.obj \

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

@ -86,6 +86,7 @@
#include "nsIScrollableView.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsNodeInfoManager.h"
#include "nsNetUtil.h" // for NS_MakeAbsoluteURI
@ -797,8 +798,20 @@ NS_IMPL_RELEASE(nsDocument)
nsresult nsDocument::Init()
{
if (mNameSpaceManager) {
return NS_ERROR_ALREADY_INITIALIZED;
}
nsresult rv = NS_NewHeapArena(&mArena, nsnull);
NS_NewNameSpaceManager(&mNameSpaceManager);
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
NS_ENSURE_SUCCESS(rv, rv);
mNodeInfoManager = new nsNodeInfoManager();
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
mNodeInfoManager->Init(mNameSpaceManager);
return rv;
}
@ -2339,29 +2352,28 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
NS_IMETHODIMP
nsDocument::GetNamespaceURI(nsString& aNamespaceURI)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetPrefix(nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetPrefix(const nsString& aPrefix)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsDocument::GetLocalName(nsString& aLocalName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
aLocalName.Truncate();
return NS_OK;
}
NS_IMETHODIMP
@ -3319,6 +3331,19 @@ nsDocument::IncrementModCount(PRInt32 aNumMods)
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager)
{
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);
aNodeInfoManager = mNodeInfoManager;
NS_ADDREF(aNodeInfoManager);
return NS_OK;
}
//
// FindContent does a depth-first search from aStartNode
// and returns the first of aTest1 or aTest2 which it finds.

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

@ -41,6 +41,7 @@
#include "nsGenericDOMNodeList.h"
#include "nsIPrincipal.h"
#include "nsIBindingManager.h"
#include "nsINodeInfo.h"
class nsIEventListenerManager;
class nsDOMStyleSheetList;
@ -332,6 +333,7 @@ public:
NS_IMETHOD FlushPendingNotifications();
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
public:
@ -474,6 +476,7 @@ protected:
PRInt32 mModCount;
nsCOMPtr<nsIBindingManager> mBindingManager;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // OWNER
};
#endif /* nsDocument_h___ */

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

@ -26,6 +26,8 @@
#include "nsIScriptObjectOwner.h"
#include "nsGenericElement.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsNodeInfoManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMScriptObjectFactory.h"
@ -40,7 +42,7 @@ class nsDocumentFragment : public nsIContent,
public nsIScriptObjectOwner
{
public:
nsDocumentFragment(nsIDocument* aOwnerDocument);
nsDocumentFragment(nsIDocument* aOwnerDocument, nsINodeInfo *aNodeInfo);
virtual ~nsDocumentFragment();
// nsISupports
@ -242,11 +244,26 @@ nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
nsIDocument* aOwnerDocument)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsCOMPtr<nsINodeInfoManager> nimgr;
nsCOMPtr<nsINodeInfo> nodeInfo;
nsresult rv;
if (aOwnerDocument) {
rv = aOwnerDocument->GetNodeInfoManager(*getter_AddRefs(nimgr));
} else {
rv = nsNodeInfoManager::GetAnonymousManager(*getter_AddRefs(nimgr));
}
nsDocumentFragment* it = new nsDocumentFragment(aOwnerDocument);
NS_ENSURE_SUCCESS(rv, rv);
rv = nimgr->GetNodeInfo(NS_ConvertASCIItoUCS2("#document-fragment"),
nsnull, kNameSpaceID_None,
*getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
nsDocumentFragment* it = new nsDocumentFragment(aOwnerDocument, nodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -254,10 +271,11 @@ NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
(void**) aInstancePtrResult);
}
nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument)
nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument,
nsINodeInfo *aNodeInfo)
{
NS_INIT_REFCNT();
mInner.Init(this, nsnull);
mInner.Init(this, aNodeInfo);
mScriptObject = nsnull;
mOwnerDocument = aOwnerDocument;
NS_IF_ADDREF(mOwnerDocument);
@ -382,7 +400,7 @@ NS_IMETHODIMP
nsDocumentFragment::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
nsDocumentFragment* it;
it = new nsDocumentFragment(mOwnerDocument);
it = new nsDocumentFragment(mOwnerDocument, mInner.mNodeInfo);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -24,6 +24,7 @@
#include "nsDOMAttribute.h"
#include "nsDOMAttributeMap.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsIDocument.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMNodeList.h"
@ -376,21 +377,16 @@ nsGenericElement::GetScriptObjectFactory(nsIDOMScriptObjectFactory **aResult)
return result;
}
nsGenericElement::nsGenericElement()
nsGenericElement::nsGenericElement() : mContent(nsnull), mDocument(nsnull),
mParent(nsnull), mNodeInfo(nsnull),
mDOMSlots(nsnull), mContentID(0)
{
mDocument = nsnull;
mParent = nsnull;
mTag = nsnull;
mContent = nsnull;
mDOMSlots = nsnull;
mContentID = 0;
}
nsGenericElement::~nsGenericElement()
{
// pop any enclosed ranges out
// nsRange::OwnerGone(mContent); not used for now
NS_IF_RELEASE(mTag);
if (nsnull != mDOMSlots) {
if (nsnull != mDOMSlots->mChildNodes) {
mDOMSlots->mChildNodes->DropReference();
@ -409,6 +405,7 @@ nsGenericElement::~nsGenericElement()
// XXX Should really be arena managed
PR_DELETE(mDOMSlots);
}
NS_IF_RELEASE(mNodeInfo);
}
nsDOMSlots *
@ -445,26 +442,17 @@ nsGenericElement::MaybeClearDOMSlots()
void
nsGenericElement::Init(nsIContent* aOuterContentObject,
nsIAtom* aTag)
nsINodeInfo *aNodeInfo)
{
NS_ABORT_IF_FALSE(aOuterContentObject, "We need a outer content object!");
NS_ABORT_IF_FALSE(aNodeInfo, "This can't be used without node info!");
NS_ASSERTION((nsnull == mContent) && (nsnull != aOuterContentObject),
"null ptr");
mContent = aOuterContentObject;
mTag = aTag;
NS_IF_ADDREF(aTag);
}
nsresult
nsGenericElement::GetNodeName(nsString& aNodeName)
{
return GetTagName(aNodeName);
}
nsresult
nsGenericElement::GetLocalName(nsString& aNodeName)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
mNodeInfo = aNodeInfo;
NS_IF_ADDREF(mNodeInfo);
}
nsresult
@ -595,6 +583,50 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
}
nsresult
nsGenericElement::GetNamespaceURI(nsString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
nsresult
nsGenericElement::GetPrefix(nsString& aPrefix)
{
return mNodeInfo->GetPrefix(aPrefix);
}
nsresult
nsGenericElement::SetPrefix(const nsString& aPrefix)
{
// XXX: Validate the prefix string!
nsINodeInfo *newNodeInfo = nsnull;
nsCOMPtr<nsIAtom> prefix;
if (aPrefix.Length()) {
prefix = dont_AddRef(NS_NewAtom(aPrefix));
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
}
nsresult rv = mNodeInfo->PrefixChanged(prefix, newNodeInfo);
NS_ENSURE_SUCCESS(rv, rv);
NS_RELEASE(mNodeInfo);
mNodeInfo = newNodeInfo;
return NS_OK;
}
nsresult
nsGenericElement::Supports(const nsString& aFeature, const nsString& aVersion,
PRBool* aReturn)
{
// XXX: TBI
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
@ -617,10 +649,8 @@ nsresult
nsGenericElement::GetTagName(nsString& aTagName)
{
aTagName.Truncate();
if (nsnull != mTag) {
// note that we assume no namespace here, subclasses that support
// namespaces must override
mTag->ToString(aTagName);
if (mNodeInfo) {
mNodeInfo->GetName(aTagName);
}
return NS_OK;
}
@ -998,9 +1028,7 @@ nsGenericElement::GetNameSpaceID(PRInt32& aResult) const
nsresult
nsGenericElement::GetTag(nsIAtom*& aResult) const
{
aResult = mTag;
NS_IF_ADDREF(aResult);
return NS_OK;
return mNodeInfo->GetNameAtom(aResult);
}
@ -1238,7 +1266,7 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
}
nsAutoString tag;
mTag->ToString(tag);
mNodeInfo->GetQualifiedName(tag);
res = factory->NewScriptElement(tag, aContext, mContent,
mParent ? (nsISupports*)mParent : (nsISupports*)mDocument,
(void**)&slots->mScriptObject);
@ -1983,7 +2011,8 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute,
mDocument->GetScriptGlobalObject(getter_AddRefs(global));
if (global) {
if (NS_OK == global->GetContext(&context)) {
if (nsHTMLAtoms::body == mTag || nsHTMLAtoms::frameset == mTag) {
if (mNodeInfo->Equals(nsHTMLAtoms::body) ||
mNodeInfo->Equals(nsHTMLAtoms::frameset)) {
nsIDOMEventReceiver *receiver;
if (nsnull != global && NS_OK == global->QueryInterface(kIDOMEventReceiverIID, (void**)&receiver)) {
@ -2427,14 +2456,10 @@ nsGenericContainerElement::List(FILE* out, PRInt32 aIndent) const
PRInt32 index;
for (index = aIndent; --index >= 0; ) fputs(" ", out);
nsIAtom* tag;
GetTag(tag);
if (tag != nsnull) {
nsAutoString buf;
tag->ToString(buf);
fputs(buf, out);
NS_RELEASE(tag);
}
nsAutoString buf;
mNodeInfo->GetQualifiedName(buf);
fputs(buf, out);
fprintf(out, "@%p", mContent);
ListAttributes(out);

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

@ -34,6 +34,7 @@
#include "nsILinkHandler.h"
#include "nsGenericDOMNodeList.h"
#include "nsIEventListenerManager.h"
#include "nsINodeInfo.h"
extern const nsIID kIDOMNodeIID;
extern const nsIID kIDOMElementIID;
@ -53,6 +54,7 @@ class nsDOMCSSDeclaration;
class nsIDOMCSSStyleDeclaration;
class nsDOMAttributeMap;
class nsIURI;
class nsINodeInfo;
// Class that holds the child list of a content element and also
@ -124,10 +126,9 @@ public:
nsGenericElement();
~nsGenericElement();
void Init(nsIContent* aOuterContentObject, nsIAtom* aTag);
void Init(nsIContent* aOuterContentObject, nsINodeInfo *aNodeInfo);
// Implementation for nsIDOMNode
nsresult GetNodeName(nsString& aNodeName);
nsresult GetNodeValue(nsString& aNodeValue);
nsresult SetNodeValue(const nsString& aNodeValue);
nsresult GetNodeType(PRUint16* aNodeType);
@ -136,8 +137,12 @@ public:
nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult GetLocalName(nsString& aLocalName);
nsresult GetNamespaceURI(nsString& aNamespaceURI);
nsresult GetPrefix(nsString& aPrefix);
nsresult SetPrefix(const nsString& aPrefix);
nsresult Normalize();
nsresult Supports(const nsString& aFeature,
const nsString& aVersion, PRBool* aReturn);
// Implementation for nsIDOMElement
nsresult GetTagName(nsString& aTagName);
@ -252,12 +257,12 @@ public:
// supporting. Sometimes there is work that we just can't do
// ourselves, so this is needed to ask the real object to do the
// work.
nsIContent* mContent;
nsIContent* mContent; // WEAK
nsIDocument* mDocument; // WEAK
nsIContent* mParent; // WEAK
nsIAtom* mTag;
nsDOMSlots *mDOMSlots;
nsINodeInfo* mNodeInfo; // OWNER
nsDOMSlots *mDOMSlots; // OWNER
PRUint32 mContentID;
};
@ -346,9 +351,6 @@ public:
*
* Note that classes using this macro will need to implement:
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
* Note:
* GetNamespaceURI, GetPrefix, SetPrefix, Normalize and Supports must be
* implemented in a super class of this one.
*/
#define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \
NS_IMETHOD GetNodeName(nsString& aNodeName) { \

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше