зеркало из https://github.com/mozilla/pjs.git
Redesign wrappers a bit (bug #65237). Comment out nslogging stuff for now. Use mozilla's new GetBaseURI. Not part of default build. r=Pike.
This commit is contained in:
Родитель
417b8e6182
Коммит
4fc1e978ff
|
@ -36,7 +36,6 @@
|
|||
*/
|
||||
Attr::Attr(nsIDOMAttr* aAttr, Document* aOwner) : Node(aAttr, aOwner)
|
||||
{
|
||||
nsAttr = aAttr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,25 +45,6 @@ Attr::~Attr()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the wrapped nsIDOMAttr.
|
||||
*/
|
||||
nsIDOMAttr* Attr::getNSAttr()
|
||||
{
|
||||
return nsAttr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aAttr the nsIDOMAttr you want to wrap
|
||||
*/
|
||||
void Attr::setNSObj(nsIDOMAttr* aAttr)
|
||||
{
|
||||
Node::setNSObj(aAttr);
|
||||
nsAttr = aAttr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMAttr::GetName to retrieve the name of this attribute.
|
||||
*
|
||||
|
@ -72,8 +52,11 @@ void Attr::setNSObj(nsIDOMAttr* aAttr)
|
|||
*/
|
||||
const String& Attr::getName()
|
||||
{
|
||||
NSI_FROM_TX(Attr)
|
||||
|
||||
nodeName.clear();
|
||||
nsAttr->GetName(nodeName.getNSString());
|
||||
if (nsAttr)
|
||||
nsAttr->GetName(nodeName.getNSString());
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
|
@ -85,9 +68,11 @@ const String& Attr::getName()
|
|||
*/
|
||||
MBool Attr::getSpecified() const
|
||||
{
|
||||
MBool specified;
|
||||
NSI_FROM_TX(Attr)
|
||||
MBool specified = MB_FALSE;
|
||||
|
||||
nsAttr->GetSpecified(&specified);
|
||||
if (nsAttr)
|
||||
nsAttr->GetSpecified(&specified);
|
||||
return specified;
|
||||
}
|
||||
|
||||
|
@ -98,8 +83,11 @@ MBool Attr::getSpecified() const
|
|||
*/
|
||||
const String& Attr::getValue()
|
||||
{
|
||||
NSI_FROM_TX(Attr)
|
||||
|
||||
nodeValue.clear();
|
||||
nsAttr->GetValue(nodeValue.getNSString());
|
||||
if (nsAttr)
|
||||
nsAttr->GetValue(nodeValue.getNSString());
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
@ -110,5 +98,8 @@ const String& Attr::getValue()
|
|||
*/
|
||||
void Attr::setValue(const String& aNewValue)
|
||||
{
|
||||
nsAttr->SetValue(aNewValue.getConstNSString());
|
||||
NSI_FROM_TX(Attr)
|
||||
|
||||
if (nsAttr)
|
||||
nsAttr->SetValue(aNewValue.getConstNSString());
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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/
|
||||
*
|
||||
* The program provided "as is" without any warranty express or
|
||||
* implied, including the warranty of non-infringement and the implied
|
||||
* warranties of merchantibility and fitness for a particular purpose.
|
||||
* The Copyright owner will not be liable for any damages suffered by
|
||||
* you as a result of using the Program. In no event will the Copyright
|
||||
* owner be liable for any special, indirect or consequential damages or
|
||||
* lost profits even if the Copyright owner has been advised of the
|
||||
* possibility of their occurrence.
|
||||
*
|
||||
* Please see release.txt distributed with this file for more information.
|
||||
*
|
||||
* Contributor(s): Tom Kneeland
|
||||
* Peter Van der Beken <peter.vanderbeken@pandora.be>
|
||||
*
|
||||
*/
|
||||
|
||||
/* Implementation of the wrapper class to convert the Mozilla nsIDOMCDATASection
|
||||
interface into a TransforMIIX CDATASection interface.
|
||||
*/
|
||||
|
||||
#include "mozilladom.h"
|
||||
|
||||
/**
|
||||
* Construct a text object with the specified Mozilla object and document owner.
|
||||
*
|
||||
* @param aCdataSection the nsIDOMCDATASection you want to wrap
|
||||
* @param aOwner the document that owns this object
|
||||
*/
|
||||
CDATASection::CDATASection(nsIDOMCDATASection* aCdataSection, Document* aOwner) :
|
||||
Text(aCdataSection, aOwner)
|
||||
{
|
||||
nsCDATASection = aCdataSection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
CDATASection::~CDATASection()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aCdataSection the nsIDOMCDATASection you want to wrap
|
||||
*/
|
||||
void CDATASection::setNSObj(nsIDOMCDATASection* aCdataSection)
|
||||
{
|
||||
Text::setNSObj(aCdataSection);
|
||||
nsCDATASection = aCdataSection;
|
||||
}
|
|
@ -37,7 +37,6 @@
|
|||
CharacterData::CharacterData(nsIDOMCharacterData* aCharData, Document* aOwner) :
|
||||
Node(aCharData, aOwner)
|
||||
{
|
||||
nsCharacterData = aCharData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +46,6 @@ CharacterData::~CharacterData()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aCharData the nsIDOMCharacterData you want to wrap
|
||||
*/
|
||||
void CharacterData::setNSObj(nsIDOMCharacterData* aCharData)
|
||||
{
|
||||
Node::setNSObj(aCharData);
|
||||
nsCharacterData = aCharData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMCharacterData::GetData to retrieve the character data.
|
||||
*
|
||||
|
@ -65,8 +53,11 @@ void CharacterData::setNSObj(nsIDOMCharacterData* aCharData)
|
|||
*/
|
||||
const String& CharacterData::getData()
|
||||
{
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
nodeValue.clear();
|
||||
nsCharacterData->GetData(nodeValue.getNSString());
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->GetData(nodeValue.getNSString());
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
@ -77,7 +68,10 @@ const String& CharacterData::getData()
|
|||
*/
|
||||
void CharacterData::setData(const String& aData)
|
||||
{
|
||||
nsCharacterData->SetData(aData.getConstNSString());
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->SetData(aData.getConstNSString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,9 +81,11 @@ void CharacterData::setData(const String& aData)
|
|||
*/
|
||||
Int32 CharacterData::getLength() const
|
||||
{
|
||||
NSI_FROM_TX(CharacterData)
|
||||
UInt32 length = 0;
|
||||
|
||||
nsCharacterData->GetLength(&length);
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->GetLength(&length);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
@ -106,8 +102,11 @@ Int32 CharacterData::getLength() const
|
|||
String& CharacterData::substringData(Int32 aOffset, Int32 aCount,
|
||||
String& aDest)
|
||||
{
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
aDest.clear();
|
||||
nsCharacterData->SubstringData(aOffset, aCount, aDest.getNSString());
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->SubstringData(aOffset, aCount, aDest.getNSString());
|
||||
return aDest;
|
||||
}
|
||||
|
||||
|
@ -118,7 +117,10 @@ String& CharacterData::substringData(Int32 aOffset, Int32 aCount,
|
|||
*/
|
||||
void CharacterData::appendData(const String& aSource)
|
||||
{
|
||||
nsCharacterData->AppendData(aSource.getConstNSString());
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->AppendData(aSource.getConstNSString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +131,10 @@ void CharacterData::appendData(const String& aSource)
|
|||
*/
|
||||
void CharacterData::insertData(Int32 aOffset, const String& aSource)
|
||||
{
|
||||
nsCharacterData->InsertData(aOffset, aSource.getConstNSString());
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->InsertData(aOffset, aSource.getConstNSString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +145,10 @@ void CharacterData::insertData(Int32 aOffset, const String& aSource)
|
|||
*/
|
||||
void CharacterData::deleteData(Int32 aOffset, Int32 aCount)
|
||||
{
|
||||
nsCharacterData->DeleteData(aOffset, aCount);
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->DeleteData(aOffset, aCount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,5 +161,8 @@ void CharacterData::deleteData(Int32 aOffset, Int32 aCount)
|
|||
void CharacterData::replaceData(Int32 aOffset, Int32 aCount,
|
||||
const String& aSource)
|
||||
{
|
||||
nsCharacterData->ReplaceData(aOffset, aCount, aSource.getConstNSString());
|
||||
NSI_FROM_TX(CharacterData)
|
||||
|
||||
if (nsCharacterData)
|
||||
nsCharacterData->ReplaceData(aOffset, aCount, aSource.getConstNSString());
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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/
|
||||
*
|
||||
* The program provided "as is" without any warranty express or
|
||||
* implied, including the warranty of non-infringement and the implied
|
||||
* warranties of merchantibility and fitness for a particular purpose.
|
||||
* The Copyright owner will not be liable for any damages suffered by
|
||||
* you as a result of using the Program. In no event will the Copyright
|
||||
* owner be liable for any special, indirect or consequential damages or
|
||||
* lost profits even if the Copyright owner has been advised of the
|
||||
* possibility of their occurrence.
|
||||
*
|
||||
* Please see release.txt distributed with this file for more information.
|
||||
*
|
||||
* Contributor(s): Tom Kneeland
|
||||
* Peter Van der Beken <peter.vanderbeken@pandora.be>
|
||||
*
|
||||
*/
|
||||
|
||||
/* Implementation of the wrapper class to convert the Mozilla nsIDOMComment
|
||||
interface into a TransforMIIX Comment interface.
|
||||
*/
|
||||
|
||||
#include "mozilladom.h"
|
||||
|
||||
/**
|
||||
* Construct a wrapper with the specified Mozilla object and document owner.
|
||||
*
|
||||
* @param aComment the nsIDOMComment you want to wrap
|
||||
* @param aOwner the document that owns this object
|
||||
*/
|
||||
Comment::Comment(nsIDOMComment* aComment, Document* aOwner) :
|
||||
CharacterData(aComment, aOwner)
|
||||
{
|
||||
nsComment = aComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
Comment::~Comment()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aComment the nsIDOMComment you want to wrap
|
||||
*/
|
||||
void Comment::setNSObj(nsIDOMComment* aComment)
|
||||
{
|
||||
CharacterData::setNSObj(aComment);
|
||||
nsComment = aComment;
|
||||
}
|
|
@ -39,7 +39,6 @@ DOMImplementation::DOMImplementation(nsIDOMDOMImplementation* aDomImpl,
|
|||
Document* aOwner) :
|
||||
MozillaObjectWrapper(aDomImpl, aOwner)
|
||||
{
|
||||
nsDOMImpl = aDomImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,17 +48,6 @@ DOMImplementation::~DOMImplementation()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aDomImpl the nsIDOMDOMImplementation you want to wrap
|
||||
*/
|
||||
void DOMImplementation::setNSObj(nsIDOMDOMImplementation* aDomImpl)
|
||||
{
|
||||
MozillaObjectWrapper::setNSObj(aDomImpl);
|
||||
nsDOMImpl = aDomImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the mozilla object for the requested feature, and return the
|
||||
* result to the caller.
|
||||
|
@ -70,10 +58,12 @@ void DOMImplementation::setNSObj(nsIDOMDOMImplementation* aDomImpl)
|
|||
MBool DOMImplementation::hasFeature(const String& aFeature,
|
||||
const String& aVersion) const
|
||||
{
|
||||
NSI_FROM_TX(DOMImplementation)
|
||||
MBool bHasFeature = MB_FALSE;
|
||||
|
||||
nsDOMImpl->HasFeature(aFeature.getConstNSString(), aVersion.getConstNSString(),
|
||||
&bHasFeature);
|
||||
if (nsDOMImplementation)
|
||||
nsDOMImplementation->HasFeature(aFeature.getConstNSString(), aVersion.getConstNSString(),
|
||||
&bHasFeature);
|
||||
|
||||
return bHasFeature;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ Document::Document() : Node(NULL, NULL)
|
|||
res = implementation->CreateDocument(emptyStr, emptyStr, nsnull,
|
||||
getter_AddRefs(document));
|
||||
//if (NS_FAILED(res)) return NULL;
|
||||
nsDocument = document;
|
||||
wrapperHashTable = new nsObjectHashtable(nsnull, nsnull, DeleteWrapper, nsnull);
|
||||
bInHashTableDeletion = PR_FALSE;
|
||||
addWrapper(this);
|
||||
|
@ -71,7 +70,6 @@ Document::Document() : Node(NULL, NULL)
|
|||
*/
|
||||
Document::Document(nsIDOMDocument* aDocument) : Node(aDocument, this)
|
||||
{
|
||||
nsDocument = aDocument;
|
||||
wrapperHashTable = new nsObjectHashtable(nsnull, nsnull, DeleteWrapper, nsnull);
|
||||
bInHashTableDeletion = PR_FALSE;
|
||||
addWrapper(this);
|
||||
|
@ -87,17 +85,6 @@ Document::~Document()
|
|||
delete wrapperHashTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aDocument the nsIDOMDocument you want to wrap
|
||||
*/
|
||||
void Document::setNSObj(nsIDOMDocument* aDocument)
|
||||
{
|
||||
Node::setNSObj(aDocument);
|
||||
nsDocument = aDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags wether the document is deleting the wrapper hash table and the objects
|
||||
* that it contains.
|
||||
|
@ -117,11 +104,8 @@ PRBool Document::inHashTableDeletion()
|
|||
*/
|
||||
Element* Document::getDocumentElement()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMElement> theElement;
|
||||
Element* elemWrapper = NULL;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->GetDocumentElement(
|
||||
getter_AddRefs(theElement))))
|
||||
|
@ -137,11 +121,9 @@ Element* Document::getDocumentElement()
|
|||
*/
|
||||
DocumentType* Document::getDoctype()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMDocumentType> theDocType;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->GetDoctype(getter_AddRefs(theDocType))))
|
||||
return (DocumentType*)createWrapper(theDocType);
|
||||
else
|
||||
|
@ -156,11 +138,9 @@ DocumentType* Document::getDoctype()
|
|||
*/
|
||||
DOMImplementation* Document::getImplementation()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMDOMImplementation> theImpl;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->GetImplementation(getter_AddRefs(theImpl))))
|
||||
return createDOMImplementation(theImpl);
|
||||
else
|
||||
|
@ -174,11 +154,9 @@ DOMImplementation* Document::getImplementation()
|
|||
*/
|
||||
DocumentFragment* Document::createDocumentFragment()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMDocumentFragment> fragment;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateDocumentFragment(
|
||||
getter_AddRefs(fragment))))
|
||||
return createDocumentFragment(fragment);
|
||||
|
@ -194,23 +172,7 @@ DocumentFragment* Document::createDocumentFragment()
|
|||
*
|
||||
* @return the DocumentFragment
|
||||
*/
|
||||
DocumentFragment* Document::createDocumentFragment(
|
||||
nsIDOMDocumentFragment* aFragment)
|
||||
{
|
||||
DocumentFragment* docFragWrapper = NULL;
|
||||
|
||||
if (aFragment)
|
||||
{
|
||||
nsISupportsKey key(aFragment);
|
||||
docFragWrapper =
|
||||
(DocumentFragment*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!docFragWrapper)
|
||||
docFragWrapper = new DocumentFragment(aFragment, this);
|
||||
}
|
||||
|
||||
return docFragWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(DocumentFragment)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateElement to create an Element.
|
||||
|
@ -221,6 +183,7 @@ DocumentFragment* Document::createDocumentFragment(
|
|||
*/
|
||||
Element* Document::createElement(const String& aTagName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateElement(aTagName.getConstNSString(),
|
||||
|
@ -239,6 +202,7 @@ Element* Document::createElement(const String& aTagName)
|
|||
*/
|
||||
Element* Document::getElementById(const String aID)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->GetElementById(aID.getConstNSString(), getter_AddRefs(element))))
|
||||
|
@ -254,21 +218,7 @@ Element* Document::getElementById(const String aID)
|
|||
*
|
||||
* @return the Element
|
||||
*/
|
||||
Element* Document::createElement(nsIDOMElement* aElement)
|
||||
{
|
||||
Element* elemWrapper = NULL;
|
||||
|
||||
if (aElement)
|
||||
{
|
||||
nsISupportsKey key(aElement);
|
||||
elemWrapper = (Element*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!elemWrapper)
|
||||
elemWrapper = new Element(aElement, this);
|
||||
}
|
||||
|
||||
return elemWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(Element)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateElementNS to create an Element.
|
||||
|
@ -281,6 +231,7 @@ Element* Document::createElement(nsIDOMElement* aElement)
|
|||
Element* Document::createElementNS(const String& aNamespaceURI,
|
||||
const String& aTagName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateElementNS(
|
||||
|
@ -300,13 +251,36 @@ Element* Document::createElementNS(const String& aNamespaceURI,
|
|||
*/
|
||||
Attr* Document::createAttribute(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMAttr> attr;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateAttribute(aName.getConstNSString(),
|
||||
getter_AddRefs(attr))))
|
||||
return createAttribute(attr);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateAttributeNS to create an Attribute.
|
||||
*
|
||||
* @param aNamespaceURI the URI of the namespace for the element
|
||||
* @param aName the name of the attribute you want to create
|
||||
*
|
||||
* @return the Attribute
|
||||
*/
|
||||
Attr* Document::createAttributeNS(const String& aNamespaceURI,
|
||||
const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMAttr> attr;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (nsDocument->CreateAttribute(aName.getConstNSString(),
|
||||
getter_AddRefs(attr)) == NS_OK)
|
||||
if (NS_SUCCEEDED(nsDocument->CreateAttributeNS(
|
||||
aNamespaceURI.getConstNSString(), aName.getConstNSString(),
|
||||
getter_AddRefs(attr)) == NS_OK))
|
||||
return createAttribute(attr);
|
||||
else
|
||||
return NULL;
|
||||
|
@ -319,21 +293,7 @@ Attr* Document::createAttribute(const String& aName)
|
|||
*
|
||||
* @return the Attribute
|
||||
*/
|
||||
Attr* Document::createAttribute(nsIDOMAttr* aAttr)
|
||||
{
|
||||
Attr* attrWrapper = NULL;
|
||||
|
||||
if (aAttr)
|
||||
{
|
||||
nsISupportsKey key(aAttr);
|
||||
attrWrapper = (Attr*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!attrWrapper)
|
||||
attrWrapper = new Attr(aAttr, this);
|
||||
}
|
||||
|
||||
return attrWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER2(Attr, createAttribute)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateTextNode to create a Text node.
|
||||
|
@ -344,11 +304,9 @@ Attr* Document::createAttribute(nsIDOMAttr* aAttr)
|
|||
*/
|
||||
Text* Document::createTextNode(const String& aData)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMText> text;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (nsDocument->CreateTextNode(aData.getConstNSString(),
|
||||
getter_AddRefs(text)) == NS_OK)
|
||||
return createTextNode(text);
|
||||
|
@ -363,21 +321,7 @@ Text* Document::createTextNode(const String& aData)
|
|||
*
|
||||
* @return the Text node
|
||||
*/
|
||||
Text* Document::createTextNode(nsIDOMText* aText)
|
||||
{
|
||||
Text* textWrapper = NULL;
|
||||
|
||||
if (aText)
|
||||
{
|
||||
nsISupportsKey key(aText);
|
||||
textWrapper = (Text*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!textWrapper)
|
||||
textWrapper = new Text(aText, this);
|
||||
}
|
||||
|
||||
return textWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER2(Text, createTextNode)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateComment to create a Comment node.
|
||||
|
@ -388,11 +332,9 @@ Text* Document::createTextNode(nsIDOMText* aText)
|
|||
*/
|
||||
Comment* Document::createComment(const String& aData)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMComment> comment;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateComment(aData.getConstNSString(),
|
||||
getter_AddRefs(comment))))
|
||||
return createComment(comment);
|
||||
|
@ -407,21 +349,7 @@ Comment* Document::createComment(const String& aData)
|
|||
*
|
||||
* @return the Comment node
|
||||
*/
|
||||
Comment* Document::createComment(nsIDOMComment* aComment)
|
||||
{
|
||||
Comment* commentWrapper = NULL;
|
||||
|
||||
if (aComment)
|
||||
{
|
||||
nsISupportsKey key(aComment);
|
||||
commentWrapper = (Comment*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!commentWrapper)
|
||||
commentWrapper = new Comment(aComment, this);
|
||||
}
|
||||
|
||||
return commentWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(Comment)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateCDATASection to create a CDataSection.
|
||||
|
@ -432,11 +360,9 @@ Comment* Document::createComment(nsIDOMComment* aComment)
|
|||
*/
|
||||
CDATASection* Document::createCDATASection(const String& aData)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMCDATASection> cdata;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateCDATASection(aData.getConstNSString(),
|
||||
getter_AddRefs(cdata))))
|
||||
return createCDATASection(cdata);
|
||||
|
@ -452,21 +378,7 @@ CDATASection* Document::createCDATASection(const String& aData)
|
|||
*
|
||||
* @return the CDATASection node
|
||||
*/
|
||||
CDATASection* Document::createCDATASection(nsIDOMCDATASection* aCdata)
|
||||
{
|
||||
CDATASection* cdataWrapper = NULL;
|
||||
|
||||
if (aCdata)
|
||||
{
|
||||
nsISupportsKey key(aCdata);
|
||||
cdataWrapper = (CDATASection*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!cdataWrapper)
|
||||
cdataWrapper = new CDATASection(aCdata, this);
|
||||
}
|
||||
|
||||
return cdataWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(CDATASection)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateProcessingInstruction to create a
|
||||
|
@ -480,11 +392,9 @@ CDATASection* Document::createCDATASection(nsIDOMCDATASection* aCdata)
|
|||
ProcessingInstruction* Document::createProcessingInstruction(
|
||||
const String& aTarget, const String& aData)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMProcessingInstruction> pi;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateProcessingInstruction(
|
||||
aTarget.getConstNSString(), aData.getConstNSString(),
|
||||
getter_AddRefs(pi))))
|
||||
|
@ -501,22 +411,7 @@ ProcessingInstruction* Document::createProcessingInstruction(
|
|||
*
|
||||
* @return the ProcessingInstruction node
|
||||
*/
|
||||
ProcessingInstruction* Document::createProcessingInstruction(
|
||||
nsIDOMProcessingInstruction* aPi)
|
||||
{
|
||||
ProcessingInstruction* piWrapper;
|
||||
|
||||
if (aPi)
|
||||
{
|
||||
nsISupportsKey key(aPi);
|
||||
piWrapper = (ProcessingInstruction*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!piWrapper)
|
||||
piWrapper = new ProcessingInstruction(aPi, this);
|
||||
}
|
||||
|
||||
return piWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(ProcessingInstruction)
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocument::CreateEntityReference to create a EntityReference.
|
||||
|
@ -527,11 +422,9 @@ ProcessingInstruction* Document::createProcessingInstruction(
|
|||
*/
|
||||
EntityReference* Document::createEntityReference(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Document)
|
||||
nsCOMPtr<nsIDOMEntityReference> entityRef;
|
||||
|
||||
if (nsDocument == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocument->CreateEntityReference(aName.getConstNSString(),
|
||||
getter_AddRefs(entityRef))))
|
||||
return createEntityReference(entityRef);
|
||||
|
@ -547,22 +440,7 @@ EntityReference* Document::createEntityReference(const String& aName)
|
|||
*
|
||||
* @return the EntityReference
|
||||
*/
|
||||
EntityReference* Document::createEntityReference(
|
||||
nsIDOMEntityReference* aEntityRef)
|
||||
{
|
||||
EntityReference* entityWrapper = NULL;
|
||||
|
||||
if (aEntityRef)
|
||||
{
|
||||
nsISupportsKey key(aEntityRef);
|
||||
entityWrapper = (EntityReference*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!entityWrapper)
|
||||
entityWrapper = new EntityReference(aEntityRef, this);
|
||||
}
|
||||
|
||||
return entityWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(EntityReference)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMEntity, reuses an existing wrapper if possible.
|
||||
|
@ -571,21 +449,7 @@ EntityReference* Document::createEntityReference(
|
|||
*
|
||||
* @return the Entity
|
||||
*/
|
||||
Entity* Document::createEntity(nsIDOMEntity* aEntity)
|
||||
{
|
||||
Entity* entityWrapper = NULL;
|
||||
|
||||
if (aEntity)
|
||||
{
|
||||
nsISupportsKey key(aEntity);
|
||||
entityWrapper = (Entity*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!entityWrapper)
|
||||
entityWrapper = new Entity(aEntity, this);
|
||||
}
|
||||
|
||||
return entityWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(Entity)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMNode, reuses an existing wrapper if possible.
|
||||
|
@ -594,21 +458,7 @@ Entity* Document::createEntity(nsIDOMEntity* aEntity)
|
|||
*
|
||||
* @return the Node
|
||||
*/
|
||||
Node* Document::createNode(nsIDOMNode* aNode)
|
||||
{
|
||||
Node* nodeWrapper = NULL;
|
||||
|
||||
if (aNode)
|
||||
{
|
||||
nsISupportsKey key(aNode);
|
||||
nodeWrapper = (Node*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!nodeWrapper)
|
||||
nodeWrapper = new Node(aNode, this);
|
||||
}
|
||||
|
||||
return nodeWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(Node)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMNotation, reuses an existing wrapper if
|
||||
|
@ -618,21 +468,7 @@ Node* Document::createNode(nsIDOMNode* aNode)
|
|||
*
|
||||
* @return the Notation
|
||||
*/
|
||||
Notation* Document::createNotation(nsIDOMNotation* aNotation)
|
||||
{
|
||||
Notation* notationWrapper = NULL;
|
||||
|
||||
if (aNotation)
|
||||
{
|
||||
nsISupportsKey key(aNotation);
|
||||
notationWrapper = (Notation*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!notationWrapper)
|
||||
notationWrapper = new Notation(aNotation, this);
|
||||
}
|
||||
|
||||
return notationWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(Notation)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMDOMImplementation, reuses an existing wrapper if
|
||||
|
@ -642,22 +478,7 @@ Notation* Document::createNotation(nsIDOMNotation* aNotation)
|
|||
*
|
||||
* @return the DOMImplementation
|
||||
*/
|
||||
DOMImplementation* Document::createDOMImplementation(
|
||||
nsIDOMDOMImplementation* aImpl)
|
||||
{
|
||||
DOMImplementation* implWrapper = NULL;
|
||||
|
||||
if (aImpl)
|
||||
{
|
||||
nsISupportsKey key(aImpl);
|
||||
implWrapper = (DOMImplementation*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!implWrapper)
|
||||
implWrapper = new DOMImplementation(aImpl, this);
|
||||
}
|
||||
|
||||
return implWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(DOMImplementation)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMDocumentType, reuses an existing wrapper if
|
||||
|
@ -667,21 +488,7 @@ DOMImplementation* Document::createDOMImplementation(
|
|||
*
|
||||
* @return the DocumentType
|
||||
*/
|
||||
DocumentType* Document::createDocumentType(nsIDOMDocumentType* aDoctype)
|
||||
{
|
||||
DocumentType* doctypeWrapper = NULL;
|
||||
|
||||
if (aDoctype)
|
||||
{
|
||||
nsISupportsKey key(aDoctype);
|
||||
doctypeWrapper = (DocumentType*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!doctypeWrapper)
|
||||
doctypeWrapper = new DocumentType(aDoctype, this);
|
||||
}
|
||||
|
||||
return doctypeWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(DocumentType)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMNodeList, reuses an existing wrapper if
|
||||
|
@ -691,21 +498,7 @@ DocumentType* Document::createDocumentType(nsIDOMDocumentType* aDoctype)
|
|||
*
|
||||
* @return the NodeList
|
||||
*/
|
||||
NodeList* Document::createNodeList(nsIDOMNodeList* aList)
|
||||
{
|
||||
NodeList* listWrapper = NULL;
|
||||
|
||||
if (aList)
|
||||
{
|
||||
nsISupportsKey key(aList);
|
||||
listWrapper = (NodeList*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!listWrapper)
|
||||
listWrapper = new NodeList(aList, this);
|
||||
}
|
||||
|
||||
return listWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(NodeList)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMNamedNodeMap, reuses an existing wrapper if
|
||||
|
@ -715,21 +508,7 @@ NodeList* Document::createNodeList(nsIDOMNodeList* aList)
|
|||
*
|
||||
* @return the NamedNodeMap
|
||||
*/
|
||||
NamedNodeMap* Document::createNamedNodeMap(nsIDOMNamedNodeMap* aMap)
|
||||
{
|
||||
NamedNodeMap* mapWrapper = NULL;
|
||||
|
||||
if (aMap)
|
||||
{
|
||||
nsISupportsKey key(aMap);
|
||||
mapWrapper = (NamedNodeMap*)wrapperHashTable->Get(&key);
|
||||
|
||||
if (!mapWrapper)
|
||||
mapWrapper = new NamedNodeMap(aMap, this);
|
||||
}
|
||||
|
||||
return mapWrapper;
|
||||
}
|
||||
IMPL_CREATE_WRAPPER(NamedNodeMap)
|
||||
|
||||
/**
|
||||
* Create a wrapper for a nsIDOMNode, reuses an existing wrapper if possible.
|
||||
|
@ -851,11 +630,13 @@ MITREObject* Document::removeWrapper(MozillaObjectWrapper* aObject)
|
|||
|
||||
String Document::getBaseURI()
|
||||
{
|
||||
NSI_FROM_TX(Document)
|
||||
String url;
|
||||
|
||||
nsIURI* docURL = nsnull;
|
||||
nsCOMPtr<nsIDocument> sourceNsDocument(do_QueryInterface(nsDocument));
|
||||
sourceNsDocument->GetBaseURL(docURL);
|
||||
if (sourceNsDocument)
|
||||
sourceNsDocument->GetBaseURL(docURL);
|
||||
if (docURL) {
|
||||
char* urlString;
|
||||
docURL->GetSpec(&urlString);
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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/
|
||||
*
|
||||
* The program provided "as is" without any warranty express or
|
||||
* implied, including the warranty of non-infringement and the implied
|
||||
* warranties of merchantibility and fitness for a particular purpose.
|
||||
* The Copyright owner will not be liable for any damages suffered by
|
||||
* you as a result of using the Program. In no event will the Copyright
|
||||
* owner be liable for any special, indirect or consequential damages or
|
||||
* lost profits even if the Copyright owner has been advised of the
|
||||
* possibility of their occurrence.
|
||||
*
|
||||
* Please see release.txt distributed with this file for more information.
|
||||
*
|
||||
* Contributor(s): Tom Kneeland
|
||||
* Peter Van der Beken <peter.vanderbeken@pandora.be>
|
||||
*
|
||||
*/
|
||||
|
||||
/* Implementation of the wrapper class to convert the Mozilla
|
||||
nsIDOMDocumentFragment interface into a TransforMIIX DocumentFragment
|
||||
interface.
|
||||
*/
|
||||
|
||||
#include "mozilladom.h"
|
||||
|
||||
/**
|
||||
* Construct a wrapper with the specified Mozilla object and document owner.
|
||||
*
|
||||
* @param aDocFragment the nsIDOMDocumentFragment you want to wrap
|
||||
* @param aOwner the document that owns this object
|
||||
*/
|
||||
DocumentFragment::DocumentFragment(nsIDOMDocumentFragment* aDocFragment,
|
||||
Document* aOwner) :
|
||||
Node(aDocFragment, aOwner)
|
||||
{
|
||||
nsDocumentFragment = aDocFragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
DocumentFragment::~DocumentFragment()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aDocFragment the nsIDOMDocumentFragment you want to wrap
|
||||
*/
|
||||
void DocumentFragment::setNSObj(nsIDOMDocumentFragment* aDocFragment)
|
||||
{
|
||||
Node::setNSObj(aDocFragment);
|
||||
nsDocumentFragment = aDocFragment;
|
||||
}
|
|
@ -37,7 +37,6 @@
|
|||
DocumentType::DocumentType(nsIDOMDocumentType* aDocumentType, Document* aOwner):
|
||||
Node(aDocumentType, aOwner)
|
||||
{
|
||||
nsDocumentType = aDocumentType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +46,6 @@ DocumentType::~DocumentType()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aDocumentType the nsIDOMDocumentType you want to wrap
|
||||
*/
|
||||
void DocumentType::setNSObj(nsIDOMDocumentType* aDocumentType)
|
||||
{
|
||||
Node::setNSObj(aDocumentType);
|
||||
nsDocumentType = aDocumentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMDocumentType::GetName to get the name of the document type.
|
||||
*
|
||||
|
@ -65,8 +53,11 @@ void DocumentType::setNSObj(nsIDOMDocumentType* aDocumentType)
|
|||
*/
|
||||
const String& DocumentType::getName()
|
||||
{
|
||||
NSI_FROM_TX(DocumentType)
|
||||
|
||||
nodeName.clear();
|
||||
nsDocumentType->GetName(nodeName.getNSString());
|
||||
if (nsDocumentType)
|
||||
nsDocumentType->GetName(nodeName.getNSString());
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
|
@ -78,6 +69,7 @@ const String& DocumentType::getName()
|
|||
*/
|
||||
NamedNodeMap* DocumentType::getEntities()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(DocumentType)
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> tmpEntities;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocumentType->GetEntities(getter_AddRefs(tmpEntities))))
|
||||
|
@ -94,6 +86,7 @@ NamedNodeMap* DocumentType::getEntities()
|
|||
*/
|
||||
NamedNodeMap* DocumentType::getNotations()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(DocumentType)
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> notations;
|
||||
|
||||
if (NS_SUCCEEDED(nsDocumentType->GetNotations(getter_AddRefs(notations))))
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
Element::Element(nsIDOMElement* aElement, Document* aOwner) :
|
||||
Node(aElement, aOwner)
|
||||
{
|
||||
nsElement = aElement;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +46,6 @@ Element::~Element()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aElement the nsIDOMElement you want to wrap
|
||||
*/
|
||||
void Element::setNSObj(nsIDOMElement* aElement)
|
||||
{
|
||||
Node::setNSObj(aElement);
|
||||
nsElement = aElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMElement::GetTagName to retrieve the tag name for this element.
|
||||
*
|
||||
|
@ -65,8 +53,11 @@ void Element::setNSObj(nsIDOMElement* aElement)
|
|||
*/
|
||||
const String& Element::getTagName()
|
||||
{
|
||||
NSI_FROM_TX(Element)
|
||||
|
||||
nodeName.clear();
|
||||
nsElement->GetTagName(nodeName.getNSString());
|
||||
if (nsElement)
|
||||
nsElement->GetTagName(nodeName.getNSString());
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
|
@ -96,7 +87,10 @@ const String& Element::getAttribute(const String& aName)
|
|||
*/
|
||||
void Element::setAttribute(const String& aName, const String& aValue)
|
||||
{
|
||||
nsElement->SetAttribute(aName.getConstNSString(), aValue.getConstNSString());
|
||||
NSI_FROM_TX(Element)
|
||||
|
||||
if (nsElement)
|
||||
nsElement->SetAttribute(aName.getConstNSString(), aValue.getConstNSString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,8 +104,12 @@ void Element::setAttribute(const String& aName, const String& aValue)
|
|||
void Element::setAttributeNS(const String& aNamespaceURI, const String& aName,
|
||||
const String& aValue)
|
||||
{
|
||||
nsElement->SetAttributeNS(aNamespaceURI.getConstNSString(),
|
||||
aName.getConstNSString(), aValue.getConstNSString());
|
||||
NSI_FROM_TX(Element)
|
||||
|
||||
if (nsElement)
|
||||
nsElement->SetAttributeNS(aNamespaceURI.getConstNSString(),
|
||||
aName.getConstNSString(),
|
||||
aValue.getConstNSString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,21 +121,25 @@ void Element::setAttributeNS(const String& aNamespaceURI, const String& aName,
|
|||
*/
|
||||
void Element::removeAttribute(const String& aName)
|
||||
{
|
||||
nsCOMPtr<nsIDOMAttr> attr;
|
||||
Attr* attrWrapper = NULL;
|
||||
NSI_FROM_TX(Element)
|
||||
|
||||
// First, get the nsIDOMAttr object from the nsIDOMElement object
|
||||
nsElement->GetAttributeNode(aName.getConstNSString(), getter_AddRefs(attr));
|
||||
if (nsElement) {
|
||||
nsCOMPtr<nsIDOMAttr> attr;
|
||||
Attr* attrWrapper = NULL;
|
||||
|
||||
// Second, remove the attribute wrapper object from the hash table if it is
|
||||
// there. It might not be if the attribute was created using
|
||||
// Element::setAttribute. If it was removed, then delete it.
|
||||
attrWrapper = (Attr*)ownerDocument->removeWrapper(attr);
|
||||
if (attrWrapper)
|
||||
delete attrWrapper;
|
||||
// First, get the nsIDOMAttr object from the nsIDOMElement object
|
||||
nsElement->GetAttributeNode(aName.getConstNSString(), getter_AddRefs(attr));
|
||||
|
||||
// Lastly, have the Mozilla object remove the attribute
|
||||
nsElement->RemoveAttribute(aName.getConstNSString());
|
||||
// Second, remove the attribute wrapper object from the hash table if it is
|
||||
// there. It might not be if the attribute was created using
|
||||
// Element::setAttribute. If it was removed, then delete it.
|
||||
attrWrapper = (Attr*)ownerDocument->removeWrapper(attr);
|
||||
if (attrWrapper)
|
||||
delete attrWrapper;
|
||||
|
||||
// Lastly, have the Mozilla object remove the attribute
|
||||
nsElement->RemoveAttribute(aName.getConstNSString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,6 +152,7 @@ void Element::removeAttribute(const String& aName)
|
|||
*/
|
||||
Attr* Element::getAttributeNode(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMAttr> attr;
|
||||
|
||||
if (NS_SUCCEEDED(nsElement->GetAttributeNode(aName.getConstNSString(),
|
||||
|
@ -169,9 +172,11 @@ Attr* Element::getAttributeNode(const String& aName)
|
|||
*/
|
||||
Attr* Element::setAttributeNode(Attr* aNewAttr)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMAttr> newAttr(do_QueryInterface(aNewAttr->getNSObj()));
|
||||
nsCOMPtr<nsIDOMAttr> returnAttr;
|
||||
|
||||
if (NS_SUCCEEDED(nsElement->SetAttributeNode(aNewAttr->getNSAttr(),
|
||||
if (NS_SUCCEEDED(nsElement->SetAttributeNode(newAttr,
|
||||
getter_AddRefs(returnAttr))))
|
||||
return (Attr*)ownerDocument->createWrapper(returnAttr);
|
||||
else
|
||||
|
@ -189,10 +194,12 @@ Attr* Element::setAttributeNode(Attr* aNewAttr)
|
|||
*/
|
||||
Attr* Element::removeAttributeNode(Attr* aOldAttr)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMAttr> oldAttr(do_QueryInterface(aOldAttr->getNSObj()));
|
||||
nsCOMPtr<nsIDOMAttr> removedAttr;
|
||||
Attr* attrWrapper = NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsElement->RemoveAttributeNode(aOldAttr->getNSAttr(),
|
||||
if (NS_SUCCEEDED(nsElement->RemoveAttributeNode(oldAttr,
|
||||
getter_AddRefs(removedAttr))))
|
||||
{
|
||||
attrWrapper = (Attr*)ownerDocument->removeWrapper(aOldAttr);
|
||||
|
@ -214,6 +221,7 @@ Attr* Element::removeAttributeNode(Attr* aOldAttr)
|
|||
*/
|
||||
NodeList* Element::getElementsByTagName(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Element)
|
||||
nsCOMPtr<nsIDOMNodeList> list;
|
||||
|
||||
if (NS_SUCCEEDED(nsElement->GetElementsByTagName(aName.getConstNSString(),
|
||||
|
@ -228,5 +236,8 @@ NodeList* Element::getElementsByTagName(const String& aName)
|
|||
*/
|
||||
void Element::normalize()
|
||||
{
|
||||
nsElement->Normalize();
|
||||
NSI_FROM_TX(Element)
|
||||
|
||||
if (nsElement)
|
||||
nsElement->Normalize();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
*/
|
||||
Entity::Entity(nsIDOMEntity* aEntity, Document* aOwner) : Node (aEntity, aOwner)
|
||||
{
|
||||
nsEntity = aEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,17 +45,6 @@ Entity::~Entity()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aEntity the nsIDOMEntity you want to wrap
|
||||
*/
|
||||
void Entity::setNSObj(nsIDOMEntity* aEntity)
|
||||
{
|
||||
Node::setNSObj(aEntity);
|
||||
nsEntity = aEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMElement::GetPublicId to retrieve the public id for this entity.
|
||||
*
|
||||
|
@ -64,9 +52,12 @@ void Entity::setNSObj(nsIDOMEntity* aEntity)
|
|||
*/
|
||||
const String& Entity::getPublicId()
|
||||
{
|
||||
publicId.clear();
|
||||
nsEntity->GetPublicId(publicId.getNSString());
|
||||
return publicId;
|
||||
NSI_FROM_TX(Entity)
|
||||
|
||||
publicId.clear();
|
||||
if (nsEntity)
|
||||
nsEntity->GetPublicId(publicId.getNSString());
|
||||
return publicId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,9 +67,12 @@ const String& Entity::getPublicId()
|
|||
*/
|
||||
const String& Entity::getSystemId()
|
||||
{
|
||||
systemId.clear();
|
||||
nsEntity->GetSystemId(systemId.getNSString());
|
||||
return systemId;
|
||||
NSI_FROM_TX(Entity)
|
||||
|
||||
systemId.clear();
|
||||
if (nsEntity)
|
||||
nsEntity->GetSystemId(systemId.getNSString());
|
||||
return systemId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +83,10 @@ const String& Entity::getSystemId()
|
|||
*/
|
||||
const String& Entity::getNotationName()
|
||||
{
|
||||
notationName.clear();
|
||||
nsEntity->GetNotationName(notationName.getNSString());
|
||||
return notationName;
|
||||
NSI_FROM_TX(Entity)
|
||||
|
||||
notationName.clear();
|
||||
if (nsEntity)
|
||||
nsEntity->GetNotationName(notationName.getNSString());
|
||||
return notationName;
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.0 (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/
|
||||
*
|
||||
* The program provided "as is" without any warranty express or
|
||||
* implied, including the warranty of non-infringement and the implied
|
||||
* warranties of merchantibility and fitness for a particular purpose.
|
||||
* The Copyright owner will not be liable for any damages suffered by
|
||||
* you as a result of using the Program. In no event will the Copyright
|
||||
* owner be liable for any special, indirect or consequential damages or
|
||||
* lost profits even if the Copyright owner has been advised of the
|
||||
* possibility of their occurrence.
|
||||
*
|
||||
* Please see release.txt distributed with this file for more information.
|
||||
*
|
||||
* Contributor(s): Tom Kneeland
|
||||
* Peter Van der Beken <peter.vanderbeken@pandora.be>
|
||||
*
|
||||
*/
|
||||
|
||||
/* Implementation of the wrapper class to convert the Mozilla
|
||||
nsIDOMEntityReference interface into a TransforMIIX EntityReference
|
||||
interface.
|
||||
*/
|
||||
|
||||
#include "mozilladom.h"
|
||||
|
||||
/**
|
||||
* Construct a wrapper with the specified Mozilla object and document owner.
|
||||
*
|
||||
* @param aEntityReference the nsIDOMEntityReference you want to wrap
|
||||
* @param aOwner the document that owns this object
|
||||
*/
|
||||
EntityReference::EntityReference(nsIDOMEntityReference* aEntityReference,
|
||||
Document* aOwner) : Node(aEntityReference, aOwner)
|
||||
{
|
||||
nsEntityReference = aEntityReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
EntityReference::~EntityReference()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aEntityReference the nsIDOMEntityReference you want to wrap
|
||||
*/
|
||||
void EntityReference::setNSObj(nsIDOMEntityReference* aEntityReference)
|
||||
{
|
||||
Node::setNSObj(aEntityReference);
|
||||
nsEntityReference = aEntityReference;
|
||||
}
|
|
@ -38,7 +38,6 @@ NamedNodeMap::NamedNodeMap(nsIDOMNamedNodeMap* aNamedNodeMap,
|
|||
Document* aOwner) :
|
||||
MozillaObjectWrapper(aNamedNodeMap, aOwner)
|
||||
{
|
||||
nsNamedNodeMap = aNamedNodeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,17 +47,6 @@ NamedNodeMap::~NamedNodeMap()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aNamedNodeMap the nsIDOMNamedNodeMap you want to wrap
|
||||
*/
|
||||
void NamedNodeMap::setNSObj(nsIDOMNamedNodeMap* aNamedNodeMap)
|
||||
{
|
||||
MozillaObjectWrapper::setNSObj(aNamedNodeMap);
|
||||
nsNamedNodeMap = aNamedNodeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMNamedNodeMap::GetNamedItem to get the node with the specified
|
||||
* name.
|
||||
|
@ -69,6 +57,7 @@ void NamedNodeMap::setNSObj(nsIDOMNamedNodeMap* aNamedNodeMap)
|
|||
*/
|
||||
Node* NamedNodeMap::getNamedItem(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NamedNodeMap)
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->GetNamedItem(aName.getConstNSString(),
|
||||
|
@ -87,9 +76,11 @@ Node* NamedNodeMap::getNamedItem(const String& aName)
|
|||
*/
|
||||
Node* NamedNodeMap::setNamedItem(Node* aNode)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NamedNodeMap)
|
||||
nsCOMPtr<nsIDOMNode> nsNode(do_QueryInterface(aNode->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->SetNamedItem(aNode->getNSNode(),
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->SetNamedItem(nsNode,
|
||||
getter_AddRefs(node))))
|
||||
return ownerDocument->createWrapper(node);
|
||||
else
|
||||
|
@ -106,6 +97,7 @@ Node* NamedNodeMap::setNamedItem(Node* aNode)
|
|||
*/
|
||||
Node* NamedNodeMap::removeNamedItem(const String& aName)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NamedNodeMap)
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->RemoveNamedItem(aName.getConstNSString(),
|
||||
|
@ -124,6 +116,7 @@ Node* NamedNodeMap::removeNamedItem(const String& aName)
|
|||
*/
|
||||
Node* NamedNodeMap::item(UInt32 aIndex)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NamedNodeMap)
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNamedNodeMap->Item(aIndex, getter_AddRefs(node))))
|
||||
|
@ -139,8 +132,10 @@ Node* NamedNodeMap::item(UInt32 aIndex)
|
|||
*/
|
||||
UInt32 NamedNodeMap::getLength()
|
||||
{
|
||||
NSI_FROM_TX(NamedNodeMap)
|
||||
UInt32 length = 0;
|
||||
|
||||
nsNamedNodeMap->GetLength(&length);
|
||||
if (nsNamedNodeMap)
|
||||
nsNamedNodeMap->GetLength(&length);
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ Node::Node(nsIDOMNode* aNode, Document* aOwner) :
|
|||
MozillaObjectWrapper(aNode, aOwner)
|
||||
{
|
||||
MOZ_COUNT_CTOR(Node);
|
||||
nsNode = aNode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,6 +60,8 @@ Node::~Node()
|
|||
*/
|
||||
void Node::setNSObj(nsIDOMNode* aNode)
|
||||
{
|
||||
NSI_FROM_TX(Node)
|
||||
|
||||
// First we must remove this wrapper from the document hash table since we
|
||||
// don't want to be associated with the existing nsIDOM* object anymore
|
||||
if (ownerDocument && nsNode)
|
||||
|
@ -68,34 +69,12 @@ void Node::setNSObj(nsIDOMNode* aNode)
|
|||
|
||||
// Now assume control of the new node
|
||||
MozillaObjectWrapper::setNSObj(aNode);
|
||||
nsNode = aNode;
|
||||
|
||||
// Finally, place our selves back in the hash table
|
||||
if (ownerDocument && aNode)
|
||||
ownerDocument->addWrapper(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper and set document owner.
|
||||
*
|
||||
* @param aNode the nsIDOMNode you want to wrap
|
||||
*/
|
||||
void Node::setNSObj(nsIDOMNode* aNode, Document* aOwner)
|
||||
{
|
||||
MozillaObjectWrapper::setNSObj(aNode, aOwner);
|
||||
nsNode = aNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Mozilla object wrapped with this wrapper.
|
||||
*
|
||||
* @return the Mozilla object wrapped with this wrapper
|
||||
*/
|
||||
nsIDOMNode* Node::getNSNode()
|
||||
{
|
||||
return nsNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMNode::GetNodeName to get the node's name.
|
||||
*
|
||||
|
@ -103,8 +82,11 @@ nsIDOMNode* Node::getNSNode()
|
|||
*/
|
||||
const String& Node::getNodeName()
|
||||
{
|
||||
NSI_FROM_TX(Node)
|
||||
|
||||
nodeName.clear();
|
||||
nsNode->GetNodeName(nodeName.getNSString());
|
||||
if (nsNode)
|
||||
nsNode->GetNodeName(nodeName.getNSString());
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
|
@ -115,8 +97,11 @@ const String& Node::getNodeName()
|
|||
*/
|
||||
const String& Node::getNodeValue()
|
||||
{
|
||||
NSI_FROM_TX(Node)
|
||||
|
||||
nodeValue.clear();
|
||||
nsNode->GetNodeValue(nodeValue.getNSString());
|
||||
if (nsNode)
|
||||
nsNode->GetNodeValue(nodeValue.getNSString());
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
|
@ -127,12 +112,11 @@ const String& Node::getNodeValue()
|
|||
*/
|
||||
unsigned short Node::getNodeType() const
|
||||
{
|
||||
unsigned short nodeType;
|
||||
NSI_FROM_TX(Node)
|
||||
unsigned short nodeType = 0;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return 0;
|
||||
|
||||
nsNode->GetNodeType(&nodeType);
|
||||
if (nsNode)
|
||||
nsNode->GetNodeType(&nodeType);
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
|
@ -143,11 +127,9 @@ unsigned short Node::getNodeType() const
|
|||
*/
|
||||
Node* Node::getParentNode()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> tmpParent;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetParentNode(getter_AddRefs(tmpParent))))
|
||||
return ownerDocument->createWrapper(tmpParent);
|
||||
else
|
||||
|
@ -161,11 +143,9 @@ Node* Node::getParentNode()
|
|||
*/
|
||||
NodeList* Node::getChildNodes()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNodeList> tmpNodeList;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetChildNodes(getter_AddRefs(tmpNodeList))))
|
||||
return (NodeList*)ownerDocument->createNodeList(tmpNodeList);
|
||||
else
|
||||
|
@ -179,11 +159,9 @@ NodeList* Node::getChildNodes()
|
|||
*/
|
||||
Node* Node::getFirstChild()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> tmpFirstChild;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetFirstChild(getter_AddRefs(tmpFirstChild))))
|
||||
return ownerDocument->createWrapper(tmpFirstChild);
|
||||
else
|
||||
|
@ -197,15 +175,13 @@ Node* Node::getFirstChild()
|
|||
*/
|
||||
Node* Node::getLastChild()
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> tmpLastChild;
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> tmpLastChild;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetLastChild(getter_AddRefs(tmpLastChild))))
|
||||
return ownerDocument->createWrapper(tmpLastChild);
|
||||
else
|
||||
return NULL;
|
||||
if (NS_SUCCEEDED(nsNode->GetLastChild(getter_AddRefs(tmpLastChild))))
|
||||
return ownerDocument->createWrapper(tmpLastChild);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,11 +191,9 @@ Node* Node::getLastChild()
|
|||
*/
|
||||
Node* Node::getPreviousSibling()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> tmpPrevSib;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetPreviousSibling(getter_AddRefs(tmpPrevSib))))
|
||||
return ownerDocument->createWrapper(tmpPrevSib);
|
||||
else
|
||||
|
@ -233,11 +207,9 @@ Node* Node::getPreviousSibling()
|
|||
*/
|
||||
Node* Node::getNextSibling()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> tmpNextSib;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetNextSibling(getter_AddRefs(tmpNextSib))))
|
||||
return ownerDocument->createWrapper(tmpNextSib);
|
||||
else
|
||||
|
@ -251,11 +223,9 @@ Node* Node::getNextSibling()
|
|||
*/
|
||||
NamedNodeMap* Node::getAttributes()
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> tmpAttributes;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->GetAttributes(getter_AddRefs(tmpAttributes))))
|
||||
return (NamedNodeMap*)ownerDocument->createNamedNodeMap(tmpAttributes);
|
||||
else
|
||||
|
@ -279,7 +249,9 @@ Document* Node::getOwnerDocument()
|
|||
*/
|
||||
void Node::setNodeValue(const String& aNewNodeValue)
|
||||
{
|
||||
if (nsNode != NULL)
|
||||
NSI_FROM_TX(Node)
|
||||
|
||||
if (nsNode)
|
||||
nsNode->SetNodeValue(aNewNodeValue.getConstNSString());
|
||||
}
|
||||
|
||||
|
@ -293,13 +265,13 @@ void Node::setNodeValue(const String& aNewNodeValue)
|
|||
*/
|
||||
Node* Node::insertBefore(Node* aNewChild, Node* aRefChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> refChild(do_QueryInterface(aRefChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->InsertBefore(aNewChild->getNSNode(),
|
||||
aRefChild->getNSNode(), getter_AddRefs(returnValue))))
|
||||
if (NS_SUCCEEDED(nsNode->InsertBefore(newChild, refChild,
|
||||
getter_AddRefs(returnValue))))
|
||||
return ownerDocument->createWrapper(returnValue);
|
||||
else
|
||||
return NULL;
|
||||
|
@ -315,13 +287,13 @@ Node* Node::insertBefore(Node* aNewChild, Node* aRefChild)
|
|||
*/
|
||||
Node* Node::replaceChild(Node* aNewChild, Node* aOldChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(aOldChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->ReplaceChild(aNewChild->getNSNode(),
|
||||
aOldChild->getNSNode(), getter_AddRefs(returnValue))))
|
||||
if (NS_SUCCEEDED(nsNode->ReplaceChild(newChild,
|
||||
oldChild, getter_AddRefs(returnValue))))
|
||||
return (Node*)ownerDocument->removeWrapper(returnValue.get());
|
||||
else
|
||||
return NULL;
|
||||
|
@ -336,12 +308,11 @@ Node* Node::replaceChild(Node* aNewChild, Node* aOldChild)
|
|||
*/
|
||||
Node* Node::removeChild(Node* aOldChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> oldChild(do_QueryInterface(aOldChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->RemoveChild(aOldChild->getNSNode(),
|
||||
if (NS_SUCCEEDED(nsNode->RemoveChild(oldChild,
|
||||
getter_AddRefs(returnValue))))
|
||||
return (Node*)ownerDocument->removeWrapper(returnValue.get());
|
||||
else
|
||||
|
@ -357,12 +328,11 @@ Node* Node::removeChild(Node* aOldChild)
|
|||
*/
|
||||
Node* Node::appendChild(Node* aNewChild)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> newChild(do_QueryInterface(aNewChild->getNSObj()));
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->AppendChild(aNewChild->getNSNode(),
|
||||
if (NS_SUCCEEDED(nsNode->AppendChild(newChild,
|
||||
getter_AddRefs(returnValue))))
|
||||
return ownerDocument->createWrapper(returnValue);
|
||||
else
|
||||
|
@ -379,11 +349,9 @@ Node* Node::appendChild(Node* aNewChild)
|
|||
*/
|
||||
Node* Node::cloneNode(MBool aDeep, Node* aDest)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Node)
|
||||
nsCOMPtr<nsIDOMNode> returnValue;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return NULL;
|
||||
|
||||
if (NS_SUCCEEDED(nsNode->CloneNode(aDeep, getter_AddRefs(returnValue))))
|
||||
{
|
||||
aDest->setNSObj(returnValue);
|
||||
|
@ -400,12 +368,11 @@ Node* Node::cloneNode(MBool aDeep, Node* aDest)
|
|||
*/
|
||||
MBool Node::hasChildNodes() const
|
||||
{
|
||||
PRBool returnValue;
|
||||
NSI_FROM_TX(Node)
|
||||
PRBool returnValue = MB_FALSE;
|
||||
|
||||
if (nsNode == NULL)
|
||||
return MB_FALSE;
|
||||
|
||||
nsNode->HasChildNodes(&returnValue);
|
||||
if (nsNode)
|
||||
nsNode->HasChildNodes(&returnValue);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
@ -417,40 +384,11 @@ MBool Node::hasChildNodes() const
|
|||
**/
|
||||
String Node::getBaseURI()
|
||||
{
|
||||
Node* node=this;
|
||||
ArrayList baseUrls;
|
||||
NSI_FROM_TX(Node)
|
||||
String url;
|
||||
Node* xbAttr;
|
||||
|
||||
while(node) {
|
||||
switch(node->getNodeType()) {
|
||||
case Node::ELEMENT_NODE :
|
||||
xbAttr = ((Element*)node)->getAttributeNode(XMLBASE_ATTR);
|
||||
if(xbAttr)
|
||||
baseUrls.add(new String(xbAttr->getNodeValue()));
|
||||
break;
|
||||
|
||||
case Node::DOCUMENT_NODE :
|
||||
baseUrls.add(new String(((Document*)node)->getBaseURI()));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
node = node->getParentNode();
|
||||
}
|
||||
|
||||
if(baseUrls.size()) {
|
||||
url = *((String*)baseUrls.get(baseUrls.size()-1));
|
||||
|
||||
for(int i=baseUrls.size()-2;i>=0;i--) {
|
||||
String dest;
|
||||
URIUtils::resolveHref(*(String*)baseUrls.get(i), url, dest);
|
||||
url = dest;
|
||||
}
|
||||
}
|
||||
|
||||
baseUrls.clear(MB_TRUE);
|
||||
|
||||
if (nsNode)
|
||||
nsNode->GetBaseURI(url.getNSString());
|
||||
|
||||
return url;
|
||||
} //-- getBaseURI
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
NodeList::NodeList(nsIDOMNodeList* aNodeList, Document* aOwner) :
|
||||
MozillaObjectWrapper(aNodeList, aOwner)
|
||||
{
|
||||
nsNodeList = aNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +46,6 @@ NodeList::~NodeList()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aNodeList the nsIDOMNodeList you want to wrap
|
||||
*/
|
||||
void NodeList::setNSObj(nsIDOMNodeList* aNodeList)
|
||||
{
|
||||
MozillaObjectWrapper::setNSObj(aNodeList);
|
||||
nsNodeList = aNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMNodeList::Item to the child at the specified index.
|
||||
*
|
||||
|
@ -67,6 +55,7 @@ void NodeList::setNSObj(nsIDOMNodeList* aNodeList)
|
|||
*/
|
||||
Node* NodeList::item(UInt32 aIndex)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(NodeList)
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (NS_SUCCEEDED(nsNodeList->Item(aIndex, getter_AddRefs(node))))
|
||||
|
@ -82,8 +71,10 @@ Node* NodeList::item(UInt32 aIndex)
|
|||
*/
|
||||
UInt32 NodeList::getLength()
|
||||
{
|
||||
NSI_FROM_TX(NodeList)
|
||||
UInt32 length = 0;
|
||||
|
||||
nsNodeList->GetLength(&length);
|
||||
if (nsNodeList)
|
||||
nsNodeList->GetLength(&length);
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
Notation::Notation(nsIDOMNotation* aNotation, Document* aOwner) :
|
||||
Node(aNotation, aOwner)
|
||||
{
|
||||
nsNotation = aNotation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +46,6 @@ Notation::~Notation()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aNotation the nsIDOMNotation you want to wrap
|
||||
*/
|
||||
void Notation::setNSObj(nsIDOMNotation* aNotation)
|
||||
{
|
||||
Node::setNSObj(aNotation);
|
||||
nsNotation = aNotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMNotation::GetPublicId to retrieve the public id for this notation.
|
||||
*
|
||||
|
@ -65,8 +53,11 @@ void Notation::setNSObj(nsIDOMNotation* aNotation)
|
|||
*/
|
||||
const String& Notation::getPublicId()
|
||||
{
|
||||
NSI_FROM_TX(Notation)
|
||||
|
||||
publicId.clear();
|
||||
nsNotation->GetPublicId(publicId.getNSString());
|
||||
if (nsNotation)
|
||||
nsNotation->GetPublicId(publicId.getNSString());
|
||||
return publicId;
|
||||
}
|
||||
|
||||
|
@ -77,7 +68,10 @@ const String& Notation::getPublicId()
|
|||
*/
|
||||
const String& Notation::getSystemId()
|
||||
{
|
||||
NSI_FROM_TX(Notation)
|
||||
|
||||
systemId.clear();
|
||||
nsNotation->GetSystemId(systemId.getNSString());
|
||||
if (nsNotation)
|
||||
nsNotation->GetSystemId(systemId.getNSString());
|
||||
return systemId;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ ProcessingInstruction::ProcessingInstruction(
|
|||
Document* aOwner) :
|
||||
Node (aProcInstr, aOwner)
|
||||
{
|
||||
nsProcessingInstruction = aProcInstr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,17 +49,6 @@ ProcessingInstruction::~ProcessingInstruction()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aProcInstr the nsIDOMProcessingInstruction you want to wrap
|
||||
*/
|
||||
void ProcessingInstruction::setNSObj(nsIDOMProcessingInstruction* aProcInstr)
|
||||
{
|
||||
Node::setNSObj(aProcInstr);
|
||||
nsProcessingInstruction = aProcInstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMProcessingInstruction::GetTarget to retrieve the target of the
|
||||
* processing instruction.
|
||||
|
@ -69,8 +57,11 @@ void ProcessingInstruction::setNSObj(nsIDOMProcessingInstruction* aProcInstr)
|
|||
*/
|
||||
const String& ProcessingInstruction::getTarget()
|
||||
{
|
||||
NSI_FROM_TX(ProcessingInstruction)
|
||||
|
||||
target.clear();
|
||||
nsProcessingInstruction->GetTarget(target.getNSString());
|
||||
if (nsProcessingInstruction)
|
||||
nsProcessingInstruction->GetTarget(target.getNSString());
|
||||
return target;
|
||||
}
|
||||
|
||||
|
@ -82,8 +73,11 @@ const String& ProcessingInstruction::getTarget()
|
|||
*/
|
||||
const String& ProcessingInstruction::getData()
|
||||
{
|
||||
NSI_FROM_TX(ProcessingInstruction)
|
||||
|
||||
data.clear();
|
||||
nsProcessingInstruction->GetData(data.getNSString());
|
||||
if (nsProcessingInstruction)
|
||||
nsProcessingInstruction->GetData(data.getNSString());
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -95,5 +89,8 @@ const String& ProcessingInstruction::getData()
|
|||
*/
|
||||
void ProcessingInstruction::setData(const String& aData)
|
||||
{
|
||||
nsProcessingInstruction->SetData(aData.getConstNSString());
|
||||
NSI_FROM_TX(ProcessingInstruction)
|
||||
|
||||
if (nsProcessingInstruction)
|
||||
nsProcessingInstruction->SetData(aData.getConstNSString());
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
*/
|
||||
Text::Text(nsIDOMText* aText, Document* aOwner) : CharacterData(aText, aOwner)
|
||||
{
|
||||
nsText = aText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,17 +45,6 @@ Text::~Text()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a different Mozilla object with this wrapper.
|
||||
*
|
||||
* @param aText the nsIDOMText you want to wrap
|
||||
*/
|
||||
void Text::setNSObj(nsIDOMText* aText)
|
||||
{
|
||||
CharacterData::setNSObj(aText);
|
||||
nsText = aText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call nsIDOMText::SplitText to split the text.
|
||||
*
|
||||
|
@ -66,6 +54,7 @@ void Text::setNSObj(nsIDOMText* aText)
|
|||
*/
|
||||
Text* Text::splitText(Int32 aOffset)
|
||||
{
|
||||
NSI_FROM_TX_NULL_CHECK(Text)
|
||||
nsCOMPtr<nsIDOMText> split;
|
||||
|
||||
if (NS_SUCCEEDED(nsText->SplitText(aOffset, getter_AddRefs(split))))
|
||||
|
|
|
@ -91,6 +91,59 @@ class Notation;
|
|||
class ProcessingInstruction;
|
||||
class Text;
|
||||
|
||||
|
||||
/**
|
||||
* This macro creates a nsCOMPtr to a specific interface for the
|
||||
* wrapper's Mozilla object. The nsCOMPtr will be named like the
|
||||
* supplied class with "ns" as a prefix.
|
||||
*/
|
||||
#define NSI_FROM_TX(_txClass) \
|
||||
nsCOMPtr<nsIDOM##_txClass> ns##_txClass(do_QueryInterface(nsObject));
|
||||
|
||||
/**
|
||||
* This macro creates a nsCOMPtr to a specific interface for the
|
||||
* wrapper's Mozilla object. It returns NULL if the interface is
|
||||
* unavailable (or the wrapper's Mozilla object is nsnull). The
|
||||
* nsCOMPtr will be named like the supplied class with "ns" as a
|
||||
* prefix.
|
||||
*/
|
||||
#define NSI_FROM_TX_NULL_CHECK(_txClass) \
|
||||
NSI_FROM_TX(_txClass) \
|
||||
if (!ns##_txClass) return NULL;
|
||||
|
||||
|
||||
/**
|
||||
* This macro can be used to declare a createWrapper implementation
|
||||
* for the supplied wrapper class. This macro should only be used
|
||||
* in MozillaDocument.
|
||||
*/
|
||||
#define IMPL_CREATE_WRAPPER(_txClass) \
|
||||
IMPL_CREATE_WRAPPER2(_txClass, create##_txClass)
|
||||
|
||||
/**
|
||||
* This macro can be used to declare a createWrapper implementation
|
||||
* for the supplied wrapper class. The function parameter defines
|
||||
* the function name for the implementation function. This macro
|
||||
* should only be used in MozillaDocument.
|
||||
*/
|
||||
#define IMPL_CREATE_WRAPPER2(_txClass, _function) \
|
||||
_txClass* Document::_function(nsIDOM##_txClass* aNsObject) \
|
||||
{ \
|
||||
_txClass* wrapper = NULL; \
|
||||
\
|
||||
if (aNsObject) \
|
||||
{ \
|
||||
nsISupportsKey key(aNsObject); \
|
||||
wrapper = (_txClass*)wrapperHashTable->Get(&key); \
|
||||
\
|
||||
if (!wrapper) \
|
||||
wrapper = new _txClass(aNsObject, this); \
|
||||
} \
|
||||
\
|
||||
return wrapper; \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base wrapper class for a Mozilla object. Owns the Mozilla object through an
|
||||
* nsCOMPtr<nsISupports>.
|
||||
|
@ -98,11 +151,11 @@ class Text;
|
|||
class MozillaObjectWrapper : public MITREObject
|
||||
{
|
||||
public:
|
||||
MozillaObjectWrapper(nsISupports* aNsObject, Document* aaOwner);
|
||||
MozillaObjectWrapper(nsISupports* aNsObject, Document* aOwner);
|
||||
~MozillaObjectWrapper();
|
||||
|
||||
void setNSObj(nsISupports* aNsObject);
|
||||
void setNSObj(nsISupports* aNsObject, Document* aaOwner);
|
||||
void setNSObj(nsISupports* aNsObject, Document* aOwner);
|
||||
|
||||
nsISupports* getNSObj() const;
|
||||
|
||||
|
@ -110,8 +163,6 @@ class MozillaObjectWrapper : public MITREObject
|
|||
// We want to maintain a pointer back to the aOwner document for memory
|
||||
// management.
|
||||
Document* ownerDocument;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupports> nsObject;
|
||||
};
|
||||
|
||||
|
@ -121,15 +172,10 @@ class MozillaObjectWrapper : public MITREObject
|
|||
class DOMImplementation : public MozillaObjectWrapper
|
||||
{
|
||||
public:
|
||||
DOMImplementation(nsIDOMDOMImplementation* aDomImpl, Document* aaOwner);
|
||||
DOMImplementation(nsIDOMDOMImplementation* aDomImpl, Document* aOwner);
|
||||
~DOMImplementation();
|
||||
|
||||
void setNSObj(nsIDOMDOMImplementation* aDomImpl);
|
||||
|
||||
MBool hasFeature(const String& aFeature, const String& aVersion) const;
|
||||
|
||||
private:
|
||||
nsIDOMDOMImplementation* nsDOMImpl;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -160,8 +206,6 @@ class Node : public MozillaObjectWrapper
|
|||
virtual ~Node();
|
||||
|
||||
void setNSObj(nsIDOMNode* aNode);
|
||||
void setNSObj(nsIDOMNode* aNode, Document* aOwner);
|
||||
nsIDOMNode* getNSNode();
|
||||
|
||||
// Read functions
|
||||
virtual const String& getNodeName();
|
||||
|
@ -194,9 +238,6 @@ class Node : public MozillaObjectWrapper
|
|||
protected:
|
||||
String nodeName;
|
||||
String nodeValue;
|
||||
|
||||
private:
|
||||
nsIDOMNode* nsNode;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -208,13 +249,8 @@ class NodeList : public MozillaObjectWrapper
|
|||
NodeList(nsIDOMNodeList* aNodeList, Document* aOwner);
|
||||
~NodeList();
|
||||
|
||||
void setNSObj(nsIDOMNodeList* aNodeList);
|
||||
|
||||
Node* item(UInt32 aIndex);
|
||||
UInt32 getLength();
|
||||
|
||||
protected:
|
||||
nsIDOMNodeList* nsNodeList;
|
||||
};
|
||||
|
||||
|
||||
|
@ -227,16 +263,11 @@ class NamedNodeMap : public MozillaObjectWrapper
|
|||
NamedNodeMap(nsIDOMNamedNodeMap* aNamedNodeMap, Document* aOwner);
|
||||
~NamedNodeMap();
|
||||
|
||||
void setNSObj(nsIDOMNamedNodeMap* aNamedNodeMap);
|
||||
|
||||
Node* getNamedItem(const String& aName);
|
||||
Node* setNamedItem(Node* aNode);
|
||||
Node* removeNamedItem(const String& aName);
|
||||
Node* item(UInt32 aIndex);
|
||||
UInt32 getLength();
|
||||
|
||||
private:
|
||||
nsIDOMNamedNodeMap* nsNamedNodeMap;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -248,11 +279,6 @@ class DocumentFragment : public Node
|
|||
DocumentFragment(nsIDOMDocumentFragment* aDocFragment,
|
||||
Document* aOwner);
|
||||
~DocumentFragment();
|
||||
|
||||
void setNSObj(nsIDOMDocumentFragment* aDocFragment);
|
||||
|
||||
private:
|
||||
nsIDOMDocumentFragment* nsDocumentFragment;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -265,8 +291,6 @@ class Document : public Node
|
|||
Document(nsIDOMDocument* aDocument);
|
||||
~Document();
|
||||
|
||||
void setNSObj(nsIDOMDocument* aNode);
|
||||
|
||||
PRBool inHashTableDeletion();
|
||||
|
||||
Element* getDocumentElement();
|
||||
|
@ -332,14 +356,15 @@ class Document : public Node
|
|||
Element* createElementNS(const String& aNamespaceURI,
|
||||
const String& aTagName);
|
||||
|
||||
Attr* createAttributeNS(const String& aNamespaceURI,
|
||||
const String& aName);
|
||||
|
||||
Element* getElementById(const String aID);
|
||||
|
||||
//Override to return documentBaseURI
|
||||
String getBaseURI();
|
||||
|
||||
private:
|
||||
nsIDOMDocument* nsDocument;
|
||||
|
||||
PRBool bInHashTableDeletion;
|
||||
|
||||
nsObjectHashtable *wrapperHashTable;
|
||||
|
@ -354,8 +379,6 @@ class Element : public Node
|
|||
Element(nsIDOMElement* aElement, Document* aOwner);
|
||||
~Element();
|
||||
|
||||
void setNSObj(nsIDOMElement* aElement);
|
||||
|
||||
const String& getTagName();
|
||||
const String& getAttribute(const String& aName);
|
||||
void setAttribute(const String& aName, const String& aValue);
|
||||
|
@ -368,8 +391,6 @@ class Element : public Node
|
|||
NodeList* getElementsByTagName(const String& aName);
|
||||
void normalize();
|
||||
|
||||
private:
|
||||
nsIDOMElement* nsElement;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -381,16 +402,11 @@ class Attr : public Node
|
|||
Attr(nsIDOMAttr* aAttr, Document* aOwner);
|
||||
~Attr();
|
||||
|
||||
nsIDOMAttr* getNSAttr();
|
||||
void setNSObj(nsIDOMAttr* aAttr);
|
||||
|
||||
const String& getName();
|
||||
MBool getSpecified() const;
|
||||
const String& getValue();
|
||||
void setValue(const String& aNewValue);
|
||||
|
||||
private:
|
||||
nsIDOMAttr* nsAttr;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -402,8 +418,6 @@ class CharacterData : public Node
|
|||
CharacterData(nsIDOMCharacterData* aCharData, Document* aOwner);
|
||||
~CharacterData();
|
||||
|
||||
void setNSObj(nsIDOMCharacterData* aCharData);
|
||||
|
||||
const String& getData();
|
||||
void setData(const String& aSource);
|
||||
Int32 getLength() const;
|
||||
|
@ -415,7 +429,7 @@ class CharacterData : public Node
|
|||
void replaceData(Int32 aOffset, Int32 aCount, const String& aSource);
|
||||
|
||||
private:
|
||||
nsIDOMCharacterData* nsCharacterData;
|
||||
String nodeValue;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -427,12 +441,7 @@ class Text : public CharacterData
|
|||
Text(nsIDOMText* aText, Document* aOwner);
|
||||
~Text();
|
||||
|
||||
void setNSObj(nsIDOMText* aText);
|
||||
|
||||
Text* splitText(Int32 aOffset);
|
||||
|
||||
private:
|
||||
nsIDOMText* nsText;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -443,11 +452,6 @@ class Comment : public CharacterData
|
|||
public:
|
||||
Comment(nsIDOMComment* aComment, Document* aOwner);
|
||||
~Comment();
|
||||
|
||||
void setNSObj(nsIDOMComment* aComment);
|
||||
|
||||
private:
|
||||
nsIDOMComment* nsComment;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -458,11 +462,6 @@ class CDATASection : public Text
|
|||
public:
|
||||
CDATASection(nsIDOMCDATASection* aCdataSection, Document* aOwner);
|
||||
~CDATASection();
|
||||
|
||||
void setNSObj(nsIDOMCDATASection* aCdataSection);
|
||||
|
||||
private:
|
||||
nsIDOMCDATASection* nsCDATASection;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -475,16 +474,12 @@ class ProcessingInstruction : public Node
|
|||
Document* aOwner);
|
||||
~ProcessingInstruction();
|
||||
|
||||
void setNSObj(nsIDOMProcessingInstruction* aProcInstr);
|
||||
|
||||
const String& getTarget();
|
||||
const String& getData();
|
||||
|
||||
void setData(const String& aData);
|
||||
|
||||
private:
|
||||
nsIDOMProcessingInstruction* nsProcessingInstruction;
|
||||
|
||||
String target;
|
||||
String data;
|
||||
};
|
||||
|
@ -498,14 +493,10 @@ class Notation : public Node
|
|||
Notation(nsIDOMNotation* aNotation, Document* aOwner);
|
||||
~Notation();
|
||||
|
||||
void setNSObj(nsIDOMNotation* aNotation);
|
||||
|
||||
const String& getPublicId();
|
||||
const String& getSystemId();
|
||||
|
||||
private:
|
||||
nsIDOMNotation* nsNotation;
|
||||
|
||||
String publicId;
|
||||
String systemId;
|
||||
};
|
||||
|
@ -519,15 +510,11 @@ class Entity : public Node
|
|||
Entity(nsIDOMEntity* aEntity, Document* aOwner);
|
||||
~Entity();
|
||||
|
||||
void setNSObj(nsIDOMEntity* aEntity);
|
||||
|
||||
const String& getPublicId();
|
||||
const String& getSystemId();
|
||||
const String& getNotationName();
|
||||
|
||||
private:
|
||||
nsIDOMEntity* nsEntity;
|
||||
|
||||
String publicId;
|
||||
String systemId;
|
||||
String notationName;
|
||||
|
@ -542,11 +529,6 @@ class EntityReference : public Node
|
|||
EntityReference(nsIDOMEntityReference* aEntityReference,
|
||||
Document* aOwner);
|
||||
~EntityReference();
|
||||
|
||||
void setNSObj(nsIDOMEntityReference* aEntityReference);
|
||||
|
||||
private:
|
||||
nsIDOMEntityReference* nsEntityReference;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -559,14 +541,10 @@ class DocumentType : public Node
|
|||
DocumentType(nsIDOMDocumentType* aDocumentType, Document* aOwner);
|
||||
~DocumentType();
|
||||
|
||||
void setNSObj(nsIDOMDocumentType* aDocumentType);
|
||||
|
||||
const String& getName();
|
||||
NamedNodeMap* getEntities();
|
||||
NamedNodeMap* getNotations();
|
||||
|
||||
private:
|
||||
nsIDOMDocumentType* nsDocumentType;
|
||||
};
|
||||
|
||||
// NULL string for use by Element::getAttribute() for when the attribute
|
||||
|
|
|
@ -41,7 +41,7 @@ nsNodeSet::nsNodeSet(NodeSet* aNodeSet) {
|
|||
|
||||
if (aNodeSet) {
|
||||
for (int i=0; i < aNodeSet->size(); i++) {
|
||||
mNodes.AppendElement(aNodeSet->get(i)->getNSNode());
|
||||
mNodes.AppendElement(aNodeSet->get(i)->getNSObj());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,22 +25,22 @@
|
|||
* -- added code in ::resolveFunctionCall to support the
|
||||
* document() function.
|
||||
*
|
||||
* $Id: ProcessorState.cpp,v 1.21 2001-03-07 00:42:56 axel%pike.org Exp $
|
||||
* $Id: ProcessorState.cpp,v 1.22 2001-04-03 12:21:49 peterv%netscape.com Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of ProcessorState
|
||||
* Much of this code was ported from XSL:P
|
||||
* @version $Revision: 1.21 $ $Date: 2001-03-07 00:42:56 $
|
||||
* @version $Revision: 1.22 $ $Date: 2001-04-03 12:21:49 $
|
||||
**/
|
||||
|
||||
#include "ProcessorState.h"
|
||||
#include "XSLTFunctions.h"
|
||||
#include "URIUtils.h"
|
||||
#ifdef MOZ_XSL
|
||||
#include "nslog.h"
|
||||
#define PRINTF NS_LOG_PRINTF(XPATH)
|
||||
#define FLUSH NS_LOG_FLUSH(XPATH)
|
||||
// #include "nslog.h"
|
||||
// #define PRINTF NS_LOG_PRINTF(XPATH)
|
||||
// #define FLUSH NS_LOG_FLUSH(XPATH)
|
||||
#else
|
||||
#include "TxLog.h"
|
||||
#endif
|
||||
|
@ -440,9 +440,9 @@ Document* ProcessorState::getInclude(const String& href) {
|
|||
} //-- getInclude(String)
|
||||
|
||||
Expr* ProcessorState::getExpr(const String& pattern) {
|
||||
NS_IMPL_LOG(XPATH)
|
||||
PRINTF("Resolving XPath Expr %s",pattern.toCharArray());
|
||||
FLUSH();
|
||||
// NS_IMPL_LOG(XPATH)
|
||||
// PRINTF("Resolving XPath Expr %s",pattern.toCharArray());
|
||||
// FLUSH();
|
||||
Expr* expr = (Expr*)exprHash.get(pattern);
|
||||
if ( !expr ) {
|
||||
expr = exprParser.createExpr(pattern);
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
* Olivier Gerardin
|
||||
* -- Changed behavior of passing parameters to templates
|
||||
*
|
||||
* $Id: XSLTProcessor.cpp,v 1.37 2001-03-07 00:42:57 axel%pike.org Exp $
|
||||
* $Id: XSLTProcessor.cpp,v 1.38 2001-04-03 12:21:45 peterv%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#include "XSLTProcessor.h"
|
||||
#ifdef MOZ_XSL
|
||||
#include "nsIObserverService.h"
|
||||
#include "nslog.h"
|
||||
//#include "nslog.h"
|
||||
#else
|
||||
#include "TxLog.h"
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@
|
|||
/**
|
||||
* XSLTProcessor is a class for Processing XSL stylesheets
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.37 $ $Date: 2001-03-07 00:42:57 $
|
||||
* @version $Revision: 1.38 $ $Date: 2001-04-03 12:21:45 $
|
||||
**/
|
||||
|
||||
/**
|
||||
|
@ -883,7 +883,7 @@ void XSLTProcessor::processAction
|
|||
Attr* modeAttr = actionElement->getAttributeNode(MODE_ATTR);
|
||||
if ( modeAttr ) mode = new String(modeAttr->getValue());
|
||||
String selectAtt = actionElement->getAttribute(SELECT_ATTR);
|
||||
if ( selectAtt.length() == 0 ) selectAtt = "* | text()";
|
||||
if ( selectAtt.length() == 0 ) selectAtt = "node()";
|
||||
pExpr = ps->getPatternExpr(selectAtt);
|
||||
ExprResult* exprResult = pExpr->evaluate(node, ps);
|
||||
NodeSet* nodeSet = 0;
|
||||
|
@ -1723,8 +1723,8 @@ void XSLTProcessor::xslCopyOf(ExprResult* exprResult, ProcessorState* ps) {
|
|||
} //-- xslCopyOf
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
#define PRINTF NS_LOG_PRINTF(XSLT)
|
||||
#define FLUSH NS_LOG_FLUSH(XSLT)
|
||||
//#define PRINTF NS_LOG_PRINTF(XSLT)
|
||||
//#define FLUSH NS_LOG_FLUSH(XSLT)
|
||||
NS_IMETHODIMP
|
||||
XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
|
||||
nsIDOMNode* aStyleDOM,
|
||||
|
@ -1761,9 +1761,9 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
|
|||
|
||||
docURL->GetSpec(&urlString);
|
||||
String documentBase(urlString);
|
||||
NS_IMPL_LOG(XSLT)
|
||||
PRINTF("Transforming with stylesheet %s",documentBase.toCharArray());
|
||||
FLUSH();
|
||||
// NS_IMPL_LOG(XSLT)
|
||||
// PRINTF("Transforming with stylesheet %s",documentBase.toCharArray());
|
||||
// FLUSH();
|
||||
ps->setDocumentBase(documentBase);
|
||||
nsCRT::free(urlString);
|
||||
NS_IF_RELEASE(docURL);
|
||||
|
@ -1797,7 +1797,7 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
|
|||
Node* docElement = resultDocument->getDocumentElement();
|
||||
nsIDOMNode* nsDocElement;
|
||||
if (docElement) {
|
||||
nsDocElement = docElement->getNSNode();
|
||||
nsDocElement = NS_STATIC_CAST(nsIDOMNode*, docElement->getNSObj());
|
||||
}
|
||||
else {
|
||||
nsDocElement = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче