bug 73339: Remove NS_ConvertToString (just another name for NS_ConvertASCIItoUCS2) from the tree. r=jst, sr=scc

This commit is contained in:
disttsc%bart.nl 2001-03-27 11:17:17 +00:00
Родитель 353a824cd2
Коммит f4edb65ad4
39 изменённых файлов: 127 добавлений и 177 удалений

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

@ -2899,7 +2899,7 @@ NS_IMETHODIMP nsDocViwerSelectionListener::NotifySelectionChanged(nsIDOMDocument
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(scriptGlobalObject); nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(scriptGlobalObject);
if (!domWindow) return NS_ERROR_FAILURE; if (!domWindow) return NS_ERROR_FAILURE;
domWindow->UpdateCommands(NS_ConvertToString("select")); domWindow->UpdateCommands(NS_LITERAL_STRING("select"));
mGotSelectionState = PR_TRUE; mGotSelectionState = PR_TRUE;
mSelectionWasCollapsed = selectionCollapsed; mSelectionWasCollapsed = selectionCollapsed;
} }

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

@ -52,11 +52,11 @@ static void AddRefTable()
gURIToIDTable = new nsHashtable(); gURIToIDTable = new nsHashtable();
gURIArray = new nsVoidArray(); gURIArray = new nsVoidArray();
nsString* xmlns = new nsString( NS_ConvertToString(kXMLNSNameSpaceURI) ); nsString* xmlns = new nsString( NS_ConvertASCIItoUCS2(kXMLNSNameSpaceURI) );
nsString* xml = new nsString( NS_ConvertToString(kXMLNameSpaceURI) ); nsString* xml = new nsString( NS_ConvertASCIItoUCS2(kXMLNameSpaceURI) );
nsString* xhtml = new nsString( NS_ConvertToString(kXHTMLNameSpaceURI) ); nsString* xhtml = new nsString( NS_ConvertASCIItoUCS2(kXHTMLNameSpaceURI) );
nsString* xlink = new nsString( NS_ConvertToString(kXLinkNameSpaceURI) ); nsString* xlink = new nsString( NS_ConvertASCIItoUCS2(kXLinkNameSpaceURI) );
nsString* html = new nsString( NS_ConvertToString(kHTMLNameSpaceURI) ); nsString* html = new nsString( NS_ConvertASCIItoUCS2(kHTMLNameSpaceURI) );
gURIArray->AppendElement(xmlns); // ordering here needs to match IDs gURIArray->AppendElement(xmlns); // ordering here needs to match IDs
gURIArray->AppendElement(xml); gURIArray->AppendElement(xml);
gURIArray->AppendElement(xhtml); gURIArray->AppendElement(xhtml);

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

@ -135,7 +135,7 @@ ContentScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
result = aScriptContext->GetNameSpaceManager(&manager); result = aScriptContext->GetNameSpaceManager(&manager);
if (NS_OK == result) { if (NS_OK == result) {
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLImageElement"), result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"),
NS_GET_IID(nsIScriptObjectOwner), NS_GET_IID(nsIScriptObjectOwner),
kHTMLImageElementCID, kHTMLImageElementCID,
PR_TRUE); PR_TRUE);
@ -144,7 +144,7 @@ ContentScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
return result; return result;
} }
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLOptionElement"), result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"),
NS_GET_IID(nsIScriptObjectOwner), NS_GET_IID(nsIScriptObjectOwner),
kHTMLOptionElementCID, kHTMLOptionElementCID,
PR_TRUE); PR_TRUE);

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

@ -54,7 +54,7 @@ public:
* a constructor. PR_FALSE if it is a global object. * a constructor. PR_FALSE if it is a global object.
* @result NS_OK if successful * @result NS_OK if successful
*/ */
NS_IMETHOD RegisterGlobalName(const nsString& aName, NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName,
const nsIID& aIID, const nsIID& aIID,
const nsIID& aCID, const nsIID& aCID,
PRBool aIsConstructor) = 0; PRBool aIsConstructor) = 0;
@ -65,7 +65,7 @@ public:
* @param aName the name to remove * @param aName the name to remove
* @result NS_OK if successful * @result NS_OK if successful
*/ */
NS_IMETHOD UnregisterGlobalName(const nsString& aName) = 0; NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName) = 0;
/** /**
* Used to look up the manager using a name as a key. The * Used to look up the manager using a name as a key. The
@ -83,7 +83,7 @@ public:
* @result NS_OK if the lookup succeeded. NS_ERROR_INVALID_ARG * @result NS_OK if the lookup succeeded. NS_ERROR_INVALID_ARG
* if the lookup failed. * if the lookup failed.
*/ */
NS_IMETHOD LookupName(const nsString& aName, NS_IMETHOD LookupName(const nsAReadableString& aName,
PRBool& aIsConstructor, PRBool& aIsConstructor,
nsIID& aIID, nsIID& aIID,
nsIID& aCID) = 0; nsIID& aCID) = 0;

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

