зеркало из https://github.com/mozilla/pjs.git
Fix for bug 176610 (Make nsNameSpaceManager a service). r=caillon, sr=jst.
This commit is contained in:
Родитель
80fea75abf
Коммит
23b10864c8
|
@ -67,7 +67,6 @@
|
|||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
|
|
@ -74,7 +74,6 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#include "nsILink.h"
|
||||
|
|
|
@ -970,8 +970,9 @@ NS_IMETHODIMP nsDocAccessibleMixin::GetDocType(nsAString& aDocType)
|
|||
NS_IMETHODIMP nsDocAccessibleMixin::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAString& aNameSpaceURI)
|
||||
{
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceManager;
|
||||
if (NS_SUCCEEDED(mDocument->GetNameSpaceManager(*getter_AddRefs(nameSpaceManager))))
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceManager =
|
||||
do_GetService(NS_NAMESPACEMANAGER_CONTRACTID);
|
||||
if (nameSpaceManager)
|
||||
return nameSpaceManager->GetNameSpaceURI(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "nsICSSLoader.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIResProtocolHandler.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
|
|
@ -49,6 +49,7 @@ class nsIXPConnect;
|
|||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDocShell;
|
||||
class nsINameSpaceManager;
|
||||
class nsIScriptSecurityManager;
|
||||
class nsIThreadJSContextStack;
|
||||
class nsIParserService;
|
||||
|
@ -207,6 +208,11 @@ public:
|
|||
|
||||
static nsIParserService* GetParserServiceWeakRef();
|
||||
|
||||
static nsINameSpaceManager* GetNSManagerWeakRef()
|
||||
{
|
||||
return sNameSpaceManager;
|
||||
};
|
||||
|
||||
private:
|
||||
static nsresult doReparentContentWrapper(nsIContent *aChild,
|
||||
nsIDocument *aNewDocument,
|
||||
|
@ -225,6 +231,7 @@ private:
|
|||
|
||||
static nsIParserService *sParserService;
|
||||
|
||||
static nsINameSpaceManager *sNameSpaceManager;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ class nsIDOMEvent;
|
|||
class nsIDeviceContext;
|
||||
class nsIParser;
|
||||
class nsIDOMNode;
|
||||
class nsINameSpaceManager;
|
||||
class nsIDOMDocumentFragment;
|
||||
class nsILineBreaker;
|
||||
class nsIWordBreaker;
|
||||
|
@ -292,11 +291,6 @@ public:
|
|||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject) = 0;
|
||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0;
|
||||
|
||||
/**
|
||||
* Get the name space manager for this document
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) = 0;
|
||||
|
||||
/**
|
||||
* Get the script loader for this document
|
||||
*/
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsINameSpaceManager;
|
||||
|
||||
#define NS_INAMESPACE_IID \
|
||||
{ 0xa6cf90d4, 0x15b3, 0x11d2, \
|
||||
|
@ -58,15 +57,13 @@ class nsINameSpaceManager;
|
|||
* New NameSpaces are created as a child of an existing NameSpace. Searches
|
||||
* for NameSpaces based on prefix search up the chain of nested NameSpaces
|
||||
*
|
||||
* Each NameSpace keeps a live reference on its parent and its Manager.
|
||||
* Each NameSpace keeps a live reference on its parent.
|
||||
*
|
||||
*/
|
||||
class nsINameSpace : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INAMESPACE_IID)
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const = 0;
|
||||
|
||||
// Get data of this name space
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0;
|
||||
NS_IMETHOD GetNameSpaceURI(nsAString& aURI) const = 0;
|
||||
|
|
|
@ -56,9 +56,11 @@ class nsIElementFactory;
|
|||
#define kNameSpaceID_XSLT 5
|
||||
#define kNameSpaceID_XBL 6
|
||||
#define kNameSpaceID_MathML 7
|
||||
#define kNameSpaceID_RDF 8
|
||||
#define kNameSpaceID_XUL 9
|
||||
#define kNameSpaceID_SVG 10
|
||||
|
||||
// 'html' is by definition bound to the namespace name "urn:w3-org-ns:HTML" XXX ???
|
||||
// 'xml' is by definition bound to the namespace name "urn:Connolly:input:required" XXX
|
||||
#define NS_NAMESPACEMANAGER_CONTRACTID "@mozilla.org/content/namespacemanager;1"
|
||||
|
||||
#define NS_INAMESPACEMANAGER_IID \
|
||||
{ 0xa6cf90d5, 0x15b3, 0x11d2, \
|
||||
|
@ -67,22 +69,18 @@ class nsIElementFactory;
|
|||
/**
|
||||
* The Name Space Manager tracks the associtation between a NameSpace
|
||||
* URI and the PRInt32 runtime id. Mappings between NameSpaces and
|
||||
* NameSpace prefixes are managed by nsINameSpaces
|
||||
* NameSpace prefixes are managed by nsINameSpaces.
|
||||
*
|
||||
* All NameSpace URIs are stored in a global table so that IDs are
|
||||
* consistent accross the app. NameSpace IDs are only consistent at runtime
|
||||
* ie: they are not guaranteed to be consistent accross app sessions.
|
||||
*
|
||||
* The nsINameSpaceManager needs to have a live reference for as long as
|
||||
* the NameSpace IDs are needed. Generally, a document keeps a reference to
|
||||
* a nsINameSpaceManager. Also, each nsINameSpace that comes from the manager
|
||||
* keeps a reference to it.
|
||||
* the NameSpace IDs are needed.
|
||||
*
|
||||
* To create a stack of NameSpaces, call CreateRootNameSpace, and then create
|
||||
* child NameSpaces from the root.
|
||||
*
|
||||
* The "html" and "xml" namespaces come "pre-canned" from the root.
|
||||
*
|
||||
*/
|
||||
|
||||
class nsINameSpaceManager : public nsISupports
|
||||
|
@ -105,13 +103,13 @@ public:
|
|||
|
||||
NS_IMETHOD HasRegisteredFactory(PRInt32 aNameSpaceID,
|
||||
PRBool* aHasFactory) = 0;
|
||||
|
||||
NS_IMETHOD HasNameSpaceURI(PRInt32 aNameSpaceID,
|
||||
PRBool* aHasNameSpaceURI) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewNameSpaceManager(nsINameSpaceManager** aInstancePtrResult);
|
||||
|
||||
void
|
||||
NS_NameSpaceManagerShutdown();
|
||||
|
||||
|
||||
nsresult NS_GetNameSpaceManager(nsINameSpaceManager** aInstancePtrResult);
|
||||
|
||||
void NS_NameSpaceManagerShutdown();
|
||||
|
||||
#endif // nsINameSpaceManager_h___
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
|
||||
// Forward declarations
|
||||
class nsINodeInfoManager;
|
||||
class nsINameSpaceManager;
|
||||
class nsIDocument;
|
||||
class nsIURI;
|
||||
class nsIPrincipal;
|
||||
|
@ -335,11 +334,9 @@ public:
|
|||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INODEINFOMANAGER_IID)
|
||||
|
||||
/*
|
||||
* Initialize the nodeinfo manager with a namespace manager, this should
|
||||
* allways be done.
|
||||
* Initialize the nodeinfo manager with a document.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDocument *aDocument,
|
||||
nsINameSpaceManager *aNameSpaceManager) = 0;
|
||||
NS_IMETHOD Init(nsIDocument *aDocument) = 0;
|
||||
|
||||
/*
|
||||
* Release the reference to the document, this will be called when
|
||||
|
@ -363,11 +360,6 @@ public:
|
|||
const nsAString& aNamespaceURI,
|
||||
nsINodeInfo*& aNodeInfo) = 0;
|
||||
|
||||
/*
|
||||
* Getter for the namespace manager used by this nodeinfo manager.
|
||||
*/
|
||||
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager) = 0;
|
||||
|
||||
/*
|
||||
* Retrieve a pointer to the document that owns this node info
|
||||
* manager.
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsTextFragment.h"
|
||||
|
|
|
@ -69,6 +69,7 @@ nsIXPConnect *nsContentUtils::sXPConnect = nsnull;
|
|||
nsIScriptSecurityManager *nsContentUtils::sSecurityManager = nsnull;
|
||||
nsIThreadJSContextStack *nsContentUtils::sThreadJSContextStack = nsnull;
|
||||
nsIParserService *nsContentUtils::sParserService = nsnull;
|
||||
nsINameSpaceManager *nsContentUtils::sNameSpaceManager = nsnull;
|
||||
|
||||
// static
|
||||
nsresult
|
||||
|
@ -82,15 +83,18 @@ nsContentUtils::Init()
|
|||
rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
||||
&sSecurityManager);
|
||||
if (NS_FAILED(rv)) {
|
||||
// We can run without a security manager, so don't return early.
|
||||
sSecurityManager = nsnull;
|
||||
}
|
||||
|
||||
rv = CallGetService(kJSStackContractID, &sThreadJSContextStack);
|
||||
if (NS_FAILED(rv)) {
|
||||
sThreadJSContextStack = nsnull;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_GetNameSpaceManager(&sNameSpaceManager);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -379,6 +383,7 @@ nsContentUtils::Shutdown()
|
|||
NS_IF_RELEASE(sXPConnect);
|
||||
NS_IF_RELEASE(sSecurityManager);
|
||||
NS_IF_RELEASE(sThreadJSContextStack);
|
||||
NS_IF_RELEASE(sNameSpaceManager);
|
||||
NS_IF_RELEASE(sParserService);
|
||||
}
|
||||
|
||||
|
|
|
@ -297,11 +297,8 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
|||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
if (aNamespaceURI.Length()) {
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nameSpaceID);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceID);
|
||||
|
||||
if (nameSpaceID == kNameSpaceID_Unknown)
|
||||
return NS_OK;
|
||||
|
@ -417,11 +414,8 @@ nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
|
|||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
if (aNamespaceURI.Length()) {
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nameSpaceID);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceID);
|
||||
|
||||
if (nameSpaceID == kNameSpaceID_Unknown)
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
|
|
|
@ -529,7 +529,6 @@ nsDocument::nsDocument() : mSubDocuments(nsnull),
|
|||
mRootContent = nsnull;
|
||||
mListenerManager = nsnull;
|
||||
mInDestructor = PR_FALSE;
|
||||
mNameSpaceManager = nsnull;
|
||||
mHeaderData = nsnull;
|
||||
mChildNodes = nsnull;
|
||||
mModCount = 0;
|
||||
|
@ -620,8 +619,6 @@ nsDocument::~nsDocument()
|
|||
NS_RELEASE(mListenerManager);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mNameSpaceManager);
|
||||
|
||||
if (mScriptLoader) {
|
||||
mScriptLoader->DropDocumentReference();
|
||||
}
|
||||
|
@ -694,7 +691,7 @@ NS_IMPL_RELEASE(nsDocument)
|
|||
|
||||
nsresult nsDocument::Init()
|
||||
{
|
||||
if (mNameSpaceManager) {
|
||||
if (mArena) {
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
|
@ -703,13 +700,10 @@ nsresult nsDocument::Init()
|
|||
rv = NS_NewHeapArena(&mArena, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mNodeInfoManager = new nsNodeInfoManager();
|
||||
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mNodeInfoManager->Init(this, mNameSpaceManager);
|
||||
mNodeInfoManager->Init(this);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -756,8 +750,6 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
|||
NS_IMETHODIMP
|
||||
nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
mDocumentTitle.Truncate();
|
||||
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
|
@ -807,7 +799,6 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
|||
mStyleSheets.Clear();
|
||||
|
||||
NS_IF_RELEASE(mListenerManager);
|
||||
NS_IF_RELEASE(mNameSpaceManager);
|
||||
|
||||
mDOMStyleSheets = nsnull; // Release the stylesheets list.
|
||||
|
||||
|
@ -822,10 +813,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
|||
// load group, and it works just fine.
|
||||
}
|
||||
|
||||
if (NS_OK == rv)
|
||||
rv = NS_NewNameSpaceManager(&mNameSpaceManager);
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1771,14 +1759,6 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetNameSpaceManager(nsINameSpaceManager*& aManager)
|
||||
{
|
||||
aManager = mNameSpaceManager;
|
||||
NS_IF_ADDREF(aManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetScriptLoader(nsIScriptLoader** aScriptLoader)
|
||||
{
|
||||
|
@ -2490,7 +2470,8 @@ nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIContentList> list;
|
||||
|
||||
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
|
||||
mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
|
||||
if (nameSpaceId == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no matches, we create an empty list...
|
||||
|
@ -2877,7 +2858,7 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
|||
xblService->ResolveTag(content, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
nsCAutoString contractID("@mozilla.org/layout/xul-boxobject");
|
||||
if (namespaceID == nsXULAtoms::nameSpaceID) {
|
||||
if (namespaceID == kNameSpaceID_XUL) {
|
||||
if (tag.get() == nsXULAtoms::browser)
|
||||
contractID += "-browser";
|
||||
else if (tag.get() == nsXULAtoms::editor)
|
||||
|
|
|
@ -453,11 +453,6 @@ public:
|
|||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject);
|
||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject);
|
||||
|
||||
/**
|
||||
* Get the name space manager for this document
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager);
|
||||
|
||||
/**
|
||||
* Get the script loader for this document
|
||||
*/
|
||||
|
@ -645,7 +640,6 @@ protected:
|
|||
nsIEventListenerManager* mListenerManager;
|
||||
PRBool mInDestructor;
|
||||
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
|
||||
nsINameSpaceManager* mNameSpaceManager;
|
||||
nsCOMPtr<nsIScriptLoader> mScriptLoader;
|
||||
nsDocHeaderData* mHeaderData;
|
||||
nsCOMPtr<nsILineBreaker> mLineBreaker;
|
||||
|
|
|
@ -182,7 +182,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
|
|||
#include "nsIDocument.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
//focus
|
||||
|
|
|
@ -406,49 +406,10 @@ nsNode3Tearoff::LookupNamespacePrefix(const nsAString& aNamespaceURI,
|
|||
|
||||
// XXX Waiting for DOM spec to list error codes.
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> manager;
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
||||
mContent->GetNodeInfo(*getter_AddRefs(ni));
|
||||
|
||||
if (!ni) {
|
||||
// If there's no nodeinfo (i.e. mContent is a non-element node),
|
||||
// check if the parent has nodeinfo
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
|
||||
mContent->GetParent(*getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
parent->GetNodeInfo(*getter_AddRefs(ni));
|
||||
}
|
||||
}
|
||||
|
||||
if (ni) {
|
||||
nsCOMPtr<nsINodeInfoManager> nimgr;
|
||||
|
||||
ni->GetNodeInfoManager(*getter_AddRefs(nimgr));
|
||||
NS_ENSURE_TRUE(nimgr, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(manager));
|
||||
}
|
||||
|
||||
// If there's no nodeinfo, get the manager from the document
|
||||
if (!manager) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mContent->GetDocument(*getter_AddRefs(doc));
|
||||
|
||||
if (doc) {
|
||||
doc->GetNameSpaceManager(*getter_AddRefs(manager));
|
||||
}
|
||||
}
|
||||
|
||||
if (!manager) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Get the namespace id for the URI
|
||||
PRInt32 namespaceId;
|
||||
manager->GetNameSpaceID(aNamespaceURI, namespaceId);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
namespaceId);
|
||||
if (namespaceId == kNameSpaceID_Unknown) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1477,15 +1438,7 @@ nsGenericElement::GetAttributeNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
PRInt32 nsid;
|
||||
|
||||
nsCOMPtr<nsINodeInfoManager> nimgr;
|
||||
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
|
||||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no attr...
|
||||
|
@ -1524,15 +1477,7 @@ nsGenericElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
PRInt32 nsid;
|
||||
|
||||
nsCOMPtr<nsINodeInfoManager> nimgr;
|
||||
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
|
||||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no attr...
|
||||
|
@ -1606,15 +1551,8 @@ nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIContentList> list;
|
||||
|
||||
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
|
||||
nsCOMPtr<nsINodeInfoManager> nimgr;
|
||||
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
|
||||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nameSpaceId);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
|
||||
if (nameSpaceId == kNameSpaceID_Unknown) {
|
||||
// Unknown namespace means no matches, we create an empty list...
|
||||
|
@ -1662,15 +1600,7 @@ nsGenericElement::HasAttributeNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
PRInt32 nsid;
|
||||
|
||||
nsCOMPtr<nsINodeInfoManager> nimgr;
|
||||
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
|
||||
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
nimgr->GetNamespaceManager(*getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_TRUE(nsmgr, NS_ERROR_FAILURE);
|
||||
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no attr...
|
||||
|
|
|
@ -38,156 +38,47 @@
|
|||
#include "nscore.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIElementFactory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsDoubleHashtable.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "rdf.h"
|
||||
|
||||
static nsINameSpaceManager* gNameSpaceManager = nsnull;
|
||||
|
||||
extern nsresult NS_NewXMLElementFactory(nsIElementFactory** aResult);
|
||||
|
||||
static const char kXMLNSNameSpaceURI[] = "http://www.w3.org/2000/xmlns/";
|
||||
static const char kXMLNameSpaceURI[] = "http://www.w3.org/XML/1998/namespace";
|
||||
static const char kXHTMLNameSpaceURI[] = "http://www.w3.org/1999/xhtml";
|
||||
static const char kXLinkNameSpaceURI[] = "http://www.w3.org/1999/xlink";
|
||||
static const char kXSLTNameSpaceURI[] = "http://www.w3.org/1999/XSL/Transform";
|
||||
static const char kXBLNameSpaceURI[] = "http://www.mozilla.org/xbl";
|
||||
static const char kMathMLNameSpaceURI[] = "http://www.w3.org/1998/Math/MathML";
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space ID table support
|
||||
|
||||
static PRBool gNameSpaceManagerIsInitialized = PR_FALSE;
|
||||
static nsHashtable* gURIToIDTable;
|
||||
static nsVoidArray* gURIArray;
|
||||
static nsISupportsArray* gElementFactoryArray;
|
||||
static nsIElementFactory* gDefaultElementFactory;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
static PRBool gNameSpaceManagerWasShutDown = PR_FALSE;
|
||||
#endif
|
||||
|
||||
static void InitializeNameSpaceManager()
|
||||
{
|
||||
if (gNameSpaceManagerIsInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!gURIToIDTable, "already have URI table");
|
||||
NS_ASSERTION(!gURIArray, "already have URI array");
|
||||
|
||||
gURIToIDTable = new nsHashtable();
|
||||
gURIArray = new nsVoidArray();
|
||||
|
||||
nsString* xmlns = new nsString(NS_ConvertASCIItoUCS2(kXMLNSNameSpaceURI));
|
||||
nsString* xml = new nsString(NS_ConvertASCIItoUCS2(kXMLNameSpaceURI));
|
||||
nsString* xhtml = new nsString(NS_ConvertASCIItoUCS2(kXHTMLNameSpaceURI));
|
||||
nsString* xlink = new nsString(NS_ConvertASCIItoUCS2(kXLinkNameSpaceURI));
|
||||
nsString* xslt = new nsString(NS_ConvertASCIItoUCS2(kXSLTNameSpaceURI));
|
||||
nsString* xbl = new nsString(NS_ConvertASCIItoUCS2(kXBLNameSpaceURI));
|
||||
nsString* mathml = new nsString(NS_ConvertASCIItoUCS2(kMathMLNameSpaceURI));
|
||||
|
||||
gURIArray->AppendElement(xmlns); // ordering here needs to match IDs
|
||||
gURIArray->AppendElement(xml);
|
||||
gURIArray->AppendElement(xhtml);
|
||||
gURIArray->AppendElement(xlink);
|
||||
gURIArray->AppendElement(xslt);
|
||||
gURIArray->AppendElement(xbl);
|
||||
gURIArray->AppendElement(mathml);
|
||||
|
||||
nsStringKey xmlnsKey(*xmlns);
|
||||
nsStringKey xmlKey(*xml);
|
||||
nsStringKey xhtmlKey(*xhtml);
|
||||
nsStringKey xlinkKey(*xlink);
|
||||
nsStringKey xsltKey(*xslt);
|
||||
nsStringKey xblKey(*xbl);
|
||||
nsStringKey mathmlKey(*mathml);
|
||||
|
||||
gURIToIDTable->Put(&xmlnsKey, NS_INT32_TO_PTR(kNameSpaceID_XMLNS));
|
||||
gURIToIDTable->Put(&xmlKey, NS_INT32_TO_PTR(kNameSpaceID_XML));
|
||||
gURIToIDTable->Put(&xhtmlKey, NS_INT32_TO_PTR(kNameSpaceID_XHTML));
|
||||
gURIToIDTable->Put(&xlinkKey, NS_INT32_TO_PTR(kNameSpaceID_XLink));
|
||||
gURIToIDTable->Put(&xsltKey, NS_INT32_TO_PTR(kNameSpaceID_XSLT));
|
||||
gURIToIDTable->Put(&xblKey, NS_INT32_TO_PTR(kNameSpaceID_XBL));
|
||||
gURIToIDTable->Put(&mathmlKey, NS_INT32_TO_PTR(kNameSpaceID_MathML));
|
||||
|
||||
NS_NewISupportsArray(&gElementFactoryArray);
|
||||
NS_NewXMLElementFactory(&gDefaultElementFactory);
|
||||
|
||||
NS_ASSERTION(gURIToIDTable, "no URI table");
|
||||
NS_ASSERTION(gURIArray, "no URI array");
|
||||
NS_ASSERTION(gElementFactoryArray, "no element factory array");
|
||||
|
||||
gNameSpaceManagerIsInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
void NS_NameSpaceManagerShutdown()
|
||||
{
|
||||
delete gURIToIDTable;
|
||||
PRInt32 index = gURIArray->Count();
|
||||
while (0 < index--) {
|
||||
nsString* str = (nsString*)gURIArray->ElementAt(index);
|
||||
delete str;
|
||||
}
|
||||
delete gURIArray;
|
||||
gURIToIDTable = nsnull;
|
||||
gURIArray = nsnull;
|
||||
|
||||
NS_IF_RELEASE(gElementFactoryArray);
|
||||
NS_IF_RELEASE(gDefaultElementFactory);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
gNameSpaceManagerWasShutDown = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PRInt32 FindNameSpaceID(const nsAString& aURI)
|
||||
{
|
||||
if (aURI.IsEmpty()) {
|
||||
return kNameSpaceID_None; // xmlns="", see bug 75700 for details
|
||||
}
|
||||
|
||||
NS_ASSERTION(gURIToIDTable, "no URI table");
|
||||
const nsPromiseFlatString& flatString = PromiseFlatString(aURI);
|
||||
nsStringKey key(flatString);
|
||||
void* value = gURIToIDTable->Get(&key);
|
||||
if (value) {
|
||||
return NS_PTR_TO_INT32(value);
|
||||
}
|
||||
|
||||
return kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
static const nsString* FindNameSpaceURI(PRInt32 aID)
|
||||
{
|
||||
NS_ASSERTION(gURIArray, "no URI array");
|
||||
return (const nsString*)gURIArray->SafeElementAt(aID - 1);
|
||||
}
|
||||
#define kXMLNSNameSpaceURI "http://www.w3.org/2000/xmlns/"
|
||||
#define kXMLNameSpaceURI "http://www.w3.org/XML/1998/namespace"
|
||||
#define kXHTMLNameSpaceURI "http://www.w3.org/1999/xhtml"
|
||||
#define kXLinkNameSpaceURI "http://www.w3.org/1999/xlink"
|
||||
#define kXSLTNameSpaceURI "http://www.w3.org/1999/XSL/Transform"
|
||||
#define kXBLNameSpaceURI "http://www.mozilla.org/xbl"
|
||||
#define kMathMLNameSpaceURI "http://www.w3.org/1998/Math/MathML"
|
||||
#define kRDFNameSpaceURI RDF_NAMESPACE_URI
|
||||
#define kXULNameSpaceURI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
#define kSVGNameSpaceURI "http://www.w3.org/2000/svg"
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space
|
||||
|
||||
class NameSpaceImpl : public nsINameSpace {
|
||||
public:
|
||||
NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
NameSpaceImpl(NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
const nsAString& aURI);
|
||||
NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
NameSpaceImpl(NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
PRInt32 aNameSpaceID);
|
||||
virtual ~NameSpaceImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const;
|
||||
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const;
|
||||
NS_IMETHOD GetNameSpaceURI(nsAString& aURI) const;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const;
|
||||
|
@ -208,75 +99,47 @@ private:
|
|||
NameSpaceImpl(const NameSpaceImpl& aCopy);
|
||||
NameSpaceImpl& operator=(const NameSpaceImpl& aCopy);
|
||||
|
||||
public:
|
||||
nsINameSpaceManager* mManager;
|
||||
NameSpaceImpl* mParent;
|
||||
nsIAtom* mPrefix;
|
||||
PRInt32 mID;
|
||||
nsCOMPtr<NameSpaceImpl> mParent;
|
||||
nsCOMPtr<nsIAtom> mPrefix;
|
||||
PRInt32 mID;
|
||||
};
|
||||
|
||||
NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
NameSpaceImpl::NameSpaceImpl(NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
const nsAString& aURI)
|
||||
: mManager(aManager),
|
||||
mParent(aParent),
|
||||
: mParent(aParent),
|
||||
mPrefix(aPrefix)
|
||||
{
|
||||
NS_ASSERTION(aManager, "null namespace manager");
|
||||
NS_INIT_ISUPPORTS();
|
||||
NS_ADDREF(mManager);
|
||||
NS_IF_ADDREF(mParent);
|
||||
NS_IF_ADDREF(mPrefix);
|
||||
mManager->RegisterNameSpace(aURI, mID);
|
||||
gNameSpaceManager->RegisterNameSpace(aURI, mID);
|
||||
}
|
||||
|
||||
NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
NameSpaceImpl::NameSpaceImpl(NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
PRInt32 aNameSpaceID)
|
||||
: mManager(aManager),
|
||||
mParent(aParent),
|
||||
: mParent(aParent),
|
||||
mPrefix(aPrefix),
|
||||
mID(aNameSpaceID)
|
||||
{
|
||||
NS_ASSERTION(aManager, "null namespace manager");
|
||||
NS_INIT_ISUPPORTS();
|
||||
NS_ADDREF(mManager);
|
||||
NS_IF_ADDREF(mParent);
|
||||
NS_IF_ADDREF(mPrefix);
|
||||
}
|
||||
|
||||
NameSpaceImpl::~NameSpaceImpl()
|
||||
{
|
||||
NS_RELEASE(mManager);
|
||||
NS_IF_RELEASE(mParent);
|
||||
NS_IF_RELEASE(mPrefix);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(NameSpaceImpl, nsINameSpace)
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceManager(nsINameSpaceManager*& aManager) const
|
||||
{
|
||||
NS_ASSERTION(aManager, "null namespace manager");
|
||||
aManager = mManager;
|
||||
NS_ADDREF(aManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceID(PRInt32& aID) const
|
||||
{
|
||||
aID = mID;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceURI(nsAString& aURI) const
|
||||
{
|
||||
NS_ASSERTION(mManager, "null namespace manager");
|
||||
return mManager->GetNameSpaceURI(mID, aURI);
|
||||
return gNameSpaceManager->GetNameSpaceURI(mID, aURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -284,6 +147,7 @@ NameSpaceImpl::GetNameSpacePrefix(nsIAtom*& aPrefix) const
|
|||
{
|
||||
aPrefix = mPrefix;
|
||||
NS_IF_ADDREF(aPrefix);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -292,34 +156,39 @@ NameSpaceImpl::GetParentNameSpace(nsINameSpace*& aParent) const
|
|||
{
|
||||
aParent = mParent;
|
||||
NS_IF_ADDREF(aParent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpace(nsIAtom* aPrefix, nsINameSpace*& aNameSpace) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
|
||||
do {
|
||||
if (aPrefix == nameSpace->mPrefix) {
|
||||
aNameSpace = (nsINameSpace*)nameSpace;
|
||||
NS_ADDREF(aNameSpace);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
} while (nameSpace);
|
||||
|
||||
aNameSpace = nsnull;
|
||||
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
|
||||
do {
|
||||
if (aPrefix == nameSpace->mPrefix) {
|
||||
aNameSpaceID = nameSpace->mID;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
|
@ -331,57 +200,107 @@ NameSpaceImpl::FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const
|
|||
else {
|
||||
aNameSpaceID = kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
|
||||
do {
|
||||
if (aNameSpaceID == nameSpace->mID) {
|
||||
aPrefix = nameSpace->mPrefix;
|
||||
NS_IF_ADDREF(aPrefix);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
} while (nameSpace);
|
||||
|
||||
aPrefix = nsnull;
|
||||
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsAString& aURI,
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
{
|
||||
NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aURI);
|
||||
NameSpaceImpl* child = new NameSpaceImpl(this, aPrefix, aURI);
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (child) {
|
||||
return child->QueryInterface(NS_GET_IID(nsINameSpace), (void**)&aChildNameSpace);
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
aChildNameSpace = NS_STATIC_CAST(nsINameSpace*, child);
|
||||
NS_ADDREF(aChildNameSpace);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
{
|
||||
if (FindNameSpaceURI(aNameSpaceID)) {
|
||||
NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aNameSpaceID);
|
||||
PRBool hasNSURI;
|
||||
gNameSpaceManager->HasNameSpaceURI(aNameSpaceID, &hasNSURI);
|
||||
if (hasNSURI) {
|
||||
NameSpaceImpl* child = new NameSpaceImpl(this, aPrefix, aNameSpaceID);
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (child) {
|
||||
return child->QueryInterface(NS_GET_IID(nsINameSpace), (void**)&aChildNameSpace);
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
aChildNameSpace = NS_STATIC_CAST(nsINameSpace*, child);
|
||||
NS_ADDREF(aChildNameSpace);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
class nsNameSpaceEntry : public PLDHashEntryHdr
|
||||
{
|
||||
public:
|
||||
nsNameSpaceEntry(const void* aKey) :
|
||||
mKey(NS_STATIC_CAST(const nsAString*, aKey))
|
||||
{
|
||||
}
|
||||
~nsNameSpaceEntry()
|
||||
{
|
||||
}
|
||||
const void* GetKey() const {
|
||||
return mKey;
|
||||
}
|
||||
static PLDHashNumber HashKey(const void* aKey) {
|
||||
return HashString(*NS_STATIC_CAST(const nsAString*, aKey));
|
||||
}
|
||||
PRBool MatchEntry(const void* aKey) const {
|
||||
return NS_STATIC_CAST(const nsAString*, aKey)->Equals(*mKey);
|
||||
}
|
||||
|
||||
const nsAString* mKey;
|
||||
PRInt32 mNameSpaceID;
|
||||
};
|
||||
|
||||
DECL_DHASH_WRAPPER(nsNameSpaceHashBase, nsNameSpaceEntry, nsAString&)
|
||||
DHASH_WRAPPER(nsNameSpaceHashBase, nsNameSpaceEntry, nsAString&)
|
||||
|
||||
class nsNameSpaceHash : public nsNameSpaceHashBase
|
||||
{
|
||||
public:
|
||||
nsNameSpaceHash()
|
||||
{
|
||||
}
|
||||
~nsNameSpaceHash()
|
||||
{
|
||||
}
|
||||
nsNameSpaceEntry* LookupEntry(const nsAString& aUri)
|
||||
{
|
||||
return NS_STATIC_CAST(nsNameSpaceEntry*,
|
||||
PL_DHashTableOperate(&mHashTable, &aUri,
|
||||
PL_DHASH_LOOKUP));
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space Manager
|
||||
|
||||
|
@ -391,6 +310,8 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsresult Init();
|
||||
|
||||
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace);
|
||||
|
||||
NS_IMETHOD RegisterNameSpace(const nsAString& aURI,
|
||||
|
@ -403,24 +324,26 @@ public:
|
|||
nsIElementFactory **aElementFactory);
|
||||
NS_IMETHOD HasRegisteredFactory(PRInt32 aNameSpaceID,
|
||||
PRBool* aHasFactory);
|
||||
NS_IMETHOD HasNameSpaceURI(PRInt32 aNameSpaceID,
|
||||
PRBool* aHasNameSpaceURI);
|
||||
|
||||
private:
|
||||
// These are not supported and are not implemented!
|
||||
NameSpaceManagerImpl(const NameSpaceManagerImpl& aCopy);
|
||||
NameSpaceManagerImpl& operator=(const NameSpaceManagerImpl& aCopy);
|
||||
|
||||
protected:
|
||||
virtual ~NameSpaceManagerImpl();
|
||||
nsresult AddNameSpace(const nsAString& aURI, const PRInt32 aNameSpaceID);
|
||||
|
||||
nsNameSpaceHash mURIToIDTable;
|
||||
nsStringArray mURIArray;
|
||||
nsCOMArray<nsIElementFactory> mElementFactoryArray;
|
||||
nsCOMPtr<nsIElementFactory> mDefaultElementFactory;
|
||||
|
||||
virtual ~NameSpaceManagerImpl();
|
||||
};
|
||||
|
||||
NameSpaceManagerImpl::NameSpaceManagerImpl()
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
InitializeNameSpaceManager();
|
||||
}
|
||||
|
||||
NameSpaceManagerImpl::~NameSpaceManagerImpl()
|
||||
|
@ -429,20 +352,37 @@ NameSpaceManagerImpl::~NameSpaceManagerImpl()
|
|||
|
||||
NS_IMPL_ISUPPORTS1(NameSpaceManagerImpl, nsINameSpaceManager)
|
||||
|
||||
nsresult NameSpaceManagerImpl::Init()
|
||||
{
|
||||
nsresult rv = mURIToIDTable.Init(32);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Need to be ordered according to ID.
|
||||
AddNameSpace(NS_LITERAL_STRING(kXMLNSNameSpaceURI), kNameSpaceID_XMLNS);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXMLNameSpaceURI), kNameSpaceID_XML);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXHTMLNameSpaceURI), kNameSpaceID_XHTML);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXLinkNameSpaceURI), kNameSpaceID_XLink);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXSLTNameSpaceURI), kNameSpaceID_XSLT);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXBLNameSpaceURI), kNameSpaceID_XBL);
|
||||
AddNameSpace(NS_LITERAL_STRING(kMathMLNameSpaceURI), kNameSpaceID_MathML);
|
||||
AddNameSpace(NS_LITERAL_STRING(kRDFNameSpaceURI), kNameSpaceID_RDF);
|
||||
AddNameSpace(NS_LITERAL_STRING(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
AddNameSpace(NS_LITERAL_STRING(kSVGNameSpaceURI), kNameSpaceID_SVG);
|
||||
|
||||
return NS_NewXMLElementFactory(getter_AddRefs(mDefaultElementFactory));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace)
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
|
||||
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
aRootNameSpace = nsnull;
|
||||
|
||||
NameSpaceImpl* xmlns = new NameSpaceImpl(this, nsnull,
|
||||
NameSpaceImpl* xmlns = new NameSpaceImpl(nsnull,
|
||||
nsLayoutAtoms::xmlnsNameSpace,
|
||||
kNameSpaceID_XMLNS);
|
||||
if (nsnull != xmlns) {
|
||||
NameSpaceImpl* xml = new NameSpaceImpl(this, xmlns,
|
||||
if (xmlns) {
|
||||
NameSpaceImpl* xml = new NameSpaceImpl(xmlns,
|
||||
nsLayoutAtoms::xmlNameSpace,
|
||||
kNameSpaceID_XML);
|
||||
if (xml) {
|
||||
|
@ -452,6 +392,7 @@ NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace)
|
|||
delete xmlns;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -459,47 +400,57 @@ NS_IMETHODIMP
|
|||
NameSpaceManagerImpl::RegisterNameSpace(const nsAString& aURI,
|
||||
PRInt32& aNameSpaceID)
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
if (aURI.IsEmpty()) {
|
||||
aNameSpaceID = kNameSpaceID_None; // xmlns="", see bug 75700 for details
|
||||
|
||||
PRInt32 id = FindNameSpaceID(aURI);
|
||||
|
||||
if (kNameSpaceID_Unknown == id) {
|
||||
nsString* uri = new nsString(aURI);
|
||||
if (!uri)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
gURIArray->AppendElement(uri);
|
||||
id = gURIArray->Count(); // id is index + 1
|
||||
nsStringKey key(*uri);
|
||||
gURIToIDTable->Put(&key, (void*)id);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aNameSpaceID = id;
|
||||
return NS_OK;
|
||||
|
||||
nsNameSpaceEntry* entry = mURIToIDTable.GetEntry(aURI);
|
||||
if (entry) {
|
||||
aNameSpaceID = entry->mNameSpaceID;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aNameSpaceID = mURIArray.Count() + 1; // id is index + 1
|
||||
|
||||
nsresult rv = AddNameSpace(aURI, aNameSpaceID);
|
||||
if (NS_FAILED(rv)) {
|
||||
aNameSpaceID = kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsAString& aURI)
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
PRInt32 index = aNameSpaceID - 1; // id is index + 1
|
||||
if (index < 0 || index >= mURIArray.Count()) {
|
||||
aURI.Truncate();
|
||||
|
||||
const nsString* result = FindNameSpaceURI(aNameSpaceID);
|
||||
if (result) {
|
||||
aURI = *result;
|
||||
return NS_OK;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aURI.Truncate();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
mURIArray.StringAt(index, aURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI, PRInt32& aNameSpaceID)
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
if (aURI.IsEmpty()) {
|
||||
aNameSpaceID = kNameSpaceID_None; // xmlns="", see bug 75700 for details
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsNameSpaceEntry* entry = mURIToIDTable.GetEntry(aURI);
|
||||
|
||||
aNameSpaceID = entry ? entry->mNameSpaceID : kNameSpaceID_Unknown;
|
||||
|
||||
aNameSpaceID = FindNameSpaceID(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -507,24 +458,20 @@ NS_IMETHODIMP
|
|||
NameSpaceManagerImpl::GetElementFactory(PRInt32 aNameSpaceID,
|
||||
nsIElementFactory **aElementFactory)
|
||||
{
|
||||
NS_ASSERTION(!gNameSpaceManagerWasShutDown,
|
||||
"Namespace manager used past content module shutdown!!!");
|
||||
|
||||
*aElementFactory = nsnull;
|
||||
|
||||
NS_ENSURE_TRUE(gElementFactoryArray, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_TRUE(aNameSpaceID >= 0, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
gElementFactoryArray->QueryElementAt(aNameSpaceID,
|
||||
NS_GET_IID(nsIElementFactory),
|
||||
(void **)aElementFactory);
|
||||
if (aNameSpaceID < mElementFactoryArray.Count()) {
|
||||
*aElementFactory = mElementFactoryArray.ObjectAt(aNameSpaceID);
|
||||
if (*aElementFactory) {
|
||||
NS_ADDREF(*aElementFactory);
|
||||
|
||||
if (*aElementFactory) {
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString uri;
|
||||
|
||||
GetNameSpaceURI(aNameSpaceID, uri);
|
||||
|
||||
nsCOMPtr<nsIElementFactory> ef;
|
||||
|
@ -532,29 +479,27 @@ NameSpaceManagerImpl::GetElementFactory(PRInt32 aNameSpaceID,
|
|||
if (!uri.IsEmpty()) {
|
||||
nsCAutoString contract_id(NS_ELEMENT_FACTORY_CONTRACTID_PREFIX);
|
||||
contract_id.Append(NS_ConvertUCS2toUTF8(uri));
|
||||
|
||||
ef = do_GetService(contract_id.get());
|
||||
}
|
||||
|
||||
if (!ef) {
|
||||
ef = gDefaultElementFactory;
|
||||
ef = mDefaultElementFactory;
|
||||
}
|
||||
|
||||
PRUint32 count = 0;
|
||||
gElementFactoryArray->Count(&count);
|
||||
PRInt32 count = mElementFactoryArray.Count();
|
||||
|
||||
if ((PRUint32)aNameSpaceID < count) {
|
||||
gElementFactoryArray->ReplaceElementAt(ef, aNameSpaceID);
|
||||
if (aNameSpaceID < count) {
|
||||
mElementFactoryArray.ReplaceObjectAt(ef, aNameSpaceID);
|
||||
} else {
|
||||
// This sucks, simply doing an InsertElementAt() should IMNSHO
|
||||
// This sucks, simply doing an InsertObjectAt() should IMNSHO
|
||||
// automatically grow the array and insert null's as needed to
|
||||
// fill up the array!?!!
|
||||
|
||||
for (PRInt32 i = count; i < aNameSpaceID; i++) {
|
||||
gElementFactoryArray->AppendElement(nsnull);
|
||||
|
||||
for (PRInt32 i = count; i < aNameSpaceID; ++i) {
|
||||
mElementFactoryArray.AppendObject(nsnull);
|
||||
}
|
||||
|
||||
gElementFactoryArray->AppendElement(ef);
|
||||
mElementFactoryArray.AppendObject(ef);
|
||||
}
|
||||
|
||||
*aElementFactory = ef;
|
||||
|
@ -568,25 +513,74 @@ NameSpaceManagerImpl::HasRegisteredFactory(PRInt32 aNameSpaceID,
|
|||
PRBool* aHasFactory)
|
||||
{
|
||||
*aHasFactory = PR_FALSE;
|
||||
NS_ENSURE_TRUE(mDefaultElementFactory, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIElementFactory> ef;
|
||||
GetElementFactory(aNameSpaceID, getter_AddRefs(ef));
|
||||
NS_ENSURE_TRUE(gDefaultElementFactory, NS_ERROR_FAILURE);
|
||||
*aHasFactory = ef != gDefaultElementFactory;
|
||||
*aHasFactory = ef != mDefaultElementFactory;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::HasNameSpaceURI(PRInt32 aNameSpaceID,
|
||||
PRBool* aHasNameSpaceURI)
|
||||
{
|
||||
*aHasNameSpaceURI = (aNameSpaceID > kNameSpaceID_None ||
|
||||
aNameSpaceID <= mURIArray.Count());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NameSpaceManagerImpl::AddNameSpace(const nsAString& aURI,
|
||||
const PRInt32 aNameSpaceID)
|
||||
{
|
||||
NS_ASSERTION(aNameSpaceID - 1 == mURIArray.Count(),
|
||||
"BAD! AddNameSpace not called in right order!");
|
||||
|
||||
if (!mURIArray.AppendString(aURI)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
const nsString* uri = mURIArray.StringAt(aNameSpaceID - 1);
|
||||
nsNameSpaceEntry* entry = mURIToIDTable.AddEntry(*uri);
|
||||
if (!entry) {
|
||||
mURIArray.RemoveStringAt(aNameSpaceID - 1);
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
entry->mNameSpaceID = aNameSpaceID;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewNameSpaceManager(nsINameSpaceManager** aInstancePtrResult)
|
||||
NS_GetNameSpaceManager(nsINameSpaceManager** aInstancePtrResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
*aInstancePtrResult = new NameSpaceManagerImpl();
|
||||
|
||||
if (!*aInstancePtrResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!gNameSpaceManager) {
|
||||
nsCOMPtr<NameSpaceManagerImpl> manager = new NameSpaceManagerImpl();
|
||||
if (manager) {
|
||||
nsresult rv = manager->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
gNameSpaceManager = manager;
|
||||
NS_ADDREF(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aInstancePtrResult = gNameSpaceManager;
|
||||
NS_ENSURE_TRUE(gNameSpaceManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
NS_NameSpaceManagerShutdown()
|
||||
{
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
|
|
|
@ -42,10 +42,9 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "domstubs.h" // for SetDOMStringToNull();
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
nsNodeInfo::nsNodeInfo()
|
||||
: nsINodeInfo(), mOwnerManager(nsnull)
|
||||
|
@ -140,12 +139,8 @@ nsNodeInfo::GetNamespaceURI(nsAString& aNameSpaceURI) const
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
if (mInner.mNamespaceID > 0) {
|
||||
nsCOMPtr<nsINameSpaceManager> nsm;
|
||||
|
||||
mOwnerManager->GetNamespaceManager(*getter_AddRefs(nsm));
|
||||
NS_ENSURE_TRUE(nsm, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
rv = nsm->GetNameSpaceURI(mInner.mNamespaceID, aNameSpaceURI);
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceURI(mInner.mNamespaceID,
|
||||
aNameSpaceURI);
|
||||
} else {
|
||||
SetDOMStringToNull(aNameSpaceURI);
|
||||
}
|
||||
|
@ -245,13 +240,8 @@ nsNodeInfo::Equals(const nsAString& aName, const nsAString& aPrefix,
|
|||
NS_IMETHODIMP_(PRBool)
|
||||
nsNodeInfo::NamespaceEquals(const nsAString& aNamespaceURI) const
|
||||
{
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
|
||||
NS_ENSURE_SUCCESS(mOwnerManager->GetNamespaceManager(*getter_AddRefs(nsmgr)),
|
||||
NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
PRInt32 nsid;
|
||||
nsmgr->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
|
||||
return nsINodeInfo::NamespaceEquals(nsid);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#define nsNodeInfo_h___
|
||||
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "plhash.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull;
|
||||
PRUint32 nsNodeInfoManager::gNodeManagerCount = 0;
|
||||
|
@ -148,14 +149,11 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsNodeInfoManager, nsINodeInfoManager);
|
|||
// nsINodeInfoManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeInfoManager::Init(nsIDocument *aDocument,
|
||||
nsINameSpaceManager *aNameSpaceManager)
|
||||
nsNodeInfoManager::Init(nsIDocument *aDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNameSpaceManager);
|
||||
NS_ENSURE_TRUE(mNodeInfoHash, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mDocument = aDocument;
|
||||
mNameSpaceManager = aNameSpaceManager;
|
||||
if (aDocument) {
|
||||
mPrincipal = nsnull;
|
||||
}
|
||||
|
@ -274,12 +272,8 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aName,
|
|||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (!mNameSpaceManager) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
PRInt32 nsid;
|
||||
nsresult rv = mNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsid);
|
||||
nsresult rv = nsContentUtils::GetNSManagerWeakRef()->RegisterNameSpace(aNamespaceURI, nsid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return GetNodeInfo(name, prefix, nsid, aNodeInfo);
|
||||
|
@ -314,27 +308,13 @@ nsNodeInfoManager::GetNodeInfo(const nsAString& aQualifiedName,
|
|||
PRInt32 nsid = kNameSpaceID_None;
|
||||
|
||||
if (!aNamespaceURI.IsEmpty()) {
|
||||
NS_ENSURE_TRUE(mNameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = mNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsid);
|
||||
nsresult rv = nsContentUtils::GetNSManagerWeakRef()->RegisterNameSpace(aNamespaceURI, nsid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return GetNodeInfo(nameAtom, prefixAtom, nsid, aNodeInfo);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeInfoManager::GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager)
|
||||
{
|
||||
NS_ENSURE_TRUE(mNameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
aNameSpaceManager = mNameSpaceManager;
|
||||
NS_ADDREF(aNameSpaceManager);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeInfoManager::GetDocument(nsIDocument*& aDocument)
|
||||
{
|
||||
|
@ -437,14 +417,6 @@ nsNodeInfoManager::GetAnonymousManager(nsINodeInfoManager*& aNodeInfoManager)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(gAnonymousNodeInfoManager);
|
||||
|
||||
nsresult rv = NS_NewNameSpaceManager(getter_AddRefs(gAnonymousNodeInfoManager->mNameSpaceManager));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(gAnonymousNodeInfoManager);
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
aNodeInfoManager = gAnonymousNodeInfoManager;
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#define nsNodeInfoManager_h___
|
||||
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "plhash.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -55,8 +54,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINodeInfoManager
|
||||
NS_IMETHOD Init(nsIDocument *aDocument,
|
||||
nsINameSpaceManager *aNameSpaceManager);
|
||||
NS_IMETHOD Init(nsIDocument *aDocument);
|
||||
NS_IMETHOD DropDocumentReference();
|
||||
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
|
||||
|
@ -70,7 +68,6 @@ public:
|
|||
NS_IMETHOD GetNodeInfo(const nsAString& aQualifiedName,
|
||||
const nsAString& aNamespaceURI,
|
||||
nsINodeInfo*& aNodeInfo);
|
||||
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager);
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aDocument);
|
||||
NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aPrincipal);
|
||||
NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
@ -94,7 +91,6 @@ private:
|
|||
void* arg);
|
||||
|
||||
PLHashTable *mNodeInfoHash;
|
||||
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager;
|
||||
nsIDocument *mDocument; // WEAK
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ static const char* kPrintingPromptService = "@mozilla.org/embedcomp/printingprom
|
|||
#include "nsIDocument.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
// Focus
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
typedef struct {
|
||||
nsString mPrefix;
|
||||
|
@ -477,13 +478,6 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||
// Now serialize each of the attributes
|
||||
// XXX Unfortunately we need a namespace manager to get
|
||||
// attribute URIs.
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsINameSpaceManager> nsmanager;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
if (document) {
|
||||
document->GetNameSpaceManager(*getter_AddRefs(nsmanager));
|
||||
}
|
||||
|
||||
for (index = 0; index < count; index++) {
|
||||
content->GetAttrNameAt(index,
|
||||
namespaceID,
|
||||
|
@ -498,8 +492,9 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||
}
|
||||
|
||||
addNSAttr = PR_FALSE;
|
||||
if (kNameSpaceID_XMLNS != namespaceID && nsmanager) {
|
||||
nsmanager->GetNameSpaceURI(namespaceID, uriStr);
|
||||
if (kNameSpaceID_XMLNS != namespaceID) {
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceURI(namespaceID,
|
||||
uriStr);
|
||||
addNSAttr = ConfirmPrefix(prefixStr, uriStr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Force references to all of the symbols that we want exported from
|
||||
// the dll that are located in the .lib files we link with
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
void XXXNeverCalled()
|
||||
{
|
||||
nsIDocument* doc;
|
||||
NS_NewHTMLDocument(&doc);
|
||||
NS_NewImageDocument(&doc);
|
||||
nsINameSpaceManager* nsm;
|
||||
NS_NewNameSpaceManager(&nsm);
|
||||
}
|
|
@ -181,15 +181,14 @@ static PRBool gInitialized = PR_FALSE;
|
|||
PR_STATIC_CALLBACK(nsresult)
|
||||
Initialize(nsIModule* aSelf)
|
||||
{
|
||||
// XXXwaterson turns out we initialize the module twice, because
|
||||
// nsXULAtoms::AddRefAtoms() creates a namespace manager using the
|
||||
// component manager. We should probably fix that.
|
||||
//NS_PRECONDITION(! gInitialized, "module already initialized");
|
||||
NS_PRECONDITION(!gInitialized, "module already initialized");
|
||||
if (gInitialized)
|
||||
return NS_OK;
|
||||
|
||||
gInitialized = PR_TRUE;
|
||||
|
||||
nsContentUtils::Init();
|
||||
|
||||
// Register all of our atoms once
|
||||
nsCSSAnonBoxes::AddRefAtoms();
|
||||
nsCSSPseudoClasses::AddRefAtoms();
|
||||
|
@ -210,8 +209,6 @@ Initialize(nsIModule* aSelf)
|
|||
nsSVGAtoms::AddRefAtoms();
|
||||
#endif
|
||||
|
||||
nsContentUtils::Init();
|
||||
|
||||
// Add our shutdown observer.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
|
@ -269,8 +266,9 @@ Shutdown(nsIModule* aSelf)
|
|||
|
||||
NS_IF_RELEASE(nsContentDLF::gUAStyleSheet);
|
||||
NS_IF_RELEASE(nsRuleNode::gLangService);
|
||||
nsContentUtils::Shutdown();
|
||||
nsGenericHTMLElement::Shutdown();
|
||||
|
||||
nsContentUtils::Shutdown();
|
||||
NS_NameSpaceManagerShutdown();
|
||||
}
|
||||
|
||||
|
@ -326,7 +324,7 @@ ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
|
|||
return rv; \
|
||||
}
|
||||
|
||||
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_NewNameSpaceManager)
|
||||
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
|
||||
MAKE_CTOR(CreateEventListenerManager, nsIEventListenerManager, NS_NewEventListenerManager)
|
||||
MAKE_CTOR(CreateEventStateManager, nsIEventStateManager, NS_NewEventStateManager)
|
||||
MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOMEventGroup)
|
||||
|
@ -504,7 +502,7 @@ UnregisterHTMLOptionElement(nsIComponentManager* aCompMgr,
|
|||
static const nsModuleComponentInfo gComponents[] = {
|
||||
{ "Namespace manager",
|
||||
NS_NAMESPACEMANAGER_CID,
|
||||
nsnull,
|
||||
NS_NAMESPACEMANAGER_CONTRACTID,
|
||||
CreateNameSpaceManager },
|
||||
|
||||
{ "Event listener manager",
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsImageMapUtils.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsINameSpaceManager.h" // for kNameSpaceID_XHTML
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIScrollableView.h"
|
||||
|
|
|
@ -1580,8 +1580,8 @@ nsHTMLDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
|||
nodeInfo->GetNamespaceID(namespaceID);
|
||||
|
||||
nsCOMPtr<nsIElementFactory> elementFactory;
|
||||
mNameSpaceManager->GetElementFactory(namespaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetElementFactory(namespaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
|
||||
|
|
|
@ -295,11 +295,7 @@ 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(nsnull, nsmgr);
|
||||
return mNodeInfoManager->Init(nsnull);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1615,27 +1615,18 @@ CreateNameSpace(nsISupports* aRule, void* aNameSpacePtr)
|
|||
void
|
||||
CSSStyleSheetInner::RebuildNameSpaces(void)
|
||||
{
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceMgr;
|
||||
if (mNameSpace) {
|
||||
mNameSpace->GetNameSpaceManager(*getter_AddRefs(nameSpaceMgr));
|
||||
}
|
||||
else {
|
||||
NS_NewNameSpaceManager(getter_AddRefs(nameSpaceMgr));
|
||||
}
|
||||
if (nameSpaceMgr) {
|
||||
nameSpaceMgr->CreateRootNameSpace(*getter_AddRefs(mNameSpace));
|
||||
if (kNameSpaceID_Unknown != mDefaultNameSpaceID) {
|
||||
nsCOMPtr<nsINameSpace> defaultNameSpace;
|
||||
mNameSpace->CreateChildNameSpace(nsnull, mDefaultNameSpaceID,
|
||||
*getter_AddRefs(defaultNameSpace));
|
||||
if (defaultNameSpace) {
|
||||
mNameSpace = defaultNameSpace;
|
||||
}
|
||||
}
|
||||
if (mOrderedRules) {
|
||||
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
||||
nsContentUtils::GetNSManagerWeakRef()->CreateRootNameSpace(*getter_AddRefs(mNameSpace));
|
||||
if (kNameSpaceID_Unknown != mDefaultNameSpaceID) {
|
||||
nsCOMPtr<nsINameSpace> defaultNameSpace;
|
||||
mNameSpace->CreateChildNameSpace(nsnull, mDefaultNameSpaceID,
|
||||
*getter_AddRefs(defaultNameSpace));
|
||||
if (defaultNameSpace) {
|
||||
mNameSpace = defaultNameSpace;
|
||||
}
|
||||
}
|
||||
if (mOrderedRules) {
|
||||
mOrderedRules->EnumerateForwards(CreateNameSpace, address_of(mNameSpace));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -2236,11 +2227,7 @@ CSSStyleSheetImpl::AppendStyleRule(nsICSSRule* aRule)
|
|||
aRule->GetType(type);
|
||||
if (nsICSSRule::NAMESPACE_RULE == type) {
|
||||
if (! mInner->mNameSpace) {
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceMgr;
|
||||
NS_NewNameSpaceManager(getter_AddRefs(nameSpaceMgr));
|
||||
if (nameSpaceMgr) {
|
||||
nameSpaceMgr->CreateRootNameSpace(*getter_AddRefs(mInner->mNameSpace));
|
||||
}
|
||||
nsContentUtils::GetNSManagerWeakRef()->CreateRootNameSpace(*getter_AddRefs(mInner->mNameSpace));
|
||||
}
|
||||
|
||||
if (mInner->mNameSpace) {
|
||||
|
@ -2935,11 +2922,7 @@ CSSStyleSheetImpl::InsertRule(const nsAString& aRule,
|
|||
cssRule->GetType(type);
|
||||
if (type == nsICSSRule::NAMESPACE_RULE) {
|
||||
if (! mInner->mNameSpace) {
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceMgr;
|
||||
result = NS_NewNameSpaceManager(getter_AddRefs(nameSpaceMgr));
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
nameSpaceMgr->CreateRootNameSpace(*getter_AddRefs(mInner->mNameSpace));
|
||||
nsContentUtils::GetNSManagerWeakRef()->CreateRootNameSpace(*getter_AddRefs(mInner->mNameSpace));
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mInner->mNameSpace, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of SVG atoms used during normal SVG handling. This object
|
||||
|
@ -41,9 +39,6 @@ public:
|
|||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// SVG namespace ID, good for the life of the nsSVGAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
|
|
|
@ -39,11 +39,8 @@
|
|||
#ifndef nsXBLAtoms_h___
|
||||
#define nsXBLAtoms_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of XBL atoms used during normal XBL handling. This object
|
||||
|
@ -56,9 +53,6 @@ public:
|
|||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// XBL namespace ID, good for the life of the nsXBLAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
|
|
|
@ -39,11 +39,8 @@
|
|||
#ifndef nsXULAtoms_h___
|
||||
#define nsXULAtoms_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of xul atoms used during normal xul handling. This object
|
||||
|
@ -56,9 +53,6 @@ public:
|
|||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// XUL namespace ID, good for the life of the nsXULAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
|
|
|
@ -22,45 +22,18 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsSVGAtoms.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
||||
static const char kSVGNameSpace[] = "http://www.w3.org/2000/svg";
|
||||
|
||||
PRInt32 nsSVGAtoms::nameSpaceID;
|
||||
|
||||
// define storage for all atoms
|
||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
void nsSVGAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
/* SVG Atoms registers the SVG name space ID because it's a convenient
|
||||
place to do this, if you don't want a permanent, "well-known" ID.
|
||||
*/
|
||||
|
||||
NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr =
|
||||
do_CreateInstance(kNameSpaceManagerCID);
|
||||
|
||||
if (nsmgr) {
|
||||
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace),
|
||||
nameSpaceID);
|
||||
|
||||
gNameSpaceManager = nsmgr;
|
||||
NS_ADDREF(gNameSpaceManager);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create SVG atoms namespace manager");
|
||||
}
|
||||
|
||||
// now register the atoms
|
||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsSVGAtomList.h"
|
||||
|
@ -76,7 +49,5 @@ void nsSVGAtoms::ReleaseAtoms() {
|
|||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,14 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
|
||||
static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
PRInt32 nsXULAtoms::nameSpaceID;
|
||||
|
||||
// define storage for all atoms
|
||||
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
|
||||
|
@ -54,38 +47,24 @@ PRInt32 nsXULAtoms::nameSpaceID;
|
|||
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
void nsXULAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
/* XUL Atoms registers the XUL name space ID because it's a convenient
|
||||
place to do this, if you don't want a permanent, "well-known" ID.
|
||||
*/
|
||||
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kNameSpaceManagerCID,nsnull,NS_GET_IID(nsINameSpaceManager),(void**)&gNameSpaceManager))) {
|
||||
// gNameSpaceManager->CreateRootNameSpace(namespace);
|
||||
nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace);
|
||||
gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create xul atoms namespace manager");
|
||||
}
|
||||
|
||||
// now register the atoms
|
||||
void nsXULAtoms::AddRefAtoms()
|
||||
{
|
||||
if (++gRefCnt == 1) {
|
||||
// create atoms
|
||||
#define XUL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
|
||||
void nsXULAtoms::ReleaseAtoms() {
|
||||
|
||||
void nsXULAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define XUL_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,45 +22,18 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsSVGAtoms.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
||||
static const char kSVGNameSpace[] = "http://www.w3.org/2000/svg";
|
||||
|
||||
PRInt32 nsSVGAtoms::nameSpaceID;
|
||||
|
||||
// define storage for all atoms
|
||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
void nsSVGAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
/* SVG Atoms registers the SVG name space ID because it's a convenient
|
||||
place to do this, if you don't want a permanent, "well-known" ID.
|
||||
*/
|
||||
|
||||
NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr =
|
||||
do_CreateInstance(kNameSpaceManagerCID);
|
||||
|
||||
if (nsmgr) {
|
||||
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace),
|
||||
nameSpaceID);
|
||||
|
||||
gNameSpaceManager = nsmgr;
|
||||
NS_ADDREF(gNameSpaceManager);
|
||||
} else {
|
||||
NS_ASSERTION(0, "failed to create SVG atoms namespace manager");
|
||||
}
|
||||
|
||||
// now register the atoms
|
||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsSVGAtomList.h"
|
||||
|
@ -76,7 +49,5 @@ void nsSVGAtoms::ReleaseAtoms() {
|
|||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of SVG atoms used during normal SVG handling. This object
|
||||
|
@ -41,9 +39,6 @@ public:
|
|||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// SVG namespace ID, good for the life of the nsSVGAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsMutationEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIBindingManager.h"
|
||||
#include "nsIXBLBinding.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
|
|
@ -66,13 +66,15 @@ nsSVGDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset) {
|
||||
PRBool aReset,
|
||||
nsIContentSink* aSink) {
|
||||
nsresult rv = nsXMLDocument::StartDocumentLoad(aCommand,
|
||||
aChannel,
|
||||
aLoadGroup,
|
||||
aContainer,
|
||||
aDocListener,
|
||||
aReset);
|
||||
aReset,
|
||||
aSink);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
|
||||
|
|
|
@ -58,7 +58,8 @@ class nsSVGDocument : public nsXMLDocument,
|
|||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset = PR_TRUE);
|
||||
PRBool aReset = PR_TRUE,
|
||||
nsIContentSink* aSink = nsnull);
|
||||
|
||||
NS_DECL_NSIDOMSVGDOCUMENT
|
||||
NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::)
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
|
|
|
@ -39,11 +39,8 @@
|
|||
#ifndef nsXBLAtoms_h___
|
||||
#define nsXBLAtoms_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsINameSpaceManager;
|
||||
|
||||
/**
|
||||
* This class wraps up the creation and destruction of the standard
|
||||
* set of XBL atoms used during normal XBL handling. This object
|
||||
|
@ -56,9 +53,6 @@ public:
|
|||
static void AddRefAtoms();
|
||||
static void ReleaseAtoms();
|
||||
|
||||
// XBL namespace ID, good for the life of the nsXBLAtoms object
|
||||
static PRInt32 nameSpaceID;
|
||||
|
||||
/* Declare all atoms
|
||||
|
||||
The atom names and values are stored in nsCSSAtomList.h and
|
||||
|
|
|
@ -726,7 +726,7 @@ nsXBLContentSink::CreateElement(const PRUnichar** aAtts,
|
|||
nsINodeInfo* aNodeInfo,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
if (aNameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
if (aNameSpaceID == kNameSpaceID_XUL) {
|
||||
nsXULPrototypeElement* prototype = new nsXULPrototypeElement();
|
||||
if (!prototype)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -816,7 +816,7 @@ nsXBLContentSink::AddAttributesToXULPrototype(const PRUnichar **aAtts,
|
|||
|
||||
// XUL elements may require some additional work to compute
|
||||
// derived information.
|
||||
if (aElement->mNodeInfo->NamespaceEquals(nsXULAtoms::nameSpaceID)) {
|
||||
if (aElement->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {
|
||||
nsAutoString value;
|
||||
|
||||
// Compute the element's class list if the element has a 'class' attribute.
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLFocusHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLFormHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLLoadHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLMutationHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLScrollHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -93,7 +93,6 @@
|
|||
#include "nsIDOMLoadListener.h"
|
||||
|
||||
// Static IIDs/CIDs. Try to minimize these.
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
|
||||
static PRBool IsChromeOrResourceURI(nsIURI* aURI)
|
||||
|
@ -474,17 +473,12 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
|
|||
PRUint32 nsXBLService::gRefCnt = 0;
|
||||
nsIXULPrototypeCache* nsXBLService::gXULCache = nsnull;
|
||||
|
||||
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
||||
|
||||
nsHashtable* nsXBLService::gClassTable = nsnull;
|
||||
|
||||
JSCList nsXBLService::gClassLRUList = JS_INIT_STATIC_CLIST(&nsXBLService::gClassLRUList);
|
||||
PRUint32 nsXBLService::gClassLRUListLength = 0;
|
||||
PRUint32 nsXBLService::gClassLRUListQuota = 64;
|
||||
|
||||
nsIAtom* nsXBLService::kEventAtom = nsnull;
|
||||
nsIAtom* nsXBLService::kInputAtom = nsnull;
|
||||
|
||||
// Enabled by default. Must be over-ridden to disable
|
||||
PRBool nsXBLService::gDisableChromeCache = PR_FALSE;
|
||||
static const char kDisableChromeCachePref[] = "nglayout.debug.disable_xul_cache";
|
||||
|
@ -500,28 +494,18 @@ nsXBLService::nsXBLService(void)
|
|||
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
nsresult rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create namespace manager");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
// Create our atoms
|
||||
kEventAtom = NS_NewAtom("event");
|
||||
kInputAtom = NS_NewAtom("input");
|
||||
|
||||
// Find out if the XUL cache is on or off
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
prefs->GetBoolPref(kDisableChromeCachePref, &gDisableChromeCache);
|
||||
|
||||
gClassTable = new nsHashtable();
|
||||
|
||||
rv = nsServiceManager::GetService("@mozilla.org/xul/xul-prototype-cache;1",
|
||||
NS_GET_IID(nsIXULPrototypeCache),
|
||||
(nsISupports**) &gXULCache);
|
||||
if (NS_FAILED(rv)) return;
|
||||
rv = CallGetService("@mozilla.org/xul/xul-prototype-cache;1", &gXULCache);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,12 +513,6 @@ nsXBLService::~nsXBLService(void)
|
|||
{
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
// Release our atoms
|
||||
NS_RELEASE(kEventAtom);
|
||||
NS_RELEASE(kInputAtom);
|
||||
|
||||
// Walk the LRU list removing and deleting the nsXBLJSClasses.
|
||||
FlushMemory();
|
||||
|
||||
|
@ -548,10 +526,7 @@ nsXBLService::~nsXBLService(void)
|
|||
delete gClassTable;
|
||||
gClassTable = nsnull;
|
||||
|
||||
if (gXULCache) {
|
||||
nsServiceManager::ReleaseService("@mozilla.org/xul/xul-prototype-cache;1", gXULCache);
|
||||
gXULCache = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gXULCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -981,7 +956,8 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement,
|
|||
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
gNameSpaceManager->GetNameSpaceID(nameSpace, nameSpaceID);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(nameSpace,
|
||||
nameSpaceID);
|
||||
|
||||
nsCOMPtr<nsIAtom> tagName = getter_AddRefs(NS_NewAtom(display));
|
||||
protoBinding->SetBaseTag(nameSpaceID, tagName);
|
||||
|
@ -1057,7 +1033,7 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement, nsIDocument* aB
|
|||
if (!info && bindingManager &&
|
||||
(tagName != nsXULAtoms::scrollbar) &&
|
||||
(tagName != nsXULAtoms::thumb) &&
|
||||
(tagName != kInputAtom) &&
|
||||
(tagName != nsHTMLAtoms::input) &&
|
||||
(tagName != nsHTMLAtoms::select) && !aForceSyncLoad) {
|
||||
// The third line of defense is to investigate whether or not the
|
||||
// document is currently being loaded asynchronously. If so, there's no
|
||||
|
|
|
@ -52,7 +52,6 @@ class nsIXBLBinding;
|
|||
class nsIXBLDocumentInfo;
|
||||
class nsIXBLPrototypeHandler;
|
||||
class nsIXBLPrototypeBinding;
|
||||
class nsINameSpaceManager;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIAtom;
|
||||
|
@ -61,7 +60,6 @@ class nsIURI;
|
|||
class nsSupportsHashtable;
|
||||
class nsHashtable;
|
||||
class nsIXULPrototypeCache;
|
||||
class nsIXULContentUtils;
|
||||
|
||||
class nsXBLService : public nsIXBLService, public nsIObserver, public nsSupportsWeakReference
|
||||
{
|
||||
|
@ -119,11 +117,8 @@ public:
|
|||
|
||||
// MEMBER VARIABLES
|
||||
public:
|
||||
static nsIXULContentUtils* gXULUtils;
|
||||
static nsIXULPrototypeCache* gXULCache;
|
||||
|
||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||
|
||||
static PRUint32 gRefCnt; // A count of XBLservice instances.
|
||||
|
||||
static PRBool gDisableChromeCache;
|
||||
|
@ -134,10 +129,6 @@ public:
|
|||
static PRUint32 gClassLRUListLength; // Number of classes on LRU list.
|
||||
static PRUint32 gClassLRUListQuota; // Quota on class LRU list.
|
||||
|
||||
// XBL Atoms
|
||||
static nsIAtom* kEventAtom;
|
||||
static nsIAtom* kInputAtom;
|
||||
|
||||
nsFixedSizeAllocator mPool;
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsXBLService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIXBLDocumentInfo.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsXBLService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIXBLDocumentInfo.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLXULHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -118,12 +118,8 @@ static char kNameSpaceSeparator = ':';
|
|||
|
||||
static const char* kLoadAsData = "loadAsData";
|
||||
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
|
||||
nsINameSpaceManager* nsXMLContentSink::gNameSpaceManager = nsnull;
|
||||
PRUint32 nsXMLContentSink::gRefCnt = 0;
|
||||
|
||||
// XXX Open Issues:
|
||||
// 1) what's not allowed - We need to figure out which HTML tags
|
||||
// (prefixed with a HTML namespace qualifier) are explicitly not
|
||||
|
@ -160,17 +156,6 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
|
|||
nsXMLContentSink::nsXMLContentSink()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
nsServiceManager::GetService(kNameSpaceManagerCID,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(nsISupports**) &gNameSpaceManager);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get namespace manager");
|
||||
}
|
||||
|
||||
mDocument = nsnull;
|
||||
mDocumentURL = nsnull;
|
||||
|
@ -195,11 +180,6 @@ nsXMLContentSink::nsXMLContentSink()
|
|||
|
||||
nsXMLContentSink::~nsXMLContentSink()
|
||||
{
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mDocument);
|
||||
NS_IF_RELEASE(mDocumentURL);
|
||||
NS_IF_RELEASE(mDocumentBaseURL);
|
||||
|
@ -227,8 +207,6 @@ nsXMLContentSink::Init(nsIDocument* aDoc,
|
|||
nsIWebShell* aContainer,
|
||||
nsIChannel* aChannel)
|
||||
{
|
||||
NS_ENSURE_TRUE(gNameSpaceManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_PRECONDITION(nsnull != aDoc, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aURL, "null ptr");
|
||||
if ((nsnull == aDoc) || (nsnull == aURL)) {
|
||||
|
@ -607,8 +585,8 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount, PR
|
|||
// own content element implementation (e.g., XUL or MathML).
|
||||
// This is done based off a contractid/namespace scheme.
|
||||
nsCOMPtr<nsIElementFactory> elementFactory;
|
||||
gNameSpaceManager->GetElementFactory(aNameSpaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetElementFactory(aNameSpaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
if (elementFactory) {
|
||||
// Create the content element using the element factory.
|
||||
elementFactory->CreateInstanceByTag(aNodeInfo, aResult);
|
||||
|
@ -621,7 +599,8 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount, PR
|
|||
if (!mPrettyPrintHasFactoredElements && !mPrettyPrintHasSpecialRoot &&
|
||||
mPrettyPrintXML) {
|
||||
PRBool hasFactory = PR_FALSE;
|
||||
rv = gNameSpaceManager->HasRegisteredFactory(aNameSpaceID, &hasFactory);
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->HasRegisteredFactory(aNameSpaceID,
|
||||
&hasFactory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mPrettyPrintHasFactoredElements = hasFactory;
|
||||
}
|
||||
|
@ -2120,15 +2099,8 @@ nsXMLContentSink::PushNameSpacesFrom(const PRUnichar** aAtts)
|
|||
nameSpace =
|
||||
(nsINameSpace*)mNameSpaceStack->ElementAt(mNameSpaceStack->Count() - 1);
|
||||
} else {
|
||||
nsCOMPtr<nsINameSpaceManager> manager;
|
||||
mDocument->GetNameSpaceManager(*getter_AddRefs(manager));
|
||||
|
||||
NS_ASSERTION(manager, "no name space manager in document");
|
||||
|
||||
if (manager) {
|
||||
rv = manager->CreateRootNameSpace(*getter_AddRefs(nameSpace));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->CreateRootNameSpace(*getter_AddRefs(nameSpace));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(nameSpace, NS_ERROR_UNEXPECTED);
|
||||
|
|
|
@ -69,7 +69,6 @@ class nsIUnicharInputStream;
|
|||
class nsIParser;
|
||||
class nsINameSpace;
|
||||
class nsICSSLoader;
|
||||
class nsINameSpaceManager;
|
||||
class nsIElementFactory;
|
||||
|
||||
typedef enum {
|
||||
|
@ -178,9 +177,6 @@ protected:
|
|||
|
||||
nsresult MaybePrettyPrint();
|
||||
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static PRUint32 gRefCnt;
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIURI* mDocumentURL;
|
||||
nsIURI* mDocumentBaseURL; // can be set via HTTP headers
|
||||
|
|
|
@ -1019,8 +1019,8 @@ nsXMLDocument::CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult)
|
|||
aNodeInfo->GetNamespaceID(namespaceID);
|
||||
|
||||
nsCOMPtr<nsIElementFactory> elementFactory;
|
||||
mNameSpaceManager->GetElementFactory(namespaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetElementFactory(namespaceID,
|
||||
getter_AddRefs(elementFactory));
|
||||
|
||||
if (elementFactory) {
|
||||
rv = elementFactory->CreateInstanceByTag(aNodeInfo,
|
||||
|
|
|
@ -158,16 +158,9 @@ nsICSSParser* nsXULPrototypeElement::sCSSParser = nsnull;
|
|||
nsIXULPrototypeCache* nsXULPrototypeScript::sXULPrototypeCache = nsnull;
|
||||
nsIXBLService * nsXULElement::gXBLService = nsnull;
|
||||
|
||||
// XXX This is sure to change. Copied from mozilla/layout/xul/content/src/nsXULAtoms.cpp
|
||||
#define XUL_NAMESPACE_URI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI;
|
||||
static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
|
||||
// End of XUL interface includes
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static NS_DEFINE_CID(kEventListenerManagerCID, NS_EVENTLISTENERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
|
||||
|
@ -435,9 +428,6 @@ StyleHintFor(nsINodeInfo* aNodeInfo)
|
|||
|
||||
nsrefcnt nsXULElement::gRefCnt;
|
||||
nsIRDFService* nsXULElement::gRDFService;
|
||||
nsINameSpaceManager* nsXULElement::gNameSpaceManager;
|
||||
PRInt32 nsXULElement::kNameSpaceID_RDF;
|
||||
PRInt32 nsXULElement::kNameSpaceID_XUL;
|
||||
|
||||
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
|
||||
PRUint32 nsXULPrototypeAttribute::gNumElements;
|
||||
|
@ -478,20 +468,6 @@ nsXULElement::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create namespace manager");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (gNameSpaceManager) {
|
||||
gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kRDFNameSpaceURI), kNameSpaceID_RDF);
|
||||
gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
}
|
||||
|
||||
InitEventHandlerMap();
|
||||
}
|
||||
|
||||
|
@ -524,8 +500,6 @@ nsXULElement::~nsXULElement()
|
|||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDFService);
|
||||
gRDFService = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1459,7 +1433,8 @@ nsXULElement::GetAttributeNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
PRInt32 nsid;
|
||||
|
||||
gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nsid);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no attr...
|
||||
|
@ -1496,7 +1471,8 @@ nsXULElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
|
|||
PRInt32 nameSpaceId;
|
||||
nsCOMPtr<nsIAtom> tag = dont_AddRef(NS_NewAtom(aLocalName));
|
||||
|
||||
gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
|
||||
return UnsetAttr(nameSpaceId, tag, PR_TRUE);
|
||||
}
|
||||
|
@ -1554,7 +1530,8 @@ nsXULElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
kungFuGrip = dont_AddRef(NS_STATIC_CAST(nsIDOMNodeList *, elements));
|
||||
|
||||
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
|
||||
gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceId);
|
||||
|
||||
if (nameSpaceId == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no matches, we return an empty list...
|
||||
|
@ -1606,7 +1583,7 @@ nsXULElement::HasAttributeNS(const nsAString& aNamespaceURI,
|
|||
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
|
||||
PRInt32 nsid;
|
||||
|
||||
gNameSpaceManager->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
// Unkonwn namespace means no attr...
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
@ -394,9 +393,6 @@ protected:
|
|||
static nsrefcnt gRefCnt;
|
||||
// pseudo-constants
|
||||
static nsIRDFService* gRDFService;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static PRInt32 kNameSpaceID_RDF;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
public:
|
||||
static nsresult
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
|
||||
#include "nsIExpatSink.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsXULAtoms.h"
|
||||
|
||||
static const char kNameSpaceSeparator = ':';
|
||||
static const char kNameSpaceDef[] = "xmlns";
|
||||
|
@ -111,12 +112,6 @@ static const char kNameSpaceDef[] = "xmlns";
|
|||
static PRLogModuleInfo* gLog;
|
||||
#endif
|
||||
|
||||
// XXX This is sure to change. Copied from mozilla/layout/xul/content/src/nsXULAtoms.cpp
|
||||
#define XUL_NAMESPACE_URI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI;
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -147,16 +142,9 @@ public:
|
|||
protected:
|
||||
// pseudo-constants
|
||||
static nsrefcnt gRefCnt;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static nsIXULPrototypeCache* gXULCache;
|
||||
|
||||
static nsIAtom* kClassAtom;
|
||||
static nsIAtom* kIdAtom;
|
||||
static nsIAtom* kScriptAtom;
|
||||
static nsIAtom* kStyleAtom;
|
||||
static nsIAtom* kTemplateAtom;
|
||||
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
PRUnichar* mText;
|
||||
PRInt32 mTextLength;
|
||||
|
@ -262,16 +250,9 @@ protected:
|
|||
};
|
||||
|
||||
nsrefcnt XULContentSinkImpl::gRefCnt;
|
||||
nsINameSpaceManager* XULContentSinkImpl::gNameSpaceManager;
|
||||
nsIXULPrototypeCache* XULContentSinkImpl::gXULCache;
|
||||
|
||||
nsIAtom* XULContentSinkImpl::kClassAtom;
|
||||
nsIAtom* XULContentSinkImpl::kIdAtom;
|
||||
nsIAtom* XULContentSinkImpl::kScriptAtom;
|
||||
nsIAtom* XULContentSinkImpl::kStyleAtom;
|
||||
nsIAtom* XULContentSinkImpl::kTemplateAtom;
|
||||
|
||||
PRInt32 XULContentSinkImpl::kNameSpaceID_XUL;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -358,27 +339,9 @@ XULContentSinkImpl::XULContentSinkImpl(nsresult& rv)
|
|||
NS_INIT_ISUPPORTS();
|
||||
|
||||
if (gRefCnt++ == 0) {
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
kScriptAtom = NS_NewAtom("script");
|
||||
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
||||
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
kClassAtom = NS_NewAtom("class");
|
||||
kIdAtom = NS_NewAtom("id");
|
||||
kScriptAtom = NS_NewAtom("script");
|
||||
kStyleAtom = NS_NewAtom("style");
|
||||
kTemplateAtom = NS_NewAtom("template");
|
||||
|
||||
rv = nsServiceManager::GetService(kXULPrototypeCacheCID,
|
||||
NS_GET_IID(nsIXULPrototypeCache),
|
||||
(nsISupports**) &gXULCache);
|
||||
rv = CallGetService(kXULPrototypeCacheCID, &gXULCache);
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -465,18 +428,8 @@ XULContentSinkImpl::~XULContentSinkImpl()
|
|||
PR_FREEIF(mText);
|
||||
|
||||
if (--gRefCnt == 0) {
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
NS_IF_RELEASE(kClassAtom);
|
||||
NS_IF_RELEASE(kIdAtom);
|
||||
NS_IF_RELEASE(kScriptAtom);
|
||||
NS_IF_RELEASE(kStyleAtom);
|
||||
NS_IF_RELEASE(kTemplateAtom);
|
||||
|
||||
if (gXULCache) {
|
||||
nsServiceManager::ReleaseService(kXULPrototypeCacheCID, gXULCache);
|
||||
gXULCache = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gXULCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1182,7 +1135,7 @@ XULContentSinkImpl::PushNameSpacesFrom(const PRUnichar** aAttributes)
|
|||
nameSpace =
|
||||
(nsINameSpace*)mNameSpaceStack.ElementAt(mNameSpaceStack.Count() - 1);
|
||||
} else {
|
||||
gNameSpaceManager->CreateRootNameSpace(*getter_AddRefs(nameSpace));
|
||||
nsContentUtils::GetNSManagerWeakRef()->CreateRootNameSpace(*getter_AddRefs(nameSpace));
|
||||
if (! nameSpace)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -1576,7 +1529,7 @@ XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes,
|
|||
nsAutoString value;
|
||||
|
||||
// Compute the element's class list if the element has a 'class' attribute.
|
||||
rv = aElement->GetAttr(kNameSpaceID_None, kClassAtom, value);
|
||||
rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::clazz, value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
|
@ -1585,7 +1538,7 @@ XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes,
|
|||
}
|
||||
|
||||
// Parse the element's 'style' attribute
|
||||
rv = aElement->GetAttr(kNameSpaceID_None, kStyleAtom, value);
|
||||
rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::style, value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
|
|
|
@ -175,7 +175,6 @@ static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
|||
static NS_DEFINE_CID(kHTMLStyleSheetCID, NS_HTMLSTYLESHEET_CID);
|
||||
static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID);
|
||||
static NS_DEFINE_CID(kLocalStoreCID, NS_LOCALSTORE_CID);
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kParserCID, NS_PARSER_CID);
|
||||
static NS_DEFINE_CID(kPresShellCID, NS_PRESSHELL_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
@ -202,8 +201,6 @@ static PRBool IsChromeURI(nsIURI* aURI)
|
|||
// Miscellaneous Constants
|
||||
//
|
||||
|
||||
#define XUL_NAMESPACE_URI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
|
||||
const nsForwardReference::Phase nsForwardReference::kPasses[] = {
|
||||
nsForwardReference::eConstruction,
|
||||
nsForwardReference::eHookup,
|
||||
|
@ -226,9 +223,6 @@ nsIRDFResource* nsXULDocument::kNC_value;
|
|||
nsIElementFactory* nsXULDocument::gHTMLElementFactory;
|
||||
nsIElementFactory* nsXULDocument::gXMLElementFactory;
|
||||
|
||||
nsINameSpaceManager* nsXULDocument::gNameSpaceManager;
|
||||
PRInt32 nsXULDocument::kNameSpaceID_XUL;
|
||||
|
||||
nsIXULPrototypeCache* nsXULDocument::gXULCache;
|
||||
|
||||
PRLogModuleInfo* nsXULDocument::gXULLog;
|
||||
|
@ -517,12 +511,6 @@ nsXULDocument::~nsXULDocument()
|
|||
NS_IF_RELEASE(gHTMLElementFactory);
|
||||
NS_IF_RELEASE(gXMLElementFactory);
|
||||
|
||||
if (gNameSpaceManager) {
|
||||
nsServiceManager::ReleaseService(kNameSpaceManagerCID,
|
||||
gNameSpaceManager);
|
||||
gNameSpaceManager = nsnull;
|
||||
}
|
||||
|
||||
if (gXULCache) {
|
||||
// Remove the current document here from the FastLoad table in
|
||||
// case the document did not make it past StartLayout in
|
||||
|
@ -1656,15 +1644,6 @@ nsXULDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetNameSpaceManager(nsINameSpaceManager*& aManager)
|
||||
{
|
||||
aManager = mNameSpaceManager;
|
||||
NS_IF_ADDREF(aManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Note: We don't hold a reference to the document observer; we assume
|
||||
// that it has a live reference to the document.
|
||||
void
|
||||
|
@ -3721,7 +3700,8 @@ nsXULDocument::CreateElementNS(const nsAString& aNamespaceURI,
|
|||
|
||||
// Get The real namespace ID
|
||||
PRInt32 nameSpaceID;
|
||||
rv = mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceID);
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI,
|
||||
nameSpaceID);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
|
@ -3799,7 +3779,7 @@ nsXULDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
|
|||
if (root) {
|
||||
PRInt32 nsid = kNameSpaceID_Unknown;
|
||||
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
|
||||
rv = mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceID(aNamespaceURI, nsid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (nsid == kNameSpaceID_Unknown) {
|
||||
|
@ -4464,13 +4444,6 @@ nsXULDocument::Init()
|
|||
rv = NS_NewHeapArena(getter_AddRefs(mArena), nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Create a namespace manager so we can manage tags
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
getter_AddRefs(mNameSpaceManager));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(NS_NODEINFOMANAGER_CONTRACTID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINodeInfoManager),
|
||||
|
@ -4478,7 +4451,7 @@ nsXULDocument::Init()
|
|||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mNodeInfoManager->Init(this, mNameSpaceManager);
|
||||
mNodeInfoManager->Init(this);
|
||||
|
||||
// Create our command dispatcher and hook it up.
|
||||
rv = nsXULCommandDispatcher::Create(this, getter_AddRefs(mCommandDispatcher));
|
||||
|
@ -4551,17 +4524,6 @@ nsXULDocument::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get XML element factory");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kNameSpaceManagerCID,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(nsISupports**) &gNameSpaceManager);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get namespace manager");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#define XUL_NAMESPACE_URI "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI;
|
||||
gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
|
||||
|
||||
rv = nsServiceManager::GetService(kXULPrototypeCacheCID,
|
||||
NS_GET_IID(nsIXULPrototypeCache),
|
||||
(nsISupports**) &gXULCache);
|
||||
|
@ -6908,7 +6870,8 @@ nsXULDocument::GetElementFactory(PRInt32 aNameSpaceID,
|
|||
nsIElementFactory** aResult)
|
||||
{
|
||||
// Retrieve the appropriate factory.
|
||||
gNameSpaceManager->GetElementFactory(aNameSpaceID, aResult);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetElementFactory(aNameSpaceID,
|
||||
aResult);
|
||||
|
||||
if (!*aResult) {
|
||||
// Nothing found. Use generic XML element.
|
||||
|
@ -7192,34 +7155,11 @@ public:
|
|||
|
||||
// nsIElementFactory interface
|
||||
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo, nsIContent** aResult);
|
||||
|
||||
static PRBool gIsInitialized;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
};
|
||||
|
||||
PRBool XULElementFactoryImpl::gIsInitialized = PR_FALSE;
|
||||
PRInt32 XULElementFactoryImpl::kNameSpaceID_XUL;
|
||||
|
||||
XULElementFactoryImpl::XULElementFactoryImpl()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
if (!gIsInitialized) {
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr =
|
||||
do_GetService(kNameSpaceManagerCID);
|
||||
|
||||
NS_ASSERTION(nsmgr, "unable to get namespace manager");
|
||||
if (!nsmgr)
|
||||
return;
|
||||
|
||||
#define XUL_NAMESPACE_URI \
|
||||
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
|
||||
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(XUL_NAMESPACE_URI),
|
||||
kNameSpaceID_XUL);
|
||||
|
||||
gIsInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
XULElementFactoryImpl::~XULElementFactoryImpl()
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsILineBreakerFactory.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
|
@ -262,8 +261,6 @@ public:
|
|||
|
||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager);
|
||||
|
||||
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
|
||||
|
||||
virtual void AddObserver(nsIDocumentObserver* aObserver);
|
||||
|
@ -513,9 +510,6 @@ protected:
|
|||
static nsIElementFactory* gHTMLElementFactory;
|
||||
static nsIElementFactory* gXMLElementFactory;
|
||||
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
static nsIXULContentUtils* gXULUtils;
|
||||
static nsIXULPrototypeCache* gXULCache;
|
||||
|
||||
|
@ -562,7 +556,6 @@ protected:
|
|||
// if we're attached to a DocumentViewImpl, we have a presshell
|
||||
nsAutoVoidArray mPresShells;
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
||||
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager; // [OWNER]
|
||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet; // [OWNER]
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mInlineStyleSheet; // [OWNER]
|
||||
nsCOMPtr<nsICSSLoader> mCSSLoader; // [OWNER]
|
||||
|
|
|
@ -246,10 +246,7 @@ nsXULPrototypeDocument::Init()
|
|||
mNodeInfoManager = do_CreateInstance(NS_NODEINFOMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsmgr;
|
||||
rv = NS_NewNameSpaceManager(getter_AddRefs(nsmgr));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = mNodeInfoManager->Init(nsnull, nsmgr);
|
||||
rv = mNodeInfoManager->Init(nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -1671,7 +1671,8 @@ nsXULContentBuilder::SetContainerAttrs(nsIContent *aElement, const nsTemplateMat
|
|||
void
|
||||
nsXULContentBuilder::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult)
|
||||
{
|
||||
gNameSpaceManager->GetElementFactory(aNameSpaceID, aResult);
|
||||
nsContentUtils::GetNSManagerWeakRef()->GetElementFactory(aNameSpaceID,
|
||||
aResult);
|
||||
|
||||
if (!*aResult) {
|
||||
*aResult = gXMLElementFactory; // Nothing found. Use generic XML element.
|
||||
|
|
|
@ -66,21 +66,19 @@
|
|||
#include "prlog.h"
|
||||
#include "prtime.h"
|
||||
#include "rdf.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDateTimeFormat.h"
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
#include "nsIScriptableDateFormat.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
nsrefcnt nsXULContentUtils::gRefCnt;
|
||||
nsIRDFService* nsXULContentUtils::gRDF;
|
||||
nsINameSpaceManager* nsXULContentUtils::gNameSpaceManager;
|
||||
nsIDateTimeFormat* nsXULContentUtils::gFormat;
|
||||
|
||||
#define XUL_RESOURCE(ident, uri) nsIRDFResource* nsXULContentUtils::ident
|
||||
|
@ -119,12 +117,6 @@ nsXULContentUtils::Init()
|
|||
#undef XUL_RESOURCE
|
||||
#undef XUL_LITERAL
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
|
@ -152,7 +144,6 @@ nsXULContentUtils::Finish()
|
|||
#undef XUL_RESOURCE
|
||||
#undef XUL_LITERAL
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
NS_IF_RELEASE(gFormat);
|
||||
}
|
||||
|
||||
|
@ -480,7 +471,7 @@ nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsAString& aAttribute
|
|||
PRUnichar buf[256];
|
||||
nsAutoString uri(CBufDescriptor(buf, PR_TRUE, sizeof(buf) / sizeof(PRUnichar), 0));
|
||||
if (aNameSpaceID != kNameSpaceID_Unknown && aNameSpaceID != kNameSpaceID_None) {
|
||||
rv = gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, uri);
|
||||
rv = nsContentUtils::GetNSManagerWeakRef()->GetNameSpaceURI(aNameSpaceID, uri);
|
||||
// XXX ignore failure; treat as "no namespace"
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ class nsXULContentUtils
|
|||
protected:
|
||||
static nsrefcnt gRefCnt;
|
||||
static nsIRDFService* gRDF;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static nsIDateTimeFormat* gFormat;
|
||||
|
||||
static PRBool gDisableXULCache;
|
||||
|
|
|
@ -81,16 +81,11 @@
|
|||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
|
||||
|
||||
static const char kXULNameSpaceURI[]
|
||||
= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
|
||||
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, BookmarkSeparator);
|
||||
|
||||
typedef struct _sortStruct {
|
||||
|
@ -162,9 +157,6 @@ private:
|
|||
static nsString *kAscendingStr;
|
||||
static nsString *kDescendingStr;
|
||||
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
static PRInt32 kNameSpaceID_RDF;
|
||||
|
||||
static nsIRDFService *gRDFService;
|
||||
static nsIRDFContainerUtils *gRDFC;
|
||||
|
||||
|
@ -216,9 +208,6 @@ nsString* XULSortServiceImpl::kNaturalStr = nsnull;
|
|||
nsString* XULSortServiceImpl::kAscendingStr = nsnull;
|
||||
nsString* XULSortServiceImpl::kDescendingStr = nsnull;
|
||||
|
||||
PRInt32 XULSortServiceImpl::kNameSpaceID_XUL;
|
||||
PRInt32 XULSortServiceImpl::kNameSpaceID_RDF;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XULSortServiceImpl::XULSortServiceImpl(void)
|
||||
|
@ -265,17 +254,6 @@ XULSortServiceImpl::XULSortServiceImpl(void)
|
|||
NS_ERROR("unable to get application locale");
|
||||
} else
|
||||
NS_ERROR("couldn't get locale factory");
|
||||
|
||||
// Register the XUL and RDF namespaces: these'll just retrieve
|
||||
// the IDs if they've already been registered by someone else.
|
||||
nsCOMPtr<nsINameSpaceManager> mgr = do_CreateInstance(kNameSpaceManagerCID);
|
||||
if (mgr) {
|
||||
rv = mgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");
|
||||
rv = mgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kRDFNameSpaceURI), kNameSpaceID_RDF);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
|
||||
} else
|
||||
NS_ERROR("couldn't create namepsace manager");
|
||||
}
|
||||
|
||||
++gRefCnt;
|
||||
|
|
|
@ -125,7 +125,6 @@
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
|
@ -135,11 +134,8 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
|||
//
|
||||
|
||||
nsrefcnt nsXULTemplateBuilder::gRefCnt = 0;
|
||||
PRInt32 nsXULTemplateBuilder::kNameSpaceID_RDF;
|
||||
PRInt32 nsXULTemplateBuilder::kNameSpaceID_XUL;
|
||||
nsIRDFService* nsXULTemplateBuilder::gRDFService;
|
||||
nsIRDFContainerUtils* nsXULTemplateBuilder::gRDFContainerUtils;
|
||||
nsINameSpaceManager* nsXULTemplateBuilder::gNameSpaceManager;
|
||||
nsIScriptSecurityManager* nsXULTemplateBuilder::gScriptSecurityManager;
|
||||
nsIPrincipal* nsXULTemplateBuilder::gSystemPrincipal;
|
||||
|
||||
|
@ -177,8 +173,6 @@ nsXULTemplateBuilder::~nsXULTemplateBuilder(void)
|
|||
gRDFContainerUtils = nsnull;
|
||||
}
|
||||
|
||||
NS_RELEASE(gNameSpaceManager);
|
||||
|
||||
NS_IF_RELEASE(gSystemPrincipal);
|
||||
|
||||
if (gScriptSecurityManager) {
|
||||
|
@ -195,30 +189,6 @@ nsXULTemplateBuilder::Init()
|
|||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
|
||||
// Register the XUL and RDF namespaces: these'll just retrieve
|
||||
// the IDs if they've already been registered by someone else.
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create namespace manager");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// XXX This is sure to change. Copied from mozilla/layout/xul/content/src/nsXULAtoms.cpp
|
||||
static const char kXULNameSpaceURI[]
|
||||
= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
static const char kRDFNameSpaceURI[]
|
||||
= RDF_NAMESPACE_URI;
|
||||
|
||||
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kRDFNameSpaceURI), kNameSpaceID_RDF);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Initialize the global shared reference to the service
|
||||
// manager and get some shared resource objects.
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
|
@ -1388,7 +1358,7 @@ nsXULTemplateBuilder::IsTemplateElement(nsIContent* aContent)
|
|||
PRInt32 nameSpaceID;
|
||||
aContent->GetNameSpaceID(nameSpaceID);
|
||||
|
||||
if (nameSpaceID == nsXULTemplateBuilder::kNameSpaceID_XUL) {
|
||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
aContent->GetTag(*getter_AddRefs(tag));
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#define nsXULTemplateBuilder_h__
|
||||
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISecurityCheckedComponent.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
|
@ -205,7 +204,7 @@ public:
|
|||
* syntax.
|
||||
*/
|
||||
nsresult
|
||||
CompileSimpleRule(nsIContent* aRuleElement, PRInt32 aPriorty, InnerNode* naParentNode);
|
||||
CompileSimpleRule(nsIContent* aRuleElement, PRInt32 aPriorty, InnerNode* aParentNode);
|
||||
|
||||
/**
|
||||
* Can be overridden by subclasses to handle special attribute conditions
|
||||
|
@ -334,13 +333,9 @@ protected:
|
|||
static nsrefcnt gRefCnt;
|
||||
static nsIRDFService* gRDFService;
|
||||
static nsIRDFContainerUtils* gRDFContainerUtils;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static nsIScriptSecurityManager* gScriptSecurityManager;
|
||||
static nsIPrincipal* gSystemPrincipal;
|
||||
|
||||
static PRInt32 kNameSpaceID_RDF;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
enum {
|
||||
eDontTestEmpty = (1 << 0)
|
||||
};
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include "nsXULTemplateBuilder.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
// For security check
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -173,7 +173,8 @@ RegisterTransformiix(nsIComponentManager *aCompMgr,
|
|||
|
||||
TX_LG_IMPL;
|
||||
static PRBool gInitialized = PR_FALSE;
|
||||
static nsIExceptionProvider *sXPathExceptionProvider = 0;
|
||||
static nsIExceptionProvider *gXPathExceptionProvider = 0;
|
||||
nsINameSpaceManager *gNameSpaceManager = 0;
|
||||
|
||||
// Perform our one-time intialization for this module
|
||||
PR_STATIC_CALLBACK(nsresult)
|
||||
|
@ -185,14 +186,14 @@ Initialize(nsIModule* aSelf)
|
|||
|
||||
gInitialized = PR_TRUE;
|
||||
|
||||
sXPathExceptionProvider = new nsXPathExceptionProvider();
|
||||
if (!sXPathExceptionProvider)
|
||||
gXPathExceptionProvider = new nsXPathExceptionProvider();
|
||||
if (!gXPathExceptionProvider)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(sXPathExceptionProvider);
|
||||
NS_ADDREF(gXPathExceptionProvider);
|
||||
nsCOMPtr<nsIExceptionService> xs =
|
||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||
if (xs)
|
||||
xs->RegisterExceptionProvider(sXPathExceptionProvider,
|
||||
xs->RegisterExceptionProvider(gXPathExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM_XPATH);
|
||||
|
||||
if (!txXSLTProcessor::txInit()) {
|
||||
|
@ -206,6 +207,12 @@ Initialize(nsIModule* aSelf)
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = CallGetService(NS_NAMESPACEMANAGER_CONTRACTID, &gNameSpaceManager);
|
||||
if (NS_FAILED(rv)) {
|
||||
gNameSpaceManager = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
TX_LG_CREATE;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -220,13 +227,13 @@ Shutdown(nsIModule* aSelf)
|
|||
return;
|
||||
|
||||
gInitialized = PR_FALSE;
|
||||
if (sXPathExceptionProvider) {
|
||||
if (gXPathExceptionProvider) {
|
||||
nsCOMPtr<nsIExceptionService> xs =
|
||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||
if (xs)
|
||||
xs->UnregisterExceptionProvider(sXPathExceptionProvider,
|
||||
xs->UnregisterExceptionProvider(gXPathExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM_XPATH);
|
||||
NS_RELEASE(sXPathExceptionProvider);
|
||||
NS_RELEASE(gXPathExceptionProvider);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(NS_CLASSINFO_NAME(XSLTProcessor));
|
||||
|
@ -239,6 +246,7 @@ Shutdown(nsIModule* aSelf)
|
|||
txXSLTProcessor::txShutdown();
|
||||
|
||||
NS_IF_RELEASE(gTxSecurityManager);
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
TX_LG_DELETE;
|
||||
}
|
||||
|
|
|
@ -52,10 +52,9 @@ Attr::Attr(nsIDOMAttr* aAttr, Document* aOwner) : Node(aAttr, aOwner)
|
|||
aAttr->GetNamespaceURI(ns);
|
||||
mNamespaceID = kNameSpaceID_None;
|
||||
if (!ns.IsEmpty()) {
|
||||
NS_ASSERTION(aOwner->nsNSManager,
|
||||
"owner document lacks namespace manager");
|
||||
if (aOwner->nsNSManager) {
|
||||
aOwner->nsNSManager->GetNameSpaceID(ns, mNamespaceID);
|
||||
NS_ASSERTION(gNameSpaceManager,"No namespace manager");
|
||||
if (gNameSpaceManager) {
|
||||
gNameSpaceManager->GetNameSpaceID(ns, mNamespaceID);
|
||||
}
|
||||
}
|
||||
mNSId = mNamespaceID;
|
||||
|
|
|
@ -188,13 +188,6 @@ Document::Document(nsIDOMDocument* aDocument) : Node(aDocument, this)
|
|||
if (!success) {
|
||||
mAttributeNodes.ops = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDocument));
|
||||
NS_ASSERTION(doc,"document doesn't implement nsIDocument");
|
||||
if (doc) {
|
||||
doc->GetNameSpaceManager(*getter_AddRefs(nsNSManager));
|
||||
NS_ASSERTION(nsNSManager, "Unable to get nsINamespaceManager");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -380,10 +373,9 @@ Attr* Document::createAttribute(nsIDOMAttr* aAttr)
|
|||
aAttr->GetNamespaceURI(ns);
|
||||
PRInt32 namespaceID = kNameSpaceID_None;
|
||||
if (!ns.IsEmpty()) {
|
||||
NS_ASSERTION(nsNSManager,
|
||||
"owner document lacks namespace manager");
|
||||
if (nsNSManager) {
|
||||
nsNSManager->GetNameSpaceID(ns, namespaceID);
|
||||
NS_ASSERTION(gNameSpaceManager, "No namespace manager");
|
||||
if (gNameSpaceManager) {
|
||||
gNameSpaceManager->GetNameSpaceID(ns, namespaceID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -660,18 +652,18 @@ Node* Document::createWrapper(nsIDOMNode* aNode)
|
|||
PRInt32 Document::namespaceURIToID(const String& aNamespaceURI)
|
||||
{
|
||||
PRInt32 namesspaceID = kNameSpaceID_Unknown;
|
||||
if (nsNSManager) {
|
||||
nsNSManager->RegisterNameSpace(aNamespaceURI,
|
||||
namesspaceID);
|
||||
if (gNameSpaceManager) {
|
||||
gNameSpaceManager->RegisterNameSpace(aNamespaceURI,
|
||||
namesspaceID);
|
||||
}
|
||||
return namesspaceID;
|
||||
}
|
||||
|
||||
void Document::namespaceIDToURI(PRInt32 aNamespaceID, String& aNamespaceURI)
|
||||
{
|
||||
if (nsNSManager) {
|
||||
nsNSManager->GetNameSpaceURI(aNamespaceID,
|
||||
aNamespaceURI);
|
||||
if (gNameSpaceManager) {
|
||||
gNameSpaceManager->GetNameSpaceURI(aNamespaceID,
|
||||
aNamespaceURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -354,12 +354,11 @@ PRInt32 Node::lookupNamespaceID(txAtom* aPrefix)
|
|||
NS_ENSURE_SUCCESS(rv, kNameSpaceID_Unknown);
|
||||
if (rv != NS_CONTENT_ATTR_NOT_THERE) {
|
||||
PRInt32 nsId;
|
||||
NS_ASSERTION(mOwnerDocument->nsNSManager,
|
||||
"owner document lacks namespace manager");
|
||||
if (!mOwnerDocument->nsNSManager) {
|
||||
NS_ASSERTION(gNameSpaceManager, "No namespace manager");
|
||||
if (!gNameSpaceManager) {
|
||||
return kNameSpaceID_Unknown;
|
||||
}
|
||||
mOwnerDocument->nsNSManager->RegisterNameSpace(uri, nsId);
|
||||
gNameSpaceManager->RegisterNameSpace(uri, nsId);
|
||||
return nsId;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ typedef UNICODE_CHAR DOM_CHAR;
|
|||
#define kTxAttrIndexOffset 0x40000000;
|
||||
#define kTxChildIndexOffset 0x80000000;
|
||||
|
||||
extern nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMDocumentType;
|
||||
|
@ -310,14 +312,9 @@ public:
|
|||
void namespaceIDToURI(PRInt32 aNamespaceID, String& aNamespaceURI);
|
||||
|
||||
private:
|
||||
friend class Attr; // Attrs and Nodes need to get to the cached nsNSManager
|
||||
friend class Node;
|
||||
|
||||
PLDHashTable mWrapperHashTable;
|
||||
PLDHashTable mAttributeNodes;
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> nsNSManager;
|
||||
|
||||
#ifdef DEBUG
|
||||
friend class MozillaObjectWrapper;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "nsDOMError.h"
|
||||
#include "txURIUtils.h"
|
||||
|
||||
extern nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
NS_IMPL_ADDREF(nsXPathEvaluator)
|
||||
NS_IMPL_RELEASE(nsXPathEvaluator)
|
||||
|
@ -128,8 +129,6 @@ nsXPathEvaluator::Evaluate(const nsAString & aExpression,
|
|||
* ParseContextImpl bases on a nsIDOMXPathNSResolver
|
||||
*/
|
||||
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
|
||||
nsresult nsXPathEvaluator::ParseContextImpl::resolveNamespacePrefix
|
||||
(txAtom* aPrefix, PRInt32& aID)
|
||||
{
|
||||
|
@ -153,15 +152,8 @@ nsresult nsXPathEvaluator::ParseContextImpl::resolveNamespacePrefix
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mNSMan) {
|
||||
mNSMan = do_GetService(kNameSpaceManagerCID);
|
||||
if (!mNSMan) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
// get the namespaceID for the URI
|
||||
|
||||
return mNSMan->RegisterNameSpace(ns, aID);
|
||||
return gNameSpaceManager->RegisterNameSpace(ns, aID);
|
||||
}
|
||||
|
||||
nsresult nsXPathEvaluator::ParseContextImpl::resolveFunctionCall(txAtom* aName,
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
#include "nsIDOMXPathEvaluator.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
/**
|
||||
* A class for evaluating an XPath expression string
|
||||
|
@ -86,7 +85,6 @@ private:
|
|||
private:
|
||||
nsIDOMXPathNSResolver* mResolver;
|
||||
nsresult mLastError;
|
||||
nsCOMPtr<nsINameSpaceManager> mNSMan;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
#include "TxLog.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
extern nsINameSpaceManager* gNameSpaceManager;
|
||||
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID);
|
||||
|
@ -111,10 +114,6 @@ txMozillaXMLOutput::txMozillaXMLOutput(txOutputFormat* aFormat,
|
|||
mOutputFormat.setFromDefaults();
|
||||
|
||||
aFragment->GetOwnerDocument(getter_AddRefs(mDocument));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||
NS_ASSERTION(doc, "can't QI to nsIDocument");
|
||||
doc->GetNameSpaceManager(*getter_AddRefs(mNameSpaceManager));
|
||||
NS_ASSERTION(mNameSpaceManager, "Can't get namespace manager.");
|
||||
|
||||
mCurrentNode = aFragment;
|
||||
}
|
||||
|
@ -154,7 +153,7 @@ void txMozillaXMLOutput::attribute(const String& aName,
|
|||
}
|
||||
else {
|
||||
nsAutoString nsURI;
|
||||
mNameSpaceManager->GetNameSpaceURI(aNsID, nsURI);
|
||||
gNameSpaceManager->GetNameSpaceURI(aNsID, nsURI);
|
||||
element->SetAttributeNS(nsURI, aName, aValue);
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +373,7 @@ void txMozillaXMLOutput::startElement(const String& aName,
|
|||
}
|
||||
else {
|
||||
nsAutoString nsURI;
|
||||
mNameSpaceManager->GetNameSpaceURI(aNsID, nsURI);
|
||||
gNameSpaceManager->GetNameSpaceURI(aNsID, nsURI);
|
||||
rv = mDocument->CreateElementNS(nsURI, aName,
|
||||
getter_AddRefs(element));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't create element");
|
||||
|
@ -679,8 +678,6 @@ txMozillaXMLOutput::createResultDocument(const String& aName, PRInt32 aNsID,
|
|||
doc = do_QueryInterface(aResultDocument);
|
||||
}
|
||||
mCurrentNode = mDocument;
|
||||
doc->GetNameSpaceManager(*getter_AddRefs(mNameSpaceManager));
|
||||
NS_ASSERTION(mNameSpaceManager, "Can't get namespace manager.");
|
||||
|
||||
// Reset and set up the document
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIScriptLoader.h"
|
||||
#include "nsIScriptLoaderObserver.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
|
@ -193,8 +192,6 @@ private:
|
|||
PRUint32 mBadChildLevel;
|
||||
nsCString mRefreshString;
|
||||
|
||||
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> mScriptElements;
|
||||
|
||||
nsAutoString mText;
|
||||
|
|
|
@ -224,8 +224,6 @@ txToFragmentHandlerFactory::createHandlerWith(txOutputFormat* aFormat,
|
|||
* txMozillaXSLTProcessor
|
||||
*/
|
||||
|
||||
NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
|
||||
NS_IMPL_ADDREF(txMozillaXSLTProcessor)
|
||||
NS_IMPL_RELEASE(txMozillaXSLTProcessor)
|
||||
NS_INTERFACE_MAP_BEGIN(txMozillaXSLTProcessor)
|
||||
|
@ -602,13 +600,8 @@ txMozillaXSLTProcessor::SetParameter(const nsAString & aNamespaceURI,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINameSpaceManager> namespaceManager =
|
||||
do_GetService(kNameSpaceManagerCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 nsId = kNameSpaceID_Unknown;
|
||||
rv = namespaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
nsresult rv = gNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIAtom> localName = do_GetAtom(aLocalName);
|
||||
txExpandedName varName(nsId, localName);
|
||||
|
@ -630,13 +623,8 @@ txMozillaXSLTProcessor::GetParameter(const nsAString& aNamespaceURI,
|
|||
const nsAString& aLocalName,
|
||||
nsIVariant **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINameSpaceManager> namespaceManager =
|
||||
do_GetService(kNameSpaceManagerCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 nsId = kNameSpaceID_Unknown;
|
||||
rv = namespaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
nsresult rv = gNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIAtom> localName = do_GetAtom(aLocalName);
|
||||
txExpandedName varName(nsId, localName);
|
||||
|
@ -652,13 +640,8 @@ NS_IMETHODIMP
|
|||
txMozillaXSLTProcessor::RemoveParameter(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINameSpaceManager> namespaceManager =
|
||||
do_GetService(kNameSpaceManagerCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 nsId = kNameSpaceID_Unknown;
|
||||
rv = namespaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
nsresult rv = gNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsId);
|
||||
nsCOMPtr<nsIAtom> localName = do_GetAtom(aLocalName);
|
||||
txExpandedName varName(nsId, localName);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications. Portions created by Netscape Communications are
|
||||
* Copyright (C) 2001 by Netscape Communications. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vidur Apparao <vidur@netscape.com> (original author)
|
||||
*/
|
||||
|
||||
#ifndef _nsDOMUtils_h__
|
||||
#define _nsDOMUtils_h__
|
||||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
||||
// string includes
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
// collection includes
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// nsChildElementIterator
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class nsChildElementIterator {
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNodeList> mNodeList;
|
||||
PRUint32 mIndex;
|
||||
PRUint32 mLength;
|
||||
nsString mNamespace;
|
||||
const char** mNamespaceArray;
|
||||
PRUint32 mNumNamespaces;
|
||||
|
||||
public:
|
||||
nsChildElementIterator(nsIDOMElement* aParent) :
|
||||
mIndex(0), mLength(0), mNumNamespaces(0)
|
||||
{
|
||||
SetElement(aParent);
|
||||
}
|
||||
|
||||
nsChildElementIterator(nsIDOMElement* aParent,
|
||||
const nsAString& aNamespace) :
|
||||
mIndex(0), mLength(0), mNamespace(aNamespace), mNumNamespaces(0)
|
||||
{
|
||||
SetElement(aParent);
|
||||
}
|
||||
|
||||
nsChildElementIterator(nsIDOMElement* aParent,
|
||||
const char** aNamespaceArray,
|
||||
PRUint32 aNumNamespaces) :
|
||||
mIndex(0), mLength(0), mNamespaceArray(aNamespaceArray),
|
||||
mNumNamespaces(aNumNamespaces)
|
||||
{
|
||||
SetElement(aParent);
|
||||
}
|
||||
|
||||
~nsChildElementIterator() {}
|
||||
|
||||
void SetElement(nsIDOMElement* aParent)
|
||||
{
|
||||
aParent->GetChildNodes(getter_AddRefs(mNodeList));
|
||||
if (mNodeList) {
|
||||
mNodeList->GetLength(&mLength);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 GetCurrentIndex() { return mIndex; }
|
||||
|
||||
void Reset(PRUint32 aIndex=0) { mIndex = aIndex; }
|
||||
|
||||
PRBool HasChildNodes() { return mLength; }
|
||||
|
||||
nsresult GetNextChild(nsIDOMElement** aChildElement,
|
||||
nsIAtom** aElementName)
|
||||
{
|
||||
*aChildElement = nsnull;
|
||||
|
||||
if (!mNodeList) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
while (mIndex < mLength) {
|
||||
mNodeList->Item(mIndex++, getter_AddRefs(child));
|
||||
nsCOMPtr<nsIDOMElement> childElement(do_QueryInterface(child));
|
||||
if (!childElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Confirm that the element is an element of the specified namespace
|
||||
nsAutoString namespaceURI;
|
||||
childElement->GetNamespaceURI(namespaceURI);
|
||||
if (!mNamespace.IsEmpty()) {
|
||||
if (!namespaceURI.Equals(mNamespace)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (mNumNamespaces) {
|
||||
PRUint32 i;
|
||||
for (i = 0; i < mNumNamespaces; i++) {
|
||||
if (!namespaceURI.Equals(NS_ConvertASCIItoUCS2(mNamespaceArray[i]))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(childElement));
|
||||
NS_ASSERTION(content, "Element is not content");
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
content->GetNodeInfo(*getter_AddRefs(nodeInfo));
|
||||
if (!nodeInfo) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nodeInfo->GetNameAtom(*aElementName);
|
||||
*aChildElement = childElement;
|
||||
NS_ADDREF(*aChildElement);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _nsDOMUtils_h__
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
// content includes
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
|
|
|
@ -3472,7 +3472,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
#endif
|
||||
#ifdef MOZ_SVG
|
||||
if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) &&
|
||||
(nameSpaceID == nsSVGAtoms::nameSpaceID)) {
|
||||
(nameSpaceID == kNameSpaceID_SVG)) {
|
||||
rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
@ -5361,7 +5361,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
PRBool isXULNS = (aNameSpaceID == nsXULAtoms::nameSpaceID);
|
||||
PRBool isXULNS = (aNameSpaceID == kNameSpaceID_XUL);
|
||||
PRBool isXULDisplay = IsXULDisplayType(display);
|
||||
|
||||
if (isXULNS || isXULDisplay) {
|
||||
|
@ -7107,7 +7107,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
|
|||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
NS_ASSERTION(NS_SUCCEEDED(aContent->GetNameSpaceID(aNameSpaceID)) &&
|
||||
(aNameSpaceID == nsSVGAtoms::nameSpaceID), "SVG frame constructed in wrong namespace");
|
||||
(aNameSpaceID == kNameSpaceID_SVG), "SVG frame constructed in wrong namespace");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRBool isAbsolutelyPositioned = PR_FALSE;
|
||||
|
@ -7465,7 +7465,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) &&
|
||||
((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild)) &&
|
||||
(aNameSpaceID == nsSVGAtoms::nameSpaceID)) {
|
||||
(aNameSpaceID == kNameSpaceID_SVG)) {
|
||||
rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
|
|||
#include "nsIDocument.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
//focus
|
||||
|
|
|
@ -153,7 +153,6 @@
|
|||
// For style data reconstruction
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsIStyleFrameConstruction.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIBindingManager.h"
|
||||
#include "nsIMenuFrame.h"
|
||||
#include "nsITreeBoxObject.h"
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Force references to all of the symbols that we want exported from
|
||||
// the dll that are located in the .lib files we link with
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPrintContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPrintPreviewContext.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
void XXXNeverCalled()
|
||||
{
|
||||
nsIPresShell* ps;
|
||||
NS_NewPresShell(&ps);
|
||||
nsIPresContext* cx;
|
||||
NS_NewGalleyContext(&cx);
|
||||
nsIPrintPreviewContext *ppx;
|
||||
NS_NewPrintPreviewContext(&ppx);
|
||||
nsIPrintContext *px;
|
||||
NS_NewPrintContext(&px);
|
||||
nsIFrame* f;
|
||||
NS_NewTextFrame(ps, &f);
|
||||
NS_NewInlineFrame(ps, &f);
|
||||
NS_NewBRFrame(ps, &f);
|
||||
NS_NewWBRFrame(ps, &f);
|
||||
NS_NewHRFrame(ps, &f);
|
||||
NS_NewObjectFrame(ps, &f);
|
||||
NS_NewSpacerFrame(ps, &f);
|
||||
NS_NewHTMLFramesetFrame(ps, &f);
|
||||
NS_NewCanvasFrame(ps, &f);
|
||||
NS_NewScrollFrame(ps, &f);
|
||||
NS_NewSimplePageSequenceFrame(ps, &f);
|
||||
}
|
|
@ -62,7 +62,6 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIPresState.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsIPresState.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMNSHTMLOptionCollectn.h"
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче