Export style sheets, nsPresShell, and nsTextNode via the factory.

This commit is contained in:
waterson%netscape.com 1998-12-03 20:21:40 +00:00
parent 1cd4a28768
commit 37ffaaf5ad
2 changed files with 47 additions and 0 deletions

View File

@ -52,5 +52,21 @@
#define NS_CSSPARSER_CID \
{ 0x2e363d60, 0x872e, 0x11d2, { 0xb5, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {E6FD9940-899D-11d2-8EAE-00805F29F370}
#define NS_PRESSHELL_CID \
{ 0xe6fd9940, 0x899d, 0x11d2, { 0x8e, 0xae, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B70-8A27-11d2-8EAF-00805F29F370}
#define NS_HTMLSTYLESHEET_CID \
{ 0x96882b70, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B71-8A27-11d2-8EAF-00805F29F370}
#define NS_TEXTNODE_CID \
{ 0x96882b71, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B72-8A27-11d2-8EAF-00805F29F370}
#define NS_SELECTION_CID \
{ 0x96882b72, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
#endif // nsLayoutCID_h__

View File

@ -23,6 +23,8 @@
#include "nsIDocument.h"
#include "nsIHTMLContent.h"
#include "nsICollection.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLParts.h"
@ -31,16 +33,21 @@
#include "nsIDOMNativeObjectRegistry.h"
#include "nsIServiceManager.h"
#include "nsICSSParser.h"
#include "nsIHTMLStyleSheet.h"
#include "nsICollection.h"
static NS_DEFINE_IID(kCHTMLDocumentCID, NS_HTMLDOCUMENT_CID);
static NS_DEFINE_IID(kCXMLDocumentCID, NS_XMLDOCUMENT_CID);
static NS_DEFINE_IID(kCImageDocumentCID, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kCCSSParserCID, NS_CSSPARSER_CID);
static NS_DEFINE_CID(kHTMLStyleSheetCID, NS_HTMLSTYLESHEET_CID);
static NS_DEFINE_IID(kCHTMLImageElementFactoryCID, NS_HTMLIMAGEELEMENTFACTORY_CID);
static NS_DEFINE_IID(kIDOMHTMLImageElementFactoryIID, NS_IDOMHTMLIMAGEELEMENTFACTORY_IID);
static NS_DEFINE_IID(kIDOMHTMLImageElementIID, NS_IDOMHTMLIMAGEELEMENT_IID);
static NS_DEFINE_IID(kICollectionIID, NS_ICOLLECTION_IID);
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kSelectionCID, NS_SELECTION_CID);
nsresult NS_NewRangeList(nsICollection **);
@ -208,6 +215,13 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter,
inst = new HTMLImageElementFactory();
refCounted = PR_FALSE;
}
else if (mClassID.Equals(kPresShellCID)) {
res = NS_NewPresShell((nsIPresShell**) &inst);
if (NS_FAILED(res)) {
return res;
}
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kICollectionIID)) {
res = NS_NewRangeList((nsICollection **)&inst);
if (!NS_SUCCEEDED(res)) {
@ -223,6 +237,23 @@ nsresult nsLayoutFactory::CreateInstance(nsISupports *aOuter,
return res;
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kHTMLStyleSheetCID)) {
// XXX ibid
if (NS_FAILED(res = NS_NewHTMLStyleSheet((nsIHTMLStyleSheet**)&inst)))
return res;
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kTextNodeCID)) {
// XXX ibid
if (NS_FAILED(res = NS_NewTextNode((nsIHTMLContent**) &inst)))
return res;
refCounted = PR_TRUE;
}
else if (mClassID.Equals(kSelectionCID)) {
if (NS_FAILED(res = NS_NewSelection((nsISelection**) &inst)))
return res;
refCounted = PR_TRUE;
}
else
{
return NS_NOINTERFACE;