@ -22,6 +22,7 @@
#include "nsScriptNameSpaceManager.h" #include "nsScriptNameSpaceManager.h"
#include "prmem.h" #include "prmem.h"
#include "nsReadableUtils.h"
typedef struct { typedef struct {
nsIID mIID; nsIID mIID;
@ -56,12 +57,10 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager()
} }
} }
static NS_DEFINE_IID(kIScriptNameSpaceManagerIID, NS_ISCRIPTNAMESPACEMANAGER_IID); NS_IMPL_ISUPPORTS1(nsScriptNameSpaceManager, nsIScriptNameSpaceManager);
NS_IMPL_ISUPPORTS(nsScriptNameSpaceManager, kIScriptNameSpaceManagerIID);
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, nsScriptNameSpaceManager::RegisterGlobalName(const nsAReadableString& aName,
const nsIID& aIID, const nsIID& aIID,
const nsIID& aCID, const nsIID& aCID,
PRBool aIsConstructor) PRBool aIsConstructor)
@ -71,7 +70,6 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName,
PL_CompareValues, nsnull, nsnull); PL_CompareValues, nsnull, nsnull);
} }
char* name = aName.ToNewCString();
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct);
if (nsnull == gn) { if (nsnull == gn) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -80,16 +78,17 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName,
gn->mCID = aCID; gn->mCID = aCID;
gn->mIsConstructor = aIsConstructor; gn->mIsConstructor = aIsConstructor;
char* name = ToNewCString(aName);
PL_HashTableAdd(mGlobalNames, name, (void *)gn); PL_HashTableAdd(mGlobalNames, name, (void *)gn);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) nsScriptNameSpaceManager::UnregisterGlobalName(const nsAReadableString& aName)
{ {
if (nsnull != mGlobalNames) { if (nsnull != mGlobalNames) {
char* name = aName.ToNewCString(); char* name = ToNewCString(aName);
PLHashNumber hn = PL_HashString(name); PLHashNumber hn = PL_HashString(name);
PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames, PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames,
hn, hn,
@ -98,7 +97,7 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName)
if (nsnull != entry) { if (nsnull != entry) {
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value; nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value;
char* hname = (char*)entry->key;; char* hname = (char*)entry->key;
delete gn; delete gn;
PL_HashTableRemove(mGlobalNames, name); PL_HashTableRemove(mGlobalNames, name);
@ -112,13 +111,13 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::LookupName(const nsString& aName, nsScriptNameSpaceManager::LookupName(const nsAReadableString& aName,
PRBool& aIsConstructor, PRBool& aIsConstructor,
nsIID& aIID, nsIID& aIID,
nsIID& aCID) nsIID& aCID)
{ {
if (nsnull != mGlobalNames) { if (nsnull != mGlobalNames) {
char* name = aName.ToNewCString(); char* name = ToNewCString(aName);
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name);
nsCRT::free(name); nsCRT::free(name);
@ -148,7 +147,6 @@ NS_NewScriptNameSpaceManager(nsIScriptNameSpaceManager** aInstancePtr)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
return manager->QueryInterface(kIScriptNameSpaceManagerIID, (void **)aInstancePtr); return manager->QueryInterface(NS_GET_IID(nsIScriptNameSpaceManager), (void **)aInstancePtr);
} }

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

@ -46,12 +46,12 @@ class nsScriptNameSpaceManager : public nsIScriptNameSpaceManager {
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD RegisterGlobalName(const nsString& aName, NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName,
const nsIID& aIID, const nsIID& aIID,
const nsIID& aCID, const nsIID& aCID,
PRBool aIsConstructor); PRBool aIsConstructor);
NS_IMETHOD UnregisterGlobalName(const nsString& aName); NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName);
NS_IMETHOD LookupName(const nsString& aName, NS_IMETHOD LookupName(const nsAReadableString& aName,
PRBool& aIsConstructor, PRBool& aIsConstructor,
nsIID& aIID, nsIID& aIID,
nsIID& aCID); nsIID& aCID);

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

@ -22,6 +22,7 @@
#include "nsScriptNameSpaceManager.h" #include "nsScriptNameSpaceManager.h"
#include "prmem.h" #include "prmem.h"
#include "nsReadableUtils.h"
typedef struct { typedef struct {
nsIID mIID; nsIID mIID;
@ -56,12 +57,10 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager()
} }
} }
static NS_DEFINE_IID(kIScriptNameSpaceManagerIID, NS_ISCRIPTNAMESPACEMANAGER_IID); NS_IMPL_ISUPPORTS1(nsScriptNameSpaceManager, nsIScriptNameSpaceManager);
NS_IMPL_ISUPPORTS(nsScriptNameSpaceManager, kIScriptNameSpaceManagerIID);
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, nsScriptNameSpaceManager::RegisterGlobalName(const nsAReadableString& aName,
const nsIID& aIID, const nsIID& aIID,
const nsIID& aCID, const nsIID& aCID,
PRBool aIsConstructor) PRBool aIsConstructor)
@ -71,7 +70,6 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName,
PL_CompareValues, nsnull, nsnull); PL_CompareValues, nsnull, nsnull);
} }
char* name = aName.ToNewCString();
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct);
if (nsnull == gn) { if (nsnull == gn) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@ -80,16 +78,17 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName,
gn->mCID = aCID; gn->mCID = aCID;
gn->mIsConstructor = aIsConstructor; gn->mIsConstructor = aIsConstructor;
char* name = ToNewCString(aName);
PL_HashTableAdd(mGlobalNames, name, (void *)gn); PL_HashTableAdd(mGlobalNames, name, (void *)gn);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) nsScriptNameSpaceManager::UnregisterGlobalName(const nsAReadableString& aName)
{ {
if (nsnull != mGlobalNames) { if (nsnull != mGlobalNames) {
char* name = aName.ToNewCString(); char* name = ToNewCString(aName);
PLHashNumber hn = PL_HashString(name); PLHashNumber hn = PL_HashString(name);
PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames, PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames,
hn, hn,
@ -98,7 +97,7 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName)
if (nsnull != entry) { if (nsnull != entry) {
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value; nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value;
char* hname = (char*)entry->key;; char* hname = (char*)entry->key;
delete gn; delete gn;
PL_HashTableRemove(mGlobalNames, name); PL_HashTableRemove(mGlobalNames, name);
@ -112,13 +111,13 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsScriptNameSpaceManager::LookupName(const nsString& aName, nsScriptNameSpaceManager::LookupName(const nsAReadableString& aName,
PRBool& aIsConstructor, PRBool& aIsConstructor,
nsIID& aIID, nsIID& aIID,
nsIID& aCID) nsIID& aCID)
{ {
if (nsnull != mGlobalNames) { if (nsnull != mGlobalNames) {
char* name = aName.ToNewCString(); char* name = ToNewCString(aName);
nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name);
nsCRT::free(name); nsCRT::free(name);
@ -148,7 +147,6 @@ NS_NewScriptNameSpaceManager(nsIScriptNameSpaceManager** aInstancePtr)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
return manager->QueryInterface(kIScriptNameSpaceManagerIID, (void **)aInstancePtr); return manager->QueryInterface(NS_GET_IID(nsIScriptNameSpaceManager), (void **)aInstancePtr);
} }

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

@ -46,12 +46,12 @@ class nsScriptNameSpaceManager : public nsIScriptNameSpaceManager {
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD RegisterGlobalName(const nsString& aName, NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName,
const nsIID& aIID, const nsIID& aIID,
const nsIID& aCID, const nsIID& aCID,
PRBool aIsConstructor); PRBool aIsConstructor);
NS_IMETHOD UnregisterGlobalName(const nsString& aName); NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName);
NS_IMETHOD LookupName(const nsString& aName, NS_IMETHOD LookupName(const nsAReadableString& aName,
PRBool& aIsConstructor, PRBool& aIsConstructor,
nsIID& aIID, nsIID& aIID,
nsIID& aCID); nsIID& aCID);

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

@ -115,11 +115,11 @@ void nsUnicodeMappingUtil::InitGenericFontMapping()
// We probabaly should put the following info into resource .... // We probabaly should put the following info into resource ....
// smRoman // smRoman
mGenericFontMapping[smRoman][kSerif] = new nsAutoString( NS_ConvertToString("Times") ); mGenericFontMapping[smRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times") );
mGenericFontMapping[smRoman][kSansSerif] = new nsAutoString( NS_ConvertToString("Helvetica") ); // note: MRJ use Geneva for Sans-Serif mGenericFontMapping[smRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica") ); // note: MRJ use Geneva for Sans-Serif
mGenericFontMapping[smRoman][kMonospace] = new nsAutoString( NS_ConvertToString("Courier") ); mGenericFontMapping[smRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier") );
mGenericFontMapping[smRoman][kCursive] = new nsAutoString( NS_ConvertToString("Zapf Chancery") ); mGenericFontMapping[smRoman][kCursive] = new nsAutoString( NS_LITERAL_STRING("Zapf Chancery") );
mGenericFontMapping[smRoman][kFantasy] = new nsAutoString( NS_ConvertToString("New Century Schlbk") ); mGenericFontMapping[smRoman][kFantasy] = new nsAutoString( NS_LITERAL_STRING("New Century Schlbk") );
// smJapanese // smJapanese
static PRUnichar jfontname1[] = { static PRUnichar jfontname1[] = {
@ -137,14 +137,14 @@ void nsUnicodeMappingUtil::InitGenericFontMapping()
mGenericFontMapping[smJapanese][kMonospace] = new nsAutoString(jfontname3); mGenericFontMapping[smJapanese][kMonospace] = new nsAutoString(jfontname3);
// smTradChinese // smTradChinese
mGenericFontMapping[smTradChinese][kSerif] = new nsAutoString( NS_ConvertToString("Apple LiSung Light") ); mGenericFontMapping[smTradChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiSung Light") );
mGenericFontMapping[smTradChinese][kSansSerif] = new nsAutoString( NS_ConvertToString("Apple LiGothic Medium") ); mGenericFontMapping[smTradChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") );
mGenericFontMapping[smTradChinese][kMonospace] = new nsAutoString( NS_ConvertToString("Apple LiGothic Medium") ); mGenericFontMapping[smTradChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") );
// smKorean // smKorean
mGenericFontMapping[smKorean][kSerif] = new nsAutoString( NS_ConvertToString("AppleMyungjo") ); mGenericFontMapping[smKorean][kSerif] = new nsAutoString( NS_LITERAL_STRING("AppleMyungjo") );
mGenericFontMapping[smKorean][kSansSerif] = new nsAutoString( NS_ConvertToString("AppleGothic") ); mGenericFontMapping[smKorean][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") );
mGenericFontMapping[smKorean][kMonospace] = new nsAutoString( NS_ConvertToString("AppleGothic") ); mGenericFontMapping[smKorean][kMonospace] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") );
// smArabic // smArabic
static PRUnichar afontname1[] = { static PRUnichar afontname1[] = {
@ -173,40 +173,39 @@ void nsUnicodeMappingUtil::InitGenericFontMapping()
mGenericFontMapping[smHebrew][kMonospace] = new nsAutoString(hfontname2); mGenericFontMapping[smHebrew][kMonospace] = new nsAutoString(hfontname2);
// smCyrillic // smCyrillic
mGenericFontMapping[smCyrillic][kSerif] = new nsAutoString( NS_ConvertToString("Latinski") ); mGenericFontMapping[smCyrillic][kSerif] = new nsAutoString( NS_LITERAL_STRING("Latinski") );
mGenericFontMapping[smCyrillic][kSansSerif] = new nsAutoString( NS_ConvertToString("Pryamoy Prop") ); mGenericFontMapping[smCyrillic][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Pryamoy Prop") );
mGenericFontMapping[smCyrillic][kMonospace] = new nsAutoString( NS_ConvertToString("APC Courier") ); mGenericFontMapping[smCyrillic][kMonospace] = new nsAutoString( NS_LITERAL_STRING("APC Courier") );
// smDevanagari // smDevanagari
mGenericFontMapping[smDevanagari][kSerif] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); mGenericFontMapping[smDevanagari][kSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
mGenericFontMapping[smDevanagari][kSansSerif] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); mGenericFontMapping[smDevanagari][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
mGenericFontMapping[smDevanagari][kMonospace] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); mGenericFontMapping[smDevanagari][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
// smGurmukhi // smGurmukhi
static nsAutoString gurukhiMT_str( NS_ConvertToString("Gurmukhi MT") ); mGenericFontMapping[smGurmukhi][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
mGenericFontMapping[smGurmukhi][kSerif] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") ); mGenericFontMapping[smGurmukhi][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
mGenericFontMapping[smGurmukhi][kSansSerif] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") ); mGenericFontMapping[smGurmukhi][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
mGenericFontMapping[smGurmukhi][kMonospace] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") );
// smGujarati // smGujarati
mGenericFontMapping[smGujarati][kSerif] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); mGenericFontMapping[smGujarati][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
mGenericFontMapping[smGujarati][kSansSerif] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); mGenericFontMapping[smGujarati][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
mGenericFontMapping[smGujarati][kMonospace] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); mGenericFontMapping[smGujarati][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
// smThai // smThai
mGenericFontMapping[smThai][kSerif] = new nsAutoString( NS_ConvertToString("Thonburi") ); mGenericFontMapping[smThai][kSerif] = new nsAutoString( NS_LITERAL_STRING("Thonburi") );
mGenericFontMapping[smThai][kSansSerif] = new nsAutoString( NS_ConvertToString("Krungthep") ); mGenericFontMapping[smThai][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Krungthep") );
mGenericFontMapping[smThai][kMonospace] = new nsAutoString( NS_ConvertToString("Ayuthaya") ); mGenericFontMapping[smThai][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Ayuthaya") );
// smSimpChinese // smSimpChinese
mGenericFontMapping[smSimpChinese][kSerif] = new nsAutoString( NS_ConvertToString("Song") ); mGenericFontMapping[smSimpChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Song") );
mGenericFontMapping[smSimpChinese][kSansSerif] = new nsAutoString( NS_ConvertToString("Hei") ); mGenericFontMapping[smSimpChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Hei") );
mGenericFontMapping[smSimpChinese][kMonospace] = new nsAutoString( NS_ConvertToString("Hei") ); mGenericFontMapping[smSimpChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Hei") );
// smCentralEuroRoman // smCentralEuroRoman
mGenericFontMapping[smCentralEuroRoman][kSerif] = new nsAutoString( NS_ConvertToString("Times CE") ); mGenericFontMapping[smCentralEuroRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times CE") );
mGenericFontMapping[smCentralEuroRoman][kSansSerif] = new nsAutoString( NS_ConvertToString("Helvetica CE") ); mGenericFontMapping[smCentralEuroRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica CE") );
mGenericFontMapping[smCentralEuroRoman][kMonospace] = new nsAutoString( NS_ConvertToString("Courier CE") ); mGenericFontMapping[smCentralEuroRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier CE") );
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

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

@ -494,7 +494,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
} }
} }
//if the content model is empty, then begin by opening <html>... //if the content model is empty, then begin by opening <html>...
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"))); theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
if(theToken) { if(theToken) {
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack. mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack.
} }
@ -547,7 +547,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier. mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier.
CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
result=BuildModel(aParser,mTokenizer,0,aSink); result=BuildModel(aParser,mTokenizer,0,aSink);
} }
@ -788,7 +788,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
//However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.- //However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.-
mMisplacedContent.Push(aToken); mMisplacedContent.Push(aToken);
if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) { if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
result=HandleToken(theBodyToken,aParser); result=HandleToken(theBodyToken,aParser);
} }
return result; return result;

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

@ -317,7 +317,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
if(BufferContainsHTML(aBuffer,theBufHasXML)){ if(BufferContainsHTML(aBuffer,theBufHasXML)){
result = eValidDetect ; result = eValidDetect ;
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType)); aParserContext.SetMimeType(NS_ConvertASCIItoUCS2(kHTMLTextContentType));
if(!theBufHasXML) { if(!theBufHasXML) {
switch(aParserContext.mDTDMode) { switch(aParserContext.mDTDMode) {
case eDTDMode_strict: case eDTDMode_strict:
@ -417,7 +417,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo
if(!mBodyContext->GetCount()) { if(!mBodyContext->GetCount()) {
//if the content model is empty, then begin by opening <html>... //if the content model is empty, then begin by opening <html>...
CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html")); CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html"));
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it. HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
} }
@ -668,7 +668,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo
CObserverService* theService=mParser->GetObserverService(); CObserverService* theService=mParser->GetObserverService();
if(theService) { if(theService) {
const nsISupportsParserBundle* bundle=mParser->GetParserBundle(); const nsISupportsParserBundle* bundle=mParser->GetParserBundle();
result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertToString(kHTMLTextContentType), mParser); result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertASCIItoUCS2(kHTMLTextContentType), mParser);
} }
} }

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

@ -757,7 +757,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){
break; break;
case eRTFCtrl_tab: case eRTFCtrl_tab:
{ {
CTextToken theToken2( NS_ConvertToString(" ") ); CTextToken theToken2( NS_LITERAL_STRING(" ") );
result=HandleContent(&theToken2); result=HandleContent(&theToken2);
} }
break; break;

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

@ -180,7 +180,7 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString&
else { else {
if(-1<aBuffer.Find("<?xml ")) { if(-1<aBuffer.Find("<?xml ")) {
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) ); aParserContext.SetMimeType( NS_ConvertASCIItoUCS2(kXMLTextContentType) );
} }
result=eValidDetect; result=eValidDetect;
} }

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

@ -56,7 +56,7 @@ static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
const int gTabSize=2; const int gTabSize=2;
static const nsString gMozDirty = NS_ConvertToString("_moz_dirty"); static const NS_NAMED_LITERAL_STRING(gMozDirty, "_moz_dirty");
/** /**
* This method gets called as part of our COM-like interfaces. * This method gets called as part of our COM-like interfaces.

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

@ -226,7 +226,7 @@ public:
} }
// Make sure we don't find things that aren't there // Make sure we don't find things that aren't there
value = nsHTMLEntities::EntityToUnicode(NS_ConvertToString("@")); value = nsHTMLEntities::EntityToUnicode(nsCAutoString("@"));
NS_ASSERTION(value == -1, "found @"); NS_ASSERTION(value == -1, "found @");
value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz")); value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz"));
NS_ASSERTION(value == -1, "found zzzzz"); NS_ASSERTION(value == -1, "found zzzzz");

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

@ -527,7 +527,7 @@ PRInt32 CTextToken::GetTextLength(void) {
* @return error result * @return error result
*/ */
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {; nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {;
static nsString theTerminals = NS_ConvertToString("\n\r&<",4); static nsString theTerminals = NS_LITERAL_STRING("\n\r&<");
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
nsReadingIterator<PRUnichar> origin, start, end; nsReadingIterator<PRUnichar> origin, start, end;
@ -897,7 +897,7 @@ PRInt32 CMarkupDeclToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
static nsString theTerminals = NS_ConvertToString("\n\r'\">",5); static nsString theTerminals = NS_LITERAL_STRING("\n\r'\">");
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
PRUnichar quote=0; PRUnichar quote=0;
@ -1521,7 +1521,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
*/ */
static static
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6); static nsString theTerminals = NS_LITERAL_STRING("\b\t\n\r >");
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
//Let's force quotes if either the first or last char is quoted. //Let's force quotes if either the first or last char is quoted.
@ -1570,7 +1570,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
} }
else { else {
//If you're here, handle an unquoted key. //If you're here, handle an unquoted key.
static nsAutoString theTerminals = NS_ConvertToString("\b\t\n\r \"=>",8); static nsAutoString theTerminals = NS_LITERAL_STRING("\b\t\n\r \"=>");
result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE); result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE);
} }
if (!aRetainWhitespace) { if (!aRetainWhitespace) {

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

@ -2121,7 +2121,7 @@ nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
rv = channel->GetContentType(&contentType); rv = channel->GetContentType(&contentType);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
mParserContext->SetMimeType( NS_ConvertToString(contentType) ); mParserContext->SetMimeType( NS_ConvertASCIItoUCS2(contentType) );
nsCRT::free(contentType); nsCRT::free(contentType);
} }
else else

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

@ -516,10 +516,10 @@ NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,nsITokenizer* aToke
nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator();
if(theAllocator) { if(theAllocator) {
#ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_HTML
theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kPreStyle)); theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kPreStyle));
theAttr->SetKey(NS_LITERAL_STRING("style")); theAttr->SetKey(NS_LITERAL_STRING("style"));
#else #else
theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString("http://www.mozilla.org/viewsource")); theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_LITERAL_STRING("http://www.mozilla.org/viewsource"));
theAttr->SetKey(NS_LITERAL_STRING("xmlns")); theAttr->SetKey(NS_LITERAL_STRING("xmlns"));
#endif // VIEW_SOURCE_HTML #endif // VIEW_SOURCE_HTML
} }
@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri
#ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_HTML
nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator();
if(theAllocator) { if(theAllocator) {
CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kElementStyles[aTagType])); CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kElementStyles[aTagType]));
theAttr->SetKey(NS_LITERAL_STRING("style")); theAttr->SetKey(NS_LITERAL_STRING("style"));
theContext.mStartNode.AddAttribute(theAttr); theContext.mStartNode.AddAttribute(theAttr);
} }

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

