DOM string changes. All nsString& in DOM interfaces (and interfaces needed by DOM implementations) have been changed to nsAReadableString& and nsAWritableString&. String implementation additions (sanctioned by scc) to support DOM needs. Bug 49091. r=vidur,jst,scc

This commit is contained in:
jst%netscape.com 2000-08-23 17:27:06 +00:00
Родитель 083cb4ee6b
Коммит b3a4ade60d
632 изменённых файлов: 11335 добавлений и 20592 удалений

Просмотреть файл

@ -26,13 +26,12 @@
#include "nslayout.h"
#include "nsISupports.h"
#include "nsGUIEvent.h"
#include "nsAWritableString.h"
// Forward declarations
class nsIAtom;
class nsIDocument;
class nsIPresContext;
class nsString;
class nsString;
class nsVoidArray;
class nsIXIFConverter;
class nsIDOMEvent;
@ -107,7 +106,7 @@ public:
* @param aNameSpaceID out parameter reprsenting the namespace
* of the attribute
*/
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) = 0;
@ -136,7 +135,7 @@ public:
* notified of the attribute change.
*/
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify) = 0;
/**
@ -153,7 +152,7 @@ public:
* @param aNotify specifies whether or not the document should be
* notified of the attribute change.
*/
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify) = 0;
/**
@ -174,7 +173,7 @@ public:
* </UL>
*/
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const = 0;
nsAWritableString& aResult) const = 0;
/**
* Get the current value and prefix of the attribute. This returns a form
@ -197,7 +196,7 @@ public:
*/
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const = 0;
nsIAtom*& aPrefix, nsAWritableString& aResult) const = 0;
/**
* Remove an attribute so that it is no longer explicitly specified.

Просмотреть файл

@ -26,6 +26,7 @@
#include "nsISupports.h"
#include "nsIUnicharInputStream.h"
#include "nsGUIEvent.h"
#include "nsAWritableString.h"
class nsIAtom;
class nsIArena;
@ -43,7 +44,6 @@ class nsIStyleRule;
class nsIURI;
class nsILoadGroup;
class nsIViewManager;
class nsString;
class nsIScriptGlobalObject;
class nsIDOMEvent;
class nsIDeviceContext;
@ -130,14 +130,14 @@ public:
/**
* Return the content (mime) type of this document.
*/
NS_IMETHOD GetContentType(nsString& aContentType) const = 0;
NS_IMETHOD GetContentType(nsAWritableString& aContentType) const = 0;
/**
* Return a standard name for the document's character set. This will
* trigger a startDocumentLoad if necessary to answer the question.
*/
NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID) = 0;
NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID) = 0;
NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID) = 0;
NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID) = 0;
/**
* Add an observer that gets notified whenever the charset changes.
@ -161,8 +161,8 @@ public:
* Access HTTP header data (this may also get set from other sources, like
* HTML META tags).
*/
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const = 0;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData) = 0;
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const = 0;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData) = 0;
/**
* Create a new presentation shell that will use aContext for
@ -296,7 +296,7 @@ public:
/**
* Finds text in content
*/
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
/**
* Converts the document or a selection of the
@ -306,7 +306,7 @@ public:
* NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk
*/
NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0;
NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0;
NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0;
virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0;
virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode) = 0;
@ -348,8 +348,8 @@ extern NS_LAYOUT nsresult
nsIDocument* aOwnerDocument);
extern NS_LAYOUT nsresult
NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
nsIURI* aBaseURI);

Просмотреть файл

@ -112,7 +112,7 @@ public:
/**
* Initialize with a pointer to the document and the mime type.
*/
NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 flags) = 0;
NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 flags) = 0;
/**
* If the selection is set to a non-null value, then the
@ -130,7 +130,7 @@ public:
*
* Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER
*/
NS_IMETHOD SetCharset(const nsString& aCharset) = 0;
NS_IMETHOD SetCharset(const nsAReadableString& aCharset) = 0;
/**
* Set a wrap column. This may have no effect in some types of encoders.
@ -145,7 +145,7 @@ public:
* might have been encountered.
*/
NS_IMETHOD EncodeToStream(nsIOutputStream* aStream) = 0;
NS_IMETHOD EncodeToString(nsString& aOutputString) = 0;
NS_IMETHOD EncodeToString(nsAWritableString& aOutputString) = 0;
};
// XXXXXXXXXXXXXXXX nsITextEncoder is going away! XXXXXXXXXXXXXXXXXXXXXX

Просмотреть файл

@ -54,7 +54,7 @@ public:
// Get data of this name space
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0;
NS_IMETHOD GetNameSpaceURI(nsString& aURI) const = 0;
NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const = 0;
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const = 0;
NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const = 0;
@ -65,7 +65,8 @@ public:
NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const = 0;
// create new child name space
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix,
const nsAReadableString& aURI,
nsINameSpace*& aChildNameSpace) = 0;
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,

Просмотреть файл

@ -25,6 +25,7 @@
#include "nsISupports.h"
#include "nslayout.h"
#include "nsAWritableString.h"
class nsIAtom;
class nsString;
@ -70,11 +71,11 @@ public:
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace) = 0;
NS_IMETHOD RegisterNameSpace(const nsString& aURI,
NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI,
PRInt32& aNameSpaceID) = 0;
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) = 0;
NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) = 0;
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI) = 0;
NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID) = 0;
};
extern NS_LAYOUT nsresult

Просмотреть файл

@ -41,6 +41,7 @@
#define nsINodeInfo_h___
#include "nsISupports.h"
#include "nsAWritableString.h"
// Forward declarations
class nsIAtom;
@ -73,7 +74,7 @@ public:
* For the HTML element "<body>" this will return "body" and for the XML
* element "<html:body>" this will return "body".
*/
NS_IMETHOD GetName(nsString& aName) = 0;
NS_IMETHOD GetName(nsAWritableString& aName) = 0;
/*
* Get the name from this node as an atom, this does not include the prefix.
@ -91,7 +92,7 @@ public:
* For the HTML element "<body>" this will return "body" and for the XML
* element "<html:body>" this will return "html:body".
*/
NS_IMETHOD GetQualifiedName(nsString& aQualifiedName) = 0;
NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName) = 0;
/*
* Get the local name from this node as a string, GetLocalName() gets the
@ -102,7 +103,7 @@ public:
* For the HTML element "<body>" in a HTML document this will return a null
* string and for the XML element "<html:body>" this will return "body".
*/
NS_IMETHOD GetLocalName(nsString& aLocalName) = 0;
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) = 0;
/*
* Get the prefix from this node as a string.
@ -110,7 +111,7 @@ public:
* For the HTML element "<body>" this will return a null string and for
* the XML element "<html:body>" this will return the string "html".
*/
NS_IMETHOD GetPrefix(nsString& aPrefix) = 0;
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) = 0;
/*
* Get the prefix from this node as an atom.
@ -129,7 +130,7 @@ public:
* xmlns:html='http://www.w3.org/1999/xhtml' attribute) this will return
* the string "http://www.w3.org/1999/xhtml".
*/
NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI) = 0;
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI) = 0;
/*
* Get the namespace ID for a node if the node has a namespace, if not this
@ -154,18 +155,19 @@ public:
* namespace ID.
*/
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName) = 0;
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix) = 0;
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName,
const nsAReadableString& aPrefix) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName,
const nsAReadableString& aPrefix,
PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI) = 0;
NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI) = 0;
/*
* This is a convinience method that creates a new nsINodeInfo that differs
@ -197,15 +199,17 @@ public:
*/
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName,
const nsAReadableString& aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo) = 0;
NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix,
const nsString& aNamespaceURI,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName,
const nsAReadableString& aPrefix,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo) = 0;
NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName,
const nsString& aNamespaceURI,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo) = 0;
/*

Просмотреть файл

@ -52,7 +52,7 @@ public:
/**
* Make a copy of the text content in aResult.
*/
NS_IMETHOD CopyText(nsString& aResult) = 0;
NS_IMETHOD CopyText(nsAWritableString& aResult) = 0;
/**
* Set the text to the given value. If aNotify is PR_TRUE then
@ -62,6 +62,13 @@ public:
PRInt32 aLength,
PRBool aNotify) = 0;
/**
* Set the text to the given value. If aNotify is PR_TRUE then
* the document is notified of the content change.
*/
NS_IMETHOD SetText(const nsAReadableString& aStr,
PRBool aNotify) = 0;
/**
* Set the text to the given value. If aNotify is PR_TRUE then
* the document is notified of the content change.

Просмотреть файл

@ -23,6 +23,7 @@
#define nsTextFragment_h___
#include "nslayout.h"
#include "nsAWritableString.h"
class nsString;
// XXX should this normalize the code to keep a \u0000 at the end?
@ -112,7 +113,7 @@ public:
* Change the contents of this fragment to be a copy of the
* the argument string.
*/
nsTextFragment& operator=(const nsString& aString);
nsTextFragment& operator=(const nsAReadableString& aString);
/**
* Return PR_TRUE if this fragment is represented by PRUnichar data
@ -166,8 +167,8 @@ public:
/**
* Change the contents of this fragment to be the given buffer and
* length. The memory becomes owned by the fragment. In addition,
* the memory for aBuffer must have been allocated using the "new[]"
* because it will be released with "delete []".
* the memory for aBuffer must have been allocated using the
* nsIMemory interface.
*/
void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease);

Просмотреть файл

@ -110,7 +110,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const {
aResult = nsnull; return NS_OK;
}
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) {
return mInner.ParseAttributeString(aStr, aName, aNameSpaceID);
@ -120,19 +120,19 @@ public:
return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const {
nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const {
nsIAtom*& aPrefix, nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult);
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify);
}
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNodeInfo, aValue, aNotify);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
@ -215,12 +215,14 @@ public:
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) {
return mInner.GetTextLength(aLengthResult);
}
NS_IMETHOD CopyText(nsString& aResult) {
NS_IMETHOD CopyText(nsAWritableString& aResult) {
return mInner.CopyText(aResult);
}
NS_IMETHOD SetText(const PRUnichar* aBuffer,
PRInt32 aLength,
PRBool aNotify);
NS_IMETHOD SetText(const nsAReadableString& aStr,
PRBool aNotify);
NS_IMETHOD SetText(const char* aBuffer,
PRInt32 aLength,
PRBool aNotify);
@ -289,9 +291,9 @@ nsCommentNode::GetTag(nsIAtom*& aResult) const
}
NS_IMETHODIMP
nsCommentNode::GetNodeName(nsString& aNodeName)
nsCommentNode::GetNodeName(nsAWritableString& aNodeName)
{
aNodeName.AssignWithConversion("#comment");
aNodeName.Assign(NS_LITERAL_STRING("#comment"));
return NS_OK;
}
@ -545,6 +547,16 @@ nsCommentNode::SetText(const PRUnichar* aBuffer,
return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify);
}
NS_IMETHODIMP
nsCommentNode::SetText(const nsAReadableString& aStr,
PRBool aNotify)
{
nsAutoString str(aStr);
StripCommentDelimiters(str);
return mInner.SetText(this, str.GetUnicode(), str.Length(), aNotify);
}
NS_IMETHODIMP
nsCommentNode::SetText(const char* aBuffer,
PRInt32 aLength,

Просмотреть файл

@ -180,7 +180,7 @@ nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
}
NS_IMETHODIMP
nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
nsresult result = CheckDocumentExistence();

Просмотреть файл

@ -57,7 +57,7 @@ public:
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
// nsIScriptObjectOwner
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);

Просмотреть файл

@ -37,7 +37,7 @@ static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
nsDOMAttribute::nsDOMAttribute(nsIContent* aContent,
nsINodeInfo *aNodeInfo,
const nsString& aValue)
const nsAReadableString& aValue)
: mNodeInfo(aNodeInfo), mValue(aValue)
{
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
@ -156,7 +156,7 @@ nsDOMAttribute::SetScriptObject(void *aScriptObject)
}
nsresult
nsDOMAttribute::GetName(nsString& aName)
nsDOMAttribute::GetName(nsAWritableString& aName)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -164,7 +164,7 @@ nsDOMAttribute::GetName(nsString& aName)
}
nsresult
nsDOMAttribute::GetValue(nsString& aValue)
nsDOMAttribute::GetValue(nsAWritableString& aValue)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -188,7 +188,7 @@ nsDOMAttribute::GetValue(nsString& aValue)
}
nsresult
nsDOMAttribute::SetValue(const nsString& aValue)
nsDOMAttribute::SetValue(const nsAReadableString& aValue)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -247,19 +247,19 @@ nsDOMAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement)
}
NS_IMETHODIMP
nsDOMAttribute::GetNodeName(nsString& aNodeName)
nsDOMAttribute::GetNodeName(nsAWritableString& aNodeName)
{
return GetName(aNodeName);
}
NS_IMETHODIMP
nsDOMAttribute::GetNodeValue(nsString& aNodeValue)
nsDOMAttribute::GetNodeValue(nsAWritableString& aNodeValue)
{
return GetValue(aNodeValue);
}
NS_IMETHODIMP
nsDOMAttribute::SetNodeValue(const nsString& aNodeValue)
nsDOMAttribute::SetNodeValue(const nsAReadableString& aNodeValue)
{
return SetValue(aNodeValue);
}
@ -449,7 +449,7 @@ nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
NS_IMETHODIMP
nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI)
nsDOMAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -457,7 +457,7 @@ nsDOMAttribute::GetNamespaceURI(nsString& aNamespaceURI)
}
NS_IMETHODIMP
nsDOMAttribute::GetPrefix(nsString& aPrefix)
nsDOMAttribute::GetPrefix(nsAWritableString& aPrefix)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -465,7 +465,7 @@ nsDOMAttribute::GetPrefix(nsString& aPrefix)
}
NS_IMETHODIMP
nsDOMAttribute::SetPrefix(const nsString& aPrefix)
nsDOMAttribute::SetPrefix(const nsAReadableString& aPrefix)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
nsCOMPtr<nsINodeInfo> newNodeInfo;
@ -500,7 +500,7 @@ nsDOMAttribute::SetPrefix(const nsString& aPrefix)
}
NS_IMETHODIMP
nsDOMAttribute::GetLocalName(nsString& aLocalName)
nsDOMAttribute::GetLocalName(nsAWritableString& aLocalName)
{
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
@ -515,7 +515,7 @@ nsDOMAttribute::Normalize()
}
NS_IMETHODIMP
nsDOMAttribute::Supports(const nsString& aFeature, const nsString& aVersion,
nsDOMAttribute::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn);

Просмотреть файл

@ -71,7 +71,7 @@ class nsDOMAttribute : public nsIDOMAttr,
{
public:
nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo,
const nsString& aValue);
const nsAReadableString& aValue);
virtual ~nsDOMAttribute();
NS_DECL_ISUPPORTS

Просмотреть файл

@ -90,7 +90,7 @@ nsDOMAttributeMap::SetScriptObject(void *aScriptObject)
}
nsresult
nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName,
nsDOMAttributeMap::GetNamedItem(const nsAReadableString& aAttrName,
nsIDOMNode** aAttribute)
{
NS_ENSURE_ARG_POINTER(aAttribute);
@ -213,7 +213,7 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
}
NS_IMETHODIMP
nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsDOMAttributeMap::RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
@ -338,8 +338,8 @@ nsDOMAttributeMap::GetLength(PRUint32 *aLength)
}
nsresult
nsDOMAttributeMap::GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsDOMAttributeMap::GetNamedItemNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -452,8 +452,8 @@ nsDOMAttributeMap::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn)
}
nsresult
nsDOMAttributeMap::RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsDOMAttributeMap::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);

Просмотреть файл

@ -45,15 +45,16 @@ public:
// nsIDOMNamedNodeMap interface
NS_IMETHOD GetLength(PRUint32* aSize);
NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsIDOMNode** aReturn);
NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsIDOMNode** aReturn);
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsString& aNamespaceURI,
const nsString&aLocalName, nsIDOMNode** aReturn);
NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNode** aReturn);
void DropReference();

Просмотреть файл

@ -29,12 +29,12 @@
nsresult
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
const nsString& aName,
const nsAReadableString& aName,
nsIDOMNamedNodeMap *aEntities,
nsIDOMNamedNodeMap *aNotations,
const nsString& aPublicId,
const nsString& aSystemId,
const nsString& aInternalSubset)
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
const nsAReadableString& aInternalSubset)
{
NS_ENSURE_ARG_POINTER(aDocType);
@ -49,12 +49,12 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
return NS_OK;
}
nsDOMDocumentType::nsDOMDocumentType(const nsString& aName,
nsDOMDocumentType::nsDOMDocumentType(const nsAReadableString& aName,
nsIDOMNamedNodeMap *aEntities,
nsIDOMNamedNodeMap *aNotations,
const nsString& aPublicId,
const nsString& aSystemId,
const nsString& aInternalSubset) :
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
const nsAReadableString& aInternalSubset) :
mName(aName),
mPublicId(aPublicId),
mSystemId(aSystemId),
@ -87,7 +87,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMDocumentType)
NS_INTERFACE_MAP_END_THREADSAFE
NS_IMETHODIMP
nsDOMDocumentType::GetName(nsString& aName)
nsDOMDocumentType::GetName(nsAWritableString& aName)
{
aName=mName;
@ -119,7 +119,7 @@ nsDOMDocumentType::GetNotations(nsIDOMNamedNodeMap** aNotations)
}
NS_IMETHODIMP
nsDOMDocumentType::GetPublicId(nsString& aPublicId)
nsDOMDocumentType::GetPublicId(nsAWritableString& aPublicId)
{
aPublicId = mPublicId;
@ -127,7 +127,7 @@ nsDOMDocumentType::GetPublicId(nsString& aPublicId)
}
NS_IMETHODIMP
nsDOMDocumentType::GetSystemId(nsString& aSystemId)
nsDOMDocumentType::GetSystemId(nsAWritableString& aSystemId)
{
aSystemId = mSystemId;
@ -135,7 +135,7 @@ nsDOMDocumentType::GetSystemId(nsString& aSystemId)
}
NS_IMETHODIMP
nsDOMDocumentType::GetInternalSubset(nsString& aInternalSubset)
nsDOMDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset)
{
aInternalSubset = mInternalSubset;
@ -158,7 +158,7 @@ nsDOMDocumentType::GetNodeInfo(nsINodeInfo*& aResult) const
}
NS_IMETHODIMP
nsDOMDocumentType::GetNodeName(nsString& aNodeName)
nsDOMDocumentType::GetNodeName(nsAWritableString& aNodeName)
{
aNodeName=mName;

Просмотреть файл

@ -37,12 +37,12 @@ class nsDOMDocumentType : public nsIDOMDocumentType,
public nsIContent
{
public:
nsDOMDocumentType(const nsString& aName,
nsDOMDocumentType(const nsAReadableString& aName,
nsIDOMNamedNodeMap *aEntities,
nsIDOMNamedNodeMap *aNotations,
const nsString& aPublicId,
const nsString& aSystemId,
const nsString& aInternalSubset);
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
const nsAReadableString& aInternalSubset);
virtual ~nsDOMDocumentType();
@ -78,11 +78,11 @@ protected:
};
extern nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
const nsString& aName,
const nsAReadableString& aName,
nsIDOMNamedNodeMap *aEntities,
nsIDOMNamedNodeMap *aNotations,
const nsString& aPublicId,
const nsString& aSystemId,
const nsString& aInternalSubset);
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
const nsAReadableString& aInternalSubset);
#endif // nsDOMDocument_h___

Просмотреть файл

