1999-09-28 00:44:47 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-09-28 00:44:47 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-09-28 00:44:47 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 03:40:37 +00:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-02 22:24:56 +00:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-09-28 00:44:47 +00:00
|
|
|
*/
|
2000-01-24 21:28:28 +00:00
|
|
|
#include "nspr.h"
|
|
|
|
#include "nsString.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsLayoutModule.h"
|
|
|
|
#include "nsLayoutCID.h"
|
|
|
|
#include "nsIComponentManager.h"
|
1999-11-30 04:50:42 +00:00
|
|
|
#include "nsNetUtil.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsICSSStyleSheet.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsCSSKeywords.h" // to addref/release table
|
|
|
|
#include "nsCSSProps.h" // to addref/release table
|
|
|
|
#include "nsCSSAtoms.h" // to addref/release table
|
|
|
|
#include "nsColorNames.h" // to addref/release table
|
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#endif
|
1999-10-02 11:01:41 +00:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
#include "nsMathMLAtoms.h"
|
|
|
|
#include "nsMathMLOperators.h"
|
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
|
|
|
#include "nsDOMCID.h"
|
|
|
|
#include "nsIScriptContext.h"
|
2000-06-21 00:42:59 +00:00
|
|
|
#include "nsIScriptObjectOwner.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsIScriptNameSetRegistry.h"
|
|
|
|
#include "nsIScriptNameSpaceManager.h"
|
|
|
|
#include "nsIScriptExternalNameSet.h"
|
|
|
|
|
2000-05-10 13:13:39 +00:00
|
|
|
#include "nsINodeInfo.h"
|
|
|
|
|
2000-01-19 04:11:23 +00:00
|
|
|
#include "nsIElementFactory.h"
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
#include "nsIDocumentEncoder.h"
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 10:57:30 +00:00
|
|
|
#include "nsIContentSerializer.h"
|
|
|
|
#include "nsIHTMLToTextSink.h"
|
1999-09-28 00:44:47 +00:00
|
|
|
|
2000-04-01 22:31:45 +00:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
#include "nsSVGAtoms.h"
|
|
|
|
#endif
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
// XXX
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
|
1999-10-19 23:01:23 +00:00
|
|
|
#include "nsTextTransformer.h"
|
2000-11-08 03:22:03 +00:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
#include "nsBulletinBoardLayout.h"
|
|
|
|
#include "nsRepeatService.h"
|
|
|
|
#include "nsSprocketLayout.h"
|
|
|
|
#include "nsStackLayout.h"
|
|
|
|
#endif
|
2000-05-15 03:40:40 +00:00
|
|
|
#include "nsContentPolicyUtils.h"
|
1999-10-19 23:01:23 +00:00
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
static nsLayoutModule *gModule = NULL;
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
2000-01-24 21:28:28 +00:00
|
|
|
nsIFile* location,
|
1999-09-28 00:44:47 +00:00
|
|
|
nsIModule** return_cobj)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
NS_ASSERTION(return_cobj, "Null argument");
|
|
|
|
NS_ASSERTION(gModule == NULL, "nsLayoutModule: Module already created.");
|
|
|
|
|
|
|
|
// Create an initialize the layout module instance
|
|
|
|
nsLayoutModule *m = new nsLayoutModule();
|
|
|
|
if (!m) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increase refcnt and store away nsIModule interface to m in return_cobj
|
2000-02-02 22:24:56 +00:00
|
|
|
rv = m->QueryInterface(NS_GET_IID(nsIModule), (void**)return_cobj);
|
1999-09-28 00:44:47 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete m;
|
|
|
|
m = nsnull;
|
|
|
|
}
|
|
|
|
gModule = m; // WARNING: Weak Reference
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
|
|
|
|
|
|
|
|
class LayoutScriptNameSet : public nsIScriptExternalNameSet {
|
|
|
|
public:
|
|
|
|
LayoutScriptNameSet();
|
|
|
|
virtual ~LayoutScriptNameSet();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD InitializeClasses(nsIScriptContext* aScriptContext);
|
|
|
|
NS_IMETHOD AddNameSet(nsIScriptContext* aScriptContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
LayoutScriptNameSet::LayoutScriptNameSet()
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
}
|
|
|
|
|
|
|
|
LayoutScriptNameSet::~LayoutScriptNameSet()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-01-04 20:44:42 +00:00
|
|
|
NS_IMPL_ISUPPORTS(LayoutScriptNameSet, NS_GET_IID(nsIScriptExternalNameSet));
|
1999-09-28 00:44:47 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
LayoutScriptNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|
|
|
{
|
|
|
|
nsresult result = NS_OK;
|
|
|
|
nsIScriptNameSpaceManager* manager;
|
|
|
|
static NS_DEFINE_IID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
|
|
|
|
static NS_DEFINE_IID(kHTMLOptionElementCID, NS_HTMLOPTIONELEMENT_CID);
|
|
|
|
|
|
|
|
result = aScriptContext->GetNameSpaceManager(&manager);
|
|
|
|
if (NS_OK == result) {
|
2001-03-27 11:17:17 +00:00
|
|
|
result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"),
|
2001-01-04 20:44:42 +00:00
|
|
|
NS_GET_IID(nsIScriptObjectOwner),
|
1999-09-28 00:44:47 +00:00
|
|
|
kHTMLImageElementCID,
|
|
|
|
PR_TRUE);
|
|
|
|
if (NS_FAILED(result)) {
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-03-27 11:17:17 +00:00
|
|
|
result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"),
|
2001-01-04 20:44:42 +00:00
|
|
|
NS_GET_IID(nsIScriptObjectOwner),
|
1999-09-28 00:44:47 +00:00
|
|
|
kHTMLOptionElementCID,
|
|
|
|
PR_TRUE);
|
|
|
|
if (NS_FAILED(result)) {
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
nsIScriptNameSetRegistry* nsLayoutModule::gRegistry;
|
2000-03-21 12:14:29 +00:00
|
|
|
nsICSSStyleSheet* nsLayoutModule::gUAStyleSheet = nsnull;
|
2001-04-17 07:23:04 +00:00
|
|
|
nsIStyleSheet* nsLayoutModule::gViewSourceStyleSheet = nsnull;
|
1999-09-28 00:44:47 +00:00
|
|
|
|
|
|
|
nsLayoutModule::nsLayoutModule()
|
|
|
|
: mInitialized(PR_FALSE)
|
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLayoutModule::~nsLayoutModule()
|
|
|
|
{
|
|
|
|
Shutdown();
|
|
|
|
}
|
|
|
|
|
2001-01-04 20:44:42 +00:00
|
|
|
NS_IMPL_ISUPPORTS(nsLayoutModule, NS_GET_IID(nsIModule))
|
1999-09-28 00:44:47 +00:00
|
|
|
|
|
|
|
// Perform our one-time intialization for this module
|
|
|
|
nsresult
|
|
|
|
nsLayoutModule::Initialize()
|
|
|
|
{
|
2000-03-21 10:34:56 +00:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
if (mInitialized) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-10-02 00:55:57 +00:00
|
|
|
mInitialized = PR_TRUE;
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
// Register all of our atoms once
|
|
|
|
nsCSSAtoms::AddRefAtoms();
|
|
|
|
nsCSSKeywords::AddRefTable();
|
|
|
|
nsCSSProps::AddRefTable();
|
|
|
|
nsColorNames::AddRefTable();
|
|
|
|
nsHTMLAtoms::AddRefAtoms();
|
1999-09-30 21:14:14 +00:00
|
|
|
nsLayoutAtoms::AddRefAtoms();
|
1999-09-28 00:44:47 +00:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsXULAtoms::AddRefAtoms();
|
|
|
|
#endif
|
1999-10-02 11:01:41 +00:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
nsMathMLOperators::AddRefTable();
|
|
|
|
nsMathMLAtoms::AddRefAtoms();
|
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
|
2000-04-01 22:31:45 +00:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
nsSVGAtoms::AddRefAtoms();
|
|
|
|
#endif
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
// XXX Initialize the script name set thingy-ma-jigger
|
|
|
|
if (!gRegistry) {
|
|
|
|
rv = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
|
2001-01-04 20:44:42 +00:00
|
|
|
NS_GET_IID(nsIScriptNameSetRegistry),
|
1999-09-28 00:44:47 +00:00
|
|
|
(nsISupports**) &gRegistry);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
LayoutScriptNameSet* nameSet = new LayoutScriptNameSet();
|
|
|
|
gRegistry->AddExternalNameSet(nameSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-19 23:01:23 +00:00
|
|
|
rv = nsTextTransformer::Initialize();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown this module, releasing all of the module resources
|
|
|
|
void
|
|
|
|
nsLayoutModule::Shutdown()
|
|
|
|
{
|
2000-02-16 07:42:00 +00:00
|
|
|
if (!mInitialized) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-08 03:22:03 +00:00
|
|
|
|
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsBulletinBoardLayout::Shutdown();
|
|
|
|
nsRepeatService::Shutdown();
|
|
|
|
nsSprocketLayout::Shutdown();
|
|
|
|
nsStackLayout::Shutdown();
|
|
|
|
#endif
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
// Release all of our atoms
|
|
|
|
nsColorNames::ReleaseTable();
|
|
|
|
nsCSSProps::ReleaseTable();
|
|
|
|
nsCSSKeywords::ReleaseTable();
|
|
|
|
nsCSSAtoms::ReleaseAtoms();
|
|
|
|
nsHTMLAtoms::ReleaseAtoms();
|
1999-09-30 21:14:14 +00:00
|
|
|
nsLayoutAtoms::ReleaseAtoms();
|
1999-09-28 00:44:47 +00:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsXULAtoms::ReleaseAtoms();
|
2001-02-19 21:50:04 +00:00
|
|
|
#endif
|
1999-10-02 11:01:41 +00:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
nsMathMLOperators::ReleaseTable();
|
|
|
|
nsMathMLAtoms::ReleaseAtoms();
|
|
|
|
#endif
|
2000-04-01 22:31:45 +00:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
nsSVGAtoms::ReleaseAtoms();
|
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
|
1999-10-19 23:01:23 +00:00
|
|
|
nsTextTransformer::Shutdown();
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
NS_IF_RELEASE(gRegistry);
|
2000-03-21 12:14:29 +00:00
|
|
|
NS_IF_RELEASE(gUAStyleSheet);
|
2001-04-17 07:23:04 +00:00
|
|
|
NS_IF_RELEASE(gViewSourceStyleSheet);
|
1999-09-28 00:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::GetClassObject(nsIComponentManager *aCompMgr,
|
|
|
|
const nsCID& aClass,
|
|
|
|
const nsIID& aIID,
|
|
|
|
void** r_classObj)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
if (!mInitialized) {
|
|
|
|
rv = Initialize();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-28 15:16:54 +00:00
|
|
|
nsCOMPtr<nsIFactory> f = new nsLayoutFactory(aClass);
|
1999-09-28 00:44:47 +00:00
|
|
|
if (!f) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2000-01-28 15:16:54 +00:00
|
|
|
return f->QueryInterface(aIID, r_classObj);
|
1999-09-28 00:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
struct Components {
|
|
|
|
const char* mDescription;
|
|
|
|
nsID mCID;
|
2000-09-13 23:57:52 +00:00
|
|
|
const char* mContractID;
|
1999-09-28 00:44:47 +00:00
|
|
|
};
|
|
|
|
|
2000-01-19 04:11:23 +00:00
|
|
|
// The HTML namespace.
|
|
|
|
|
1999-09-28 00:44:47 +00:00
|
|
|
// The list of components we register
|
|
|
|
static Components gComponents[] = {
|
|
|
|
{ "Frame utility", NS_FRAME_UTIL_CID, nsnull, },
|
|
|
|
{ "Print preview context", NS_PRINT_PREVIEW_CONTEXT_CID, nsnull, },
|
|
|
|
{ "Layout debugger", NS_LAYOUT_DEBUGGER_CID, nsnull, },
|
|
|
|
|
2001-02-19 21:50:04 +00:00
|
|
|
{ "CSS Frame Constructor", NS_CSSFRAMECONSTRUCTOR_CID, nsnull, },
|
|
|
|
{ "Frame Traversal", NS_FRAMETRAVERSAL_CID, nsnull, },
|
2001-04-24 08:33:57 +00:00
|
|
|
{ "Layout History State", NS_LAYOUT_HISTORY_STATE_CID, nsnull, },
|
1999-09-28 00:44:47 +00:00
|
|
|
|
|
|
|
// XXX ick
|
|
|
|
{ "Presentation shell", NS_PRESSHELL_CID, nsnull, },
|
2001-02-19 21:50:04 +00:00
|
|
|
{ "Presentation state", NS_PRESSTATE_CID, nsnull, },
|
|
|
|
{ "Galley context", NS_GALLEYCONTEXT_CID, nsnull, },
|
|
|
|
{ "Print context", NS_PRINTCONTEXT_CID, nsnull, },
|
1999-09-28 00:44:47 +00:00
|
|
|
// XXX end ick
|
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
{ "XUL Box Object", NS_BOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject;1" },
|
|
|
|
{ "XUL Tree Box Object", NS_TREEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-tree;1" },
|
|
|
|
{ "XUL Menu Box Object", NS_MENUBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-menu;1" },
|
|
|
|
{ "XUL PopupSet Box Object", NS_POPUPSETBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-popupset;1" },
|
|
|
|
{ "XUL Browser Box Object", NS_BROWSERBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-browser;1" },
|
|
|
|
{ "XUL Editor Box Object", NS_EDITORBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-editor;1" },
|
|
|
|
{ "XUL Iframe Object", NS_IFRAMEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-iframe;1" },
|
|
|
|
{ "XUL ScrollBox Object", NS_SCROLLBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-scrollbox;1" },
|
2001-03-06 22:16:42 +00:00
|
|
|
{ "XUL Outliner Box Object", NS_OUTLINERBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-outliner;1" },
|
2000-09-13 23:57:52 +00:00
|
|
|
|
2001-02-19 21:50:04 +00:00
|
|
|
{ "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, "@mozilla.org/autocopy;1" }
|
1999-09-28 00:44:47 +00:00
|
|
|
};
|
|
|
|
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
2000-01-24 21:28:28 +00:00
|
|
|
nsIFile* aPath,
|
1999-09-28 00:44:47 +00:00
|
|
|
const char* registryLocation,
|
|
|
|
const char* componentType)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Registering layout components\n");
|
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
|
|
|
|
Components* cp = gComponents;
|
|
|
|
Components* end = cp + NUM_COMPONENTS;
|
|
|
|
while (cp < end) {
|
|
|
|
rv = aCompMgr->RegisterComponentSpec(cp->mCID, cp->mDescription,
|
2000-09-13 23:57:52 +00:00
|
|
|
cp->mContractID, aPath, PR_TRUE, PR_TRUE);
|
1999-09-28 00:44:47 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
2000-10-28 22:17:53 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsLayoutModule: unable to register %s component => %x\n",
|
1999-09-28 00:44:47 +00:00
|
|
|
cp->mDescription, rv);
|
2000-10-28 22:17:53 +00:00
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = RegisterDocumentFactories(aCompMgr, aPath);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
2000-01-24 21:28:28 +00:00
|
|
|
nsIFile* aPath,
|
1999-09-28 00:44:47 +00:00
|
|
|
const char* registryLocation)
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Unregistering layout components\n");
|
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
Components* cp = gComponents;
|
|
|
|
Components* end = cp + NUM_COMPONENTS;
|
|
|
|
while (cp < end) {
|
|
|
|
nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath);
|
|
|
|
if (NS_FAILED(rv)) {
|
2000-10-28 22:17:53 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsLayoutModule: unable to unregister %s component => %x\n",
|
1999-09-28 00:44:47 +00:00
|
|
|
cp->mDescription, rv);
|
2000-10-28 22:17:53 +00:00
|
|
|
#endif
|
1999-09-28 00:44:47 +00:00
|
|
|
}
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
UnregisterDocumentFactories(aCompMgr, aPath);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|
|
|
{
|
|
|
|
if (!okToUnload) {
|
|
|
|
return NS_ERROR_INVALID_POINTER;
|
|
|
|
}
|
|
|
|
*okToUnload = PR_FALSE;
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|