@ -187,7 +187,7 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri
else { else {
if(-1<aBuffer.Find("<?xml ")) { if(-1<aBuffer.Find("<?xml ")) {
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) ); aParserContext.SetMimeType( NS_ConvertASCIItoUCS2(kXMLTextContentType) );
} }
result=eValidDetect; result=eValidDetect;
} }

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

@ -27,6 +27,7 @@
#include "nsLocale.h" #include "nsLocale.h"
#include "nsLocaleCID.h" #include "nsLocaleCID.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsReadableUtils.h"
#include <ctype.h> #include <ctype.h>
@ -502,7 +503,7 @@ nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILoca
// //
result = NS_ERROR_FAILURE; result = NS_ERROR_FAILURE;
if (countLang>0) { if (countLang>0) {
PRUnichar* localeName = NS_ConvertToString(acceptLanguageList[0]).ToNewUnicode(); PRUnichar* localeName = ToNewUnicode(nsLiteralCString(acceptLanguageList[0]));
result = NewLocale(localeName,_retval); result = NewLocale(localeName,_retval);
delete localeName; delete localeName;
} }

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

@ -2899,7 +2899,7 @@ NS_IMETHODIMP nsDocViwerSelectionListener::NotifySelectionChanged(nsIDOMDocument
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(scriptGlobalObject); nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(scriptGlobalObject);
if (!domWindow) return NS_ERROR_FAILURE; if (!domWindow) return NS_ERROR_FAILURE;
domWindow->UpdateCommands(NS_ConvertToString("select")); domWindow->UpdateCommands(NS_LITERAL_STRING("select"));
mGotSelectionState = PR_TRUE; mGotSelectionState = PR_TRUE;
mSelectionWasCollapsed = selectionCollapsed; mSelectionWasCollapsed = selectionCollapsed;
} }

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