@ -368,16 +368,16 @@ public:
NS_DECL_ISUPPORTS
// nsIDOMDOMImplementation
NS_IMETHOD HasFeature(const nsString& aFeature,
const nsString& aVersion,
NS_IMETHOD HasFeature(const nsAReadableString& aFeature,
const nsAReadableString& aVersion,
PRBool* aReturn);
NS_IMETHOD CreateDocumentType(const nsString& aQualifiedName,
const nsString& aPublicId,
const nsString& aSystemId,
NS_IMETHOD CreateDocumentType(const nsAReadableString& aQualifiedName,
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
nsIDOMDocumentType** aReturn);
NS_IMETHOD CreateDocument(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
NS_IMETHOD CreateDocument(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
nsIDOMDocument** aReturn);
@ -418,28 +418,28 @@ NS_IMPL_ISUPPORTS4(nsDOMImplementation, nsIDOMDOMImplementation, nsIPrivateDOMIm
NS_IMETHODIMP
nsDOMImplementation::HasFeature(const nsString& aFeature,
const nsString& aVersion,
nsDOMImplementation::HasFeature(const nsAReadableString& aFeature,
const nsAReadableString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn);
}
NS_IMETHODIMP
nsDOMImplementation::CreateDocumentType(const nsString& aQualifiedName,
const nsString& aPublicId,
const nsString& aSystemId,
nsDOMImplementation::CreateDocumentType(const nsAReadableString& aQualifiedName,
const nsAReadableString& aPublicId,
const nsAReadableString& aSystemId,
nsIDOMDocumentType** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
return NS_NewDOMDocumentType(aReturn, aQualifiedName, nsnull, nsnull,
aPublicId, aSystemId, nsAutoString());
aPublicId, aSystemId, nsString());
}
NS_IMETHODIMP
nsDOMImplementation::CreateDocument(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
nsDOMImplementation::CreateDocument(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
nsIDOMDocument** aReturn)
{
@ -1043,7 +1043,7 @@ nsDocument::AddPrincipal(nsIPrincipal *aNewPrincipal)
}
NS_IMETHODIMP
nsDocument::GetContentType(nsString& aContentType) const
nsDocument::GetContentType(nsAWritableString& aContentType) const
{
// Must be implemented by derived class.
return NS_ERROR_NOT_IMPLEMENTED;
@ -1067,23 +1067,21 @@ nsDocument::GetBaseURL(nsIURI*& aURL) const
return NS_OK;
}
NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsString& oCharSetID)
NS_IMETHODIMP nsDocument::GetDocumentCharacterSet(nsAWritableString& oCharSetID)
{
oCharSetID = mCharacterSet;
return NS_OK;
}
NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsString& aCharSetID)
NS_IMETHODIMP nsDocument::SetDocumentCharacterSet(const nsAReadableString& aCharSetID)
{
if (mCharacterSet != aCharSetID) {
if (!mCharacterSet.Equals(aCharSetID)) {
mCharacterSet = aCharSetID;
nsAutoString charSetTopic;
charSetTopic.AssignWithConversion("charset");
PRInt32 n = mCharSetObservers.Count();
for (PRInt32 i = 0; i < n; i++) {
nsIObserver* observer = (nsIObserver*) mCharSetObservers.ElementAt(i);
observer->Observe((nsIDocument*) this, charSetTopic.GetUnicode(),
aCharSetID.GetUnicode());
observer->Observe((nsIDocument*) this, NS_LITERAL_STRING("charset"),
nsPromiseFlatString(aCharSetID));
}
}
return NS_OK;
@ -1165,7 +1163,7 @@ NS_IMETHODIMP nsDocument::SetWordBreaker(nsIWordBreaker* aWordBreaker)
}
NS_IMETHODIMP
nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const
nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const
{
aData.Truncate();
const nsDocHeaderData* data = mHeaderData;
@ -1180,7 +1178,7 @@ nsDocument::GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const
}
NS_IMETHODIMP
nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData)
nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
{
if (nsnull != aHeaderField) {
if (nsnull == mHeaderData) {
@ -2162,7 +2160,7 @@ nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement)
}
NS_IMETHODIMP
nsDocument::CreateElement(const nsString& aTagName,
nsDocument::CreateElement(const nsAReadableString& aTagName,
nsIDOMElement** aReturn)
{
// Should be implemented by subclass
@ -2170,7 +2168,7 @@ nsDocument::CreateElement(const nsString& aTagName,
}
NS_IMETHODIMP
nsDocument::CreateTextNode(const nsString& aData, nsIDOMText** aReturn)
nsDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn)
{
nsIContent* text = nsnull;
nsresult rv = NS_NewTextNode(&text);
@ -2191,7 +2189,7 @@ nsDocument::CreateDocumentFragment(nsIDOMDocumentFragment** aReturn)
}
NS_IMETHODIMP
nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn)
nsDocument::CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn)
{
nsIContent* comment = nsnull;
nsresult rv = NS_NewCommentNode(&comment);
@ -2206,15 +2204,15 @@ nsDocument::CreateComment(const nsString& aData, nsIDOMComment** aReturn)
}
NS_IMETHODIMP
nsDocument::CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn)
nsDocument::CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn)
{
// Should be implemented by subclass
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::CreateProcessingInstruction(const nsString& aTarget,
const nsString& aData,
nsDocument::CreateProcessingInstruction(const nsAReadableString& aTarget,
const nsAReadableString& aData,
nsIDOMProcessingInstruction** aReturn)
{
// Should be implemented by subclass
@ -2222,7 +2220,7 @@ nsDocument::CreateProcessingInstruction(const nsString& aTarget,
}
NS_IMETHODIMP
nsDocument::CreateAttribute(const nsString& aName,
nsDocument::CreateAttribute(const nsAReadableString& aName,
nsIDOMAttr** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -2243,7 +2241,7 @@ nsDocument::CreateAttribute(const nsString& aName,
}
NS_IMETHODIMP
nsDocument::CreateEntityReference(const nsString& aName,
nsDocument::CreateEntityReference(const nsAReadableString& aName,
nsIDOMEntityReference** aReturn)
{
// Should be implemented by subclass
@ -2251,7 +2249,7 @@ nsDocument::CreateEntityReference(const nsString& aName,
}
NS_IMETHODIMP
nsDocument::GetElementsByTagName(const nsString& aTagname,
nsDocument::GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn)
{
nsCOMPtr<nsIAtom> nameAtom = dont_AddRef(NS_NewAtom(aTagname));
@ -2263,8 +2261,8 @@ nsDocument::GetElementsByTagName(const nsString& aTagname,
}
NS_IMETHODIMP
nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn)
{
nsCOMPtr<nsIAtom> nameAtom;
@ -2274,7 +2272,7 @@ nsDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI,
nsContentList* list = nsnull;
if (!aNamespaceURI.EqualsWithConversion("*")) {
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
mNameSpaceManager->GetNameSpaceID(aNamespaceURI, nameSpaceId);
if (nameSpaceId == kNameSpaceID_Unknown) {
@ -2310,14 +2308,14 @@ nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
}
NS_IMETHODIMP
nsDocument::GetCharacterSet(nsString& aCharacterSet)
nsDocument::GetCharacterSet(nsAWritableString& aCharacterSet)
{
return GetDocumentCharacterSet(aCharacterSet);
}
NS_IMETHODIMP
nsDocument::CreateElementWithNameSpace(const nsString& aTagName,
const nsString& aNameSpace,
nsDocument::CreateElementWithNameSpace(const nsAReadableString& aTagName,
const nsAReadableString& aNameSpace,
nsIDOMElement** aReturn)
{
*aReturn = nsnull;
@ -2336,7 +2334,7 @@ nsDocument::ImportNode(nsIDOMNode* aImportedNode,
}
NS_IMETHODIMP
nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL)
nsDocument::AddBinding(nsIDOMElement* aContent, const nsAReadableString& aURL)
{
nsCOMPtr<nsIBindingManager> bm;
GetBindingManager(getter_AddRefs(bm));
@ -2346,7 +2344,7 @@ nsDocument::AddBinding(nsIDOMElement* aContent, const nsString& aURL)
}
NS_IMETHODIMP
nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL)
nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsAReadableString& aURL)
{
if (mBindingManager) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aContent));
@ -2357,7 +2355,7 @@ nsDocument::RemoveBinding(nsIDOMElement* aContent, const nsString& aURL)
}
NS_IMETHODIMP
nsDocument::LoadBindingDocument(const nsString& aURL)
nsDocument::LoadBindingDocument(const nsAReadableString& aURL)
{
if (mBindingManager)
return mBindingManager->LoadBindingDocument(this, aURL);
@ -2454,7 +2452,7 @@ nsDocument::GetDefaultView(nsIDOMAbstractView** aDefaultView)
NS_IMETHODIMP
nsDocument::Load (const nsString& aUrl)
nsDocument::Load (const nsAReadableString& aUrl)
{
// Should be implemented by subclass
return NS_ERROR_NOT_IMPLEMENTED;
@ -2497,21 +2495,21 @@ nsDocument::GetPlugins(nsIDOMPluginArray** aPlugins)
// nsIDOMNode methods
//
NS_IMETHODIMP
nsDocument::GetNodeName(nsString& aNodeName)
nsDocument::GetNodeName(nsAWritableString& aNodeName)
{
aNodeName.AssignWithConversion("#document");
aNodeName.Assign(NS_LITERAL_STRING("#document"));
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetNodeValue(nsString& aNodeValue)
nsDocument::GetNodeValue(nsAWritableString& aNodeValue)
{
aNodeValue.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetNodeValue(const nsString& aNodeValue)
nsDocument::SetNodeValue(const nsAReadableString& aNodeValue)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
@ -2627,27 +2625,27 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
}
NS_IMETHODIMP
nsDocument::GetNamespaceURI(nsString& aNamespaceURI)
nsDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI)
{
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::GetPrefix(nsString& aPrefix)
nsDocument::GetPrefix(nsAWritableString& aPrefix)
{
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocument::SetPrefix(const nsString& aPrefix)
nsDocument::SetPrefix(const nsAReadableString& aPrefix)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
NS_IMETHODIMP
nsDocument::GetLocalName(nsString& aLocalName)
nsDocument::GetLocalName(nsAWritableString& aLocalName)
{
aLocalName.Truncate();
return NS_OK;
@ -2930,7 +2928,7 @@ nsDocument::Normalize()
}
NS_IMETHODIMP
nsDocument::Supports(const nsString& aFeature, const nsString& aVersion,
nsDocument::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn);
@ -3044,7 +3042,7 @@ nsresult nsDocument::RemoveEventListenerByIID(nsIDOMEventListener *aListener, co
return NS_ERROR_FAILURE;
}
nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
nsresult nsDocument::AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsIEventListenerManager *manager;
@ -3059,7 +3057,7 @@ nsresult nsDocument::AddEventListener(const nsString& aType, nsIDOMEventListener
return NS_ERROR_FAILURE;
}
nsresult nsDocument::RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
nsresult nsDocument::RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
if (nsnull != mListenerManager) {
@ -3094,7 +3092,7 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent)
}
NS_IMETHODIMP
nsDocument::CreateEvent(const nsString& aEventType, nsIDOMEvent** aReturn)
nsDocument::CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aReturn)
{
// Obtain a presentation context
PRInt32 count = GetNumberOfShells();
@ -3275,7 +3273,7 @@ void nsDocument::Finalize(JSContext *aContext, JSObject *aObj)
/**
* Finds text in content
*/
NS_IMETHODIMP nsDocument::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound)
NS_IMETHODIMP nsDocument::FindNext(const nsAReadableString& aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound)
{
aIsFound = PR_FALSE;
return NS_ERROR_FAILURE;
@ -3365,7 +3363,7 @@ nsDocument::ToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode)
}
NS_IMETHODIMP
nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
nsDocument::CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection)
{
nsresult result=NS_OK;
@ -3380,25 +3378,25 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
if (aSelection)
converter->SetSelection(aSelection);
converter->AddStartTag( NS_ConvertToString("section") , PR_TRUE);
converter->AddStartTag( NS_ConvertToString("section_head") , PR_TRUE);
converter->AddStartTag( NS_LITERAL_STRING("section") , PR_TRUE);
converter->AddStartTag( NS_LITERAL_STRING("section_head") , PR_TRUE);
converter->BeginStartTag( NS_ConvertToString("document_info") );
converter->AddAttribute(NS_ConvertToString("charset"),mCharacterSet);
converter->BeginStartTag( NS_LITERAL_STRING("document_info") );
converter->AddAttribute(NS_LITERAL_STRING("charset"),mCharacterSet);
nsCOMPtr<nsIURI> uri (getter_AddRefs(GetDocumentURL()));
if (uri)
{
char* spec = 0;
if (NS_SUCCEEDED(uri->GetSpec(&spec)) && spec)
{
converter->AddAttribute(NS_ConvertToString("uri"), NS_ConvertToString(spec));
converter->AddAttribute(NS_LITERAL_STRING("uri"), NS_ConvertToString(spec));
Recycle(spec);
}
}
converter->FinishStartTag(NS_ConvertToString("document_info"),PR_TRUE,PR_TRUE);
converter->FinishStartTag(NS_LITERAL_STRING("document_info"),PR_TRUE,PR_TRUE);
converter->AddEndTag(NS_ConvertToString("section_head"), PR_TRUE, PR_TRUE);
converter->AddStartTag(NS_ConvertToString("section_body"), PR_TRUE);
converter->AddEndTag(NS_LITERAL_STRING("section_head"), PR_TRUE, PR_TRUE);
converter->AddStartTag(NS_LITERAL_STRING("section_body"), PR_TRUE);
nsCOMPtr<nsIDOMDocumentType> doctype;
GetDoctype(getter_AddRefs(doctype));
@ -3408,28 +3406,28 @@ nsDocument::CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection)
doctype->GetName(tmpStr);
if (tmpStr.Length()) {
docTypeStr.AppendWithConversion("DOCTYPE ");
docTypeStr.Append(NS_LITERAL_STRING("DOCTYPE "));
docTypeStr.Append(tmpStr);
doctype->GetPublicId(tmpStr);
if (tmpStr.Length()) {
docTypeStr.AppendWithConversion(" PUBLIC \"");
docTypeStr.Append(NS_LITERAL_STRING(" PUBLIC \""));
docTypeStr.Append(tmpStr);
docTypeStr.AppendWithConversion('"');
docTypeStr.Append(PRUnichar('"'));
}
doctype->GetSystemId(tmpStr);
if (tmpStr.Length()) {
docTypeStr.AppendWithConversion(" SYSTEM \"");
docTypeStr.Append(NS_LITERAL_STRING(" SYSTEM \""));
docTypeStr.Append(tmpStr);
docTypeStr.AppendWithConversion('"');
docTypeStr.Append(PRUnichar('"'));
}
doctype->GetInternalSubset(tmpStr);
if (tmpStr.Length()) {
docTypeStr.AppendWithConversion(" [\n");
docTypeStr.Append(NS_LITERAL_STRING(" [\n"));
docTypeStr.Append(tmpStr);
docTypeStr.AppendWithConversion("\n]");
docTypeStr.Append(NS_LITERAL_STRING("\n]"));
}
}
if (docTypeStr.Length())

Просмотреть файл

@ -74,7 +74,7 @@ protected:
class nsDocHeaderData
{
public:
nsDocHeaderData(nsIAtom* aField, const nsString& aData)
nsDocHeaderData(nsIAtom* aField, const nsAReadableString& aData)
{
mField = aField;
NS_IF_ADDREF(mField);
@ -177,7 +177,7 @@ public:
/**
* Return the content (mime) type of this document.
*/
NS_IMETHOD GetContentType(nsString& aContentType) const;
NS_IMETHOD GetContentType(nsAWritableString& aContentType) const;
/**
* Return the LoadGroup for the document. May return null.
@ -193,8 +193,8 @@ public:
* Return a standard name for the document's character set. This will
* trigger a startDocumentLoad if necessary to answer the question.
*/
NS_IMETHOD GetDocumentCharacterSet(nsString& oCharsetID);
NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID);
NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharsetID);
NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID);
/**
* Add an observer that gets notified whenever the charset changes.
@ -218,8 +218,8 @@ public:
* Access HTTP header data (this may also get set from other sources, like
* HTML META tags).
*/
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData);
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData);
/**
* Create a new presentation shell that will use aContext for
@ -350,14 +350,14 @@ public:
/**
* Finds text in content
*/
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
/**
* Converts the document or a selection of the
* document to XIF (XML Interchange Format)
* and places the result in aBuffer.
*/
NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
NS_IMETHOD CreateXIF(nsAWritableString & aBuffer, nsIDOMSelection* aSelection);
NS_IMETHOD ToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode);
virtual void BeginConvertToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode);
virtual void ConvertChildrenToXIF(nsIXIFConverter * aConverter, nsIDOMNode* aNode);
@ -378,26 +378,26 @@ public:
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation);
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement);
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn);
NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn);
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn);
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn);
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn);
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn);
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn);
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn);
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn);
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn);
NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn);
NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn);
NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn);
NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn);
NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn);
NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn);
NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn);
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn);
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn);
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
NS_IMETHOD GetCharacterSet(nsString& aCharacterSet);
NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet);
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode,
PRBool aDeep,
nsIDOMNode** aReturn);
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName,
const nsString& aNameSpace,
NS_IMETHOD CreateElementWithNameSpace(const nsAReadableString& aTagName,
const nsAReadableString& aNameSpace,
nsIDOMElement** aReturn);
NS_IMETHOD CreateRange(nsIDOMRange** aReturn);
NS_IMETHOD Load (const nsString& aUrl);
NS_IMETHOD Load (const nsAReadableString& aUrl);
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
// nsIDOMNode interface
@ -434,9 +434,9 @@ public:
NS_IMETHOD IncrementModCount(PRInt32 aNumMods);
// nsIDOMEventTarget interface
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);

Просмотреть файл

