Bug 386548. Remove nsTextTransformer. r+sr=mats

This commit is contained in:
roc+@cs.cmu.edu 2007-07-02 16:36:59 -07:00
parent 57eaf3d31b
commit f89a82a7f6
9 changed files with 36 additions and 22 deletions

View File

@ -91,6 +91,7 @@ template<class E> class nsCOMArray;
class nsIPref;
class nsVoidArray;
struct JSRuntime;
class nsICaseConversion;
#ifdef MOZ_XTF
class nsIXTFService;
#endif
@ -511,6 +512,11 @@ public:
{
return sWordBreaker;
}
static nsICaseConversion* GetCaseConv()
{
return sCaseConv;
}
/**
* @return PR_TRUE if aContent has an attribute aName in namespace aNameSpaceID,
@ -1103,6 +1109,7 @@ private:
static nsILineBreaker* sLineBreaker;
static nsIWordBreaker* sWordBreaker;
static nsICaseConversion* sCaseConv;
// Holds pointers to nsISupports* that should be released at shutdown
static nsVoidArray* sPtrsToPtrsToRelease;

View File

@ -138,6 +138,8 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsIKBStateControl.h"
#include "nsIMEStateManager.h"
#include "nsContentErrors.h"
#include "nsUnicharUtilCIID.h"
#include "nsICaseConversion.h"
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
@ -176,6 +178,7 @@ nsIContentPolicy *nsContentUtils::sContentPolicyService;
PRBool nsContentUtils::sTriedToGetContentPolicy = PR_FALSE;
nsILineBreaker *nsContentUtils::sLineBreaker;
nsIWordBreaker *nsContentUtils::sWordBreaker;
nsICaseConversion *nsContentUtils::sCaseConv;
nsVoidArray *nsContentUtils::sPtrsToPtrsToRelease;
nsIJSRuntimeService *nsContentUtils::sJSRuntimeService;
JSRuntime *nsContentUtils::sJSScriptRuntime;
@ -271,6 +274,9 @@ nsContentUtils::Init()
rv = CallGetService(NS_WBRK_CONTRACTID, &sWordBreaker);
NS_ENSURE_SUCCESS(rv, rv);
rv = CallGetService(NS_UNICHARUTIL_CONTRACTID, &sCaseConv);
NS_ENSURE_SUCCESS(rv, rv);
// Ignore failure and just don't load images
rv = CallGetService("@mozilla.org/image/loader;1", &sImgLoader);
@ -667,6 +673,7 @@ nsContentUtils::Shutdown()
NS_IF_RELEASE(sIOService);
NS_IF_RELEASE(sLineBreaker);
NS_IF_RELEASE(sWordBreaker);
NS_IF_RELEASE(sCaseConv);
#ifdef MOZ_XTF
NS_IF_RELEASE(sXTFService);
#endif

View File

@ -73,13 +73,13 @@
#include "nsStackLayout.h"
#include "nsStyleSet.h"
#include "nsTextControlFrame.h"
#include "nsTextTransformer.h"
#include "nsXBLWindowKeyHandler.h"
#include "txMozillaXSLTProcessor.h"
#include "nsDOMStorage.h"
#include "nsCellMap.h"
#include "nsTextFrameTextRunCache.h"
#include "nsCCUncollectableMarker.h"
#include "nsTextFragment.h"
#ifdef MOZ_XUL
#include "nsXULContentUtils.h"
@ -198,11 +198,6 @@ nsLayoutStatics::Initialize()
#ifdef DEBUG
nsFrame::DisplayReflowStartup();
#endif
rv = nsTextTransformer::Initialize();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsTextTransformer");
return rv;
}
nsDOMAttribute::Initialize();
rv = txMozillaXSLTProcessor::Init();
@ -265,7 +260,6 @@ nsLayoutStatics::Shutdown()
#endif
nsCSSFrameConstructor::ReleaseGlobals();
nsTextTransformer::Shutdown();
nsSpaceManager::Shutdown();
nsImageFrame::ReleaseGlobals();

View File

@ -114,7 +114,6 @@ EXPORTS = \
ifdef IBMBIDI
EXPORTS += \
nsTextTransformer.h \
nsBidiFrames.h \
$(NULL)
endif
@ -161,7 +160,6 @@ CPPSRCS = \
nsTextFrameThebes.cpp \
nsTextFrameUtils.cpp \
nsTextRunTransformations.cpp \
nsTextTransformer.cpp \
nsViewportFrame.cpp \
$(NULL)

View File

@ -99,7 +99,6 @@
#include "nsITextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
#include "nsTextTransformer.h"
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
@ -4818,9 +4817,9 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
// Use the hidden preference which is based on operating system behavior.
// This pref only affects whether moving forward by word should go to the end of this word or start of the next word.
// When going backwards, the start of the word is always used, on every operating system.
nsTextTransformer::Initialize();
wordSelectEatSpace = aPos->mDirection == eDirNext && nsTextTransformer::GetWordSelectEatSpaceAfter();
}
wordSelectEatSpace = aPos->mDirection == eDirNext &&
nsContentUtils::GetBoolPref("layout.word_select.eat_space_to_next_word");
}
// sawBeforeType means "we already saw characters of the type
// before the boundary we're looking for". Examples:

View File

@ -76,7 +76,6 @@
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsFrame.h"
#include "nsTextTransformer.h"
#include "nsTextFrameUtils.h"
#include "nsTextRunTransformations.h"
#include "nsFrameManager.h"
@ -751,7 +750,7 @@ static PRBool IsCSSWordSpacingSpace(const nsTextFragment* aFrag, PRUint32 aPos)
{
NS_ASSERTION(aPos < aFrag->GetLength(), "No text for IsSpace!");
PRUnichar ch = aFrag->CharAt(aPos);
if (ch == ' ' || ch == 0x3000/*IDEOGRAPHIC SPACE*/)
if (ch == ' ' || ch == CH_CJKSP)
return !IsSpaceCombiningSequenceTail(aFrag, aPos + 1);
return ch == '\t' || ch == '\n' || ch == '\f';
}
@ -786,7 +785,7 @@ static PRBool IsSelectionSpace(const nsTextFragment* aFrag, PRUint32 aPos)
{
NS_ASSERTION(aPos < aFrag->GetLength(), "No text for IsSpace!");
PRUnichar ch = aFrag->CharAt(aPos);
if (ch == ' ' || ch == 0x00A0/*NBSP*/)
if (ch == ' ' || ch == CH_NBSP)
return !IsSpaceCombiningSequenceTail(aFrag, aPos + 1);
return ch == '\t' || ch == '\n' || ch == '\f';
}
@ -4809,7 +4808,8 @@ nsTextFrame::PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool
if (!cIter.NextCluster())
return PR_FALSE;
PRBool stopAfterPunctuation = nsTextTransformer::GetWordSelectStopAtPunctuation();
PRBool stopAfterPunctuation =
nsContentUtils::GetBoolPref("layout.word_select.stop_at_punctuation");
PRBool stopBeforePunctuation = stopAfterPunctuation && !aIsKeyboardSelect;
do {
if (aWordSelectEatSpace == cIter.IsWhitespace() && !*aSawBeforeType) {

View File

@ -40,9 +40,9 @@
#include "nsContentUtils.h"
#include "nsIWordBreaker.h"
#include "gfxFont.h"
#include "nsTextTransformer.h"
#include "nsCompressedCharMap.h"
#include "nsUnicharUtils.h"
#include "nsBidiUtils.h"
// XXX TODO implement transform of backslash to yen that nsTextTransform does
// when requested by PresContext->LanguageSpecificTransformType(). Do it with
@ -83,7 +83,7 @@ static PRBool IsDiscardable(PRUnichar ch, PRUint32* aFlags)
// Not a Bidi control character
return PR_FALSE;
}
return IS_BIDI_CONTROL(ch);
return IS_BIDI_CONTROL_CHAR(ch);
}
static PRBool IsDiscardable(PRUint8 ch, PRUint32* aFlags)