@ -145,7 +145,7 @@ LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
result = aScriptContext->GetNameSpaceManager(&manager); result = aScriptContext->GetNameSpaceManager(&manager);
if (NS_OK == result) { if (NS_OK == result) {
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLImageElement"), result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"),
NS_GET_IID(nsIScriptObjectOwner), NS_GET_IID(nsIScriptObjectOwner),
kHTMLImageElementCID, kHTMLImageElementCID,
PR_TRUE); PR_TRUE);
@ -154,7 +154,7 @@ LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
return result; return result;
} }
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLOptionElement"), result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"),
NS_GET_IID(nsIScriptObjectOwner), NS_GET_IID(nsIScriptObjectOwner),
kHTMLOptionElementCID, kHTMLOptionElementCID,
PR_TRUE); PR_TRUE);

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

@ -414,10 +414,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIContent> content; nsCOMPtr<nsIContent> content;
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align,
NS_ConvertToString("horizontal"), PR_FALSE); NS_LITERAL_STRING("horizontal"), PR_FALSE);
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed,
NS_ConvertToString("true"), PR_FALSE); NS_LITERAL_STRING("true"), PR_FALSE);
aAnonymousChildren.AppendElement(content); aAnonymousChildren.AppendElement(content);
@ -425,10 +425,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
content = nsnull; content = nsnull;
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align,
NS_ConvertToString("vertical"), PR_FALSE); NS_LITERAL_STRING("vertical"), PR_FALSE);
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed,
NS_ConvertToString("true"), PR_FALSE); NS_LITERAL_STRING("true"), PR_FALSE);
aAnonymousChildren.AppendElement(content); aAnonymousChildren.AppendElement(content);
@ -1400,7 +1400,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl
return; return;
if (!aVisible) if (!aVisible)
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_ConvertToString("true"), PR_TRUE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_TRUE);
else else
content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE); content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE);

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