@ -54,7 +54,7 @@ public:
nsTextEncoder();
virtual ~nsTextEncoder();
NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags);
NS_IMETHOD Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags);
/* Interfaces for addref and release and queryinterface */
NS_DECL_ISUPPORTS
@ -62,10 +62,10 @@ public:
// Inherited methods from nsIDocumentEncoder
NS_IMETHOD SetSelection(nsIDOMSelection* aSelection);
NS_IMETHOD SetWrapColumn(PRUint32 aWC);
NS_IMETHOD SetCharset(const nsString& aCharset);
NS_IMETHOD SetCharset(const nsAReadableString& aCharset);
NS_IMETHOD EncodeToStream(nsIOutputStream* aStream);
NS_IMETHOD EncodeToString(nsString& aOutputString);
NS_IMETHOD EncodeToString(nsAWritableString& aOutputString);
protected:
// Local methods to the text encoder -- used to be in nsITextEncoder,
@ -104,7 +104,7 @@ nsTextEncoder::~nsTextEncoder()
}
NS_IMETHODIMP
nsTextEncoder::Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags)
nsTextEncoder::Init(nsIDocument* aDocument, const nsAReadableString& aMimeType, PRUint32 aFlags)
{
if (!aDocument)
return NS_ERROR_INVALID_ARG;
@ -156,14 +156,14 @@ nsTextEncoder::SetSelection(nsIDOMSelection* aSelection)
}
NS_IMETHODIMP
nsTextEncoder::SetCharset(const nsString& aCharset)
nsTextEncoder::SetCharset(const nsAReadableString& aCharset)
{
mCharset = aCharset;
return NS_OK;
}
NS_IMETHODIMP
nsTextEncoder::EncodeToString(nsString& aOutputString)
nsTextEncoder::EncodeToString(nsAWritableString& aOutputString)
{
nsresult rv;

Просмотреть файл

@ -49,9 +49,9 @@ public:
NS_DECL_ISUPPORTS
// interface nsIDOMDocumentFragment
NS_IMETHOD GetNodeName(nsString& aNodeName);
NS_IMETHOD GetNodeValue(nsString& aNodeValue);
NS_IMETHOD SetNodeValue(const nsString& aNodeValue);
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName);
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue);
NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue);
NS_IMETHOD GetNodeType(PRUint16* aNodeType);
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode)
{
@ -93,12 +93,12 @@ public:
NS_IMETHOD HasChildNodes(PRBool* aReturn)
{ return mInner.HasChildNodes(aReturn); }
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
NS_IMETHOD GetPrefix(nsString& aPrefix);
NS_IMETHOD SetPrefix(const nsString& aPrefix);
NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI);
NS_IMETHOD GetLocalName(nsString& aLocalName);
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix);
NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix);
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI);
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName);
NS_IMETHOD Normalize();
NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion,
NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn);
// interface nsIScriptObjectOwner
@ -106,7 +106,7 @@ public:
NS_IMETHOD SetScriptObject(void* aScriptObject);
// interface nsIContent
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID)
{ aName = nsnull;
@ -166,18 +166,18 @@ public:
NS_IMETHOD IsSynthetic(PRBool& aResult)
{ return mInner.IsSynthetic(aResult); }
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{ return NS_OK; }
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{ return NS_OK; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
nsAWritableString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const
nsIAtom*& aPrefix, nsAWritableString& aResult) const
{ return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify)
@ -352,21 +352,21 @@ nsDocumentFragment::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
NS_IMETHODIMP
nsDocumentFragment::GetNodeName(nsString& aNodeName)
nsDocumentFragment::GetNodeName(nsAWritableString& aNodeName)
{
aNodeName.AssignWithConversion("#document-fragment");
aNodeName.Assign(NS_ConvertASCIItoUCS2("#document-fragment"));
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::GetNodeValue(nsString& aNodeValue)
nsDocumentFragment::GetNodeValue(nsAWritableString& aNodeValue)
{
aNodeValue.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::SetNodeValue(const nsString& aNodeValue)
nsDocumentFragment::SetNodeValue(const nsAReadableString& aNodeValue)
{
// The node value can't be modified
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
@ -392,27 +392,27 @@ nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
NS_IMETHODIMP
nsDocumentFragment::GetNamespaceURI(nsString& aNamespaceURI)
nsDocumentFragment::GetNamespaceURI(nsAWritableString& aNamespaceURI)
{
aNamespaceURI.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::GetPrefix(nsString& aPrefix)
nsDocumentFragment::GetPrefix(nsAWritableString& aPrefix)
{
aPrefix.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsDocumentFragment::SetPrefix(const nsString& aPrefix)
nsDocumentFragment::SetPrefix(const nsAReadableString& aPrefix)
{
return NS_ERROR_DOM_NAMESPACE_ERR;
}
NS_IMETHODIMP
nsDocumentFragment::GetLocalName(nsString& aLocalName)
nsDocumentFragment::GetLocalName(nsAWritableString& aLocalName)
{
return GetNodeName(aLocalName);
}
@ -438,7 +438,7 @@ nsDocumentFragment::Normalize()
NS_IMETHODIMP
nsDocumentFragment::Supports(const nsString& aFeature, const nsString& aVersion,
nsDocumentFragment::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn);

Просмотреть файл

@ -32,7 +32,7 @@
#include "nsTextContentChangeData.h"
#include "nsIDOMSelection.h"
#include "nsIEnumerator.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsIEventStateManager.h"
@ -79,14 +79,14 @@ nsGenericDOMDataNode::~nsGenericDOMDataNode()
}
nsresult
nsGenericDOMDataNode::GetNodeValue(nsString& aNodeValue)
nsGenericDOMDataNode::GetNodeValue(nsAWritableString& aNodeValue)
{
return GetData(aNodeValue);
}
nsresult
nsGenericDOMDataNode::SetNodeValue(nsIContent *aOuterContent,
const nsString& aNodeValue)
const nsAReadableString& aNodeValue)
{
return SetData(aOuterContent, aNodeValue);
}
@ -215,21 +215,21 @@ nsGenericDOMDataNode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
nsresult
nsGenericDOMDataNode::GetNamespaceURI(nsString& aNamespaceURI)
nsGenericDOMDataNode::GetNamespaceURI(nsAWritableString& aNamespaceURI)
{
aNamespaceURI.Truncate();
return NS_OK;
}
nsresult
nsGenericDOMDataNode::GetPrefix(nsString& aPrefix)
nsGenericDOMDataNode::GetPrefix(nsAWritableString& aPrefix)
{
aPrefix.Truncate();
return NS_OK;
}
nsresult
nsGenericDOMDataNode::SetPrefix(const nsString& aPrefix)
nsGenericDOMDataNode::SetPrefix(const nsAReadableString& aPrefix)
{
return NS_ERROR_DOM_NAMESPACE_ERR;
}
@ -241,8 +241,8 @@ nsGenericDOMDataNode::Normalize()
}
nsresult
nsGenericDOMDataNode::Supports(const nsString& aFeature,
const nsString& aVersion,
nsGenericDOMDataNode::Supports(const nsAReadableString& aFeature,
const nsAReadableString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalSupports(aFeature, aVersion, aReturn);
@ -268,19 +268,19 @@ nsGenericDOMDataNode::Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn)
// Implementation of nsIDOMCharacterData
nsresult
nsGenericDOMDataNode::GetData(nsString& aData)
nsGenericDOMDataNode::GetData(nsAWritableString& aData)
{
if (mText.Is2b()) {
aData.Assign(mText.Get2b(), mText.GetLength());
}
else {
aData.AssignWithConversion(mText.Get1b(), mText.GetLength());
aData.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()));
}
return NS_OK;
}
nsresult
nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData)
nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsAReadableString& aData)
{
// inform any enclosed ranges of change
// we can lie and say we are deleting all the text, since in a total
@ -294,13 +294,10 @@ nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsString& aData)
// If possible, let the container content object have a go at it.
if (NS_SUCCEEDED(result)) {
result = textContent->SetText(aData.GetUnicode(),
aData.Length(),
PR_TRUE);
result = textContent->SetText(aData, PR_TRUE);
}
else {
result = SetText(aOuterContent, aData.GetUnicode(), aData.Length(),
PR_TRUE);
result = SetText(aOuterContent, aData, PR_TRUE);
}
return result;
@ -316,7 +313,7 @@ nsGenericDOMDataNode::GetLength(PRUint32* aLength)
nsresult
nsGenericDOMDataNode::SubstringData(PRUint32 aStart,
PRUint32 aCount,
nsString& aReturn)
nsAWritableString& aReturn)
{
aReturn.Truncate();
@ -334,7 +331,7 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart,
aReturn.Assign(mText.Get2b() + aStart, amount);
}
else {
aReturn.AssignWithConversion(mText.Get1b() + aStart, amount);
aReturn.Assign(NS_ConvertASCIItoUCS2(mText.Get1b() + aStart, amount), amount);
}
return NS_OK;
@ -344,12 +341,12 @@ nsGenericDOMDataNode::SubstringData(PRUint32 aStart,
nsresult
nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent,
const nsString& aData)
const nsAReadableString& aData)
{
#if 1
// Allocate new buffer
nsresult result = NS_OK;
PRInt32 dataLength = aData.Length();
PRUint32 dataLength = aData.Length();
PRInt32 textLength = mText.GetLength();
PRInt32 newSize = textLength + dataLength;
PRUnichar* to = new PRUnichar[newSize + 1];
@ -363,8 +360,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent,
if (textLength) {
mText.CopyTo(to, 0, textLength);
}
nsCRT::memcpy(to + textLength, aData.GetUnicode(),
sizeof(PRUnichar) * dataLength);
CopyUnicodeTo(aData, to + textLength, dataLength);
// Null terminate the new buffer...
to[newSize] = (PRUnichar)0;
@ -405,7 +401,7 @@ nsGenericDOMDataNode::AppendData(nsIContent *aOuterContent,
nsresult
nsGenericDOMDataNode::InsertData(nsIContent *aOuterContent, PRUint32 aOffset,
const nsString& aData)
const nsAReadableString& aData)
{
return ReplaceData(aOuterContent, aOffset, 0, aData);
}
@ -420,7 +416,7 @@ nsGenericDOMDataNode::DeleteData(nsIContent *aOuterContent, PRUint32 aOffset,
nsresult
nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset,
PRUint32 aCount, const nsString& aData)
PRUint32 aCount, const nsAReadableString& aData)
{
nsresult result = NS_OK;
@ -452,8 +448,7 @@ nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset,
mText.CopyTo(to, 0, aOffset);
}
if (0 != dataLength) {
nsCRT::memcpy(to + aOffset, aData.GetUnicode(),
sizeof(PRUnichar) * dataLength);
CopyUnicodeTo(aData, to+aOffset, dataLength);
}
if (endOffset != textLength) {
mText.CopyTo(to + aOffset + dataLength, endOffset, textLength - endOffset);
@ -599,7 +594,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent,
continue; // This range doesn't intersect the node at all
// Put all of our text into the buffer, initially:
nsString buffer;
nsAutoString buffer;
mText.AppendTo(buffer);
// Clip to whatever is inside the range:
@ -640,7 +635,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent,
}
else
{
nsString buffer;
nsAutoString buffer;
mText.AppendTo(buffer);
aConverter->AddContent(buffer);
}
@ -648,7 +643,7 @@ nsGenericDOMDataNode::ConvertContentToXIF(const nsIContent *aOuterContent,
}
void
nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset,
nsGenericDOMDataNode::ToCString(nsAWritableString& aBuf, PRInt32 aOffset,
PRInt32 aLen) const
{
if (mText.Is2b()) {
@ -657,15 +652,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset,
while (cp < end) {
PRUnichar ch = *cp++;
if (ch == '\r') {
aBuf.AppendWithConversion("\\r");
aBuf.Append(NS_LITERAL_STRING("\\r"));
} else if (ch == '\n') {
aBuf.AppendWithConversion("\\n");
aBuf.Append(NS_LITERAL_STRING("\\n"));
} else if (ch == '\t') {
aBuf.AppendWithConversion("\\t");
aBuf.Append(NS_LITERAL_STRING("\\t"));
} else if ((ch < ' ') || (ch >= 127)) {
char buf[10];
PR_snprintf(buf, sizeof(buf), "\\u%04x", ch);
aBuf.AppendWithConversion(buf);
aBuf.Append(NS_ConvertASCIItoUCS2(buf));
} else {
aBuf.Append(ch);
}
@ -677,15 +672,15 @@ nsGenericDOMDataNode::ToCString(nsString& aBuf, PRInt32 aOffset,
while (cp < end) {
PRUnichar ch = *cp++;
if (ch == '\r') {
aBuf.AppendWithConversion("\\r");
aBuf.Append(NS_LITERAL_STRING("\\r"));
} else if (ch == '\n') {
aBuf.AppendWithConversion("\\n");
aBuf.Append(NS_LITERAL_STRING("\\n"));
} else if (ch == '\t') {
aBuf.AppendWithConversion("\\t");
aBuf.Append(NS_LITERAL_STRING("\\t"));
} else if ((ch < ' ') || (ch >= 127)) {
char buf[10];
PR_snprintf(buf, sizeof(buf), "\\u%04x", ch);
aBuf.AppendWithConversion(buf);
aBuf.Append(NS_ConvertASCIItoUCS2(buf));
} else {
aBuf.Append(ch);
}
@ -1008,13 +1003,14 @@ nsGenericDOMDataNode::GetTextLength(PRInt32* aLengthResult)
}
nsresult
nsGenericDOMDataNode::CopyText(nsString& aResult)
nsGenericDOMDataNode::CopyText(nsAWritableString& aResult)
{
if (mText.Is2b()) {
aResult.Assign(mText.Get2b(), mText.GetLength());
}
else {
aResult.AssignWithConversion(mText.Get1b(), mText.GetLength());
aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()),
mText.GetLength());
}
return NS_OK;
}
@ -1069,6 +1065,23 @@ nsGenericDOMDataNode::SetText(nsIContent *aOuterContent, const char* aBuffer,
return NS_OK;
}
nsresult
nsGenericDOMDataNode::SetText(nsIContent *aOuterContent,
const nsAReadableString& aStr,
PRBool aNotify)
{
if (aNotify && (nsnull != mDocument)) {
mDocument->BeginUpdate();
}
mText = aStr;
// Trigger a reflow
if (aNotify && (nsnull != mDocument)) {
mDocument->ContentChanged(aOuterContent, nsnull);
mDocument->EndUpdate();
}
return NS_OK;
}
nsresult
nsGenericDOMDataNode::IsOnlyWhitespace(PRBool* aResult)

Просмотреть файл

@ -57,9 +57,9 @@ struct nsGenericDOMDataNode {
virtual ~nsGenericDOMDataNode();
// Implementation for nsIDOMNode
nsresult GetNodeValue(nsString& aNodeValue);
nsresult GetNodeValue(nsAWritableString& aNodeValue);
nsresult SetNodeValue(nsIContent *aOuterContent,
const nsString& aNodeValue);
const nsAReadableString& aNodeValue);
nsresult GetParentNode(nsIDOMNode** aParentNode);
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes) {
NS_ENSURE_ARG_POINTER(aAttributes);
@ -119,25 +119,25 @@ struct nsGenericDOMDataNode {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult GetNamespaceURI(nsString& aNamespaceURI);
nsresult GetPrefix(nsString& aPrefix);
nsresult SetPrefix(const nsString& aPrefix);
nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI);
nsresult GetPrefix(nsAWritableString& aPrefix);
nsresult SetPrefix(const nsAReadableString& aPrefix);
nsresult Normalize();
nsresult Supports(const nsString& aFeature, const nsString& aVersion,
nsresult Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn);
// Implementation for nsIDOMCharacterData
nsresult GetData(nsString& aData);
nsresult SetData(nsIContent *aOuterContent, const nsString& aData);
nsresult GetData(nsAWritableString& aData);
nsresult SetData(nsIContent *aOuterContent, const nsAReadableString& aData);
nsresult GetLength(PRUint32* aLength);
nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn);
nsresult AppendData(nsIContent *aOuterContent, const nsString& aArg);
nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsAWritableString& aReturn);
nsresult AppendData(nsIContent *aOuterContent, const nsAReadableString& aArg);
nsresult InsertData(nsIContent *aOuterContent, PRUint32 aOffset,
const nsString& aArg);
const nsAReadableString& aArg);
nsresult DeleteData(nsIContent *aOuterContent, PRUint32 aOffset,
PRUint32 aCount);
nsresult ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset,
PRUint32 aCount, const nsString& aArg);
PRUint32 aCount, const nsAReadableString& aArg);
// nsIScriptObjectOwner interface
@ -158,7 +158,7 @@ struct nsGenericDOMDataNode {
aID = kNameSpaceID_None;
return NS_OK;
}
nsresult ParseAttributeString(const nsString& aStr,
nsresult ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) {
aName = nsnull;
@ -170,21 +170,21 @@ struct nsGenericDOMDataNode {
aPrefix = nsnull;
return NS_OK;
}
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue,
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue,
PRBool aNotify) {
return NS_OK;
}
nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue,
nsresult SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify) {
return NS_OK;
}
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) {
return NS_OK;
}
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const {
return NS_CONTENT_ATTR_NOT_THERE;
}
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const {
aPrefix = nsnull;
return NS_CONTENT_ATTR_NOT_THERE;
}
@ -257,11 +257,14 @@ struct nsGenericDOMDataNode {
nsresult GetText(const nsTextFragment** aFragmentsResult);
nsresult GetTextLength(PRInt32* aLengthResult);
nsresult CopyText(nsString& aResult);
nsresult CopyText(nsAWritableString& aResult);
nsresult SetText(nsIContent *aOuterContent,
const PRUnichar* aBuffer,
PRInt32 aLength,
PRBool aNotify);
nsresult SetText(nsIContent *aOuterContent,
const nsAReadableString& aStr,
PRBool aNotify);
nsresult SetText(nsIContent *aOuterContent,
const char* aBuffer,
PRInt32 aLength,
@ -272,7 +275,7 @@ struct nsGenericDOMDataNode {
nsresult GetListenerManager(nsIContent* aOuterContent, nsIEventListenerManager** aInstancePtrResult);
void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
nsIDocument* mDocument;
nsIContent* mParent;
@ -296,14 +299,14 @@ struct nsGenericDOMDataNode {
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
*/
#define NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(_g) \
NS_IMETHOD GetNodeName(nsString& aNodeName); \
NS_IMETHOD GetLocalName(nsString& aLocalName) { \
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \
return GetNodeName(aLocalName); \
} \
NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \
return _g.GetNodeValue(aNodeValue); \
} \
NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \
NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \
return _g.SetNodeValue(this, aNodeValue); \
} \
NS_IMETHOD GetNodeType(PRUint16* aNodeType); \
@ -348,48 +351,48 @@ struct nsGenericDOMDataNode {
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \
return _g.GetOwnerDocument(aOwnerDocument); \
} \
NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \
return _g.GetNamespaceURI(aNamespaceURI); \
} \
NS_IMETHOD GetPrefix(nsString& aPrefix) { \
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \
return _g.GetPrefix(aPrefix); \
} \
NS_IMETHOD SetPrefix(const nsString& aPrefix) { \
NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \
return _g.SetPrefix(aPrefix); \
} \
NS_IMETHOD Normalize() { \
return NS_OK; \
} \
NS_IMETHOD Supports(const nsString& aFeature, const nsString& aVersion,\
NS_IMETHOD Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,\
PRBool* aReturn) { \
return _g.Supports(aFeature, aVersion, aReturn); \
} \
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
#define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \
NS_IMETHOD GetData(nsString& aData) { \
NS_IMETHOD GetData(nsAWritableString& aData) { \
return _g.GetData(aData); \
} \
NS_IMETHOD SetData(const nsString& aData) { \
NS_IMETHOD SetData(const nsAReadableString& aData) { \
return _g.SetData(this, aData); \
} \
NS_IMETHOD GetLength(PRUint32* aLength) { \
return _g.GetLength(aLength); \
} \
NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsString& aReturn) { \
NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsAWritableString& aReturn) { \
return _g.SubstringData(aStart, aEnd, aReturn); \
} \
NS_IMETHOD AppendData(const nsString& aData) { \
NS_IMETHOD AppendData(const nsAReadableString& aData) { \
return _g.AppendData(this, aData); \
} \
NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aData) { \
NS_IMETHOD InsertData(PRUint32 aOffset, const nsAReadableString& aData) { \
return _g.InsertData(this, aOffset, aData); \
} \
NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { \
return _g.DeleteData(this, aOffset, aCount); \
} \
NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, \
const nsString& aData) { \
const nsAReadableString& aData) { \
return _g.ReplaceData(this, aOffset, aCount, aData); \
}
@ -417,12 +420,12 @@ struct nsGenericDOMDataNode {
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \
return _g.HandleEvent(aEvent); \
} \
NS_IMETHOD AddEventListener(const nsString& aType, \
NS_IMETHOD AddEventListener(const nsAReadableString& aType, \
nsIDOMEventListener* aListener, \
PRBool aUseCapture) { \
return _g.AddEventListener(aType, aListener, aUseCapture); \
} \
NS_IMETHOD RemoveEventListener(const nsString& aType, \
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \
nsIDOMEventListener* aListener, \
PRBool aUseCapture) { \
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
@ -489,7 +492,7 @@ struct nsGenericDOMDataNode {
} \
NS_IMETHOD GetTag(nsIAtom*& aResult) const; \
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -499,19 +502,19 @@ struct nsGenericDOMDataNode {
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \
nsString &aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \
nsIAtom*& aPrefix, nsString &aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aAttribute, aPrefix, aResult); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -589,7 +592,7 @@ struct nsGenericDOMDataNode {
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { \
return mInner.GetTextLength(aLengthResult); \
} \
NS_IMETHOD CopyText(nsString& aResult) { \
NS_IMETHOD CopyText(nsAWritableString& aResult) { \
return mInner.CopyText(aResult); \
} \
NS_IMETHOD SetText(const PRUnichar* aBuffer, \
@ -597,6 +600,10 @@ struct nsGenericDOMDataNode {
PRBool aNotify){ \
return mInner.SetText(this, aBuffer, aLength, aNotify); \
} \
NS_IMETHOD SetText(const nsAReadableString& aStr, \
PRBool aNotify){ \
return mInner.SetText(this, aStr, aNotify); \
} \
NS_IMETHOD SetText(const char* aBuffer, \
PRInt32 aLength, \
PRBool aNotify){ \

Просмотреть файл

@ -486,14 +486,14 @@ nsGenericElement::Init(nsIContent* aOuterContentObject,
}
nsresult
nsGenericElement::GetNodeValue(nsString& aNodeValue)
nsGenericElement::GetNodeValue(nsAWritableString& aNodeValue)
{
aNodeValue.Truncate();
return NS_OK;
}
nsresult
nsGenericElement::SetNodeValue(const nsString& aNodeValue)
nsGenericElement::SetNodeValue(const nsAReadableString& aNodeValue)
{
// The node value can't be modified
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
@ -614,19 +614,19 @@ nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
}
nsresult
nsGenericElement::GetNamespaceURI(nsString& aNamespaceURI)
nsGenericElement::GetNamespaceURI(nsAWritableString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
nsresult
nsGenericElement::GetPrefix(nsString& aPrefix)
nsGenericElement::GetPrefix(nsAWritableString& aPrefix)
{
return mNodeInfo->GetPrefix(aPrefix);
}
nsresult
nsGenericElement::SetPrefix(const nsString& aPrefix)
nsGenericElement::SetPrefix(const nsAReadableString& aPrefix)
{
// XXX: Validate the prefix string!
@ -649,30 +649,31 @@ nsGenericElement::SetPrefix(const nsString& aPrefix)
}
nsresult
nsGenericElement::InternalSupports(const nsString& aFeature,
const nsString& aVersion,
nsGenericElement::InternalSupports(const nsAReadableString& aFeature,
const nsAReadableString& aVersion,
PRBool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = PR_FALSE;
nsAutoString feature(aFeature);
if (aFeature.EqualsWithConversion("XML", PR_TRUE) ||
aFeature.EqualsWithConversion("HTML", PR_TRUE)) {
if (feature.EqualsWithConversion("XML", PR_TRUE) ||
feature.EqualsWithConversion("HTML", PR_TRUE)) {
if (!aVersion.Length() ||
aVersion.EqualsWithConversion("1.0") ||
aVersion.EqualsWithConversion("2.0")) {
aVersion.Equals(NS_LITERAL_STRING("1.0")) ||
aVersion.Equals(NS_LITERAL_STRING("2.0"))) {
*aReturn = PR_TRUE;
}
} else if (aFeature.EqualsWithConversion("Views", PR_TRUE) ||
aFeature.EqualsWithConversion("StyleSheets", PR_TRUE) ||
aFeature.EqualsWithConversion("CSS", PR_TRUE) ||
// aFeature.EqualsWithConversion("CSS2", PR_TRUE) ||
aFeature.EqualsWithConversion("Events", PR_TRUE) ||
// aFeature.EqualsWithConversion("UIEvents", PR_TRUE) ||
aFeature.EqualsWithConversion("MouseEvents", PR_TRUE) ||
aFeature.EqualsWithConversion("HTMLEvents", PR_TRUE) ||
aFeature.EqualsWithConversion("Range", PR_TRUE)) {
if (!aVersion.Length() || aVersion.EqualsWithConversion("2.0")) {
} else if (feature.EqualsWithConversion("Views", PR_TRUE) ||
feature.EqualsWithConversion("StyleSheets", PR_TRUE) ||
feature.EqualsWithConversion("CSS", PR_TRUE) ||
// feature.EqualsWithConversion("CSS2", PR_TRUE) ||
feature.EqualsWithConversion("Events", PR_TRUE) ||
// feature.EqualsWithConversion("UIEvents", PR_TRUE) ||
feature.EqualsWithConversion("MouseEvents", PR_TRUE) ||
feature.EqualsWithConversion("HTMLEvents", PR_TRUE) ||
feature.EqualsWithConversion("Range", PR_TRUE)) {
if (!aVersion.Length() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) {
*aReturn = PR_TRUE;
}
}
@ -681,7 +682,7 @@ nsGenericElement::InternalSupports(const nsString& aFeature,
}
nsresult
nsGenericElement::Supports(const nsString& aFeature, const nsString& aVersion,
nsGenericElement::Supports(const nsAReadableString& aFeature, const nsAReadableString& aVersion,
PRBool* aReturn)
{
return InternalSupports(aFeature, aVersion, aReturn);
@ -706,7 +707,7 @@ nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
}
nsresult
nsGenericElement::GetTagName(nsString& aTagName)
nsGenericElement::GetTagName(nsAWritableString& aTagName)
{
aTagName.Truncate();
if (mNodeInfo) {
@ -716,7 +717,7 @@ nsGenericElement::GetTagName(nsString& aTagName)
}
nsresult
nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn)
nsGenericElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)
{
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aName)));
@ -726,13 +727,13 @@ nsGenericElement::GetAttribute(const nsString& aName, nsString& aReturn)
}
nsresult
nsGenericElement::SetAttribute(const nsString& aName,
const nsString& aValue)
nsGenericElement::SetAttribute(const nsAReadableString& aName,
const nsAReadableString& aValue)
{
if (kStrictDOMLevel2) {
PRInt32 pos = aName.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aName);
nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName));
printf ("Possible DOM Error: SetAttribute(\"%s\") called, use SetAttributeNS() in stead!\n", (const char *)tmp);
}
@ -755,12 +756,12 @@ nsGenericElement::SetAttribute(const nsString& aName,
}
nsresult
nsGenericElement::RemoveAttribute(const nsString& aName)
nsGenericElement::RemoveAttribute(const nsAReadableString& aName)
{
if (kStrictDOMLevel2) {
PRInt32 pos = aName.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aName);
nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aName));
printf ("Possible DOM Error: RemoveAttribute(\"%s\") called, use RemoveAttributeNS() in stead!\n", (const char *)tmp);
}
@ -783,7 +784,7 @@ nsGenericElement::RemoveAttribute(const nsString& aName)
}
nsresult
nsGenericElement::GetAttributeNode(const nsString& aName,
nsGenericElement::GetAttributeNode(const nsAReadableString& aName,
nsIDOMAttr** aReturn)
{
if (nsnull == aReturn) {
@ -864,7 +865,7 @@ nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
}
nsresult
nsGenericElement::GetElementsByTagName(const nsString& aTagname,
nsGenericElement::GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn)
{
nsIAtom* nameAtom;
@ -874,7 +875,7 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname,
if (kStrictDOMLevel2) {
PRInt32 pos = aTagname.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aTagname);
nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aTagname));
printf ("Possible DOM Error: GetElementsByTagName(\"%s\") called, use GetElementsByTagNameNS() in stead!\n", (const char *)tmp);
}
@ -901,8 +902,8 @@ nsGenericElement::GetElementsByTagName(const nsString& aTagname,
}
nsresult
nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsString& aReturn)
nsGenericElement::GetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsAWritableString& aReturn)
{
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
PRInt32 nsid;
@ -930,9 +931,9 @@ nsGenericElement::GetAttributeNS(const nsString& aNamespaceURI,
}
nsresult
nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsString& aValue)
nsGenericElement::SetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
const nsAReadableString& aValue)
{
nsCOMPtr<nsINodeInfoManager> nimgr;
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
@ -948,8 +949,8 @@ nsGenericElement::SetAttributeNS(const nsString& aNamespaceURI,
nsresult
nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName)
nsGenericElement::RemoveAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName)
{
nsCOMPtr<nsIAtom> name(dont_AddRef(NS_NewAtom(aLocalName)));
PRInt32 nsid;
@ -977,8 +978,8 @@ nsGenericElement::RemoveAttributeNS(const nsString& aNamespaceURI,
}
nsresult
nsGenericElement::GetAttributeNodeNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsGenericElement::GetAttributeNodeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMAttr** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -1029,8 +1030,8 @@ nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
}
nsresult
nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsGenericElement::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn)
{
nsCOMPtr<nsIAtom> nameAtom(dont_AddRef(NS_NewAtom(aLocalName)));
@ -1038,7 +1039,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI,
nsContentList* list = nsnull;
if (!aNamespaceURI.EqualsWithConversion("*")) {
if (!aNamespaceURI.Equals(NS_LITERAL_STRING("*"))) {
nsCOMPtr<nsINodeInfoManager> nimgr;
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
@ -1065,7 +1066,7 @@ nsGenericElement::GetElementsByTagNameNS(const nsString& aNamespaceURI,
}
nsresult
nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn)
nsGenericElement::HasAttribute(const nsAReadableString& aName, PRBool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -1080,8 +1081,8 @@ nsGenericElement::HasAttribute(const nsString& aName, PRBool* aReturn)
}
nsresult
nsGenericElement::HasAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, PRBool* aReturn)
nsGenericElement::HasAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, PRBool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -1679,7 +1680,7 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mContent));
viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl));
if (cssDecl) {
nsAutoString behavior; behavior.AssignWithConversion("behavior");
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior"));
nsAutoString value;
cssDecl->GetPropertyValue(behavior, value);
if (!value.IsEmpty()) {
@ -1777,7 +1778,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js
propName.Assign(NS_REINTERPRET_CAST(const PRUnichar*, JS_GetStringChars(JS_ValueToString(aContext, aID))));
if (propName.Length() > 2)
prefix.Assign(propName.GetUnicode(), 2);
if (prefix.EqualsWithConversion("on")) {
if (prefix.Equals(NS_LITERAL_STRING("on"))) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName));
nsIEventListenerManager *manager = nsnull;
@ -2423,7 +2424,7 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext,
nsresult
nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
REFNSIID aIID)
{
nsresult ret = NS_OK;
@ -2504,7 +2505,7 @@ nsGenericElement::CutNameSpacePrefix(nsString& aString)
struct nsGenericAttribute
{
nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue)
nsGenericAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue)
: mNodeInfo(aNodeInfo),
mValue(aValue)
{
@ -2671,7 +2672,7 @@ nsGenericContainerElement::GetLastChild(nsIDOMNode** aNode)
nsresult
nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
nsresult rv;
@ -2689,7 +2690,7 @@ nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
NS_ENSURE_ARG_POINTER(aNodeInfo);
@ -2750,7 +2751,7 @@ nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo,
nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const
nsAWritableString& aResult) const
{
nsCOMPtr<nsIAtom> prefix;
return GetAttribute(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult);
@ -2759,7 +2760,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix,
nsString& aResult) const
nsAWritableString& aResult) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
if (nsnull == aName) {
@ -2777,7 +2778,7 @@ nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) &&
(attr->mNodeInfo->Equals(aName))) {
attr->mNodeInfo->GetPrefixAtom(aPrefix);
aResult = attr->mValue;
aResult.Assign(attr->mValue);
if (0 < aResult.Length()) {
rv = NS_CONTENT_ATTR_HAS_VALUE;
}

Просмотреть файл

@ -131,49 +131,49 @@ public:
void Init(nsIContent* aOuterContentObject, nsINodeInfo *aNodeInfo);
// Implementation for nsIDOMNode
nsresult GetNodeValue(nsString& aNodeValue);
nsresult SetNodeValue(const nsString& aNodeValue);
nsresult GetNodeValue(nsAWritableString& aNodeValue);
nsresult SetNodeValue(const nsAReadableString& aNodeValue);
nsresult GetNodeType(PRUint16* aNodeType);
nsresult GetParentNode(nsIDOMNode** aParentNode);
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes);
nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult GetNamespaceURI(nsString& aNamespaceURI);
nsresult GetPrefix(nsString& aPrefix);
nsresult SetPrefix(const nsString& aPrefix);
nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI);
nsresult GetPrefix(nsAWritableString& aPrefix);
nsresult SetPrefix(const nsAReadableString& aPrefix);
nsresult Normalize();
nsresult Supports(const nsString& aFeature,
const nsString& aVersion, PRBool* aReturn);
nsresult Supports(const nsAReadableString& aFeature,
const nsAReadableString& aVersion, PRBool* aReturn);
// Implementation for nsIDOMElement
nsresult GetTagName(nsString& aTagName);
nsresult GetAttribute(const nsString& aName, nsString& aReturn);
nsresult SetAttribute(const nsString& aName, const nsString& aValue);
nsresult RemoveAttribute(const nsString& aName);
nsresult GetAttributeNode(const nsString& aName,
nsresult GetTagName(nsAWritableString& aTagName);
nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn);
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue);
nsresult RemoveAttribute(const nsAReadableString& aName);
nsresult GetAttributeNode(const nsAReadableString& aName,
nsIDOMAttr** aReturn);
nsresult SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn);
nsresult RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn);
nsresult GetElementsByTagName(const nsString& aTagname,
nsresult GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn);
nsresult GetAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsString& aReturn);
nsresult SetAttributeNS(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsString& aValue);
nsresult RemoveAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName);
nsresult GetAttributeNodeNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsresult GetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsAWritableString& aReturn);
nsresult SetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
const nsAReadableString& aValue);
nsresult RemoveAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName);
nsresult GetAttributeNodeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMAttr** aReturn);
nsresult SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn);
nsresult GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
nsresult GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn);
nsresult HasAttribute(const nsString& aName, PRBool* aReturn);
nsresult HasAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, PRBool* aReturn);
nsresult HasAttribute(const nsAReadableString& aName, PRBool* aReturn);
nsresult HasAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, PRBool* aReturn);
// nsIScriptObjectOwner interface
nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
@ -251,7 +251,7 @@ public:
nsresult RenderFrame(nsIPresContext*);
nsresult AddScriptEventListener(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
REFNSIID aIID);
nsresult TriggerLink(nsIPresContext* aPresContext,
@ -273,8 +273,8 @@ public:
static nsIAtom* CutNameSpacePrefix(nsString& aString);
static nsresult InternalSupports(const nsString& aFeature,
const nsString& aVersion, PRBool* aReturn);
static nsresult InternalSupports(const nsAReadableString& aFeature,
const nsAReadableString& aVersion, PRBool* aReturn);
nsDOMSlots *GetDOMSlots();
void MaybeClearDOMSlots();
@ -303,11 +303,11 @@ public:
PRBool aDeep);
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
nsresult GetAttribute(const nsString& aName, nsString& aReturn)
nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)
{
return nsGenericElement::GetAttribute(aName, aReturn);
}
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
{
return nsGenericElement::SetAttribute(aName, aValue);
}
@ -337,14 +337,14 @@ public:
// Remainder of nsIContent
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const;
nsAWritableString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const;
nsIAtom*& aPrefix, nsAWritableString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
@ -386,13 +386,13 @@ public:
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
*/
#define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \
NS_IMETHOD GetNodeName(nsString& aNodeName) { \
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { \
return _g.GetNodeName(aNodeName); \
} \
NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \
return _g.GetNodeValue(aNodeValue); \
} \
NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \
NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { \
return _g.SetNodeValue(aNodeValue); \
} \
NS_IMETHOD GetNodeType(PRUint16* aNodeType) { \
@ -422,16 +422,16 @@ public:
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \
return _g.GetAttributes(aAttributes); \
} \
NS_IMETHOD GetNamespaceURI(nsString& aNamespaceURI) { \
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNamespaceURI) { \
return _g.GetNamespaceURI(aNamespaceURI); \
} \
NS_IMETHOD GetPrefix(nsString& aPrefix) { \
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { \
return _g.GetPrefix(aPrefix); \
} \
NS_IMETHOD SetPrefix(const nsString& aPrefix) { \
NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { \
return _g.SetPrefix(aPrefix); \
} \
NS_IMETHOD GetLocalName(nsString& aLocalName) { \
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \
return _g.GetLocalName(aLocalName); \
} \
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \
@ -455,8 +455,8 @@ public:
NS_IMETHOD Normalize() { \
return _g.Normalize(); \
} \
NS_IMETHOD Supports(const nsString& aFeature, \
const nsString& aVersion, PRBool* aReturn) { \
NS_IMETHOD Supports(const nsAReadableString& aFeature, \
const nsAReadableString& aVersion, PRBool* aReturn) { \
return _g.Supports(aFeature, aVersion, aReturn); \
}
@ -466,19 +466,19 @@ public:
* nsGenericHTMLContainerContent)
*/
#define NS_IMPL_IDOMELEMENT_USING_GENERIC(_g) \
NS_IMETHOD GetTagName(nsString& aTagName) { \
NS_IMETHOD GetTagName(nsAWritableString& aTagName) { \
return _g.GetTagName(aTagName); \
} \
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { \
NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) { \
return _g.GetAttribute(aName, aReturn); \
} \
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { \
NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) { \
return _g.SetAttribute(aName, aValue); \
} \
NS_IMETHOD RemoveAttribute(const nsString& aName) { \
NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) { \
return _g.RemoveAttribute(aName); \
} \
NS_IMETHOD GetAttributeNode(const nsString& aName, \
NS_IMETHOD GetAttributeNode(const nsAReadableString& aName, \
nsIDOMAttr** aReturn) { \
return _g.GetAttributeNode(aName, aReturn); \
} \
@ -488,41 +488,41 @@ public:
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {\
return _g.RemoveAttributeNode(aOldAttr, aReturn); \
} \
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, \
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, \
nsIDOMNodeList** aReturn) { \
return _g.GetElementsByTagName(aTagname, aReturn); \
} \
NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI, \
const nsString& aLocalName, nsString& aReturn) { \
NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aLocalName, nsAWritableString& aReturn) { \
return _g.GetAttributeNS(aNamespaceURI, aLocalName, aReturn); \
} \
NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI, \
const nsString& aQualifiedName, \
const nsString& aValue) { \
NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aQualifiedName, \
const nsAReadableString& aValue) { \
return _g.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue); \
} \
NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI, \
const nsString& aLocalName) { \
NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aLocalName) { \
return _g.RemoveAttributeNS(aNamespaceURI, aLocalName); \
} \
NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI, \
const nsString& aLocalName, \
NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aLocalName, \
nsIDOMAttr** aReturn) { \
return _g.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn); \
} \
NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { \
return _g.SetAttributeNodeNS(aNewAttr, aReturn); \
} \
NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, \
const nsString& aLocalName, \
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aLocalName, \
nsIDOMNodeList** aReturn) { \
return _g.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); \
} \
NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) { \
NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) { \
return _g.HasAttribute(aName, aReturn); \
} \
NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI, \
const nsString& aLocalName, PRBool* aReturn) { \
NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI, \
const nsAReadableString& aLocalName, PRBool* aReturn) { \
return _g.HasAttributeNS(aNamespaceURI, aLocalName, aReturn); \
}
@ -549,12 +549,12 @@ public:
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent) { \
return _g.HandleEvent(aEvent); \
} \
NS_IMETHOD AddEventListener(const nsString& aType, \
NS_IMETHOD AddEventListener(const nsAReadableString& aType, \
nsIDOMEventListener* aListener, \
PRBool aUseCapture) { \
return _g.AddEventListener(aType, aListener, aUseCapture); \
} \
NS_IMETHOD RemoveEventListener(const nsString& aType, \
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, \
nsIDOMEventListener* aListener, \
PRBool aUseCapture) { \
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
@ -611,7 +611,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -621,19 +621,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -750,7 +750,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -760,19 +760,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -889,7 +889,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -899,19 +899,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -1026,7 +1026,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -1036,19 +1036,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -1167,7 +1167,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -1177,19 +1177,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
@ -1300,7 +1300,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const { \
return _g.GetNodeInfo(aResult); \
} \
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr, \
nsIAtom*& aName, \
PRInt32& aNameSpaceID) { \
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
@ -1310,19 +1310,19 @@ public:
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
} \
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
} \
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo, \
const nsString& aValue, PRBool aNotify) { \
const nsAReadableString& aValue, PRBool aNotify) { \
return _g.SetAttribute(aNodeInfo, aValue, aNotify); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsString& aResult) const { \
nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
} \
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
nsIAtom*& aPrefix, nsString& aResult) const { \
nsIAtom*& aPrefix, nsAWritableString& aResult) const { \
return _g.GetAttribute(aNameSpaceID, aName, aPrefix, aResult); \
} \
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsHTMLValue.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsISizeOfHandler.h"
@ -60,14 +61,14 @@ nsHTMLValue::nsHTMLValue(float aValue)
mValue.mFloat = aValue;
}
nsHTMLValue::nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit)
nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit)
: mUnit(aUnit)
{
NS_ASSERTION((eHTMLUnit_String == aUnit) ||
(eHTMLUnit_ColorName == aUnit), "not a string value");
if ((eHTMLUnit_String == aUnit) ||
(eHTMLUnit_ColorName == aUnit)) {
mValue.mString = aValue.ToNewUnicode();
mValue.mString = ToNewUnicode(aValue);
}
else {
mUnit = eHTMLUnit_Null;
@ -226,12 +227,13 @@ void nsHTMLValue::SetPercentValue(float aValue)
mValue.mFloat = aValue;
}
void nsHTMLValue::SetStringValue(const nsString& aValue, nsHTMLUnit aUnit)
void nsHTMLValue::SetStringValue(const nsAReadableString& aValue,
nsHTMLUnit aUnit)
{
Reset();
if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) {
mUnit = aUnit;
mValue.mString = aValue.ToNewUnicode();
mValue.mString = ToNewUnicode(aValue);
}
}
@ -256,7 +258,7 @@ void nsHTMLValue::SetEmptyValue(void)
mUnit = eHTMLUnit_Empty;
}
void nsHTMLValue::AppendToString(nsString& aBuffer) const
void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const
{
if (eHTMLUnit_Null == mUnit) {
return;
@ -266,37 +268,48 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const
}
else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) {
if (nsnull != mValue.mString) {
aBuffer.AppendWithConversion('"');
aBuffer.Append(PRUnichar('"'));
aBuffer.Append(mValue.mString);
aBuffer.AppendWithConversion('"');
aBuffer.Append(PRUnichar('"'));
}
else {
aBuffer.AppendWithConversion("null str");
aBuffer.Append(NS_LITERAL_STRING("null str"));
}
}
else if (eHTMLUnit_ISupports == mUnit) {
aBuffer.AppendWithConversion("0x");
aBuffer.AppendInt((PRInt32)mValue.mISupports, 16);
aBuffer.Append(NS_LITERAL_STRING("0x"));
nsAutoString intStr;
intStr.AppendInt((PRInt32)mValue.mISupports, 16);
aBuffer.Append(intStr);
}
else if (eHTMLUnit_Color == mUnit){
aBuffer.AppendWithConversion("(0x");
aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16);
aBuffer.AppendWithConversion(" 0x");
aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16);
aBuffer.AppendWithConversion(" 0x");
aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16);
aBuffer.AppendWithConversion(" 0x");
aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16);
aBuffer.AppendWithConversion(')');
nsAutoString intStr;
intStr.Append(NS_LITERAL_STRING("(0x"));
intStr.AppendInt(NS_GET_R(mValue.mColor), 16);
intStr.Append(intStr);
intStr.Append(NS_LITERAL_STRING(" 0x"));
intStr.AppendInt(NS_GET_G(mValue.mColor), 16);
intStr.Append(NS_LITERAL_STRING(" 0x"));
intStr.AppendInt(NS_GET_B(mValue.mColor), 16);
intStr.Append(NS_LITERAL_STRING(" 0x"));
intStr.AppendInt(NS_GET_A(mValue.mColor), 16);
intStr.Append(PRUnichar(')'));
aBuffer.Append(intStr);
}
else if (eHTMLUnit_Percent == mUnit) {
aBuffer.AppendFloat(mValue.mFloat * 100.0f);
nsAutoString floatStr;
floatStr.AppendFloat(mValue.mFloat * 100.0f);
aBuffer.Append(floatStr);
}
else {
aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.AppendWithConversion("[0x");
aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.AppendWithConversion(']');
nsAutoString intStr;
intStr.AppendInt(mValue.mInt, 10);
intStr.Append(NS_LITERAL_STRING("[0x"));
intStr.AppendInt(mValue.mInt, 16);
intStr.Append(PRUnichar(']'));
aBuffer.Append(intStr);
}
switch (mUnit) {
@ -304,18 +317,18 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const
case eHTMLUnit_Empty: break;
case eHTMLUnit_String: break;
case eHTMLUnit_ColorName: break;
case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break;
case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break;
case eHTMLUnit_Integer: break;
case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break;
case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break;
case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break;
case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break;
case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break;
case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break;
case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break;
}
aBuffer.AppendWithConversion(' ');
aBuffer.Append(PRUnichar(' '));
}
void nsHTMLValue::ToString(nsString& aBuffer) const
void nsHTMLValue::ToString(nsAWritableString& aBuffer) const
{
aBuffer.Truncate();
AppendToString(aBuffer);

Просмотреть файл

@ -48,7 +48,7 @@ public:
nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null);
nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit);
nsHTMLValue(float aValue);
nsHTMLValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String);
nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String);
nsHTMLValue(nsISupports* aValue);
nsHTMLValue(nscolor aValue);
nsHTMLValue(const nsHTMLValue& aCopy);
@ -63,7 +63,7 @@ public:
PRInt32 GetIntValue(void) const;
PRInt32 GetPixelValue(void) const;
float GetPercentValue(void) const;
nsString& GetStringValue(nsString& aBuffer) const;
nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const;
nsISupports* GetISupportsValue(void) const;
nscolor GetColorValue(void) const;
@ -71,13 +71,13 @@ public:
void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit);
void SetPixelValue(PRInt32 aValue);
void SetPercentValue(float aValue);
void SetStringValue(const nsString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String);
void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String);
void SetISupportsValue(nsISupports* aValue);
void SetColorValue(nscolor aValue);
void SetEmptyValue(void);
void AppendToString(nsString& aBuffer) const;
void ToString(nsString& aBuffer) const;
void AppendToString(nsAWritableString& aBuffer) const;
void ToString(nsAWritableString& aBuffer) const;
protected:
nsHTMLUnit mUnit;
@ -129,7 +129,7 @@ inline float nsHTMLValue::GetPercentValue(void) const
return 0.0f;
}
inline nsString& nsHTMLValue::GetStringValue(nsString& aBuffer) const
inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const
{
NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) ||
(mUnit == eHTMLUnit_Null), "not a string value");

Просмотреть файл

@ -45,8 +45,6 @@ static PRInt32 gNameSpaceTableRefs;
static nsHashtable* gURIToIDTable;
static nsVoidArray* gURIArray;
MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey);
static void AddRefTable()
{
if (0 == gNameSpaceTableRefs++) {
@ -96,7 +94,7 @@ static void ReleaseTable()
}
}
static PRInt32 FindNameSpaceID(const nsString& aURI)
static PRInt32 FindNameSpaceID(const nsAReadableString& aURI)
{
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
nsStringKey key(aURI);
@ -121,7 +119,7 @@ public:
NameSpaceImpl(nsINameSpaceManager* aManager,
NameSpaceImpl* aParent,
nsIAtom* aPrefix,
const nsString& aURI);
const nsAReadableString& aURI);
NameSpaceImpl(nsINameSpaceManager* aManager,
NameSpaceImpl* aParent,
nsIAtom* aPrefix,
@ -133,7 +131,7 @@ public:
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const;
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const;
NS_IMETHOD GetNameSpaceURI(nsString& aURI) const;
NS_IMETHOD GetNameSpaceURI(nsAWritableString& aURI) const;
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const;
NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const;
@ -142,7 +140,7 @@ public:
NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const;
NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const;
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI,
nsINameSpace*& aChildNameSpace);
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
nsINameSpace*& aChildNameSpace);
@ -162,7 +160,7 @@ public:
NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager,
NameSpaceImpl* aParent,
nsIAtom* aPrefix,
const nsString& aURI)
const nsAReadableString& aURI)
: mManager(aManager),
mParent(aParent),
mPrefix(aPrefix)
@ -217,7 +215,7 @@ NameSpaceImpl::GetNameSpaceID(PRInt32& aID) const
}
NS_IMETHODIMP
NameSpaceImpl::GetNameSpaceURI(nsString& aURI) const
NameSpaceImpl::GetNameSpaceURI(nsAWritableString& aURI) const
{
NS_ASSERTION(nsnull != mManager, "null namespace manager");
return mManager->GetNameSpaceURI(mID, aURI);
@ -295,7 +293,7 @@ NameSpaceImpl::FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) cons
}
NS_IMETHODIMP
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsAReadableString& aURI,
nsINameSpace*& aChildNameSpace)
{
NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aURI);
@ -335,11 +333,11 @@ public:
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace);
NS_IMETHOD RegisterNameSpace(const nsString& aURI,
NS_IMETHOD RegisterNameSpace(const nsAReadableString& aURI,
PRInt32& aNameSpaceID);
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI);
NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID);
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI);
NS_IMETHOD GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID);
private:
// These are not supported and are not implemented!
@ -384,7 +382,7 @@ NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace)
}
NS_IMETHODIMP
NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI,
NameSpaceManagerImpl::RegisterNameSpace(const nsAReadableString& aURI,
PRInt32& aNameSpaceID)
{
PRInt32 id = FindNameSpaceID(aURI);
@ -401,7 +399,7 @@ NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI,
}
NS_IMETHODIMP
NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI)
NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsAWritableString& aURI)
{
const nsString* result = FindNameSpaceURI(aNameSpaceID);
if (nsnull != result) {
@ -413,7 +411,7 @@ NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI)
}
NS_IMETHODIMP
NameSpaceManagerImpl::GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID)
NameSpaceManagerImpl::GetNameSpaceID(const nsAReadableString& aURI, PRInt32& aNameSpaceID)
{
aNameSpaceID = FindNameSpaceID(aURI);
return NS_OK;

Просмотреть файл

@ -96,7 +96,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS(nsNodeInfo, NS_GET_IID(nsINodeInfo));
// nsINodeInfo
NS_IMETHODIMP
nsNodeInfo::GetName(nsString& aName)
nsNodeInfo::GetName(nsAWritableString& aName)
{
NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED);
@ -117,7 +117,7 @@ nsNodeInfo::GetNameAtom(nsIAtom*& aAtom)
NS_IMETHODIMP
nsNodeInfo::GetQualifiedName(nsString& aQualifiedName)
nsNodeInfo::GetQualifiedName(nsAWritableString& aQualifiedName)
{
NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED);
@ -133,7 +133,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName)
aQualifiedName.Append(name);
if (kStrictDOMLevel2 && mInner.mPrefix) {
nsCAutoString tmp; tmp.AssignWithConversion(aQualifiedName);
nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aQualifiedName));
printf ("Possible DOM Error: .name, .nodeName or .tagName requested on a namespace element/attribute with the qulaified name '%s', is this OK?\n", (const char *)tmp);
}
@ -142,7 +142,7 @@ nsNodeInfo::GetQualifiedName(nsString& aQualifiedName)
NS_IMETHODIMP
nsNodeInfo::GetLocalName(nsString& aLocalName)
nsNodeInfo::GetLocalName(nsAWritableString& aLocalName)
{
NS_ENSURE_TRUE(mInner.mName, NS_ERROR_NOT_INITIALIZED);
@ -161,7 +161,7 @@ nsNodeInfo::GetLocalName(nsString& aLocalName)
NS_IMETHODIMP
nsNodeInfo::GetPrefix(nsString& aPrefix)
nsNodeInfo::GetPrefix(nsAWritableString& aPrefix)
{
if (mInner.mPrefix) {
mInner.mPrefix->ToString(aPrefix);
@ -184,7 +184,7 @@ nsNodeInfo::GetPrefixAtom(nsIAtom*& aAtom)
NS_IMETHODIMP
nsNodeInfo::GetNamespaceURI(nsString& aNameSpaceURI)
nsNodeInfo::GetNamespaceURI(nsAWritableString& aNameSpaceURI)
{
NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED);
nsresult rv = NS_OK;
@ -234,7 +234,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom)
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName)
nsNodeInfo::Equals(const nsAReadableString& aName)
{
if (!mInner.mName) return PR_FALSE;
@ -253,7 +253,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom)
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix)
nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix)
{
if (!mInner.mName) return PR_FALSE;
@ -275,7 +275,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID)
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, PRInt32 aNamespaceID)
nsNodeInfo::Equals(const nsAReadableString& aName, PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
@ -297,7 +297,7 @@ nsNodeInfo::Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
NS_IMETHODIMP_(PRBool)
nsNodeInfo::Equals(const nsString& aName, const nsString& aPrefix,
nsNodeInfo::Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix,
PRInt32 aNamespaceID)
{
if (!mInner.mName) return PR_FALSE;
@ -321,7 +321,7 @@ nsNodeInfo::NamespaceEquals(PRInt32 aNamespaceID)
NS_IMETHODIMP_(PRBool)
nsNodeInfo::NamespaceEquals(const nsString& aNamespaceURI)
nsNodeInfo::NamespaceEquals(const nsAReadableString& aNamespaceURI)
{
NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsINameSpaceManager> nsmgr;

Просмотреть файл

@ -65,29 +65,29 @@ public:
NS_DECL_ISUPPORTS
// nsINodeInfo
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD GetName(nsAWritableString& aName);
NS_IMETHOD GetNameAtom(nsIAtom*& aAtom);
NS_IMETHOD GetQualifiedName(nsString& aQualifiedName);
NS_IMETHOD GetLocalName(nsString& aLocalName);
NS_IMETHOD GetPrefix(nsString& aPrefix);
NS_IMETHOD GetQualifiedName(nsAWritableString& aQualifiedName);
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName);
NS_IMETHOD GetPrefix(nsAWritableString& aPrefix);
NS_IMETHOD GetPrefixAtom(nsIAtom*& aAtom);
NS_IMETHOD GetNamespaceURI(nsString& aNameSpaceURI);
NS_IMETHOD GetNamespaceURI(nsAWritableString& aNameSpaceURI);
NS_IMETHOD GetNamespaceID(PRInt32& aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName);
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom);
NS_IMETHOD_(PRBool) Equals(const nsString& aName,
const nsString& aPrefix);
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName,
const nsAReadableString& aPrefix);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(nsIAtom *aNameAtom, nsIAtom *aPrefixAtom,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) Equals(const nsString& aName, const nsString& aPrefix,
NS_IMETHOD_(PRBool) Equals(const nsAReadableString& aName, const nsAReadableString& aPrefix,
PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(PRInt32 aNamespaceID);
NS_IMETHOD_(PRBool) NamespaceEquals(const nsString& aNamespaceURI);
NS_IMETHOD_(PRBool) NamespaceEquals(const nsAReadableString& aNamespaceURI);
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult);
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult);

Просмотреть файл

@ -149,7 +149,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
NS_IMETHODIMP
nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix,
nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo)
{
NS_ENSURE_ARG(aName.Length());
@ -162,7 +162,7 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, nsIAtom *aPrefix,
NS_IMETHODIMP
nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix,
nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo)
{
NS_ENSURE_ARG(aName.Length());
@ -182,8 +182,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix,
NS_IMETHODIMP
nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix,
const nsString& aNamespaceURI,
nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo)
{
NS_ENSURE_ARG(aName.Length());
@ -214,8 +214,8 @@ nsNodeInfoManager::GetNodeInfo(const nsString& aName, const nsString& aPrefix,
NS_IMETHODIMP
nsNodeInfoManager::GetNodeInfo(const nsString& aQualifiedName,
const nsString& aNamespaceURI,
nsNodeInfoManager::GetNodeInfo(const nsAReadableString& aQualifiedName,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo)
{
NS_ENSURE_ARG(aQualifiedName.Length());

Просмотреть файл

@ -40,15 +40,15 @@ public:
NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager);
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
NS_IMETHOD GetNodeInfo(const nsString& aName, nsIAtom *aPrefix,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix,
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
NS_IMETHOD GetNodeInfo(const nsString& aName, const nsString& aPrefix,
const nsString& aNamespaceURI,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, const nsAReadableString& aPrefix,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo);
NS_IMETHOD GetNodeInfo(const nsString& aQualifiedName,
const nsString& aNamespaceURI,
NS_IMETHOD GetNodeInfo(const nsAReadableString& aQualifiedName,
const nsAReadableString& aNamespaceURI,
nsINodeInfo*& aNodeInfo);
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager);

Просмотреть файл

@ -1559,7 +1559,7 @@ nsresult nsRange::InsertNode(nsIDOMNode* aN)
nsresult nsRange::SurroundContents(nsIDOMNode* aN)
{ return NS_ERROR_NOT_IMPLEMENTED; }
nsresult nsRange::ToString(nsString& aReturn)
nsresult nsRange::ToString(nsAWritableString& aReturn)
{
nsCOMPtr<nsIContent> cStart( do_QueryInterface(mStartParent) );
nsCOMPtr<nsIContent> cEnd( do_QueryInterface(mEndParent) );
@ -1851,7 +1851,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
// nsIDOMNSRange interface
NS_IMETHODIMP
nsRange::CreateContextualFragment(const nsString& aFragment,
nsRange::CreateContextualFragment(const nsAReadableString& aFragment,
nsIDOMDocumentFragment** aReturn)
{
nsresult result = NS_OK;
@ -1924,7 +1924,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment,
}
else {
// Who're we kidding. This only works for html.
contentType.AssignWithConversion("text/html");
contentType.Assign(NS_LITERAL_STRING("text/html"));
}
result = parser->ParseFragment(aFragment, (void*)0,
@ -1957,7 +1957,7 @@ nsRange::CreateContextualFragment(const nsString& aFragment,
}
NS_IMETHODIMP
nsRange::IsValidFragment(const nsString& aFragment, PRBool* aReturn)
nsRange::IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn)
{
nsresult result = NS_OK;
nsCOMPtr<nsIParser> parser;

Просмотреть файл

@ -88,12 +88,12 @@ public:
NS_IMETHOD Clone(nsIDOMRange** aReturn);
NS_IMETHOD ToString(nsString& aReturn);
NS_IMETHOD ToString(nsAWritableString& aReturn);
/*BEGIN nsIDOMNSRange interface implementations*/
NS_IMETHOD CreateContextualFragment(const nsString& aFragment,
NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment,
nsIDOMDocumentFragment** aReturn);
NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn);
NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn);
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset,
PRBool* aResult);

Просмотреть файл

@ -147,7 +147,7 @@ public:
NS_IMETHOD RemoveSelectionListener(nsIDOMSelectionListener* aListenerToRemove);
NS_IMETHOD GetEnumerator(nsIEnumerator **aIterator);
NS_IMETHOD ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn);
NS_IMETHOD ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn);
NS_IMETHOD SetHint(PRBool aHintRight);
NS_IMETHOD GetHint(PRBool *aHintRight);
@ -1528,10 +1528,10 @@ nsSelection::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
//BEGIN nsIFrameSelection methods
NS_IMETHODIMP
nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn)
nsDOMSelection::ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDocumentEncoder> encoder;
nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE );
formatType.AppendWithConversion(aFormatType);
@ -4342,7 +4342,7 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
content->GetTag(tag);
if (tag)
{
nsString tagString;
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
@ -5158,7 +5158,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
content->GetTag(tag);
if (tag)
{
nsString tagString;
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);

Просмотреть файл

@ -22,6 +22,8 @@
#include "nsTextFragment.h"
#include "nsString.h"
#include "nsCRT.h"
#include "nsReadableUtils.h"
#include "nsMemory.h"
nsTextFragment::~nsTextFragment()
{
@ -33,10 +35,10 @@ nsTextFragment::ReleaseText()
{
if (mState.mLength && m1b && mState.mInHeap) {
if (mState.mIs2b) {
delete [] m2b;
nsMemory::Free(m2b);
}
else {
delete [] m1b;
nsMemory::Free(m1b);
}
}
m1b = nsnull;
@ -105,9 +107,24 @@ nsTextFragment::operator=(const PRUnichar* aString)
}
nsTextFragment&
nsTextFragment::operator=(const nsString& aString)
nsTextFragment::operator=(const nsAReadableString& aString)
{
SetTo(aString.GetUnicode(), aString.Length());
ReleaseText();
PRUint32 length = aString.Length();
if (length > 0) {
if (IsASCII(aString)) {
m1b = NS_REINTERPRET_CAST(unsigned char *, ToNewCString(aString));
mState.mIs2b = 0;
}
else {
m2b = ToNewUnicode(aString);
mState.mIs2b = 1;
}
mState.mInHeap = 1;
mState.mLength = (PRInt32)length;
}
return *this;
}
@ -141,7 +158,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength)
if (need2) {
// Use ucs2 storage because we have to
PRUnichar* nt = new PRUnichar[aLength];
PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar));
if (nsnull != nt) {
// Copy data
nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength);
@ -155,7 +172,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength)
}
else {
// Use 1 byte storage because we can
unsigned char* nt = new unsigned char[aLength];
unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char));
if (nsnull != nt) {
// Copy data
unsigned char* cp = nt;
@ -179,7 +196,7 @@ nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength)
{
ReleaseText();
if (0 != aLength) {
unsigned char* nt = new unsigned char[aLength];
unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char));
if (nsnull != nt) {
nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength);

Просмотреть файл

@ -23,6 +23,7 @@
#define nsTextFragment_h___
#include "nslayout.h"
#include "nsAWritableString.h"
class nsString;
// XXX should this normalize the code to keep a \u0000 at the end?
@ -112,7 +113,7 @@ public:
* Change the contents of this fragment to be a copy of the
* the argument string.
*/
nsTextFragment& operator=(const nsString& aString);
nsTextFragment& operator=(const nsAReadableString& aString);
/**
* Return PR_TRUE if this fragment is represented by PRUnichar data
@ -166,8 +167,8 @@ public:
/**
* Change the contents of this fragment to be the given buffer and
* length. The memory becomes owned by the fragment. In addition,
* the memory for aBuffer must have been allocated using the "new[]"
* because it will be released with "delete []".
* the memory for aBuffer must have been allocated using the
* nsIMemory interface.
*/
void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease);

Просмотреть файл

@ -135,9 +135,9 @@ nsTextNode::GetNodeInfo(nsINodeInfo*& aResult) const
}
NS_IMETHODIMP
nsTextNode::GetNodeName(nsString& aNodeName)
nsTextNode::GetNodeName(nsAWritableString& aNodeName)
{
aNodeName.AssignWithConversion("#text");
aNodeName.Assign(NS_LITERAL_STRING("#text"));
return NS_OK;
}

Просмотреть файл

