From fc3a408bdbd413abed489f4aaf5659972327f32f Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 17 Jan 2007 02:58:49 +0000 Subject: [PATCH] Bug 333659. Relanding new nsTextTransformer::GetCaseConv, should not affect anything. r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@218487 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsTextTransformer.cpp | 15 +++++++++++---- mozilla/layout/generic/nsTextTransformer.h | 7 +++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index dfbe7096f23..edc03e1ae3b 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -59,7 +59,7 @@ #include "nsLayoutAtoms.h" #endif - +nsICaseConversion* nsTextTransformer::gCaseConv = nsnull; PRBool nsTextTransformer::sWordSelectListenerPrefChecked = PR_FALSE; PRBool nsTextTransformer::sWordSelectEatSpaceAfter = PR_FALSE; PRBool nsTextTransformer::sWordSelectStopAtPunctuation = PR_FALSE; @@ -120,8 +120,6 @@ nsAutoTextBuffer::GrowTo(PRInt32 aNewSize, PRBool aCopyToHead) //---------------------------------------------------------------------- -static nsICaseConversion* gCaseConv = nsnull; - nsresult nsTextTransformer::Initialize() { @@ -142,7 +140,9 @@ nsTextTransformer::Initialize() return NS_OK; } -static nsresult EnsureCaseConv() + +nsresult +nsTextTransformer::EnsureCaseConv() { nsresult res = NS_OK; if (!gCaseConv) { @@ -153,6 +153,13 @@ static nsresult EnsureCaseConv() return res; } +nsICaseConversion* +nsTextTransformer::GetCaseConv() +{ + EnsureCaseConv(); + return gCaseConv; +} + void nsTextTransformer::Shutdown() { diff --git a/mozilla/layout/generic/nsTextTransformer.h b/mozilla/layout/generic/nsTextTransformer.h index 21b4bdd07ac..c3710f5f05b 100644 --- a/mozilla/layout/generic/nsTextTransformer.h +++ b/mozilla/layout/generic/nsTextTransformer.h @@ -56,6 +56,7 @@ class nsIContent; class nsIFrame; class nsILineBreaker; class nsIWordBreaker; +class nsICaseConversion; // XXX I'm sure there are other special characters #define CH_NBSP 160 @@ -345,6 +346,8 @@ public: return sWordSelectStopAtPunctuation; } + static nsICaseConversion* GetCaseConv(); + static nsresult Initialize(); static void Shutdown(); @@ -378,6 +381,8 @@ protected: PRInt32 ScanPreWrapWhiteSpace_B(PRInt32* aWordLen); PRInt32 ScanPreData_B(PRInt32* aWordLen); + static nsresult EnsureCaseConv(); + // Converts the current text in the transform buffer from ascii to // Unicode void ConvertTransformedTextToUnicode(); @@ -429,6 +434,8 @@ protected: static PRBool sWordSelectEatSpaceAfter; // should we include whitespace up to next word? static PRBool sWordSelectStopAtPunctuation; // should we stop at punctuation? + static nsICaseConversion* gCaseConv; + #ifdef DEBUG static void SelfTest(nsPresContext* aPresContext);