@ -414,10 +414,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsCOMPtr<nsIContent> content; nsCOMPtr<nsIContent> content;
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align,
NS_ConvertToString("horizontal"), PR_FALSE); NS_LITERAL_STRING("horizontal"), PR_FALSE);
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed,
NS_ConvertToString("true"), PR_FALSE); NS_LITERAL_STRING("true"), PR_FALSE);
aAnonymousChildren.AppendElement(content); aAnonymousChildren.AppendElement(content);
@ -425,10 +425,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
content = nsnull; content = nsnull;
elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content));
content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align,
NS_ConvertToString("vertical"), PR_FALSE); NS_LITERAL_STRING("vertical"), PR_FALSE);
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed,
NS_ConvertToString("true"), PR_FALSE); NS_LITERAL_STRING("true"), PR_FALSE);
aAnonymousChildren.AppendElement(content); aAnonymousChildren.AppendElement(content);
@ -1400,7 +1400,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl
return; return;
if (!aVisible) if (!aVisible)
content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_ConvertToString("true"), PR_TRUE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_TRUE);
else else
content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE); content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE);

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

@ -1778,7 +1778,7 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext,
// Set the neccessary style attributes on the text control. // Set the neccessary style attributes on the text control.
if (IsSingleLineTextControl()) if (IsSingleLineTextControl())
rv = divContent->SetAttribute(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertToString(DIV_STRING_SINGLELINE), PR_FALSE); rv = divContent->SetAttribute(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertASCIItoUCS2(DIV_STRING_SINGLELINE), PR_FALSE);
else { else {
nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING); nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING);
const nsStyleDisplay* disp = (const nsStyleDisplay*) const nsStyleDisplay* disp = (const nsStyleDisplay*)
@ -1794,7 +1794,7 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
// rv = divContent->SetAttribute(kNameSpaceID_None,nsXULAtoms::debug, NS_ConvertToString("true"), PR_FALSE); // rv = divContent->SetAttribute(kNameSpaceID_None,nsXULAtoms::debug, NS_LITERAL_STRING("true"), PR_FALSE);
rv = aChildList.AppendElement(divContent); rv = aChildList.AppendElement(divContent);
if (NS_FAILED(rv)) if (NS_FAILED(rv))

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