@ -67,13 +67,13 @@ public:
* Sets events listeners of all types.
* @param an event listener
*/
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0;
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0;
/**
* Removes events listeners of all types.
* @param an event listener
*/
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0;
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0;
/**
* Creates a script event listener for the given script object with name mName and function
@ -83,7 +83,7 @@ public:
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
nsIScriptObjectOwner *aScriptObjectOwner,
nsIAtom *aName,
const nsString& aFunc,
const nsAReadableString& aFunc,
REFNSIID aIID,
PRBool aDeferCompilation) = 0;
@ -116,7 +116,7 @@ public:
*/
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
const nsString& aEventType,
const nsAReadableString& aEventType,
nsIDOMEvent** aDOMEvent) = 0;
/**

Просмотреть файл

@ -55,7 +55,7 @@ public:
extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent);
extern nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
nsIPresContext* aPresContext,
const nsString& aEventType,
const nsAReadableString& aEventType,
nsEvent *aEvent);
#endif // nsIPrivateDOMEvent_h__

Просмотреть файл

@ -53,7 +53,7 @@ static char* mEventNames[] = {
"scroll","overflow", "underflow", "overflowchanged"
};
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType) {
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType) {
mPresContext = aPresContext;
if (mPresContext)
NS_ADDREF(mPresContext);
@ -63,15 +63,16 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsSt
}
else {
//Allocate internal event
if (aEventType.EqualsIgnoreCase("MouseEvent")) {
nsAutoString eventType(aEventType);
if (eventType.EqualsIgnoreCase("MouseEvent")) {
mEvent = PR_NEWZAP(nsMouseEvent);
mEvent->eventStructType = NS_MOUSE_EVENT;
}
else if (aEventType.EqualsIgnoreCase("KeyEvent")) {
else if (eventType.EqualsIgnoreCase("KeyEvent")) {
mEvent = PR_NEWZAP(nsKeyEvent);
mEvent->eventStructType = NS_KEY_EVENT;
}
else if (aEventType.EqualsIgnoreCase("HTMLEvent")) {
else if (eventType.EqualsIgnoreCase("HTMLEvent")) {
mEvent = PR_NEWZAP(nsEvent);
mEvent->eventStructType = NS_EVENT;
}
@ -144,12 +145,12 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
NS_INTERFACE_MAP_END
// nsIDOMEventInterface
NS_METHOD nsDOMEvent::GetType(nsString& aType)
NS_METHOD nsDOMEvent::GetType(nsAWritableString& aType)
{
const char* mName = GetEventName(mEvent->message);
if (nsnull != mName) {
aType.AssignWithConversion(mName);
aType.Assign(NS_ConvertASCIItoUCS2(mName));
return NS_OK;
}
@ -886,7 +887,7 @@ NS_METHOD nsDOMEvent::GetPreventDefault(PRBool* aReturn)
}
nsresult
nsDOMEvent::SetEventType(const nsString& aEventTypeArg)
nsDOMEvent::SetEventType(const nsAReadableString& aEventTypeArg)
{
nsAutoString str; str.AssignWithConversion("on");
nsIAtom* atom;
@ -958,7 +959,7 @@ nsDOMEvent::SetEventType(const nsString& aEventTypeArg)
}
NS_IMETHODIMP
nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)
nsDOMEvent::InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)
{
NS_ENSURE_SUCCESS(SetEventType(aEventTypeArg), NS_ERROR_FAILURE);
mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
@ -968,13 +969,13 @@ nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBoo
}
NS_IMETHODIMP
nsDOMEvent::InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)
nsDOMEvent::InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg)
nsDOMEvent::InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg)
{
NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
//mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
@ -983,7 +984,7 @@ nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool
}
NS_IMETHODIMP
nsDOMEvent::InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg)
nsDOMEvent::InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg)
{
NS_ENSURE_SUCCESS(SetEventType(aTypeArg), NS_ERROR_FAILURE);
mEvent->flags |= aCanBubbleArg ? NS_EVENT_FLAG_NONE : NS_EVENT_FLAG_CANT_BUBBLE;
@ -1166,7 +1167,7 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
nsIPresContext* aPresContext,
const nsString& aEventType,
const nsAReadableString& aEventType,
nsEvent *aEvent)
{
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType);

Просмотреть файл

@ -90,13 +90,13 @@ public:
eDOMEvents_overflowchanged
};
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsString& aEventType);
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType);
virtual ~nsDOMEvent();
NS_DECL_ISUPPORTS
// nsIDOMEvent Interface
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetType(nsAWritableString& aType);
NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget);
NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget);
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase);
@ -107,12 +107,12 @@ public:
NS_IMETHOD PreventBubble();
NS_IMETHOD PreventCapture();
NS_IMETHOD PreventDefault();
NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg);
NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg);
// nsIDOMUIEvent Interface
NS_IMETHOD GetView(nsIDOMAbstractView** aView);
NS_IMETHOD GetDetail(PRInt32* aDetail);
NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
// nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface
NS_IMETHOD GetScreenX(PRInt32* aScreenX);
@ -127,8 +127,8 @@ public:
NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget);
NS_IMETHOD GetCharCode(PRUint32* aCharCode);
NS_IMETHOD GetKeyCode(PRUint32* aKeyCode);
NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg);
NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg);
NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg);
NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg);
// nsIDOMNSUIEvent interface
NS_IMETHOD GetLayerX(PRInt32* aLayerX);
@ -166,7 +166,7 @@ protected:
//Internal helper funcs
nsresult GetScrollInfo(nsIScrollableView** aScrollableView, float* aP2T, float* aT2P);
nsresult SetEventType(const nsString& aEventTypeArg);
nsresult SetEventType(const nsAReadableString& aEventTypeArg);
nsEvent* mEvent;
PRBool mEventIsInternal;

Просмотреть файл

@ -511,7 +511,7 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, nsIID& aI
}
nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
const nsString& aType, PRInt32 aFlags)
const nsAReadableString& aType, PRInt32 aFlags)
{
PRInt32 subType;
nsIID iid;
@ -531,7 +531,7 @@ nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aLi
}
nsresult nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener,
const nsString& aType, PRInt32 aFlags)
const nsAReadableString& aType, PRInt32 aFlags)
{
PRInt32 subType;
nsIID iid;
@ -620,7 +620,7 @@ nsresult
nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext,
nsIScriptObjectOwner *aScriptObjectOwner,
nsIAtom *aName,
const nsString& aBody,
const nsAReadableString& aBody,
REFNSIID aIID,
PRBool aDeferCompilation)
{
@ -1694,11 +1694,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
const nsString& aEventType,
const nsAReadableString& aEventType,
nsIDOMEvent** aDOMEvent)
{
if (!aEvent && !aEventType.EqualsIgnoreCase("MouseEvent") && !aEventType.EqualsIgnoreCase("KeyEvent") &&
!aEventType.EqualsIgnoreCase("HTMLEvent")) {
nsAutoString str(aEventType);
if (!aEvent && !str.EqualsIgnoreCase("MouseEvent") && !str.EqualsIgnoreCase("KeyEvent") &&
!str.EqualsIgnoreCase("HTMLEvent")) {
return NS_ERROR_FAILURE;
}
@ -1975,7 +1976,7 @@ nsresult nsEventListenerManager::SetListenerTarget(nsISupports* aTarget)
// nsIDOMEventTarget interface
NS_IMETHODIMP
nsEventListenerManager::AddEventListener(const nsString& aType,
nsEventListenerManager::AddEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
@ -1985,7 +1986,7 @@ nsEventListenerManager::AddEventListener(const nsString& aType,
}
NS_IMETHODIMP
nsEventListenerManager::RemoveEventListener(const nsString& aType,
nsEventListenerManager::RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{

Просмотреть файл

@ -73,13 +73,13 @@ public:
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags);
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags) ;
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags);
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags) ;
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
nsIScriptObjectOwner *aScriptObjectOwner,
nsIAtom *aName,
const nsString& aFunc,
const nsAReadableString& aFunc,
REFNSIID aIID,
PRBool aDeferCompilation);
virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
@ -100,7 +100,7 @@ public:
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
const nsString& aEventType,
const nsAReadableString& aEventType,
nsIDOMEvent** aDOMEvent);
virtual nsresult RemoveAllListeners(PRBool aScriptOnly);
@ -110,10 +110,10 @@ public:
static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType);
// nsIDOMEventTarget interface
NS_IMETHOD AddEventListener(const nsString& aType,
NS_IMETHOD AddEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD RemoveEventListener(const nsString& aType,
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);

Просмотреть файл

@ -60,7 +60,7 @@ public:
* attributes. The name or id attributes of the form control
* are used as a key into the table.
*/
NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsString& aName) = 0;
NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0;
/**
* Get the element at a specified index position
@ -95,7 +95,7 @@ public:
* @param aName the name or id of the element to remove
* @return NS_OK if the element was successfully removed.
*/
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName) = 0;
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0;
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
};

Просмотреть файл

@ -64,10 +64,10 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const = 0;
nsAWritableString& aResult) const = 0;
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult) = 0;
/**
@ -84,7 +84,7 @@ public:
* but certain content carries a local base for backward
* compatibility.
*/
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0;
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0;
/**
* Translate this piece of content to html. Note that this only
@ -94,7 +94,7 @@ public:
*/
// XXX add in output character set information so that we know how
// to encode non 7 bit characters
NS_IMETHOD ToHTMLString(nsString& aResult) const = 0;
NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const = 0;
NS_IMETHOD ToHTML(FILE* out) const = 0;
};

Просмотреть файл

@ -112,7 +112,7 @@ GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
}
NS_IMETHODIMP
GenericElementCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
GenericElementCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;

Просмотреть файл

@ -42,7 +42,7 @@ public:
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
NS_IMETHOD ParentDestroyed();

Просмотреть файл

