fix bug 96530. delay loading of unicharutil dll till we really need it.

r=dp sr=waterson
This commit is contained in:
ftang%netscape.com 2001-10-16 12:38:19 +00:00
Родитель f32e210d7a
Коммит 293ca72ce7
2 изменённых файлов: 34 добавлений и 12 удалений

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

@ -100,6 +100,11 @@ static nsICaseConversion* gCaseConv = nsnull;
nsresult nsresult
nsTextTransformer::Initialize() nsTextTransformer::Initialize()
{
nsresult res = NS_OK;
return res;
}
static nsresult EnsureCaseConv()
{ {
nsresult res = NS_OK; nsresult res = NS_OK;
if (!gCaseConv) { if (!gCaseConv) {
@ -880,7 +885,8 @@ nsTextTransformer::GetNextWord(PRBool aInWord,
if (!isWhitespace) { if (!isWhitespace) {
switch (mTextTransform) { switch (mTextTransform) {
case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE:
gCaseConv->ToTitle(result, result, wordLen, !aInWord); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToTitle(result, result, wordLen, !aInWord);
// if the first character is szlig // if the first character is szlig
if(kSzlig == *result) if(kSzlig == *result)
{ {
@ -900,11 +906,13 @@ nsTextTransformer::GetNextWord(PRBool aInWord,
} }
break; break;
case NS_STYLE_TEXT_TRANSFORM_LOWERCASE: case NS_STYLE_TEXT_TRANSFORM_LOWERCASE:
gCaseConv->ToLower(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToLower(result, result, wordLen);
break; break;
case NS_STYLE_TEXT_TRANSFORM_UPPERCASE: case NS_STYLE_TEXT_TRANSFORM_UPPERCASE:
{ {
gCaseConv->ToUpper(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToUpper(result, result, wordLen);
// first we search for German Szlig // first we search for German Szlig
PRInt32 szligCnt = CountGermanSzlig(result, wordLen); PRInt32 szligCnt = CountGermanSzlig(result, wordLen);
@ -1248,13 +1256,16 @@ nsTextTransformer::GetPrevWord(PRBool aInWord,
if (!isWhitespace) { if (!isWhitespace) {
switch (mTextTransform) { switch (mTextTransform) {
case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE:
gCaseConv->ToTitle(result, result, wordLen, !aInWord); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToTitle(result, result, wordLen, !aInWord);
break; break;
case NS_STYLE_TEXT_TRANSFORM_LOWERCASE: case NS_STYLE_TEXT_TRANSFORM_LOWERCASE:
gCaseConv->ToLower(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToLower(result, result, wordLen);
break; break;
case NS_STYLE_TEXT_TRANSFORM_UPPERCASE: case NS_STYLE_TEXT_TRANSFORM_UPPERCASE:
gCaseConv->ToUpper(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToUpper(result, result, wordLen);
break; break;
} }
} }

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

@ -100,6 +100,11 @@ static nsICaseConversion* gCaseConv = nsnull;
nsresult nsresult
nsTextTransformer::Initialize() nsTextTransformer::Initialize()
{
nsresult res = NS_OK;
return res;
}
static nsresult EnsureCaseConv()
{ {
nsresult res = NS_OK; nsresult res = NS_OK;
if (!gCaseConv) { if (!gCaseConv) {
@ -880,7 +885,8 @@ nsTextTransformer::GetNextWord(PRBool aInWord,
if (!isWhitespace) { if (!isWhitespace) {
switch (mTextTransform) { switch (mTextTransform) {
case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE:
gCaseConv->ToTitle(result, result, wordLen, !aInWord); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToTitle(result, result, wordLen, !aInWord);
// if the first character is szlig // if the first character is szlig
if(kSzlig == *result) if(kSzlig == *result)
{ {
@ -900,11 +906,13 @@ nsTextTransformer::GetNextWord(PRBool aInWord,
} }
break; break;
case NS_STYLE_TEXT_TRANSFORM_LOWERCASE: case NS_STYLE_TEXT_TRANSFORM_LOWERCASE:
gCaseConv->ToLower(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToLower(result, result, wordLen);
break; break;
case NS_STYLE_TEXT_TRANSFORM_UPPERCASE: case NS_STYLE_TEXT_TRANSFORM_UPPERCASE:
{ {
gCaseConv->ToUpper(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToUpper(result, result, wordLen);
// first we search for German Szlig // first we search for German Szlig
PRInt32 szligCnt = CountGermanSzlig(result, wordLen); PRInt32 szligCnt = CountGermanSzlig(result, wordLen);
@ -1248,13 +1256,16 @@ nsTextTransformer::GetPrevWord(PRBool aInWord,
if (!isWhitespace) { if (!isWhitespace) {
switch (mTextTransform) { switch (mTextTransform) {
case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE: case NS_STYLE_TEXT_TRANSFORM_CAPITALIZE:
gCaseConv->ToTitle(result, result, wordLen, !aInWord); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToTitle(result, result, wordLen, !aInWord);
break; break;
case NS_STYLE_TEXT_TRANSFORM_LOWERCASE: case NS_STYLE_TEXT_TRANSFORM_LOWERCASE:
gCaseConv->ToLower(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToLower(result, result, wordLen);
break; break;
case NS_STYLE_TEXT_TRANSFORM_UPPERCASE: case NS_STYLE_TEXT_TRANSFORM_UPPERCASE:
gCaseConv->ToUpper(result, result, wordLen); if(NS_SUCCEEDED(EnsureCaseConv()))
gCaseConv->ToUpper(result, result, wordLen);
break; break;
} }
} }