@ -714,7 +714,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
rv = GetServerURI(getter_Copies(serverUri)); rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage, rv = dialog->PromptPassword(aPromptTitle, aPromptMessage,
NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniPassword), okayValue); getter_Copies(uniPassword), okayValue);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;

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

@ -206,7 +206,7 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
rv = GetServerURI(getter_Copies(serverUri)); rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage, rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage,
NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniPassword), &okayValue); getter_Copies(uniPassword), &okayValue);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -253,7 +253,7 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
rv = GetServerURI(getter_Copies(serverUri)); rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = aDialog->PromptUsernameAndPassword(aPromptTitle, aPromptMessage, rv = aDialog->PromptUsernameAndPassword(aPromptTitle, aPromptMessage,
NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniUsername), getter_Copies(uniPassword), &okayValue); getter_Copies(uniUsername), getter_Copies(uniPassword), &okayValue);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;

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

@ -494,7 +494,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke
} }
} }
//if the content model is empty, then begin by opening <html>... //if the content model is empty, then begin by opening <html>...
theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"))); theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
if(theToken) { if(theToken) {
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack. mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack.
} }
@ -547,7 +547,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse
mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier. mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier.
CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it
result=BuildModel(aParser,mTokenizer,0,aSink); result=BuildModel(aParser,mTokenizer,0,aSink);
} }
@ -788,7 +788,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){
//However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.- //However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.-
mMisplacedContent.Push(aToken); mMisplacedContent.Push(aToken);
if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) { if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) {
CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
result=HandleToken(theBodyToken,aParser); result=HandleToken(theBodyToken,aParser);
} }
return result; return result;

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