@ -113,7 +113,7 @@ public:
}
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) {
aName = nsnull;
@ -138,13 +138,13 @@ public:
return NS_OK;
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue,
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue,
PRBool aNotify) { return NS_OK; }
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsString& aValue,
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify) { return NS_OK; }
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom*& aPrefix, nsAWritableString& aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName, nsIAtom*& aPrefix) const {
aName = nsnull;
aPrefix = nsnull;
@ -194,10 +194,12 @@ public:
// Implementation for nsITextContent
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult);
NS_IMETHOD GetTextLength(PRInt32* aLengthResult);
NS_IMETHOD CopyText(nsString& aResult);
NS_IMETHOD CopyText(nsAWritableString& aResult);
NS_IMETHOD SetText(const PRUnichar* aBuffer,
PRInt32 aLength,
PRBool aNotify);
NS_IMETHOD SetText(const nsAReadableString& aStr,
PRBool aNotify);
NS_IMETHOD SetText(const char* aBuffer,
PRInt32 aLength,
PRBool aNotify);
@ -208,7 +210,7 @@ public:
void ValidateTextFragment();
void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
void ToCString(nsAWritableString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
// Up pointer to the real content object that we are
// supporting. Sometimes there is work that we just can't do
@ -353,7 +355,7 @@ nsAttributeContent::ConvertContentToXIF(nsIXIFConverter* ) const
}
void
nsAttributeContent::ToCString(nsString& aBuf, PRInt32 aOffset,
nsAttributeContent::ToCString(nsAWritableString& aBuf, PRInt32 aOffset,
PRInt32 aLen) const
{
}
@ -471,14 +473,14 @@ nsAttributeContent::GetTextLength(PRInt32* aLengthResult)
}
nsresult
nsAttributeContent::CopyText(nsString& aResult)
nsAttributeContent::CopyText(nsAWritableString& aResult)
{
ValidateTextFragment();
if (mText.Is2b()) {
aResult.Assign(mText.Get2b(), mText.GetLength());
}
else {
aResult.AssignWithConversion(mText.Get1b(), mText.GetLength());
aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()), mText.GetLength());
}
return NS_OK;
}
@ -504,6 +506,19 @@ nsAttributeContent::SetText(const PRUnichar* aBuffer, PRInt32 aLength,
return NS_OK;
}
NS_IMETHODIMP
nsAttributeContent::SetText(const nsAReadableString& aStr,
PRBool aNotify)
{
mText = aStr;
// Trigger a reflow
if (aNotify && (nsnull != mDocument)) {
mDocument->ContentChanged(mContent, nsnull);
}
return NS_OK;
}
// XXX shouldn't these update mContent's attribute?
nsresult
nsAttributeContent::SetText(const char* aBuffer,

Просмотреть файл

@ -53,7 +53,7 @@ public:
// nsIDOMHTMLCollection interface
NS_IMETHOD GetLength(PRUint32* aLength)=0;
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0;
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0;
protected:
void* mScriptObject;

Просмотреть файл

@ -123,14 +123,14 @@ public:
nsDOMCSSAttributeDeclaration(nsIHTMLContent *aContent);
~nsDOMCSSAttributeDeclaration();
NS_IMETHOD RemoveProperty(const nsString& aPropertyName,
nsString& aReturn);
NS_IMETHOD RemoveProperty(const nsAReadableString& aPropertyName,
nsAWritableString& aReturn);
virtual void DropReference();
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
PRBool aAllocate);
virtual nsresult SetCSSDeclaration(nsICSSDeclaration *aDecl);
virtual nsresult ParseDeclaration(const nsString& aDecl,
virtual nsresult ParseDeclaration(const nsAReadableString& aDecl,
PRBool aParseOnlyOneDecl,
PRBool aClearOldDecl);
virtual nsresult GetParent(nsISupports **aParent);
@ -156,8 +156,8 @@ nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration()
}
NS_IMETHODIMP
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsString& aPropertyName,
nsString& aReturn)
nsDOMCSSAttributeDeclaration::RemoveProperty(const nsAReadableString& aPropertyName,
nsAWritableString& aReturn)
{
nsCOMPtr<nsICSSDeclaration> decl;
nsresult rv = GetCSSDeclaration(getter_AddRefs(decl), PR_TRUE);
@ -272,7 +272,7 @@ nsDOMCSSAttributeDeclaration::SetCSSDeclaration(nsICSSDeclaration *aDecl)
}
nsresult
nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsString& aDecl,
nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
PRBool aParseOnlyOneDecl,
PRBool aClearOldDecl)
{
@ -471,13 +471,13 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent,
}
nsresult
nsGenericHTMLElement::GetTagName(nsString& aTagName)
nsGenericHTMLElement::GetTagName(nsAWritableString& aTagName)
{
return GetNodeName(aTagName);
}
nsresult
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
nsGenericHTMLElement::GetNodeName(nsAWritableString& aNodeName)
{
if (kStrictDOMLevel2) {
mNodeInfo->GetPrefix(aNodeName);
@ -503,14 +503,14 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) {
// Only fold to uppercase if the HTML element has no namespace, i.e.,
// it was created as part of an HTML document.
aNodeName.ToUpperCase();
ToUpperCase(aNodeName);
}
}
if (kStrictDOMLevel2) {
PRInt32 pos = aNodeName.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aNodeName);
nsCAutoString tmp; tmp.Assign(NS_ConvertUCS2toUTF8(aNodeName));
printf ("Possible DOM Error: .nodeName or .tagName requested on the HTML element '%s', is this OK?\n", (const char *)tmp);
}
}
@ -519,54 +519,54 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
}
nsresult
nsGenericHTMLElement::GetLocalName(nsString& aLocalName)
nsGenericHTMLElement::GetLocalName(nsAWritableString& aLocalName)
{
mNodeInfo->GetLocalName(aLocalName);
// This doesn't work for XHTML
aLocalName.ToUpperCase();
ToUpperCase(aLocalName);
return NS_OK;
}
// Implementation for nsIDOMHTMLElement
nsresult
nsGenericHTMLElement::GetId(nsString& aId)
nsGenericHTMLElement::GetId(nsAWritableString& aId)
{
GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId);
return NS_OK;
}
nsresult
nsGenericHTMLElement::SetId(const nsString& aId)
nsGenericHTMLElement::SetId(const nsAReadableString& aId)
{
SetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, aId, PR_TRUE);
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetTitle(nsString& aTitle)
nsGenericHTMLElement::GetTitle(nsAWritableString& aTitle)
{
GetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle);
return NS_OK;
}
nsresult
nsGenericHTMLElement::SetTitle(const nsString& aTitle)
nsGenericHTMLElement::SetTitle(const nsAReadableString& aTitle)
{
SetAttribute(kNameSpaceID_None, nsHTMLAtoms::title, aTitle, PR_TRUE);
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetLang(nsString& aLang)
nsGenericHTMLElement::GetLang(nsAWritableString& aLang)
{
GetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang);
return NS_OK;
}
nsresult
nsGenericHTMLElement::SetLang(const nsString& aLang)
nsGenericHTMLElement::SetLang(const nsAReadableString& aLang)
{
SetAttribute(kNameSpaceID_None, nsHTMLAtoms::lang, aLang, PR_TRUE);
return NS_OK;
@ -579,7 +579,7 @@ static nsGenericHTMLElement::EnumTable kDirTable[] = {
};
nsresult
nsGenericHTMLElement::GetDir(nsString& aDir)
nsGenericHTMLElement::GetDir(nsAWritableString& aDir)
{
nsHTMLValue value;
nsresult result = GetHTMLAttribute(nsHTMLAtoms::dir, value);
@ -592,21 +592,21 @@ nsGenericHTMLElement::GetDir(nsString& aDir)
}
nsresult
nsGenericHTMLElement::SetDir(const nsString& aDir)
nsGenericHTMLElement::SetDir(const nsAReadableString& aDir)
{
SetAttribute(kNameSpaceID_None, nsHTMLAtoms::dir, aDir, PR_TRUE);
return NS_OK;
}
nsresult
nsGenericHTMLElement::GetClassName(nsString& aClassName)
nsGenericHTMLElement::GetClassName(nsAWritableString& aClassName)
{
GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName);
return NS_OK;
}
nsresult
nsGenericHTMLElement::SetClassName(const nsString& aClassName)
nsGenericHTMLElement::SetClassName(const nsAReadableString& aClassName)
{
SetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, aClassName, PR_TRUE);
return NS_OK;
@ -852,7 +852,7 @@ nsGenericHTMLElement::GetOffsetParent(nsIDOMElement** aOffsetParent)
}
nsresult
nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML)
nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML)
{
aInnerHTML.Truncate();
@ -910,7 +910,7 @@ nsGenericHTMLElement::GetInnerHTML(nsString& aInnerHTML)
}
nsresult
nsGenericHTMLElement::SetInnerHTML(const nsString& aInnerHTML)
nsGenericHTMLElement::SetInnerHTML(const nsAReadableString& aInnerHTML)
{
nsresult rv = NS_OK;
@ -1252,13 +1252,13 @@ nsGenericHTMLElement::GetNameSpaceID(PRInt32& aID) const
}
nsresult
nsGenericHTMLElement::ParseAttributeString(const nsString& aStr,
nsGenericHTMLElement::ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID)
{
// XXX need to validate/strip namespace prefix
nsAutoString lower;
aStr.ToLowerCase(lower);
nsAutoString lower(aStr);
lower.ToLowerCase();
aName = NS_NewAtom(lower);
aNameSpaceID = kNameSpaceID_None;
@ -1276,7 +1276,7 @@ nsGenericHTMLElement::GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
nsresult
nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
nsresult result = NS_OK;
@ -1417,7 +1417,7 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
nsresult
nsGenericHTMLElement::SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
NS_ENSURE_ARG_POINTER(aNodeInfo);
@ -1574,7 +1574,7 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom*& aPrefix, nsString &aResult) const
nsIAtom*& aPrefix, nsAWritableString& aResult) const
{
aPrefix = nsnull;
@ -1583,7 +1583,7 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsresult
nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsString &aResult) const
nsAWritableString& aResult) const
{
#if 0
NS_ASSERTION((kNameSpaceID_HTML == aNameSpaceID) ||
@ -1602,7 +1602,6 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsresult result = mAttributes ? mAttributes->GetAttribute(aAttribute, &value) :
NS_CONTENT_ATTR_NOT_THERE;
char cbuf[20];
nscolor color;
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
nsIHTMLContent* htmlContent;
@ -1631,26 +1630,39 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
break;
case eHTMLUnit_Integer:
aResult.Truncate();
aResult.AppendInt(value->GetIntValue(), 10);
break;
{
nsAutoString intStr;
intStr.AppendInt(value->GetIntValue());
aResult.Assign(intStr);
break;
}
case eHTMLUnit_Pixel:
aResult.Truncate();
aResult.AppendInt(value->GetPixelValue(), 10);
break;
{
nsAutoString intStr;
intStr.AppendInt(value->GetPixelValue());
aResult.Assign(intStr);
break;
}
case eHTMLUnit_Percent:
aResult.Truncate();
aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10);
aResult.AppendWithConversion('%');
break;
{
nsAutoString intStr;
intStr.AppendInt(PRInt32(value->GetPercentValue() * 100.0f));
aResult.Assign(intStr);
aResult.Append(PRUnichar('%'));
break;
}
case eHTMLUnit_Color:
char cbuf[20];
color = nscolor(value->GetColorValue());
PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
NS_GET_R(color), NS_GET_G(color), NS_GET_B(color));
aResult.AssignWithConversion(cbuf);
aResult.Assign(NS_ConvertASCIItoUCS2(cbuf));
break;
default:
@ -1807,7 +1819,7 @@ nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref,
}
nsresult
nsGenericHTMLElement::GetBaseTarget(nsString& aBaseTarget) const
nsGenericHTMLElement::GetBaseTarget(nsAWritableString& aBaseTarget) const
{
nsresult result = NS_OK;
@ -1989,7 +2001,7 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult)
{
const PRUnichar* cp = aValue.GetUnicode();
const PRUnichar* end = aValue.GetUnicode() + aValue.Length();
aResult.AssignWithConversion('"');
aResult.Assign(NS_LITERAL_STRING("\""));
while (cp < end) {
PRUnichar ch = *cp++;
if ((ch >= 0x20) && (ch <= 0x7f)) {
@ -2010,16 +2022,16 @@ NS_QuoteForHTML(const nsString& aValue, nsString& aResult)
}
nsresult
nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
nsGenericHTMLElement::ToHTMLString(nsAWritableString& aBuf) const
{
aBuf.AssignWithConversion('<');
aBuf.Assign(NS_LITERAL_STRING("<"));
if (mNodeInfo) {
nsAutoString tmp;
mNodeInfo->GetQualifiedName(tmp);
aBuf.Append(tmp);
} else {
aBuf.AppendWithConversion("?NULL");
aBuf.Append(NS_LITERAL_STRING("?NULL"));
}
if (nsnull != mAttributes) {
@ -2030,20 +2042,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
nsIAtom* atom = nsnull;
mAttributes->GetAttributeNameAt(index, atom);
atom->ToString(name);
aBuf.AppendWithConversion(' ');
aBuf.Append(NS_LITERAL_STRING(" "));
aBuf.Append(name);
value.Truncate();
GetAttribute(kNameSpaceID_None, atom, value);
NS_RELEASE(atom);
if (value.Length() > 0) {
aBuf.AppendWithConversion('=');
aBuf.Append(NS_LITERAL_STRING("="));
NS_QuoteForHTML(value, quotedValue);
aBuf.Append(quotedValue);
}
}
}
aBuf.AppendWithConversion('>');
aBuf.Append(NS_LITERAL_STRING(">"));
return NS_OK;
}
@ -2053,7 +2065,7 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
nsresult
nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (nsHTMLAtoms::style == aAttribute) {
if (eHTMLUnit_ISupports == aValue.GetUnit()) {
@ -2069,7 +2081,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
NS_RELEASE(cssRule);
}
else {
aResult.AssignWithConversion("Unknown rule type");
aResult.Assign(NS_LITERAL_STRING("Unknown rule type"));
}
NS_RELEASE(rule);
}
@ -2090,12 +2102,13 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
}
PRBool
nsGenericHTMLElement::ParseEnumValue(const nsString& aValue,
nsGenericHTMLElement::ParseEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult)
{
nsAutoString val(aValue);
while (nsnull != aTable->tag) {
if (aValue.EqualsIgnoreCase(aTable->tag)) {
if (val.EqualsIgnoreCase(aTable->tag)) {
aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated);
return PR_TRUE;
}
@ -2105,12 +2118,13 @@ nsGenericHTMLElement::ParseEnumValue(const nsString& aValue,
}
PRBool
nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue,
nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult)
{
nsAutoString val(aValue);
while (nsnull != aTable->tag) {
if (aValue.EqualsWithConversion(aTable->tag)) {
if (val.EqualsWithConversion(aTable->tag)) {
aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated);
return PR_TRUE;
}
@ -2122,7 +2136,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue,
PRBool
nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
EnumTable* aTable,
nsString& aResult,
nsAWritableString& aResult,
PRBool aFoldCase)
{
aResult.Truncate(0);
@ -2130,9 +2144,10 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
PRInt32 v = aValue.GetIntValue();
while (nsnull != aTable->tag) {
if (aTable->value == v) {
aResult.AppendWithConversion(aTable->tag);
aResult.Append(NS_ConvertASCIItoUCS2(aTable->tag));
if (aFoldCase) {
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
nsWritingIterator<PRUnichar> start(aResult.BeginWriting());
*start.get() = nsCRT::ToUpper(*start.get());
}
return PR_TRUE;
}
@ -2143,7 +2158,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
}
PRBool
nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
nsGenericHTMLElement::ParseValueOrPercent(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
{
@ -2175,7 +2190,7 @@ nsGenericHTMLElement::ParseValueOrPercent(const nsString& aString,
* or proportional (n*)
*/
PRBool
nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit)
{
@ -2210,19 +2225,23 @@ nsGenericHTMLElement::ParseValueOrPercentOrProportional(const nsString& aString,
PRBool
nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
nsAutoString intStr;
aResult.Truncate(0);
switch (aValue.GetUnit()) {
case eHTMLUnit_Integer:
aResult.AppendInt(aValue.GetIntValue(), 10);
intStr.AppendInt(aValue.GetIntValue());
aResult.Append(intStr);
return PR_TRUE;
case eHTMLUnit_Pixel:
aResult.AppendInt(aValue.GetPixelValue(), 10);
intStr.AppendInt(aValue.GetPixelValue());
aResult.Append(intStr);
return PR_TRUE;
case eHTMLUnit_Percent:
aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
aResult.AppendWithConversion('%');
intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f));
aResult.Append(intStr);
aResult.Append(PRUnichar('%'));
return PR_TRUE;
default:
break;
@ -2232,23 +2251,28 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue,
PRBool
nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
nsAutoString intStr;
aResult.Truncate(0);
switch (aValue.GetUnit()) {
case eHTMLUnit_Integer:
aResult.AppendInt(aValue.GetIntValue(), 10);
intStr.AppendInt(aValue.GetIntValue());
aResult.Append(intStr);
return PR_TRUE;
case eHTMLUnit_Pixel:
aResult.AppendInt(aValue.GetPixelValue(), 10);
intStr.AppendInt(aValue.GetPixelValue());
aResult.Append(intStr);
return PR_TRUE;
case eHTMLUnit_Percent:
aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
aResult.AppendWithConversion('%');
intStr.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f));
aResult.Append(intStr);
aResult.Append(NS_LITERAL_STRING("%"));
return PR_TRUE;
case eHTMLUnit_Proportional:
aResult.AppendInt(aValue.GetIntValue(), 10);
aResult.AppendWithConversion('*');
intStr.AppendInt(aValue.GetIntValue());
aResult.Append(intStr);
aResult.Append(NS_LITERAL_STRING("*"));
return PR_TRUE;
default:
break;
@ -2257,10 +2281,11 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV
}
PRBool
nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit)
{
PRInt32 ec, val = aString.ToInteger(&ec);
nsAutoString str(aString);
PRInt32 ec, val = str.ToInteger(&ec);
if (NS_OK == ec) {
if (val < aMin) val = aMin;
if (eHTMLUnit_Pixel == aValueUnit) {
@ -2276,11 +2301,12 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
}
PRBool
nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
nsGenericHTMLElement::ParseValue(const nsAReadableString& aString, PRInt32 aMin,
PRInt32 aMax,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit)
{
PRInt32 ec, val = aString.ToInteger(&ec);
nsAutoString str(aString);
PRInt32 ec, val = str.ToInteger(&ec);
if (NS_OK == ec) {
if (val < aMin) val = aMin;
if (val > aMax) val = aMax;
@ -2297,7 +2323,7 @@ nsGenericHTMLElement::ParseValue(const nsString& aString, PRInt32 aMin,
}
PRBool
nsGenericHTMLElement::ParseColor(const nsString& aString,
nsGenericHTMLElement::ParseColor(const nsAReadableString& aString,
nsIDocument* aDocument,
nsHTMLValue& aResult)
{
@ -2320,7 +2346,8 @@ nsGenericHTMLElement::ParseColor(const nsString& aString,
}
}
else {
if (NS_LooseHexToRGB(aString, &color)) { // no space compression
nsAutoString str(aString);
if (NS_LooseHexToRGB(str, &color)) { // no space compression
aResult.SetColorValue(color);
return PR_TRUE;
}
@ -2332,14 +2359,14 @@ nsGenericHTMLElement::ParseColor(const nsString& aString,
PRBool
nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
if (aValue.GetUnit() == eHTMLUnit_Color) {
nscolor v = aValue.GetColorValue();
char buf[10];
PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x",
NS_GET_R(v), NS_GET_G(v), NS_GET_B(v));
aResult.AssignWithConversion(buf);
aResult.Assign(NS_ConvertASCIItoUCS2(buf));
return PR_TRUE;
}
if ((aValue.GetUnit() == eHTMLUnit_ColorName) ||
@ -2511,7 +2538,7 @@ static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = {
PRBool
nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (nsHTMLAtoms::dir == aAttribute) {
@ -2525,7 +2552,7 @@ nsGenericHTMLElement::ParseCommonAttribute(nsIAtom* aAttribute,
}
PRBool
nsGenericHTMLElement::ParseAlignValue(const nsString& aString,
nsGenericHTMLElement::ParseAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult)
{
return ParseEnumValue(aString, kAlignTable, aResult);
@ -2555,7 +2582,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableHAlignTable[] = {
};
PRBool
nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString,
nsGenericHTMLElement::ParseTableHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const
{
if (InNavQuirksMode(mDocument)) {
@ -2566,7 +2593,7 @@ nsGenericHTMLElement::ParseTableHAlignValue(const nsString& aString,
PRBool
nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (InNavQuirksMode(mDocument)) {
return EnumValueToString(aValue, kCompatTableHAlignTable, aResult);
@ -2604,7 +2631,7 @@ static nsGenericHTMLElement::EnumTable kCompatTableCellHAlignTable[] = {
};
PRBool
nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString,
nsGenericHTMLElement::ParseTableCellHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const
{
if (InNavQuirksMode(mDocument)) {
@ -2615,7 +2642,7 @@ nsGenericHTMLElement::ParseTableCellHAlignValue(const nsString& aString,
PRBool
nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (InNavQuirksMode(mDocument)) {
return EnumValueToString(aValue, kCompatTableCellHAlignTable, aResult);
@ -2626,7 +2653,7 @@ nsGenericHTMLElement::TableCellHAlignValueToString(const nsHTMLValue& aValue,
//----------------------------------------
PRBool
nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString,
nsGenericHTMLElement::ParseTableVAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult)
{
return ParseEnumValue(aString, kTableVAlignTable, aResult);
@ -2634,20 +2661,20 @@ nsGenericHTMLElement::ParseTableVAlignValue(const nsString& aString,
PRBool
nsGenericHTMLElement::AlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
return EnumValueToString(aValue, kAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
return EnumValueToString(aValue, kTableVAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString,
nsGenericHTMLElement::ParseDivAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const
{
return ParseEnumValue(aString, kDivAlignTable, aResult);
@ -2655,14 +2682,14 @@ nsGenericHTMLElement::ParseDivAlignValue(const nsString& aString,
PRBool
nsGenericHTMLElement::DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return EnumValueToString(aValue, kDivAlignTable, aResult);
}
PRBool
nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult)
{
if ((aAttribute == nsHTMLAtoms::width) ||
@ -2680,7 +2707,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
PRBool
nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height) ||
@ -2694,7 +2721,7 @@ nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute,
PRBool
nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult)
{
if (aStandardMode) {
@ -2707,7 +2734,7 @@ nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode,
PRBool
nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
if (aStandardMode) {
return EnumValueToString(aValue, kFrameborderStandardTable, aResult);
@ -2718,7 +2745,7 @@ nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode,
PRBool
nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult)
{
if (aStandardMode) {
@ -2731,7 +2758,7 @@ nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode,
PRBool
nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsString& aResult)
nsAWritableString& aResult)
{
if (aStandardMode) {
return EnumValueToString(aValue, kScrollingStandardTable, aResult);
@ -2759,7 +2786,7 @@ nsGenericHTMLElement::ReparseStyleAttribute(void)
}
nsresult
nsGenericHTMLElement::ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult)
nsGenericHTMLElement::ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult)
{
nsresult result = NS_OK;
@ -3128,10 +3155,9 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes*
aPresContext->GetCompatibilityMode(&mode);
if (eCompatibility_NavQuirks == mode &&
eHTMLUnit_Empty == value.GetUnit()) {
nsAutoString spec;
nsStyleColor* color;
color = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color);
color->mBackgroundImage = spec;
color->mBackgroundImage.Truncate();
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
color->mBackgroundRepeat = NS_STYLE_BG_REPEAT_XY;
}
@ -3626,7 +3652,7 @@ nsGenericHTMLContainerFormElement::SetForm(nsIForm* aForm)
}
nsresult
nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue,
PRBool aNotify)
{
// Add the control to the hash table
@ -3641,7 +3667,7 @@ nsGenericHTMLContainerFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* a
nsresult
nsGenericHTMLContainerFormElement::SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
NS_ENSURE_ARG_POINTER(aNodeInfo);
@ -3713,7 +3739,9 @@ nsGenericHTMLLeafFormElement::SetForm(nsIForm* aForm)
}
nsresult
nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID,
nsIAtom* aName,
const nsAReadableString& aValue,
PRBool aNotify)
{
// Add the control to the hash table
@ -3728,12 +3756,13 @@ nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
mForm->AddElementToTable(control, aValue);
}
return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue, aNotify);
return nsGenericHTMLElement::SetAttribute(aNameSpaceID, aName, aValue,
aNotify);
}
nsresult
nsGenericHTMLLeafFormElement::SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue,
const nsAReadableString& aValue,
PRBool aNotify)
{
NS_ENSURE_ARG_POINTER(aNodeInfo);

Просмотреть файл

@ -67,39 +67,39 @@ public:
PRBool aDeep);
// Implementation for nsIDOMNode
nsresult GetNodeName(nsString& aNodeName);
nsresult GetLocalName(nsString& aLocalName);
nsresult GetNodeName(nsAWritableString& aNodeName);
nsresult GetLocalName(nsAWritableString& aLocalName);
// Implementation for nsIDOMElement
nsresult GetAttribute(const nsString& aName, nsString& aReturn)
nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)
{
return nsGenericElement::GetAttribute(aName, aReturn);
}
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
{
return nsGenericElement::SetAttribute(aName, aValue);
}
nsresult GetTagName(nsString& aTagName);
nsresult GetTagName(nsAWritableString& aTagName);
// Implementation for nsIDOMHTMLElement
nsresult GetId(nsString& aId);
nsresult SetId(const nsString& aId);
nsresult GetTitle(nsString& aTitle);
nsresult SetTitle(const nsString& aTitle);
nsresult GetLang(nsString& aLang);
nsresult SetLang(const nsString& aLang);
nsresult GetDir(nsString& aDir);
nsresult SetDir(const nsString& aDir);
nsresult GetClassName(nsString& aClassName);
nsresult SetClassName(const nsString& aClassName);
nsresult GetId(nsAWritableString& aId);
nsresult SetId(const nsAReadableString& aId);
nsresult GetTitle(nsAWritableString& aTitle);
nsresult SetTitle(const nsAReadableString& aTitle);
nsresult GetLang(nsAWritableString& aLang);
nsresult SetLang(const nsAReadableString& aLang);
nsresult GetDir(nsAWritableString& aDir);
nsresult SetDir(const nsAReadableString& aDir);
nsresult GetClassName(nsAWritableString& aClassName);
nsresult SetClassName(const nsAReadableString& aClassName);
nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
nsresult GetOffsetTop(PRInt32* aOffsetTop);
nsresult GetOffsetLeft(PRInt32* aOffsetLeft);
nsresult GetOffsetWidth(PRInt32* aOffsetWidth);
nsresult GetOffsetHeight(PRInt32* aOffsetHeight);
nsresult GetOffsetParent(nsIDOMElement** aOffsetParent);
nsresult GetInnerHTML(nsString& aInnerHTML);
nsresult SetInnerHTML(const nsString& aInnerHTML);
nsresult GetInnerHTML(nsAWritableString& aInnerHTML);
nsresult SetInnerHTML(const nsAReadableString& aInnerHTML);
nsresult GetOffsetRect(nsRect& aRect,
nsIAtom* aOffsetParentTag,
nsIContent** aOffsetParent);
@ -108,17 +108,17 @@ public:
// Implementation for nsIContent
nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const;
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers);
nsresult ParseAttributeString(const nsString& aStr,
nsresult ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID);
nsresult GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
nsIAtom*& aPrefix);
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify);
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAWritableString& aResult) const;
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom*& aPrefix, nsAWritableString& aResult) const;
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
nsresult GetAttributeNameAt(PRInt32 aIndex,
PRInt32& aNameSpaceID,
@ -153,8 +153,8 @@ public:
nsresult GetContentStyleRules(nsISupportsArray* aRules);
nsresult GetInlineStyleRules(nsISupportsArray* aRules);
nsresult GetBaseURL(nsIURI*& aBaseURL) const;
nsresult GetBaseTarget(nsString& aBaseTarget) const;
nsresult ToHTMLString(nsString& aResult) const;
nsresult GetBaseTarget(nsAWritableString& aBaseTarget) const;
nsresult ToHTMLString(nsAWritableString& aResult) const;
nsresult ToHTML(FILE* out) const;
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult,
size_t aInstanceSize) const;
@ -162,7 +162,7 @@ public:
//----------------------------------------
nsresult AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const;
nsAWritableString& aResult) const;
void ListAttributes(FILE* out) const;
@ -176,100 +176,100 @@ public:
PRInt32 value;
};
static PRBool ParseEnumValue(const nsString& aValue,
static PRBool ParseEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult);
static PRBool ParseCaseSensitiveEnumValue(const nsString& aValue,
static PRBool ParseCaseSensitiveEnumValue(const nsAReadableString& aValue,
EnumTable* aTable,
nsHTMLValue& aResult);
static PRBool EnumValueToString(const nsHTMLValue& aValue,
EnumTable* aTable,
nsString& aResult,
nsAWritableString& aResult,
PRBool aFoldCase=PR_TRUE);
static PRBool ParseValueOrPercent(const nsString& aString,
static PRBool ParseValueOrPercent(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
static PRBool ParseValueOrPercentOrProportional(const nsString& aString,
static PRBool ParseValueOrPercentOrProportional(const nsAReadableString& aString,
nsHTMLValue& aResult,
nsHTMLUnit aValueUnit);
static PRBool ValueOrPercentToString(const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ParseValue(const nsString& aString, PRInt32 aMin,
static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit);
static PRBool ParseValue(const nsString& aString, PRInt32 aMin, PRInt32 aMax,
static PRBool ParseValue(const nsAReadableString& aString, PRInt32 aMin, PRInt32 aMax,
nsHTMLValue& aResult, nsHTMLUnit aValueUnit);
static PRBool ParseColor(const nsString& aString, nsIDocument* aDocument,
static PRBool ParseColor(const nsAReadableString& aString, nsIDocument* aDocument,
nsHTMLValue& aResult);
static PRBool ColorToString(const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ParseCommonAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
static PRBool ParseAlignValue(const nsString& aString, nsHTMLValue& aResult);
static PRBool ParseAlignValue(const nsAReadableString& aString, nsHTMLValue& aResult);
PRBool ParseDivAlignValue(const nsString& aString,
PRBool ParseDivAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
nsAWritableString& aResult) const;
PRBool ParseTableHAlignValue(const nsString& aString,
PRBool ParseTableHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
nsAWritableString& aResult) const;
PRBool ParseTableCellHAlignValue(const nsString& aString,
PRBool ParseTableCellHAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult) const;
PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult) const;
nsAWritableString& aResult) const;
static PRBool ParseTableVAlignValue(const nsString& aString,
static PRBool ParseTableVAlignValue(const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool TableVAlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool AlignValueToString(const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool ImageAttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ParseFrameborderValue(PRBool aStandardMode,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool FrameborderValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
static PRBool ParseScrollingValue(PRBool aStandardMode,
const nsString& aString,
const nsAReadableString& aString,
nsHTMLValue& aResult);
static PRBool ScrollingValueToString(PRBool aStandardMode,
const nsHTMLValue& aValue,
nsString& aResult);
nsAWritableString& aResult);
nsresult ReparseStyleAttribute(void);
nsresult ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult);
nsresult ParseStyleAttribute(const nsAReadableString& aValue, nsHTMLValue& aResult);
/** Attribute Mapping Helpers
*
@ -466,11 +466,11 @@ public:
~nsGenericHTMLContainerFormElement();
nsresult SetForm(nsIForm* aForm);
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
{
return nsGenericHTMLElement::SetAttribute(aName, aValue);
}
@ -487,11 +487,11 @@ public:
~nsGenericHTMLLeafFormElement();
nsresult SetForm(nsIForm* aForm);
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsString& aValue,
nsresult SetAttribute(nsINodeInfo* aNodeInfo, const nsAReadableString& aValue,
PRBool aNotify);
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
{
return nsGenericHTMLElement::SetAttribute(aName, aValue);
}
@ -508,34 +508,34 @@ public:
* nsGenericHTMLContainerContent)
*/
#define NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(_g) \
NS_IMETHOD GetId(nsString& aId) { \
NS_IMETHOD GetId(nsAWritableString& aId) { \
return _g.GetId(aId); \
} \
NS_IMETHOD SetId(const nsString& aId) { \
NS_IMETHOD SetId(const nsAReadableString& aId) { \
return _g.SetId(aId); \
} \
NS_IMETHOD GetTitle(nsString& aTitle) { \
NS_IMETHOD GetTitle(nsAWritableString& aTitle) { \
return _g.GetTitle(aTitle); \
} \
NS_IMETHOD SetTitle(const nsString& aTitle) { \
NS_IMETHOD SetTitle(const nsAReadableString& aTitle) { \
return _g.SetTitle(aTitle); \
} \
NS_IMETHOD GetLang(nsString& aLang) { \
NS_IMETHOD GetLang(nsAWritableString& aLang) { \
return _g.GetLang(aLang); \
} \
NS_IMETHOD SetLang(const nsString& aLang) { \
NS_IMETHOD SetLang(const nsAReadableString& aLang) { \
return _g.SetLang(aLang); \
} \
NS_IMETHOD GetDir(nsString& aDir) { \
NS_IMETHOD GetDir(nsAWritableString& aDir) { \
return _g.GetDir(aDir); \
} \
NS_IMETHOD SetDir(const nsString& aDir) { \
NS_IMETHOD SetDir(const nsAReadableString& aDir) { \
return _g.SetDir(aDir); \
} \
NS_IMETHOD GetClassName(nsString& aClassName) { \
NS_IMETHOD GetClassName(nsAWritableString& aClassName) { \
return _g.GetClassName(aClassName); \
} \
NS_IMETHOD SetClassName(const nsString& aClassName) { \
NS_IMETHOD SetClassName(const nsAReadableString& aClassName) { \
return _g.SetClassName(aClassName); \
} \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { \
@ -556,10 +556,10 @@ public:
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) { \
return _g.GetOffsetParent(aOffsetParent); \
} \
NS_IMETHOD GetInnerHTML(nsString& aInnerHTML) { \
NS_IMETHOD GetInnerHTML(nsAWritableString& aInnerHTML) { \
return _g.GetInnerHTML(aInnerHTML); \
} \
NS_IMETHOD SetInnerHTML(const nsString& aInnerHTML) { \
NS_IMETHOD SetInnerHTML(const nsAReadableString& aInnerHTML) { \
return _g.SetInnerHTML(aInnerHTML); \
}
@ -594,21 +594,21 @@ public:
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \
return _g.GetBaseURL(aBaseURL); \
} \
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \
return _g.GetBaseTarget(aBaseTarget); \
} \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \
return _g.ToHTMLString(aResult); \
} \
NS_IMETHOD ToHTML(FILE* out) const { \
return _g.ToHTML(out); \
} \
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \
const nsString& aValue, \
const nsAReadableString& aValue, \
nsHTMLValue& aResult); \
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \
const nsHTMLValue& aValue, \
nsString& aResult) const; \
nsAWritableString& aResult) const; \
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \
nsMapAttributesFunc& aMapFunc) const; \
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \
@ -640,21 +640,21 @@ public:
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \
return _g.GetBaseURL(aBaseURL); \
} \
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const { \
return _g.GetBaseTarget(aBaseTarget); \
} \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
NS_IMETHOD ToHTMLString(nsAWritableString& aResult) const { \
return _g.ToHTMLString(aResult); \
} \
NS_IMETHOD ToHTML(FILE* out) const { \
return _g.ToHTML(out); \
} \
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \
const nsString& aValue, \
const nsAReadableString& aValue, \
nsHTMLValue& aResult); \
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \
const nsHTMLValue& aValue, \
nsString& aResult) const; \
nsAWritableString& aResult) const; \
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \
nsMapAttributesFunc& aMapFunc) const; \
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \
@ -692,13 +692,13 @@ public:
*/
#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \
NS_IMETHODIMP \
_class::Get##_method(nsString& aValue) \
_class::Get##_method(nsAWritableString& aValue) \
{ \
mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue); \
return NS_OK; \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsString& aValue) \
_class::Set##_method(const nsAReadableString& aValue) \
{ \
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue, PR_TRUE); \
}

Просмотреть файл

@ -46,6 +46,7 @@
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIHTMLAttributes.h"
#include "prprf.h"
// XXX suppress
@ -77,42 +78,10 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLAnchorElement
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
NS_IMETHOD GetCharset(nsString& aCharset);
NS_IMETHOD SetCharset(const nsString& aCharset);
NS_IMETHOD GetCoords(nsString& aCoords);
NS_IMETHOD SetCoords(const nsString& aCoords);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD SetHref(const nsString& aHref);
NS_IMETHOD GetHreflang(nsString& aHreflang);
NS_IMETHOD SetHreflang(const nsString& aHreflang);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetRel(nsString& aRel);
NS_IMETHOD SetRel(const nsString& aRel);
NS_IMETHOD GetRev(nsString& aRev);
NS_IMETHOD SetRev(const nsString& aRev);
NS_IMETHOD GetShape(nsString& aShape);
NS_IMETHOD SetShape(const nsString& aShape);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetTarget(nsString& aTarget);
NS_IMETHOD SetTarget(const nsString& aTarget);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD Blur();
NS_IMETHOD Focus();
NS_DECL_IDOMHTMLANCHORELEMENT
// nsIDOMNSHTMLAnchorElement
NS_IMETHOD GetProtocol(nsString& aProtocol);
NS_IMETHOD GetHost(nsString& aHost);
NS_IMETHOD GetHostname(nsString& aHostname);
NS_IMETHOD GetPathname(nsString& aPathname);
NS_IMETHOD GetSearch(nsString& aSearch);
NS_IMETHOD GetPort(nsString& aPort);
NS_IMETHOD GetHash(nsString& aHash);
NS_IMETHOD GetText(nsString& aText);
NS_DECL_IDOMNSHTMLANCHORELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -351,7 +320,7 @@ nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
@ -361,7 +330,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::suppress) {
if (aValue.EqualsIgnoreCase("true")) {
if (nsCRT::strcasecmp(nsPromiseFlatString(aValue), NS_LITERAL_STRING("true"))) {
aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}
@ -372,7 +341,7 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@ -421,13 +390,13 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHref(nsString& aValue)
nsHTMLAnchorElement::GetHref(nsAWritableString& aValue)
{
char *buf;
nsresult rv = GetHrefCString(buf);
if (NS_FAILED(rv)) return rv;
if (buf) {
aValue.AssignWithConversion(buf);
aValue.Assign(NS_ConvertASCIItoUCS2(buf));
nsCRT::free(buf);
}
// NS_IMPL_STRING_ATTR does nothing where we have (buf == null)
@ -435,7 +404,7 @@ nsHTMLAnchorElement::GetHref(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetHref(const nsString& aValue)
nsHTMLAnchorElement::SetHref(const nsAReadableString& aValue)
{
// Clobber our "cache", so we'll recompute it the next time
// somebody asks for it.
@ -451,7 +420,7 @@ nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetProtocol(nsString& aProtocol)
nsHTMLAnchorElement::GetProtocol(nsAWritableString& aProtocol)
{
nsAutoString href;
nsIURI *url;
@ -464,8 +433,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol)
char* protocol;
result = url->GetScheme(&protocol);
if (result == NS_OK) {
aProtocol.AssignWithConversion(protocol);
aProtocol.AppendWithConversion(":");
aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol));
aProtocol.Append(NS_LITERAL_STRING(":"));
nsCRT::free(protocol);
}
NS_RELEASE(url);
@ -476,7 +445,7 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHost(nsString& aHost)
nsHTMLAnchorElement::GetHost(nsAWritableString& aHost)
{
nsAutoString href;
nsIURI *url;
@ -489,13 +458,15 @@ nsHTMLAnchorElement::GetHost(nsString& aHost)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHost.AssignWithConversion(host);
aHost.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aHost.AppendWithConversion(":");
aHost.AppendInt(port, 10);
aHost.Append(NS_LITERAL_STRING(":"));
nsAutoString portStr;
portStr.AppendInt(port);
aHost.Append(portStr);
}
}
NS_RELEASE(url);
@ -506,7 +477,7 @@ nsHTMLAnchorElement::GetHost(nsString& aHost)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHostname(nsString& aHostname)
nsHTMLAnchorElement::GetHostname(nsAWritableString& aHostname)
{
nsAutoString href;
nsIURI *url;
@ -519,7 +490,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHostname.AssignWithConversion(host);
aHostname.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
}
NS_RELEASE(url);
@ -530,7 +501,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetPathname(nsString& aPathname)
nsHTMLAnchorElement::GetPathname(nsAWritableString& aPathname)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
@ -560,14 +531,14 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname)
return result;
}
aPathname.AssignWithConversion(file);
aPathname.Assign(NS_ConvertASCIItoUCS2(file));
nsCRT::free(file);
return result;
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetSearch(nsString& aSearch)
nsHTMLAnchorElement::GetSearch(nsAWritableString& aSearch)
{
nsAutoString href;
nsIURI *uri;
@ -585,8 +556,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {
aSearch.AssignWithConversion("?");
aSearch.AppendWithConversion(search);
aSearch.Assign(NS_LITERAL_STRING("?"));
aSearch.Append(NS_ConvertASCIItoUCS2(search));
nsCRT::free(search);
}
else {
@ -600,7 +571,7 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetPort(nsString& aPort)
nsHTMLAnchorElement::GetPort(nsAWritableString& aPort)
{
nsAutoString href;
nsIURI *url;
@ -610,11 +581,13 @@ nsHTMLAnchorElement::GetPort(nsString& aPort)
if (NS_OK == result) {
result = NS_NewURI(&url, href);
if (NS_OK == result) {
aPort.SetLength(0);
aPort.Truncate(0);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aPort.AppendInt(port, 10);
nsAutoString portStr;
portStr.AppendInt(port);
aPort.Append(portStr);
}
NS_RELEASE(url);
}
@ -624,7 +597,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetHash(nsString& aHash)
nsHTMLAnchorElement::GetHash(nsAWritableString& aHash)
{
nsAutoString href;
nsIURI *uri;
@ -643,8 +616,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
aHash.AssignWithConversion("#");
aHash.AppendWithConversion(ref);
aHash.Assign(NS_LITERAL_STRING("#"));
aHash.Append(NS_ConvertASCIItoUCS2(ref));
nsCRT::free(ref);
}
else {
@ -658,7 +631,7 @@ nsHTMLAnchorElement::GetHash(nsString& aHash)
}
NS_IMETHODIMP
nsHTMLAnchorElement::GetText(nsString& aText)
nsHTMLAnchorElement::GetText(nsAWritableString& aText)
{
aText.Truncate();

Просмотреть файл

@ -72,28 +72,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLAppletElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetAlt(nsString& aAlt);
NS_IMETHOD SetAlt(const nsString& aAlt);
NS_IMETHOD GetArchive(nsString& aArchive);
NS_IMETHOD SetArchive(const nsString& aArchive);
NS_IMETHOD GetCode(nsString& aCode);
NS_IMETHOD SetCode(const nsString& aCode);
NS_IMETHOD GetCodeBase(nsString& aCodeBase);
NS_IMETHOD SetCodeBase(const nsString& aCodeBase);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetHspace(nsString& aHspace);
NS_IMETHOD SetHspace(const nsString& aHspace);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetObject(nsString& aObject);
NS_IMETHOD SetObject(const nsString& aObject);
NS_IMETHOD GetVspace(nsString& aVspace);
NS_IMETHOD SetVspace(const nsString& aVspace);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLAPPLETELEMENT
// nsIJSScriptObject
virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj,
@ -209,7 +188,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width)
NS_IMETHODIMP
nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -227,7 +206,7 @@ nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -62,31 +62,10 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLAreaElement
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
NS_IMETHOD GetAlt(nsString& aAlt);
NS_IMETHOD SetAlt(const nsString& aAlt);
NS_IMETHOD GetCoords(nsString& aCoords);
NS_IMETHOD SetCoords(const nsString& aCoords);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD SetHref(const nsString& aHref);
NS_IMETHOD GetNoHref(PRBool* aNoHref);
NS_IMETHOD SetNoHref(PRBool aNoHref);
NS_IMETHOD GetShape(nsString& aShape);
NS_IMETHOD SetShape(const nsString& aShape);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetTarget(nsString& aTarget);
NS_IMETHOD SetTarget(const nsString& aTarget);
NS_DECL_IDOMHTMLAREAELEMENT
// nsIDOMNSHTMLAreaElement
NS_IMETHOD GetProtocol(nsString& aProtocol);
NS_IMETHOD GetHost(nsString& aHost);
NS_IMETHOD GetHostname(nsString& aHostname);
NS_IMETHOD GetPathname(nsString& aPathname);
NS_IMETHOD GetSearch(nsString& aSearch);
NS_IMETHOD GetPort(nsString& aPort);
NS_IMETHOD GetHash(nsString& aHash);
NS_DECL_IDOMNSHTMLAREAELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -187,7 +166,7 @@ NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Target, target)
NS_IMETHODIMP
nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::nohref) {
@ -206,7 +185,7 @@ nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@ -279,13 +258,13 @@ nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHref(nsString& aValue)
nsHTMLAreaElement::GetHref(nsAWritableString& aValue)
{
char *buf;
nsresult rv = GetHrefCString(buf);
if (NS_FAILED(rv)) return rv;
if (buf) {
aValue.AssignWithConversion(buf);
aValue.Assign(NS_ConvertASCIItoUCS2(buf));
nsCRT::free(buf);
}
// NS_IMPL_STRING_ATTR does nothing where we have (buf == null)
@ -293,7 +272,7 @@ nsHTMLAreaElement::GetHref(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLAreaElement::SetHref(const nsString& aValue)
nsHTMLAreaElement::SetHref(const nsAReadableString& aValue)
{
// Clobber our "cache", so we'll recompute it the next time
// somebody asks for it.
@ -309,7 +288,7 @@ nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
}
NS_IMETHODIMP
nsHTMLAreaElement::GetProtocol(nsString& aProtocol)
nsHTMLAreaElement::GetProtocol(nsAWritableString& aProtocol)
{
nsAutoString href;
nsIURI *url;
@ -322,8 +301,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol)
char* protocol;
result = url->GetScheme(&protocol);
if (result == NS_OK) {
aProtocol.AssignWithConversion(protocol);
aProtocol.AppendWithConversion(":");
aProtocol.Assign(NS_ConvertASCIItoUCS2(protocol));
aProtocol.Append(NS_LITERAL_STRING(":"));
nsCRT::free(protocol);
}
NS_RELEASE(url);
@ -334,7 +313,7 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHost(nsString& aHost)
nsHTMLAreaElement::GetHost(nsAWritableString& aHost)
{
nsAutoString href;
nsIURI *url;
@ -347,13 +326,15 @@ nsHTMLAreaElement::GetHost(nsString& aHost)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHost.AssignWithConversion(host);
aHost.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aHost.AppendWithConversion(":");
aHost.AppendInt(port, 10);
aHost.Append(NS_LITERAL_STRING(":"));
nsAutoString portStr;
portStr.AppendInt(port, 10);
aHost.Append(portStr);
}
}
NS_RELEASE(url);
@ -364,7 +345,7 @@ nsHTMLAreaElement::GetHost(nsString& aHost)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHostname(nsString& aHostname)
nsHTMLAreaElement::GetHostname(nsAWritableString& aHostname)
{
nsAutoString href;
nsIURI *url;
@ -377,7 +358,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
aHostname.AssignWithConversion(host);
aHostname.Assign(NS_ConvertASCIItoUCS2(host));
nsCRT::free(host);
}
NS_RELEASE(url);
@ -388,7 +369,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetPathname(nsString& aPathname)
nsHTMLAreaElement::GetPathname(nsAWritableString& aPathname)
{
nsAutoString href;
nsCOMPtr<nsIURI> uri;
@ -409,14 +390,14 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname)
result = url->GetFilePath(&file);
NS_ENSURE_SUCCESS(result, result);
aPathname.AssignWithConversion(file);
aPathname.Assign(NS_ConvertASCIItoUCS2(file));
nsCRT::free(file);
return result;
}
NS_IMETHODIMP
nsHTMLAreaElement::GetSearch(nsString& aSearch)
nsHTMLAreaElement::GetSearch(nsAWritableString& aSearch)
{
nsAutoString href;
nsIURI *uri;
@ -434,8 +415,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {
aSearch.AssignWithConversion("?");
aSearch.AppendWithConversion(search);
aSearch.Assign(NS_LITERAL_STRING("?"));
aSearch.Append(NS_ConvertASCIItoUCS2(search));
nsCRT::free(search);
}
else {
@ -449,7 +430,7 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetPort(nsString& aPort)
nsHTMLAreaElement::GetPort(nsAWritableString& aPort)
{
nsAutoString href;
nsIURI *url;
@ -463,7 +444,9 @@ nsHTMLAreaElement::GetPort(nsString& aPort)
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
aPort.AppendInt(port, 10);
nsAutoString portStr;
portStr.AppendInt(port, 10);
aPort.Append(portStr);
}
NS_RELEASE(url);
}
@ -473,7 +456,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort)
}
NS_IMETHODIMP
nsHTMLAreaElement::GetHash(nsString& aHash)
nsHTMLAreaElement::GetHash(nsAWritableString& aHash)
{
nsAutoString href;
nsIURI *uri;
@ -492,8 +475,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
aHash.AssignWithConversion("#");
aHash.AppendWithConversion(ref);
aHash.Assign(NS_LITERAL_STRING("#"));
aHash.Append(NS_ConvertASCIItoUCS2(ref));
nsCRT::free(ref);
}
else {

Просмотреть файл

@ -55,8 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLBRElement
NS_IMETHOD GetClear(nsString& aClear);
NS_IMETHOD SetClear(const nsString& aClear);
NS_DECL_IDOMHTMLBRELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -137,7 +136,7 @@ static nsGenericHTMLElement::EnumTable kClearTable[] = {
NS_IMETHODIMP
nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::clear) {
@ -151,7 +150,7 @@ nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::clear) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -54,10 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLBaseElement
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD SetHref(const nsString& aHref);
NS_IMETHOD GetTarget(nsString& aTarget);
NS_IMETHOD SetTarget(const nsString& aTarget);
NS_DECL_IDOMHTMLBASEELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Target, target)
NS_IMETHODIMP
nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -140,7 +137,7 @@ nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -54,12 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLBaseElement
NS_IMETHOD GetColor(nsString& aColor);
NS_IMETHOD SetColor(const nsString& aColor);
NS_IMETHOD GetFace(nsString& aFace);
NS_IMETHOD SetFace(const nsString& aFace);
NS_IMETHOD GetSize(nsString& aSize);
NS_IMETHOD SetSize(const nsString& aSize);
NS_DECL_IDOMHTMLBASEFONTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -134,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Size, size)
NS_IMETHODIMP
nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -144,7 +139,7 @@ nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -193,18 +193,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLBodyElement
NS_IMETHOD GetALink(nsString& aALink);
NS_IMETHOD SetALink(const nsString& aALink);
NS_IMETHOD GetBackground(nsString& aBackground);
NS_IMETHOD SetBackground(const nsString& aBackground);
NS_IMETHOD GetBgColor(nsString& aBgColor);
NS_IMETHOD SetBgColor(const nsString& aBgColor);
NS_IMETHOD GetLink(nsString& aLink);
NS_IMETHOD SetLink(const nsString& aLink);
NS_IMETHOD GetText(nsString& aText);
NS_IMETHOD SetText(const nsString& aText);
NS_IMETHOD GetVLink(nsString& aVLink);
NS_IMETHOD SetVLink(const nsString& aVLink);
NS_DECL_IDOMHTMLBODYELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -756,7 +745,7 @@ NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text)
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink)
NS_IMETHODIMP
nsHTMLBodyElement::GetBgColor(nsString& aBgColor)
nsHTMLBodyElement::GetBgColor(nsAWritableString& aBgColor)
{
// If we don't have an attribute, find the actual color used for
// (generally from the user agent style sheet) for compatibility
@ -805,14 +794,14 @@ nsHTMLBodyElement::GetBgColor(nsString& aBgColor)
}
NS_IMETHODIMP
nsHTMLBodyElement::SetBgColor(const nsString& aBgColor)
nsHTMLBodyElement::SetBgColor(const nsAReadableString& aBgColor)
{
return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor, PR_TRUE);
}
NS_IMETHODIMP
nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if ((aAttribute == nsHTMLAtoms::bgcolor) ||
@ -836,7 +825,7 @@ nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -60,15 +60,15 @@ public:
// nsIDOMElement
// NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
NS_IMETHOD GetTagName(nsString& aTagName) {
NS_IMETHOD GetTagName(nsAWritableString& aTagName) {
return mInner.GetTagName(aTagName);
}
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn);
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue);
NS_IMETHOD RemoveAttribute(const nsString& aName) {
NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn);
NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue);
NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) {
return mInner.RemoveAttribute(aName);
}
NS_IMETHOD GetAttributeNode(const nsString& aName,
NS_IMETHOD GetAttributeNode(const nsAReadableString& aName,
nsIDOMAttr** aReturn) {
return mInner.GetAttributeNode(aName, aReturn);
}
@ -78,41 +78,41 @@ public:
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {
return mInner.RemoveAttributeNode(aOldAttr, aReturn);
}
NS_IMETHOD GetElementsByTagName(const nsString& aTagname,
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagName(aTagname, aReturn);
}
NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsString& aReturn) {
NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsAWritableString& aReturn) {
return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsString& aValue) {
NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
const nsAReadableString& aValue) {
return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue);
}
NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName) {
NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName) {
return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName);
}
NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMAttr** aReturn) {
return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) {
return mInner.SetAttributeNodeNS(aNewAttr, aReturn);
}
NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) {
NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) {
return mInner.HasAttribute(aName, aReturn);
}
NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, PRBool* aReturn) {
NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, PRBool* aReturn) {
return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
@ -120,18 +120,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLButtonElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetValue(nsString& aValue);
NS_IMETHOD SetValue(const nsString& aValue);
NS_DECL_IDOMHTMLBUTTONELEMENT
// nsIDOMHTMLButtonElement
NS_IMETHOD Blur();
@ -215,14 +204,15 @@ nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
NS_IMETHODIMP
nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn)
nsHTMLButtonElement::GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)
{
if (aName.EqualsWithConversion("disabled", PR_TRUE)) {
nsAutoString name(aName);
if (name.EqualsWithConversion("disabled", PR_TRUE)) {
nsresult rv = GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, aReturn);
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
aReturn.AssignWithConversion("false");
aReturn.Assign(NS_LITERAL_STRING("false"));
} else {
aReturn.AssignWithConversion("true");
aReturn.Assign(NS_LITERAL_STRING("true"));
}
return NS_OK;
@ -232,10 +222,11 @@ nsHTMLButtonElement::GetAttribute(const nsString& aName, nsString& aReturn)
}
NS_IMETHODIMP
nsHTMLButtonElement::SetAttribute(const nsString& aName, const nsString& aValue)
nsHTMLButtonElement::SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
{
if (aName.EqualsWithConversion("disabled", PR_TRUE) &&
aValue.EqualsWithConversion("false", PR_TRUE)) {
nsAutoString name(aName), value(aValue);
if (name.EqualsWithConversion("disabled", PR_TRUE) &&
value.EqualsWithConversion("false", PR_TRUE)) {
return mInner.RemoveAttribute(aName);
}
@ -285,7 +276,7 @@ nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
return result;
}
NS_IMETHODIMP
nsHTMLButtonElement::GetType(nsString& aType)
nsHTMLButtonElement::GetType(nsAWritableString& aType)
{
return AttributeToString(nsHTMLAtoms::type,
nsHTMLValue(mType, eHTMLUnit_Enumerated),
@ -387,7 +378,7 @@ static nsGenericHTMLElement::EnumTable kButtonTypeTable[] = {
NS_IMETHODIMP
nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::tabindex) {
@ -398,8 +389,9 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
}
else if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumTable *table = kButtonTypeTable;
nsAutoString val(aValue);
while (nsnull != table->tag) {
if (aValue.EqualsIgnoreCase(table->tag)) {
if (val.EqualsIgnoreCase(table->tag)) {
aResult.SetIntValue(table->value, eHTMLUnit_Enumerated);
mType = table->value;
return NS_CONTENT_ATTR_HAS_VALUE;
@ -417,7 +409,7 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -129,7 +129,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact)
NS_IMETHODIMP
nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::compact) {
@ -142,7 +142,7 @@ nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -54,10 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLModElement
NS_IMETHOD GetCite(nsString& aCite);
NS_IMETHOD SetCite(const nsString& aCite);
NS_IMETHOD GetDateTime(nsString& aDateTime);
NS_IMETHOD SetDateTime(const nsString& aDateTime);
NS_DECL_IDOMHTMLMODELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime)
NS_IMETHODIMP
nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -141,7 +138,7 @@ nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLDirectoryElement, Compact, compact)
NS_IMETHODIMP
nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
@ -157,7 +157,7 @@ nsHTMLDirectoryElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult);

Просмотреть файл

@ -57,8 +57,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLDivElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_DECL_IDOMHTMLDIVELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -130,7 +129,7 @@ NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align)
NS_IMETHODIMP
nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -160,7 +159,7 @@ nsHTMLDivElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLDivElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -155,7 +155,7 @@ nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_IMETHODIMP
nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -173,7 +173,7 @@ nsHTMLEmbedElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLEmbedElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -224,7 +224,7 @@ nsHTMLFieldSetElement::SetForm(nsIDOMHTMLFormElement* aForm)
NS_IMETHODIMP
nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -233,7 +233,7 @@ nsHTMLFieldSetElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLFieldSetElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -58,12 +58,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLFontElement
NS_IMETHOD GetColor(nsString& aColor);
NS_IMETHOD SetColor(const nsString& aColor);
NS_IMETHOD GetFace(nsString& aFace);
NS_IMETHOD SetFace(const nsString& aFace);
NS_IMETHOD GetSize(nsString& aSize);
NS_IMETHOD SetSize(const nsString& aSize);
NS_DECL_IDOMHTMLFONTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -138,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFontElement, Size, size)
NS_IMETHODIMP
nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if ((aAttribute == nsHTMLAtoms::size) ||
@ -167,22 +162,25 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if ((aAttribute == nsHTMLAtoms::size) ||
(aAttribute == nsHTMLAtoms::pointSize) ||
(aAttribute == nsHTMLAtoms::fontWeight)) {
aResult.Truncate();
nsAutoString intVal;
if (aValue.GetUnit() == eHTMLUnit_Enumerated) {
aResult.AppendInt(aValue.GetIntValue(), 10);
intVal.AppendInt(aValue.GetIntValue(), 10);
aResult.Append(intVal);
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aValue.GetUnit() == eHTMLUnit_Integer) {
PRInt32 value = aValue.GetIntValue();
if (value >= 0) {
aResult.AppendWithConversion('+');
aResult.Append(NS_LITERAL_STRING("+"));
}
aResult.AppendInt(value, 10);
intVal.AppendInt(value, 10);
aResult.Append(intVal);
return NS_CONTENT_ATTR_HAS_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;

Просмотреть файл

@ -85,10 +85,7 @@ public:
NS_DECL_IDOMHTMLFORMELEMENT
// nsIDOMNSHTMLFormElement
NS_IMETHOD GetEncoding(nsString& aEncoding);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn);
NS_IMETHOD NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn);
NS_DECL_IDOMNSHTMLFORMELEMENT
// nsIContent
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
@ -113,11 +110,11 @@ public:
// nsIForm
NS_IMETHOD AddElement(nsIFormControl* aElement);
NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsString& aName);
NS_IMETHOD AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName);
NS_IMETHOD GetElementAt(PRInt32 aIndex, nsIFormControl** aElement) const;
NS_IMETHOD GetElementCount(PRUint32* aCount) const;
NS_IMETHOD RemoveElement(nsIFormControl* aElement);
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsString& aName);
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName);
protected:
nsFormControlList* mControls;
@ -145,8 +142,8 @@ public:
nsresult GetNamedObject(JSContext* aContext, jsval aID, JSObject** aObj);
nsresult AddElementToTable(nsIFormControl* aChild, const nsString& aName);
nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsString& aName);
nsresult AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName);
nsresult RemoveElementFromTable(nsIFormControl* aChild, const nsAReadableString& aName);
#ifdef DEBUG
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
@ -261,13 +258,13 @@ nsHTMLFormElement::GetElements(nsIDOMHTMLCollection** aElements)
}
NS_IMETHODIMP
nsHTMLFormElement::GetName(nsString& aValue)
nsHTMLFormElement::GetName(nsAWritableString& aValue)
{
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue);
}
NS_IMETHODIMP
nsHTMLFormElement::SetName(const nsString& aValue)
nsHTMLFormElement::SetName(const nsAReadableString& aValue)
{
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, aValue, PR_TRUE);
}
@ -361,7 +358,7 @@ static nsGenericHTMLElement::EnumTable kFormEnctypeTable[] = {
NS_IMETHODIMP
nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::method) {
@ -380,7 +377,7 @@ nsHTMLFormElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::method) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
@ -500,7 +497,7 @@ nsHTMLFormElement::AddElement(nsIFormControl* aChild)
}
NS_IMETHODIMP
nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsString& aName)
nsHTMLFormElement::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName)
{
return mControls->AddElementToTable(aChild, aName);
}
@ -516,13 +513,13 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild)
NS_IMETHODIMP
nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement,
const nsString& aName)
const nsAReadableString& aName)
{
return mControls->RemoveElementFromTable(aElement, aName);
}
NS_IMETHODIMP
nsHTMLFormElement::GetEncoding(nsString& aEncoding)
nsHTMLFormElement::GetEncoding(nsAWritableString& aEncoding)
{
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::enctype, aEncoding);
}
@ -888,7 +885,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb
if (mLookupTable) {
// Get the hash entry
nsString ustr; ustr.AssignWithConversion(str);
nsAutoString ustr; ustr.AssignWithConversion(str);
nsStringKey key(ustr);
nsCOMPtr<nsISupports> tmp = dont_AddRef((nsISupports *)mLookupTable->Get(&key));
@ -952,7 +949,7 @@ nsFormControlList::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* a
}
NS_IMETHODIMP
nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsFormControlList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
@ -985,7 +982,7 @@ nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
}
nsresult
nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aName)
nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsAReadableString& aName)
{
nsStringKey key(aName);
if (!mLookupTable) {
@ -1054,9 +1051,8 @@ nsFormControlList::AddElementToTable(nsIFormControl* aChild, const nsString& aNa
nsresult
nsFormControlList::RemoveElementFromTable(nsIFormControl* aChild,
const nsString& aName)
const nsAReadableString& aName)
{
nsAutoString name;
nsCOMPtr<nsIContent> content = do_QueryInterface(aChild);
if (mLookupTable && content) {
nsStringKey key(aName);

Просмотреть файл

@ -61,24 +61,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLFrameElement
NS_IMETHOD GetFrameBorder(nsString& aFrameBorder);
NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder);
NS_IMETHOD GetLongDesc(nsString& aLongDesc);
NS_IMETHOD SetLongDesc(const nsString& aLongDesc);
NS_IMETHOD GetMarginHeight(nsString& aMarginHeight);
NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight);
NS_IMETHOD GetMarginWidth(nsString& aMarginWidth);
NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetNoResize(PRBool* aNoResize);
NS_IMETHOD SetNoResize(PRBool aNoResize);
NS_IMETHOD GetScrolling(nsString& aScrolling);
NS_IMETHOD SetScrolling(const nsString& aScrolling);
NS_IMETHOD GetSrc(nsString& aSrc);
NS_IMETHOD SetSrc(const nsString& aSrc);
NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument);
NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument);
NS_DECL_IDOMHTMLFRAMEELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -206,7 +189,7 @@ nsHTMLFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument)
NS_IMETHODIMP
nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
@ -247,7 +230,7 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::frameborder) {
nsGenericHTMLElement::FrameborderValueToString(PR_FALSE, aValue, aResult);

Просмотреть файл

@ -54,10 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLFrameSetElement
NS_IMETHOD GetCols(nsString& aCols);
NS_IMETHOD SetCols(const nsString& aCols);
NS_IMETHOD GetRows(nsString& aRows);
NS_IMETHOD SetRows(const nsString& aRows);
NS_DECL_IDOMHTMLFRAMESETELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLFrameSetElement, Rows, rows)
NS_IMETHODIMP
nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::bordercolor) {
@ -156,7 +153,7 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::frameborder) {
// XXX need to check for correct mode

Просмотреть файл

@ -55,14 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLHRElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetNoShade(PRBool* aNoShade);
NS_IMETHOD SetNoShade(PRBool aNoShade);
NS_IMETHOD GetSize(nsString& aSize);
NS_IMETHOD SetSize(const nsString& aSize);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLHRELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -170,7 +163,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = {
NS_IMETHODIMP
nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::width) {
@ -199,7 +192,7 @@ nsHTMLHRElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLHRElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -54,8 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLHeadElement
NS_IMETHOD GetProfile(nsString& aProfile);
NS_IMETHOD SetProfile(const nsString& aProfile);
NS_DECL_IDOMHTMLHEADELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadElement, Profile, profile)
NS_IMETHODIMP
nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -137,7 +136,7 @@ nsHTMLHeadElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLHeadElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -55,8 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLHeadingElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_DECL_IDOMHTMLHEADINGELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -129,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align)
NS_IMETHODIMP
nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -143,7 +142,7 @@ nsHTMLHeadingElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLHeadingElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -55,8 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLHtmlElement
NS_IMETHOD GetVersion(nsString& aVersion);
NS_IMETHOD SetVersion(const nsString& aVersion);
NS_DECL_IDOMHTMLHTMLELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -134,7 +133,7 @@ NS_IMPL_STRING_ATTR(nsHTMLHtmlElement, Version, version)
NS_IMETHODIMP
nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -143,7 +142,7 @@ nsHTMLHtmlElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLHtmlElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -62,28 +62,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLIFrameElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetFrameBorder(nsString& aFrameBorder);
NS_IMETHOD SetFrameBorder(const nsString& aFrameBorder);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetLongDesc(nsString& aLongDesc);
NS_IMETHOD SetLongDesc(const nsString& aLongDesc);
NS_IMETHOD GetMarginHeight(nsString& aMarginHeight);
NS_IMETHOD SetMarginHeight(const nsString& aMarginHeight);
NS_IMETHOD GetMarginWidth(nsString& aMarginWidth);
NS_IMETHOD SetMarginWidth(const nsString& aMarginWidth);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetScrolling(nsString& aScrolling);
NS_IMETHOD SetScrolling(const nsString& aScrolling);
NS_IMETHOD GetSrc(nsString& aSrc);
NS_IMETHOD SetSrc(const nsString& aSrc);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument);
NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument);
NS_DECL_IDOMHTMLIFRAMEELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -213,7 +192,7 @@ nsHTMLIFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument)
NS_IMETHODIMP
nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::marginwidth) {
@ -261,7 +240,7 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::frameborder) {
nsGenericHTMLElement::FrameborderValueToString(PR_TRUE, aValue, aResult);

Просмотреть файл

@ -86,37 +86,12 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLImageElement
NS_IMETHOD GetLowSrc(nsString& aLowSrc);
NS_IMETHOD SetLowSrc(const nsString& aLowSrc);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetAlt(nsString& aAlt);
NS_IMETHOD SetAlt(const nsString& aAlt);
NS_IMETHOD GetBorder(nsString& aBorder);
NS_IMETHOD SetBorder(const nsString& aBorder);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetHspace(nsString& aHspace);
NS_IMETHOD SetHspace(const nsString& aHspace);
NS_IMETHOD GetIsMap(PRBool* aIsMap);
NS_IMETHOD SetIsMap(PRBool aIsMap);
NS_IMETHOD GetLongDesc(nsString& aLongDesc);
NS_IMETHOD SetLongDesc(const nsString& aLongDesc);
NS_IMETHOD GetSrc(nsString& aSrc);
NS_IMETHOD SetSrc(const nsString& aSrc);
NS_IMETHOD GetUseMap(nsString& aUseMap);
NS_IMETHOD SetUseMap(const nsString& aUseMap);
NS_IMETHOD GetVspace(nsString& aVspace);
NS_IMETHOD SetVspace(const nsString& aVspace);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLIMAGEELEMENT
// nsIDOMImage
// XXX Casing is different for backward compatibility
NS_IMETHOD GetLowsrc(nsString& aLowsrc);
NS_IMETHOD SetLowsrc(const nsString& aLowsrc);
NS_IMETHOD GetLowsrc(nsAWritableString& aLowsrc);
NS_IMETHOD SetLowsrc(const nsAReadableString& aLowsrc);
NS_IMETHOD GetComplete(PRBool* aComplete);
NS_IMETHOD GetBorder(PRInt32* aBorder);
NS_IMETHOD SetBorder(PRInt32 aBorder);
@ -154,7 +129,7 @@ public:
// nsIJSNativeInitializer
NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj,
PRUint32 argc, jsval *argv);
nsresult SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc);
nsresult SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc);
nsresult GetCallerSourceURL(JSContext* cx, nsIURI** sourceURL);
nsresult GetImageFrame(nsImageFrame** aImageFrame);
@ -342,7 +317,7 @@ nsHTMLImageElement::GetComplete(PRBool* aComplete)
}
NS_IMETHODIMP
nsHTMLImageElement::GetHeight(nsString& aValue)
nsHTMLImageElement::GetHeight(nsAWritableString& aValue)
{
nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height,
aValue);
@ -354,8 +329,10 @@ nsHTMLImageElement::GetHeight(nsString& aValue)
// A zero height most likely means that the image is not loaded yet.
if (NS_SUCCEEDED(GetHeight(&height)) && height) {
aValue.AppendInt(height);
aValue.AppendWithConversion("px");
nsAutoString heightStr;
heightStr.AppendInt(height);
aValue.Append(heightStr);
aValue.Append(NS_LITERAL_STRING("px"));
}
}
@ -363,7 +340,7 @@ nsHTMLImageElement::GetHeight(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLImageElement::SetHeight(const nsString& aValue)
nsHTMLImageElement::SetHeight(const nsAReadableString& aValue)
{
return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, aValue,
PR_TRUE);
@ -416,7 +393,7 @@ nsHTMLImageElement::SetHeight(PRInt32 aHeight)
}
NS_IMETHODIMP
nsHTMLImageElement::GetWidth(nsString& aValue)
nsHTMLImageElement::GetWidth(nsAWritableString& aValue)
{
nsresult rv = mInner.GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width,
aValue);
@ -428,8 +405,10 @@ nsHTMLImageElement::GetWidth(nsString& aValue)
// A zero width most likely means that the image is not loaded yet.
if (NS_SUCCEEDED(GetWidth(&width)) && width) {
aValue.AppendInt(width);
aValue.AppendWithConversion("px");
nsAutoString widthStr;
widthStr.AppendInt(width);
aValue.Append(widthStr);
aValue.Append(NS_LITERAL_STRING("px"));
}
}
@ -437,7 +416,7 @@ nsHTMLImageElement::GetWidth(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLImageElement::SetWidth(const nsString& aValue)
nsHTMLImageElement::SetWidth(const nsAReadableString& aValue)
{
return mInner.SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, aValue,
PR_TRUE);
@ -491,7 +470,7 @@ nsHTMLImageElement::SetWidth(PRInt32 aWidth)
NS_IMETHODIMP
nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -513,7 +492,7 @@ nsHTMLImageElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
@ -843,7 +822,7 @@ nsHTMLImageElement::SetDocument(nsIDocument* aDocument,
}
NS_IMETHODIMP
nsHTMLImageElement::GetSrc(nsString& aSrc)
nsHTMLImageElement::GetSrc(nsAWritableString& aSrc)
{
// Resolve url to an absolute url
nsresult rv = NS_OK;
@ -869,7 +848,7 @@ nsHTMLImageElement::GetSrc(nsString& aSrc)
}
nsresult
nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc)
nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc)
{
nsresult result = NS_OK;
@ -947,7 +926,7 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc)
}
NS_IMETHODIMP
nsHTMLImageElement::SetSrc(const nsString& aSrc)
nsHTMLImageElement::SetSrc(const nsAReadableString& aSrc)
{
nsIURI* baseURL = nsnull;
nsresult result = NS_OK;

Просмотреть файл

@ -97,13 +97,13 @@ public:
// nsIDOMElement
// can't use the macro here because input type=text needs to notify up to
// frame system on SetAttribute("value");
NS_IMETHOD GetTagName(nsString& aTagName) {
NS_IMETHOD GetTagName(nsAWritableString& aTagName) {
return mInner.GetTagName(aTagName);
}
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) {
return mInner.GetAttribute(aName, aReturn);
}
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) {
nsAutoString valueAttribute;
nsHTMLAtoms::value->ToString(valueAttribute);
if (PR_TRUE==valueAttribute.Equals(aName)) {
@ -112,10 +112,10 @@ public:
}
return mInner.SetAttribute(aName, aValue);
}
NS_IMETHOD RemoveAttribute(const nsString& aName) {
NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) {
return mInner.RemoveAttribute(aName);
}
NS_IMETHOD GetAttributeNode(const nsString& aName,
NS_IMETHOD GetAttributeNode(const nsAReadableString& aName,
nsIDOMAttr** aReturn) {
return mInner.GetAttributeNode(aName, aReturn);
}
@ -125,41 +125,41 @@ public:
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {
return mInner.RemoveAttributeNode(aOldAttr, aReturn);
}
NS_IMETHOD GetElementsByTagName(const nsString& aTagname,
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagName(aTagname, aReturn);
}
NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsString& aReturn) {
NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsAWritableString& aReturn) {
return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsString& aValue) {
NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
const nsAReadableString& aValue) {
return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue);
}
NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName) {
NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName) {
return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName);
}
NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMAttr** aReturn) {
return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) {
return mInner.SetAttributeNodeNS(aNewAttr, aReturn);
}
NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) {
NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) {
return mInner.HasAttribute(aName, aReturn);
}
NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, PRBool* aReturn) {
NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, PRBool* aReturn) {
return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
@ -318,13 +318,13 @@ nsHTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm)
}
NS_IMETHODIMP
nsHTMLInputElement::GetDefaultValue(nsString& aDefaultValue)
nsHTMLInputElement::GetDefaultValue(nsAWritableString& aDefaultValue)
{
return mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue);
}
NS_IMETHODIMP
nsHTMLInputElement::SetDefaultValue(const nsString& aDefaultValue)
nsHTMLInputElement::SetDefaultValue(const nsAReadableString& aDefaultValue)
{
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::value, aDefaultValue, PR_TRUE);
}
@ -374,7 +374,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInputElement, Type, type)
//NS_IMPL_STRING_ATTR(nsHTMLInputElement, Value, value)
NS_IMETHODIMP
nsHTMLInputElement::GetValue(nsString& aValue)
nsHTMLInputElement::GetValue(nsAWritableString& aValue)
{
PRInt32 type;
GetType(&type);
@ -392,8 +392,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
// Obtain the value property from the presentation state.
if (presState) {
nsAutoString value;
presState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
presState->GetStateProperty(NS_LITERAL_STRING("value"), aValue);
}
}
@ -405,7 +404,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
NS_IMETHODIMP
nsHTMLInputElement::SetValue(const nsString& aValue)
nsHTMLInputElement::SetValue(const nsAReadableString& aValue)
{
PRInt32 type;
GetType(&type);
@ -444,7 +443,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
// Obtain the value property from the presentation state.
if (presState) {
presState->SetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
presState->SetStateProperty(NS_LITERAL_STRING("value"), aValue);
}
}
return NS_OK;
@ -1026,13 +1025,14 @@ static nsGenericHTMLElement::EnumTable kInputTypeTable[] = {
NS_IMETHODIMP
nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumTable *table = kInputTypeTable;
nsAutoString valueStr(aValue);
while (nsnull != table->tag) {
if (aValue.EqualsIgnoreCase(table->tag)) {
if (valueStr.EqualsIgnoreCase(table->tag)) {
aResult.SetIntValue(table->value, eHTMLUnit_Enumerated);
mType = table->value; // set the type of this input
return NS_CONTENT_ATTR_HAS_VALUE;
@ -1101,7 +1101,7 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -54,10 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLModElement
NS_IMETHOD GetCite(nsString& aCite);
NS_IMETHOD SetCite(const nsString& aCite);
NS_IMETHOD GetDateTime(nsString& aDateTime);
NS_IMETHOD SetDateTime(const nsString& aDateTime);
NS_DECL_IDOMHTMLMODELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLInsElement, DateTime, datetime)
NS_IMETHODIMP
nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -141,7 +138,7 @@ nsHTMLInsElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLInsElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -54,9 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLIsIndexElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetPrompt(nsString& aPrompt);
NS_IMETHOD SetPrompt(const nsString& aPrompt);
NS_DECL_IDOMHTMLISINDEXELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -137,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLIsIndexElement, Prompt, prompt)
NS_IMETHODIMP
nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -147,7 +145,7 @@ nsHTMLIsIndexElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLIsIndexElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -55,10 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLLIElement
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD GetValue(PRInt32* aValue);
NS_IMETHOD SetValue(PRInt32 aValue);
NS_DECL_IDOMHTMLLIELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -145,7 +142,7 @@ static nsGenericHTMLElement::EnumTable kListItemTypeTable[] = {
NS_IMETHODIMP
nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
@ -166,7 +163,7 @@ nsHTMLLIElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
PRInt32 v = aValue.GetIntValue();

Просмотреть файл

@ -64,31 +64,35 @@ public:
// nsIDOMElement, because of the "htmlFor" attribute handling we can't
// use the NS_IMPL_IDOMELEMENT_USING_GENERIC macro here...
NS_IMETHOD GetTagName(nsString& aTagName) {
NS_IMETHOD GetTagName(nsAWritableString& aTagName) {
return mInner.GetTagName(aTagName);
}
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttribute(NS_ConvertASCIItoUCS2("for"), aReturn);
NS_IMETHOD GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn) {
nsAutoString name(aName);
if (name.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttribute(NS_LITERAL_STRING("for"), aReturn);
}
return mInner.GetAttribute(aName, aReturn);
}
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.SetAttribute(NS_ConvertASCIItoUCS2("for"), aValue);
NS_IMETHOD SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue) {
nsAutoString name(aName);
if (name.EqualsIgnoreCase("htmlfor")) {
return mInner.SetAttribute(NS_LITERAL_STRING("for"), aValue);
}
return mInner.SetAttribute(aName, aValue);
}
NS_IMETHOD RemoveAttribute(const nsString& aName) {
if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.RemoveAttribute(NS_ConvertASCIItoUCS2("for"));
NS_IMETHOD RemoveAttribute(const nsAReadableString& aName) {
nsAutoString name(aName);
if (name.EqualsIgnoreCase("htmlfor")) {
return mInner.RemoveAttribute(NS_LITERAL_STRING("for"));
}
return mInner.RemoveAttribute(aName);
}
NS_IMETHOD GetAttributeNode(const nsString& aName,
NS_IMETHOD GetAttributeNode(const nsAReadableString& aName,
nsIDOMAttr** aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttributeNode(NS_ConvertASCIItoUCS2("for"), aReturn);
nsAutoString name(aName);
if (name.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttributeNode(NS_LITERAL_STRING("for"), aReturn);
}
return mInner.GetAttributeNode(aName, aReturn);
}
@ -98,41 +102,41 @@ public:
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {
return mInner.RemoveAttributeNode(aOldAttr, aReturn);
}
NS_IMETHOD GetElementsByTagName(const nsString& aTagname,
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagName(aTagname, aReturn);
}
NS_IMETHOD GetAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, nsString& aReturn) {
NS_IMETHOD GetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, nsAWritableString& aReturn) {
return mInner.GetAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNS(const nsString& aNamespaceURI,
const nsString& aQualifiedName,
const nsString& aValue) {
NS_IMETHOD SetAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
const nsAReadableString& aValue) {
return mInner.SetAttributeNS(aNamespaceURI, aQualifiedName, aValue);
}
NS_IMETHOD RemoveAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName) {
NS_IMETHOD RemoveAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName) {
return mInner.RemoveAttributeNS(aNamespaceURI, aLocalName);
}
NS_IMETHOD GetAttributeNodeNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetAttributeNodeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMAttr** aReturn) {
return mInner.GetAttributeNodeNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) {
return mInner.SetAttributeNodeNS(aNewAttr, aReturn);
}
NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI,
const nsString& aLocalName,
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName,
nsIDOMNodeList** aReturn) {
return mInner.GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn);
}
NS_IMETHOD HasAttribute(const nsString& aName, PRBool* aReturn) {
NS_IMETHOD HasAttribute(const nsAReadableString& aName, PRBool* aReturn) {
return HasAttribute(aName, aReturn);
}
NS_IMETHOD HasAttributeNS(const nsString& aNamespaceURI,
const nsString& aLocalName, PRBool* aReturn) {
NS_IMETHOD HasAttributeNS(const nsAReadableString& aNamespaceURI,
const nsAReadableString& aLocalName, PRBool* aReturn) {
return mInner.HasAttributeNS(aNamespaceURI, aLocalName, aReturn);
}
@ -140,12 +144,8 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLLabelElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_DECL_IDOMHTMLLABELELEMENT
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
NS_IMETHOD GetHtmlFor(nsString& aHtmlFor);
NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor);
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -307,14 +307,14 @@ NS_IMPL_STRING_ATTR(nsHTMLLabelElement, AccessKey, accesskey)
//NS_IMPL_STRING_ATTR(nsHTMLLabelElement, HtmlFor, _for)
NS_IMETHODIMP
nsHTMLLabelElement::GetHtmlFor(nsString& aValue)
nsHTMLLabelElement::GetHtmlFor(nsAWritableString& aValue)
{
mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_for, aValue);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLLabelElement::SetHtmlFor(const nsString& aValue)
nsHTMLLabelElement::SetHtmlFor(const nsAReadableString& aValue)
{
// trim leading and trailing whitespace
static char whitespace[] = " \r\n\t";
@ -325,7 +325,7 @@ nsHTMLLabelElement::SetHtmlFor(const nsString& aValue)
NS_IMETHODIMP
nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -334,7 +334,7 @@ nsHTMLLabelElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLLabelElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -61,11 +61,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLLegendElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_DECL_IDOMHTMLLEGENDELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -251,7 +247,7 @@ static nsGenericHTMLElement::EnumTable kAlignTable[] = {
NS_IMETHODIMP
nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -265,7 +261,7 @@ nsHTMLLegendElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -66,24 +66,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLLinkElement
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetCharset(nsString& aCharset);
NS_IMETHOD SetCharset(const nsString& aCharset);
NS_IMETHOD GetHref(nsString& aHref);
NS_IMETHOD SetHref(const nsString& aHref);
NS_IMETHOD GetHreflang(nsString& aHreflang);
NS_IMETHOD SetHreflang(const nsString& aHreflang);
NS_IMETHOD GetMedia(nsString& aMedia);
NS_IMETHOD SetMedia(const nsString& aMedia);
NS_IMETHOD GetRel(nsString& aRel);
NS_IMETHOD SetRel(const nsString& aRel);
NS_IMETHOD GetRev(nsString& aRev);
NS_IMETHOD SetRev(const nsString& aRev);
NS_IMETHOD GetTarget(nsString& aTarget);
NS_IMETHOD SetTarget(const nsString& aTarget);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_DECL_IDOMHTMLLINKELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -237,13 +220,13 @@ NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Target, target)
NS_IMPL_STRING_ATTR(nsHTMLLinkElement, Type, type)
NS_IMETHODIMP
nsHTMLLinkElement::GetHref(nsString& aValue)
nsHTMLLinkElement::GetHref(nsAWritableString& aValue)
{
char *buf;
nsresult rv = GetHrefCString(buf);
if (NS_FAILED(rv)) return rv;
if (buf) {
aValue.AssignWithConversion(buf);
aValue.Assign(NS_ConvertASCIItoUCS2(buf));
nsCRT::free(buf);
}
// NS_IMPL_STRING_ATTR does nothing where we have (buf == null)
@ -251,7 +234,7 @@ nsHTMLLinkElement::GetHref(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLLinkElement::SetHref(const nsString& aValue)
nsHTMLLinkElement::SetHref(const nsAReadableString& aValue)
{
// Clobber our "cache", so we'll recompute it the next time
// somebody asks for it.
@ -282,7 +265,7 @@ nsHTMLLinkElement::GetStyleSheet(nsIStyleSheet*& aStyleSheet)
NS_IMETHODIMP
nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -291,7 +274,7 @@ nsHTMLLinkElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLLinkElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -59,9 +59,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLMapElement
NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_DECL_IDOMHTMLMAPELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -115,7 +113,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const {
return mInner.GetNodeInfo(aResult);
}
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) {
return mInner.ParseAttributeString(aStr, aName, aNameSpaceID);
@ -125,19 +123,19 @@ public:
return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix);
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify);
}
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNodeInfo, aValue, aNotify);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const {
nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
nsIAtom*& aPrefix, nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
@ -330,7 +328,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMapElement, Name, name)
NS_IMETHODIMP
nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -339,7 +337,7 @@ nsHTMLMapElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLMapElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -133,7 +133,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLMenuElement, Compact, compact)
NS_IMETHODIMP
nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
@ -153,7 +153,7 @@ nsHTMLMenuElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable, aResult);