View File

@ -45,6 +45,15 @@
#define BIG_TEXT_NODE_SIZE 4096
#define CH_NBSP 160
#define CH_SHY 173
#define CH_CJKSP 12288 // U+3000 IDEOGRAPHIC SPACE (CJK Full-Width Space)
#define CH_LRM 8206 //<!ENTITY lrm CDATA "&#8206;" -- left-to-right mark, U+200E NEW RFC 2070 -->
#define CH_RLM 8207 //<!ENTITY rlm CDATA "&#8207;" -- right-to-left mark, U+200F NEW RFC 2070 -->
#define CH_LRE 8234 //<!CDATA "&#8234;" -- left-to-right embedding, U+202A -->
#define CH_RLO 8238 //<!CDATA "&#8238;" -- right-to-left override, U+202E -->
class nsTextFrameUtils {
public:
// These constants are used as textrun flags for textframe textruns.

View File

@ -37,7 +37,6 @@
#include "nsTextRunTransformations.h"
#include "nsTextTransformer.h"
#include "nsTextFrameUtils.h"
#include "gfxSkipChars.h"
@ -45,6 +44,7 @@
#include "nsStyleConsts.h"
#include "nsStyleContext.h"
#include "gfxContext.h"
#include "nsContentUtils.h"
#define SZLIG 0x00DF
@ -327,7 +327,7 @@ void
nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
gfxContext* aRefContext)
{
nsICaseConversion* converter = nsTextTransformer::GetCaseConv();
nsICaseConversion* converter = nsContentUtils::GetCaseConv();
if (!converter)
return;
@ -436,7 +436,7 @@ void
nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
gfxContext* aRefContext)
{
nsICaseConversion* converter = nsTextTransformer::GetCaseConv();
nsICaseConversion* converter = nsContentUtils::GetCaseConv();
if (!converter)
return;