@ -317,7 +317,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a
if(BufferContainsHTML(aBuffer,theBufHasXML)){ if(BufferContainsHTML(aBuffer,theBufHasXML)){
result = eValidDetect ; result = eValidDetect ;
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType)); aParserContext.SetMimeType(NS_ConvertASCIItoUCS2(kHTMLTextContentType));
if(!theBufHasXML) { if(!theBufHasXML) {
switch(aParserContext.mDTDMode) { switch(aParserContext.mDTDMode) {
case eDTDMode_strict: case eDTDMode_strict:
@ -417,7 +417,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo
if(!mBodyContext->GetCount()) { if(!mBodyContext->GetCount()) {
//if the content model is empty, then begin by opening <html>... //if the content model is empty, then begin by opening <html>...
CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html")); CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html"));
HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it. HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it.
} }
@ -668,7 +668,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo
CObserverService* theService=mParser->GetObserverService(); CObserverService* theService=mParser->GetObserverService();
if(theService) { if(theService) {
const nsISupportsParserBundle* bundle=mParser->GetParserBundle(); const nsISupportsParserBundle* bundle=mParser->GetParserBundle();
result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertToString(kHTMLTextContentType), mParser); result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertASCIItoUCS2(kHTMLTextContentType), mParser);
} }
} }

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

@ -757,7 +757,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){
break; break;
case eRTFCtrl_tab: case eRTFCtrl_tab:
{ {
CTextToken theToken2( NS_ConvertToString(" ") ); CTextToken theToken2( NS_LITERAL_STRING(" ") );
result=HandleContent(&theToken2); result=HandleContent(&theToken2);
} }
break; break;

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

@ -180,7 +180,7 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString&
else { else {
if(-1<aBuffer.Find("<?xml ")) { if(-1<aBuffer.Find("<?xml ")) {
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) ); aParserContext.SetMimeType( NS_ConvertASCIItoUCS2(kXMLTextContentType) );
} }
result=eValidDetect; result=eValidDetect;
} }

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