Просмотреть файл

@ -54,14 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLMetaElement
NS_IMETHOD GetContent(nsString& aContent);
NS_IMETHOD SetContent(const nsString& aContent);
NS_IMETHOD GetHttpEquiv(nsString& aHttpEquiv);
NS_IMETHOD SetHttpEquiv(const nsString& aHttpEquiv);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetScheme(nsString& aScheme);
NS_IMETHOD SetScheme(const nsString& aScheme);
NS_DECL_IDOMHTMLMETAELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -138,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLMetaElement, Scheme, scheme)
NS_IMETHODIMP
nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -147,7 +140,7 @@ nsHTMLMetaElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLMetaElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -54,10 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLModElement
NS_IMETHOD GetCite(nsString& aCite);
NS_IMETHOD SetCite(const nsString& aCite);
NS_IMETHOD GetDateTime(nsString& aDateTime);
NS_IMETHOD SetDateTime(const nsString& aDateTime);
NS_DECL_IDOMHTMLMODELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -131,7 +128,7 @@ NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime)
NS_IMETHODIMP
nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -141,7 +138,7 @@ nsHTMLModElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLModElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -55,12 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLOListElement
NS_IMETHOD GetCompact(PRBool* aCompact);
NS_IMETHOD SetCompact(PRBool aCompact);
NS_IMETHOD GetStart(PRInt32* aStart);
NS_IMETHOD SetStart(PRInt32 aStart);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_DECL_IDOMHTMLOLISTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -158,7 +153,7 @@ nsGenericHTMLElement::EnumTable kOldListTypeTable[] = {
NS_IMETHODIMP
nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
@ -182,7 +177,7 @@ nsHTMLOListElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::type) {
PRInt32 v = aValue.GetIntValue();

Просмотреть файл

@ -166,7 +166,7 @@ nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument)
NS_IMETHODIMP
nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -184,7 +184,7 @@ nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -57,10 +57,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLOptGroupElement
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetLabel(nsString& aLabel);
NS_IMETHOD SetLabel(const nsString& aLabel);
NS_DECL_IDOMHTMLOPTGROUPELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -134,7 +131,7 @@ NS_IMPL_STRING_ATTR(nsHTMLOptGroupElement, Label, label)
NS_IMETHODIMP
nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -144,7 +141,7 @@ nsHTMLOptGroupElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLOptGroupElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -305,14 +305,14 @@ nsHTMLOptionElement::SetDisabled(PRBool aDisabled)
#endif
NS_IMETHODIMP
nsHTMLOptionElement::GetLabel(nsString& aValue)
nsHTMLOptionElement::GetLabel(nsAWritableString& aValue)
{
mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLOptionElement::SetLabel(const nsString& aValue)
nsHTMLOptionElement::SetLabel(const nsAReadableString& aValue)
{
nsresult result = mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::label, aValue, PR_TRUE);
if (NS_SUCCEEDED(result)) {
@ -398,7 +398,7 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
NS_IMETHODIMP
nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::selected) {
@ -415,7 +415,7 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLOptionElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@ -466,7 +466,7 @@ nsHTMLOptionElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsHTMLOptionElement::GetText(nsString& aText)
nsHTMLOptionElement::GetText(nsAWritableString& aText)
{
aText.SetLength(0);
PRInt32 numNodes;
@ -488,7 +488,7 @@ nsHTMLOptionElement::GetText(nsString& aText)
nsAutoString compressText(aText);
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
if (compressText.Length() != 0) {
aText = compressText;
aText.Assign(compressText);
}
}
NS_RELEASE(node);
@ -502,7 +502,7 @@ nsHTMLOptionElement::GetText(nsString& aText)
}
NS_IMETHODIMP
nsHTMLOptionElement::SetText(const nsString& aText)
nsHTMLOptionElement::SetText(const nsAReadableString& aText)
{
PRInt32 numNodes;
PRBool usedExistingTextNode = PR_FALSE; // Do we need to create a text node?

Просмотреть файл

@ -57,8 +57,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLParagraphElement
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_DECL_IDOMHTMLPARAGRAPHELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -136,7 +135,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)
NS_IMETHODIMP
nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -150,7 +149,7 @@ nsHTMLParagraphElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLParagraphElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -54,14 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLParamElement
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD GetValue(nsString& aValue);
NS_IMETHOD SetValue(const nsString& aValue);
NS_IMETHOD GetValueType(nsString& aValueType);
NS_IMETHOD SetValueType(const nsString& aValueType);
NS_DECL_IDOMHTMLPARAMELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -137,7 +130,7 @@ NS_IMPL_STRING_ATTR(nsHTMLParamElement, ValueType, valuetype)
NS_IMETHODIMP
nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -147,7 +140,7 @@ nsHTMLParamElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLParamElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -131,7 +131,7 @@ NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width)
NS_IMETHODIMP
nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::cols) {
@ -147,7 +147,8 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::tabstop) {
PRInt32 ec, tabstop = aValue.ToInteger(&ec);
nsAutoString val(aValue);
PRInt32 ec, tabstop = val.ToInteger(&ec);
if (tabstop <= 0) {
tabstop = 8;
}
@ -160,7 +161,7 @@ nsHTMLPreElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -54,8 +54,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLQuoteElement
NS_IMETHOD GetCite(nsString& aCite);
NS_IMETHOD SetCite(const nsString& aCite);
NS_DECL_IDOMHTMLQUOTEELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -128,7 +127,7 @@ NS_IMPL_STRING_ATTR(nsHTMLQuoteElement, Cite, cite)
NS_IMETHODIMP
nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -138,7 +137,7 @@ nsHTMLQuoteElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLQuoteElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Просмотреть файл

@ -55,20 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLScriptElement
NS_IMETHOD GetText(nsString& aText);
NS_IMETHOD SetText(const nsString& aText);
NS_IMETHOD GetHtmlFor(nsString& aHtmlFor);
NS_IMETHOD SetHtmlFor(const nsString& aHtmlFor);
NS_IMETHOD GetEvent(nsString& aEvent);
NS_IMETHOD SetEvent(const nsString& aEvent);
NS_IMETHOD GetCharset(nsString& aCharset);
NS_IMETHOD SetCharset(const nsString& aCharset);
NS_IMETHOD GetDefer(PRBool* aDefer);
NS_IMETHOD SetDefer(PRBool aDefer);
NS_IMETHOD GetSrc(nsString& aSrc);
NS_IMETHOD SetSrc(const nsString& aSrc);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_DECL_IDOMHTMLSCRIPTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -138,7 +125,7 @@ nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
}
NS_IMETHODIMP
nsHTMLScriptElement::GetText(nsString& aValue)
nsHTMLScriptElement::GetText(nsAWritableString& aValue)
{
PRInt32 i, count = 0;
nsresult rv = NS_OK;
@ -167,7 +154,7 @@ nsHTMLScriptElement::GetText(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLScriptElement::SetText(const nsString& aValue)
nsHTMLScriptElement::SetText(const nsAReadableString& aValue)
{
nsCOMPtr<nsIContent> content;
PRInt32 i, count = 0;
@ -202,7 +189,7 @@ nsHTMLScriptElement::SetText(const nsString& aValue)
}
NS_IMETHODIMP
nsHTMLScriptElement::GetHtmlFor(nsString& aValue)
nsHTMLScriptElement::GetHtmlFor(nsAWritableString& aValue)
{
// XXX write me
// mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
@ -210,7 +197,7 @@ nsHTMLScriptElement::GetHtmlFor(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLScriptElement::SetHtmlFor(const nsString& aValue)
nsHTMLScriptElement::SetHtmlFor(const nsAReadableString& aValue)
{
// XXX write me
// return mInner.SetAttr(nsHTMLAtoms::charset, aValue);
@ -218,7 +205,7 @@ nsHTMLScriptElement::SetHtmlFor(const nsString& aValue)
}
NS_IMETHODIMP
nsHTMLScriptElement::GetEvent(nsString& aValue)
nsHTMLScriptElement::GetEvent(nsAWritableString& aValue)
{
// XXX write me
// mInner.GetAttribute(nsHTMLAtoms::charset, aValue);
@ -226,7 +213,7 @@ nsHTMLScriptElement::GetEvent(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLScriptElement::SetEvent(const nsString& aValue)
nsHTMLScriptElement::SetEvent(const nsAReadableString& aValue)
{
// XXX write me
// return mInner.SetAttr(nsHTMLAtoms::charset, aValue);
@ -240,7 +227,7 @@ NS_IMPL_STRING_ATTR(nsHTMLScriptElement, Type, type)
NS_IMETHODIMP
nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
return NS_CONTENT_ATTR_NOT_THERE;
@ -249,7 +236,7 @@ nsHTMLScriptElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLScriptElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}

Просмотреть файл

@ -147,33 +147,10 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLSelectElement
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD GetSelectedIndex(PRInt32* aSelectedIndex);
NS_IMETHOD SetSelectedIndex(PRInt32 aSelectedIndex);
NS_IMETHOD GetValue(nsString& aValue);
NS_IMETHOD SetValue(const nsString& aValue);
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD SetLength(PRUint32 aLength);
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetOptions(nsIDOMNSHTMLOptionCollection** aOptions);
NS_IMETHOD GetDisabled(PRBool* aDisabled);
NS_IMETHOD SetDisabled(PRBool aDisabled);
NS_IMETHOD GetMultiple(PRBool* aMultiple);
NS_IMETHOD SetMultiple(PRBool aMultiple);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetSize(PRInt32* aSize);
NS_IMETHOD SetSize(PRInt32 aSize);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore);
NS_IMETHOD Remove(PRInt32 aIndex);
NS_IMETHOD Blur();
NS_IMETHOD Focus();
NS_DECL_IDOMHTMLSELECTELEMENT
// nsIDOMNSHTMLSelectElement
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn);
NS_DECL_IDOMNSHTMLSELECTELEMENT
// nsIContent
//NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_NO_FOCUS_USING_GENERIC(mInner)
@ -215,7 +192,7 @@ public:
NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const {
return mInner.GetNodeInfo(aResult);
}
NS_IMETHOD ParseAttributeString(const nsString& aStr,
NS_IMETHOD ParseAttributeString(const nsAReadableString& aStr,
nsIAtom*& aName,
PRInt32& aNameSpaceID) {
return mInner.ParseAttributeString(aStr, aName, aNameSpaceID);
@ -225,19 +202,19 @@ public:
return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix);
}
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNameSpaceID, aName, aValue, aNotify);
}
NS_IMETHOD SetAttribute(nsINodeInfo* aNodeInfo,
const nsString& aValue, PRBool aNotify) {
const nsAReadableString& aValue, PRBool aNotify) {
return mInner.SetAttribute(aNodeInfo, aValue, aNotify);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsString& aResult) const {
nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aResult);
}
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom*& aPrefix, nsString& aResult) const {
nsIAtom*& aPrefix, nsAWritableString& aResult) const {
return mInner.GetAttribute(aNameSpaceID, aName, aPrefix, aResult);
}
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
@ -580,7 +557,7 @@ nsHTMLSelectElement::GetOptions(nsIDOMNSHTMLOptionCollection** aValue)
}
NS_IMETHODIMP
nsHTMLSelectElement::GetType(nsString& aType)
nsHTMLSelectElement::GetType(nsAWritableString& aType)
{
PRBool isMultiple;
nsresult result = NS_OK;
@ -588,10 +565,10 @@ nsHTMLSelectElement::GetType(nsString& aType)
result = GetMultiple(&isMultiple);
if (NS_OK == result) {
if (isMultiple) {
aType.AssignWithConversion("select-multiple");
aType.Assign(NS_LITERAL_STRING("select-multiple"));
}
else {
aType.AssignWithConversion("select-one");
aType.Assign(NS_LITERAL_STRING("select-one"));
}
}
@ -854,7 +831,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
//NS_IMPL_STRING_ATTR(nsHTMLSelectElement, Value, value)
NS_IMETHODIMP
nsHTMLSelectElement::GetValue(nsString& aValue)
nsHTMLSelectElement::GetValue(nsAWritableString& aValue)
{
nsresult result = NS_OK;
PRInt32 selectedIndex;
@ -911,7 +888,7 @@ nsHTMLSelectElement::GetValue(nsString& aValue)
}
NS_IMETHODIMP
nsHTMLSelectElement::SetValue(const nsString& aValue)
nsHTMLSelectElement::SetValue(const nsAReadableString& aValue)
{
nsresult result = NS_OK;
nsCOMPtr<nsIDOMNSHTMLOptionCollection> options;
@ -1013,7 +990,7 @@ nsHTMLSelectElement::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
}
NS_IMETHODIMP
nsHTMLSelectElement::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsHTMLSelectElement::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
if (!mOptions) {
Init();
@ -1188,7 +1165,7 @@ nsHTMLSelectElement::DoneAddingContent(PRBool aIsDone)
NS_IMETHODIMP
nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::disabled) {
@ -1215,7 +1192,7 @@ nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLSelectElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
return mInner.AttributeToString(aAttribute, aValue, aResult);
}
@ -1603,7 +1580,7 @@ nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
}
NS_IMETHODIMP
nsHTMLOptionCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
nsHTMLOptionCollection::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
{
if (mDirty && (nsnull != mSelect)) {
GetOptions();

Просмотреть файл

@ -166,7 +166,7 @@ nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument)
NS_IMETHODIMP
nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
@ -184,7 +184,7 @@ nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -161,7 +161,7 @@ nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_IMETHODIMP
nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::size) {
@ -187,7 +187,7 @@ nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {

Просмотреть файл

@ -114,7 +114,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_IMETHODIMP
nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
// XXX write me
@ -124,7 +124,7 @@ nsHTMLSpanElement::StringToAttribute(nsIAtom* aAttribute,
NS_IMETHODIMP
nsHTMLSpanElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsString& aResult) const
nsAWritableString& aResult) const
{
// XXX write me
return mInner.AttributeToString(aAttribute, aValue, aResult);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше