Eliminating mCharset mode of prescontex. Bug 253489, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@160548 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu 2004-08-09 21:19:15 +00:00
parent a1559d566d
commit a4b06cfcbf
4 changed files with 20 additions and 18 deletions

View File

@ -730,18 +730,18 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (mLangService) {
doc->AddCharSetObserver(this);
UpdateCharSet(doc->GetDocumentCharacterSet().get());
UpdateCharSet(doc->GetDocumentCharacterSet());
}
}
}
}
void
nsPresContext::UpdateCharSet(const char* aCharSet)
nsPresContext::UpdateCharSet(const nsAFlatCString& aCharSet)
{
if (mLangService) {
NS_IF_RELEASE(mLangGroup);
mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs
mLangGroup = mLangService->LookupCharSet(aCharSet.get()).get(); // addrefs
if (mLangGroup == nsLayoutAtoms::Japanese && mEnableJapaneseTransform) {
mLanguageSpecificTransformType =
@ -762,7 +762,6 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
}
#ifdef IBMBIDI
//ahmed
mCharset=aCharSet;
switch (GET_BIDI_OPTION_TEXTTYPE(mBidi)) {
@ -776,7 +775,7 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
case IBMBIDI_TEXTTYPE_CHARSET:
default:
SetVisualMode(IsVisualCharset(mCharset));
SetVisualMode(IsVisualCharset(aCharSet));
}
#endif // IBMBIDI
}
@ -787,7 +786,7 @@ nsPresContext::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!nsCRT::strcmp(aTopic, "charset")) {
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData).get());
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData));
mDeviceContext->FlushFontCache();
ClearStyleDataAndReflow();
@ -1114,7 +1113,10 @@ nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow)
SetVisualMode(PR_FALSE);
}
else {
SetVisualMode(IsVisualCharset(mCharset) );
nsIDocument* doc = mShell->GetDocument();
if (doc) {
SetVisualMode(IsVisualCharset(doc->GetDocumentCharacterSet()));
}
}
if (mShell && aForceReflow) {
ClearStyleDataAndReflow();

View File

@ -589,7 +589,7 @@ protected:
NS_HIDDEN_(void) GetUserPreferences();
NS_HIDDEN_(void) GetFontPreferences();
NS_HIDDEN_(void) UpdateCharSet(const char* aCharSet);
NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
// IMPORTANT: The ownership implicit in the following member variables
// has been explicitly checked. If you add any members to this class,
@ -615,7 +615,6 @@ protected:
#ifdef IBMBIDI
nsBidiPresUtils* mBidiUtils;
nsCString mCharset; // the charset we are using
#endif
nsCOMPtr<nsITheme> mTheme;

View File

@ -589,7 +589,7 @@ protected:
NS_HIDDEN_(void) GetUserPreferences();
NS_HIDDEN_(void) GetFontPreferences();
NS_HIDDEN_(void) UpdateCharSet(const char* aCharSet);
NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
// IMPORTANT: The ownership implicit in the following member variables
// has been explicitly checked. If you add any members to this class,
@ -615,7 +615,6 @@ protected:
#ifdef IBMBIDI
nsBidiPresUtils* mBidiUtils;
nsCString mCharset; // the charset we are using
#endif
nsCOMPtr<nsITheme> mTheme;

View File

@ -730,18 +730,18 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (mLangService) {
doc->AddCharSetObserver(this);
UpdateCharSet(doc->GetDocumentCharacterSet().get());
UpdateCharSet(doc->GetDocumentCharacterSet());
}
}
}
}
void
nsPresContext::UpdateCharSet(const char* aCharSet)
nsPresContext::UpdateCharSet(const nsAFlatCString& aCharSet)
{
if (mLangService) {
NS_IF_RELEASE(mLangGroup);
mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs
mLangGroup = mLangService->LookupCharSet(aCharSet.get()).get(); // addrefs
if (mLangGroup == nsLayoutAtoms::Japanese && mEnableJapaneseTransform) {
mLanguageSpecificTransformType =
@ -762,7 +762,6 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
}
#ifdef IBMBIDI
//ahmed
mCharset=aCharSet;
switch (GET_BIDI_OPTION_TEXTTYPE(mBidi)) {
@ -776,7 +775,7 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
case IBMBIDI_TEXTTYPE_CHARSET:
default:
SetVisualMode(IsVisualCharset(mCharset));
SetVisualMode(IsVisualCharset(aCharSet));
}
#endif // IBMBIDI
}
@ -787,7 +786,7 @@ nsPresContext::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!nsCRT::strcmp(aTopic, "charset")) {
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData).get());
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData));
mDeviceContext->FlushFontCache();
ClearStyleDataAndReflow();
@ -1114,7 +1113,10 @@ nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow)
SetVisualMode(PR_FALSE);
}
else {
SetVisualMode(IsVisualCharset(mCharset) );
nsIDocument* doc = mShell->GetDocument();
if (doc) {
SetVisualMode(IsVisualCharset(doc->GetDocumentCharacterSet()));
}
}
if (mShell && aForceReflow) {
ClearStyleDataAndReflow();