Implement nsIHTMLElementFactory

This commit is contained in:
kipp%netscape.com 1999-05-06 19:26:43 +00:00
parent c37119c8c6
commit c66cd43ff3
2 changed files with 104 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include "prlog.h"
#include "nsHTMLParts.h"
#include "nsIHTMLElementFactory.h"
#include "nsITextContent.h"
#include "nsIDOMText.h"
@ -814,6 +815,57 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, const nsString& aTag)
//----------------------------------------------------------------------
static NS_DEFINE_IID(kIHTMLElementFactoryIID, NS_IHTML_ELEMENT_FACTORY_IID);
class nsHTMLElementFactory : public nsIHTMLElementFactory {
public:
nsHTMLElementFactory();
virtual ~nsHTMLElementFactory();
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstanceByTag(const nsString& aTag,
nsIHTMLContent** aResult);
};
nsresult
NS_NewHTMLElementFactory(nsIHTMLElementFactory** aInstancePtrResult)
{
NS_PRECONDITION(aInstancePtrResult, "null OUT ptr");
if (!aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLElementFactory* it = new nsHTMLElementFactory();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIHTMLElementFactoryIID,
(void**)aInstancePtrResult);
}
nsHTMLElementFactory::nsHTMLElementFactory()
{
NS_INIT_REFCNT();
}
nsHTMLElementFactory::~nsHTMLElementFactory()
{
}
NS_IMPL_ISUPPORTS(nsHTMLElementFactory, kIHTMLElementFactoryIID);
NS_IMETHODIMP
nsHTMLElementFactory::CreateInstanceByTag(const nsString& aTag,
nsIHTMLContent** aResult)
{
nsresult rv;
rv = NS_CreateHTMLElement(aResult, aTag);
return rv;
}
//----------------------------------------------------------------------
SinkContext::SinkContext(HTMLContentSink* aSink)
{
mSink = aSink;

View File

@ -35,6 +35,7 @@
#include "prlog.h"
#include "nsHTMLParts.h"
#include "nsIHTMLElementFactory.h"
#include "nsITextContent.h"
#include "nsIDOMText.h"
@ -814,6 +815,57 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, const nsString& aTag)
//----------------------------------------------------------------------
static NS_DEFINE_IID(kIHTMLElementFactoryIID, NS_IHTML_ELEMENT_FACTORY_IID);
class nsHTMLElementFactory : public nsIHTMLElementFactory {
public:
nsHTMLElementFactory();
virtual ~nsHTMLElementFactory();
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstanceByTag(const nsString& aTag,
nsIHTMLContent** aResult);
};
nsresult
NS_NewHTMLElementFactory(nsIHTMLElementFactory** aInstancePtrResult)
{
NS_PRECONDITION(aInstancePtrResult, "null OUT ptr");
if (!aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsHTMLElementFactory* it = new nsHTMLElementFactory();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(kIHTMLElementFactoryIID,
(void**)aInstancePtrResult);
}
nsHTMLElementFactory::nsHTMLElementFactory()
{
NS_INIT_REFCNT();
}
nsHTMLElementFactory::~nsHTMLElementFactory()
{
}
NS_IMPL_ISUPPORTS(nsHTMLElementFactory, kIHTMLElementFactoryIID);
NS_IMETHODIMP
nsHTMLElementFactory::CreateInstanceByTag(const nsString& aTag,
nsIHTMLContent** aResult)
{
nsresult rv;
rv = NS_CreateHTMLElement(aResult, aTag);
return rv;
}
//----------------------------------------------------------------------
SinkContext::SinkContext(HTMLContentSink* aSink)
{
mSink = aSink;