@ -56,7 +56,7 @@ static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
const int gTabSize=2; const int gTabSize=2;
static const nsString gMozDirty = NS_ConvertToString("_moz_dirty"); static const NS_NAMED_LITERAL_STRING(gMozDirty, "_moz_dirty");
/** /**
* This method gets called as part of our COM-like interfaces. * This method gets called as part of our COM-like interfaces.

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

@ -226,7 +226,7 @@ public:
} }
// Make sure we don't find things that aren't there // Make sure we don't find things that aren't there
value = nsHTMLEntities::EntityToUnicode(NS_ConvertToString("@")); value = nsHTMLEntities::EntityToUnicode(nsCAutoString("@"));
NS_ASSERTION(value == -1, "found @"); NS_ASSERTION(value == -1, "found @");
value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz")); value = nsHTMLEntities::EntityToUnicode(nsCAutoString("zzzzz"));
NS_ASSERTION(value == -1, "found zzzzz"); NS_ASSERTION(value == -1, "found zzzzz");

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

@ -527,7 +527,7 @@ PRInt32 CTextToken::GetTextLength(void) {
* @return error result * @return error result
*/ */
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {; nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {;
static nsString theTerminals = NS_ConvertToString("\n\r&<",4); static nsString theTerminals = NS_LITERAL_STRING("\n\r&<");
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
nsReadingIterator<PRUnichar> origin, start, end; nsReadingIterator<PRUnichar> origin, start, end;
@ -897,7 +897,7 @@ PRInt32 CMarkupDeclToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) {
static nsString theTerminals = NS_ConvertToString("\n\r'\">",5); static nsString theTerminals = NS_LITERAL_STRING("\n\r'\">");
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
PRUnichar quote=0; PRUnichar quote=0;
@ -1521,7 +1521,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
*/ */
static static
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6); static nsString theTerminals = NS_LITERAL_STRING("\b\t\n\r >");
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
//Let's force quotes if either the first or last char is quoted. //Let's force quotes if either the first or last char is quoted.
@ -1570,7 +1570,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
} }
else { else {
//If you're here, handle an unquoted key. //If you're here, handle an unquoted key.
static nsAutoString theTerminals = NS_ConvertToString("\b\t\n\r \"=>",8); static nsAutoString theTerminals = NS_LITERAL_STRING("\b\t\n\r \"=>");
result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE); result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE);
} }
if (!aRetainWhitespace) { if (!aRetainWhitespace) {

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

@ -2121,7 +2121,7 @@ nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
rv = channel->GetContentType(&contentType); rv = channel->GetContentType(&contentType);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
mParserContext->SetMimeType( NS_ConvertToString(contentType) ); mParserContext->SetMimeType( NS_ConvertASCIItoUCS2(contentType) );
nsCRT::free(contentType); nsCRT::free(contentType);
} }
else else

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

@ -516,10 +516,10 @@ NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,nsITokenizer* aToke
nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator();
if(theAllocator) { if(theAllocator) {
#ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_HTML
theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kPreStyle)); theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kPreStyle));
theAttr->SetKey(NS_LITERAL_STRING("style")); theAttr->SetKey(NS_LITERAL_STRING("style"));
#else #else
theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString("http://www.mozilla.org/viewsource")); theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_LITERAL_STRING("http://www.mozilla.org/viewsource"));
theAttr->SetKey(NS_LITERAL_STRING("xmlns")); theAttr->SetKey(NS_LITERAL_STRING("xmlns"));
#endif // VIEW_SOURCE_HTML #endif // VIEW_SOURCE_HTML
} }
@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri
#ifdef VIEW_SOURCE_HTML #ifdef VIEW_SOURCE_HTML
nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator();
if(theAllocator) { if(theAllocator) {
CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kElementStyles[aTagType])); CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kElementStyles[aTagType]));
theAttr->SetKey(NS_LITERAL_STRING("style")); theAttr->SetKey(NS_LITERAL_STRING("style"));
theContext.mStartNode.AddAttribute(theAttr); theContext.mStartNode.AddAttribute(theAttr);
} }

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

@ -187,7 +187,7 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri
else { else {
if(-1<aBuffer.Find("<?xml ")) { if(-1<aBuffer.Find("<?xml ")) {
if(0==aParserContext.mMimeType.Length()) { if(0==aParserContext.mMimeType.Length()) {
aParserContext.SetMimeType( NS_ConvertToString(kXMLTextContentType) ); aParserContext.SetMimeType( NS_ConvertASCIItoUCS2(kXMLTextContentType) );
} }
result=eValidDetect; result=eValidDetect;
} }

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

@ -599,29 +599,6 @@ class NS_COM NS_ConvertASCIItoUCS2
NS_ConvertASCIItoUCS2( PRUnichar ); NS_ConvertASCIItoUCS2( PRUnichar );
}; };
#define NS_ConvertToString NS_ConvertASCIItoUCS2
#if 0
inline
nsAutoString
NS_ConvertToString( const char* aCString )
{
nsAutoString result;
result.AssignWithConversion(aCString);
return result;
}
inline
nsAutoString
NS_ConvertToString( const char* aCString, PRUint32 aLength )
{
nsAutoString result;
result.AssignWithConversion(aCString, aLength);
return result;
}
#endif
class NS_COM NS_ConvertUTF8toUCS2 class NS_COM NS_ConvertUTF8toUCS2
: public nsAutoString : public nsAutoString
{ {

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

@ -599,29 +599,6 @@ class NS_COM NS_ConvertASCIItoUCS2
NS_ConvertASCIItoUCS2( PRUnichar ); NS_ConvertASCIItoUCS2( PRUnichar );
}; };
#define NS_ConvertToString NS_ConvertASCIItoUCS2
#if 0
inline
nsAutoString
NS_ConvertToString( const char* aCString )
{
nsAutoString result;
result.AssignWithConversion(aCString);
return result;
}
inline
nsAutoString
NS_ConvertToString( const char* aCString, PRUint32 aLength )
{
nsAutoString result;
result.AssignWithConversion(aCString, aLength);
return result;
}
#endif
class NS_COM NS_ConvertUTF8toUCS2 class NS_COM NS_ConvertUTF8toUCS2
: public nsAutoString : public nsAutoString
{ {