first part of fix for bug 112209, making nsStr private by switching nsStaticNameTable over to nsAFlatString. r=dbaron, sr=blake

git-svn-id: svn://10.0.0.236/trunk@109022 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2001-11-27 21:13:53 +00:00
parent d4197fdc08
commit bf4d9b0e6e
24 changed files with 119 additions and 108 deletions

View File

@@ -38,8 +38,9 @@
#ifndef nsCSSKeywords_h___
#define nsCSSKeywords_h___
class nsString;
class nsCString;
class nsAString;
class nsACString;
class nsAFlatCString;
/*
Declare the enum list using the magic of preprocessing
@@ -63,11 +64,11 @@ public:
static void ReleaseTable(void);
// Given a keyword string, return the enum value
static nsCSSKeyword LookupKeyword(const nsCString& aKeyword);
static nsCSSKeyword LookupKeyword(const nsString& aKeyword);
static nsCSSKeyword LookupKeyword(const nsACString& aKeyword);
static nsCSSKeyword LookupKeyword(const nsAString& aKeyword);
// Given a keyword enum, get the string value
static const nsCString& GetStringValue(nsCSSKeyword aKeyword);
static const nsAFlatCString& GetStringValue(nsCSSKeyword aKeyword);
};
#endif /* nsCSSKeywords_h___ */

View File

@@ -63,22 +63,22 @@ public:
// Given a property string, return the enum value
static nsCSSProperty LookupProperty(const nsAReadableString& aProperty);
static nsCSSProperty LookupProperty(const nsCString& aProperty);
static nsCSSProperty LookupProperty(const nsACString& aProperty);
// Given a property enum, get the string value
static const nsCString& GetStringValue(nsCSSProperty aProperty);
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the
// value. Return back nullstr if no value is found
static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
// Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID
static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const PRInt32 kHintTable[];

View File

@@ -86,7 +86,7 @@ nsCSSKeywords::ReleaseTable(void)
}
nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsCString& aKeyword)
nsCSSKeywords::LookupKeyword(const nsACString& aKeyword)
{
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) {
@@ -96,7 +96,7 @@ nsCSSKeywords::LookupKeyword(const nsCString& aKeyword)
}
nsCSSKeyword
nsCSSKeywords::LookupKeyword(const nsString& aKeyword)
nsCSSKeywords::LookupKeyword(const nsAString& aKeyword)
{
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) {
@@ -105,14 +105,14 @@ nsCSSKeywords::LookupKeyword(const nsString& aKeyword)
return eCSSKeyword_UNKNOWN;
}
const nsCString&
const nsAFlatCString&
nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword)
{
NS_ASSERTION(gKeywordTable, "no lookup table, needs addref");
if (gKeywordTable) {
return gKeywordTable->GetStringValue(PRInt32(aKeyword));
} else {
static nsCString kNullStr;
static nsDependentCString kNullStr("");
return kNullStr;
}
}

View File

@@ -92,7 +92,7 @@ nsCSSProps::ReleaseTable(void)
}
nsCSSProperty
nsCSSProps::LookupProperty(const nsCString& aProperty)
nsCSSProps::LookupProperty(const nsACString& aProperty)
{
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) {
@@ -107,14 +107,14 @@ nsCSSProps::LookupProperty(const nsAReadableString& aProperty) {
return LookupProperty(theProp);
}
const nsCString&
const nsAFlatCString&
nsCSSProps::GetStringValue(nsCSSProperty aProperty)
{
NS_ASSERTION(gPropertyTable, "no lookup table, needs addref");
if (gPropertyTable) {
return gPropertyTable->GetStringValue(PRInt32(aProperty));
} else {
static nsCString sNullStr;
static nsDependentCString sNullStr("");
return sNullStr;
}
}
@@ -754,19 +754,19 @@ nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[])
return -1;
}
const nsCString&
const nsAFlatCString&
nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[])
{
PRInt32 i = SearchKeywordTableInt(aValue, aTable);
if (i < 0) {
static nsCString sNullStr;
static nsDependentCString sNullStr("");
return sNullStr;
} else {
return nsCSSKeywords::GetStringValue(nsCSSKeyword(i));
}
}
const nsCString&
const nsAFlatCString&
nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue)
{
static const PRInt32 kBackgroundXPositionKTable[] = {
@@ -1128,7 +1128,7 @@ static const PRInt32 kBackgroundYPositionKTable[] = {
NS_ERROR("invalid property");
break;
}
static nsCString sNullStr;
static nsDependentCString sNullStr("");
return sNullStr;
}