bug 245770 : add a pref. to control whether or not replace backslashes with Yen signs in Japanese documents (r=smontagu, sr=dbaron)

This commit is contained in:
jshin%mailaps.org 2004-06-21 10:32:27 +00:00
parent 95ba2e84ee
commit bad1f152f4
11 changed files with 40 additions and 35 deletions

View File

@ -207,7 +207,7 @@ LAYOUT_ATOM(onDOMCharacterDataModified, "onDOMCharacterDataModified")
// Alphabetical list of languages for lang-specific transforms // Alphabetical list of languages for lang-specific transforms
LAYOUT_ATOM(Japanese, "ja") LAYOUT_ATOM(Japanese, "ja")
LAYOUT_ATOM(Korean, "ko") LAYOUT_ATOM(Unicode, "x-unicode")
// other // other
LAYOUT_ATOM(wildcard, "*") LAYOUT_ATOM(wildcard, "*")

View File

@ -137,9 +137,6 @@ nsLanguageAtomService::LookupCharSet(const char *aCharSet, nsresult *aError)
return nsnull; return nsnull;
} }
} }
if (!mUnicode) {
mUnicode = do_GetAtom("x-unicode");
}
nsCOMPtr<nsIAtom> langGroup; nsCOMPtr<nsIAtom> langGroup;
mCharSets->GetCharsetLangGroup(aCharSet, getter_AddRefs(langGroup)); mCharSets->GetCharsetLangGroup(aCharSet, getter_AddRefs(langGroup));
@ -149,17 +146,6 @@ nsLanguageAtomService::LookupCharSet(const char *aCharSet, nsresult *aError)
return nsnull; return nsnull;
} }
#if !defined(XP_BEOS)
if (langGroup == mUnicode) {
langGroup = GetLocaleLanguageGroup(&res);
if (NS_FAILED(res)) {
if (aError)
*aError = res;
return nsnull;
}
}
#endif
// transfer reference to raw pointer // transfer reference to raw pointer
nsIAtom *raw = nsnull; nsIAtom *raw = nsnull;

View File

@ -73,5 +73,4 @@ protected:
nsInterfaceHashtable<nsStringHashKey, nsIAtom> mLangs; nsInterfaceHashtable<nsStringHashKey, nsIAtom> mLangs;
nsCOMPtr<nsIStringBundle> mLangGroups; nsCOMPtr<nsIStringBundle> mLangGroups;
nsCOMPtr<nsIAtom> mLocaleLangGroup; nsCOMPtr<nsIAtom> mLocaleLangGroup;
nsCOMPtr<nsIAtom> mUnicode;
}; };

View File

@ -207,7 +207,7 @@ LAYOUT_ATOM(onDOMCharacterDataModified, "onDOMCharacterDataModified")
// Alphabetical list of languages for lang-specific transforms // Alphabetical list of languages for lang-specific transforms
LAYOUT_ATOM(Japanese, "ja") LAYOUT_ATOM(Japanese, "ja")
LAYOUT_ATOM(Korean, "ko") LAYOUT_ATOM(Unicode, "x-unicode")
// other // other
LAYOUT_ATOM(wildcard, "*") LAYOUT_ATOM(wildcard, "*")

View File

@ -521,6 +521,10 @@ nsPresContext::GetUserPreferences()
mUseDocumentFonts = mUseDocumentFonts =
nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0; nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0;
// * replace backslashes with Yen signs? (bug 245770)
mEnableJapaneseTransform =
nsContentUtils::GetBoolPref("layout.enable_japanese_specific_transform");
GetFontPreferences(); GetFontPreferences();
// * image animation // * image animation
@ -726,19 +730,23 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
if (mLangService) { if (mLangService) {
NS_IF_RELEASE(mLangGroup); NS_IF_RELEASE(mLangGroup);
mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs
GetFontPreferences();
if (mLangGroup == nsLayoutAtoms::Japanese) { if (mLangGroup == nsLayoutAtoms::Japanese && mEnableJapaneseTransform) {
mLanguageSpecificTransformType = mLanguageSpecificTransformType =
eLanguageSpecificTransformType_Japanese; eLanguageSpecificTransformType_Japanese;
} }
else if (mLangGroup == nsLayoutAtoms::Korean) {
mLanguageSpecificTransformType =
eLanguageSpecificTransformType_Korean;
}
else { else {
mLanguageSpecificTransformType = mLanguageSpecificTransformType =
eLanguageSpecificTransformType_None; eLanguageSpecificTransformType_None;
} }
// bug 39570: moved from nsLanguageAtomService::LookupCharSet()
#if !defined(XP_BEOS)
if (mLangGroup == nsLayoutAtoms::Unicode) {
NS_RELEASE(mLangGroup);
NS_IF_ADDREF(mLangGroup = mLangService->GetLocaleLanguageGroup());
}
#endif
GetFontPreferences();
} }
#ifdef IBMBIDI #ifdef IBMBIDI
//ahmed //ahmed

View File

@ -93,8 +93,7 @@ enum nsWidgetType {
enum nsLanguageSpecificTransformType { enum nsLanguageSpecificTransformType {
eLanguageSpecificTransformType_Unknown = -1, eLanguageSpecificTransformType_Unknown = -1,
eLanguageSpecificTransformType_None = 0, eLanguageSpecificTransformType_None = 0,
eLanguageSpecificTransformType_Japanese, eLanguageSpecificTransformType_Japanese
eLanguageSpecificTransformType_Korean
}; };
// supported values for cached bool types // supported values for cached bool types

View File

@ -93,8 +93,7 @@ enum nsWidgetType {
enum nsLanguageSpecificTransformType { enum nsLanguageSpecificTransformType {
eLanguageSpecificTransformType_Unknown = -1, eLanguageSpecificTransformType_Unknown = -1,
eLanguageSpecificTransformType_None = 0, eLanguageSpecificTransformType_None = 0,
eLanguageSpecificTransformType_Japanese, eLanguageSpecificTransformType_Japanese
eLanguageSpecificTransformType_Korean
}; };
// supported values for cached bool types // supported values for cached bool types

View File

@ -93,8 +93,7 @@ enum nsWidgetType {
enum nsLanguageSpecificTransformType { enum nsLanguageSpecificTransformType {
eLanguageSpecificTransformType_Unknown = -1, eLanguageSpecificTransformType_Unknown = -1,
eLanguageSpecificTransformType_None = 0, eLanguageSpecificTransformType_None = 0,
eLanguageSpecificTransformType_Japanese, eLanguageSpecificTransformType_Japanese
eLanguageSpecificTransformType_Korean
}; };
// supported values for cached bool types // supported values for cached bool types

View File

@ -521,6 +521,10 @@ nsPresContext::GetUserPreferences()
mUseDocumentFonts = mUseDocumentFonts =
nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0; nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0;
// * replace backslashes with Yen signs? (bug 245770)
mEnableJapaneseTransform =
nsContentUtils::GetBoolPref("layout.enable_japanese_specific_transform");
GetFontPreferences(); GetFontPreferences();
// * image animation // * image animation
@ -726,19 +730,23 @@ nsPresContext::UpdateCharSet(const char* aCharSet)
if (mLangService) { if (mLangService) {
NS_IF_RELEASE(mLangGroup); NS_IF_RELEASE(mLangGroup);
mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs mLangGroup = mLangService->LookupCharSet(aCharSet).get(); // addrefs
GetFontPreferences();
if (mLangGroup == nsLayoutAtoms::Japanese) { if (mLangGroup == nsLayoutAtoms::Japanese && mEnableJapaneseTransform) {
mLanguageSpecificTransformType = mLanguageSpecificTransformType =
eLanguageSpecificTransformType_Japanese; eLanguageSpecificTransformType_Japanese;
} }
else if (mLangGroup == nsLayoutAtoms::Korean) {
mLanguageSpecificTransformType =
eLanguageSpecificTransformType_Korean;
}
else { else {
mLanguageSpecificTransformType = mLanguageSpecificTransformType =
eLanguageSpecificTransformType_None; eLanguageSpecificTransformType_None;
} }
// bug 39570: moved from nsLanguageAtomService::LookupCharSet()
#if !defined(XP_BEOS)
if (mLangGroup == nsLayoutAtoms::Unicode) {
NS_RELEASE(mLangGroup);
NS_IF_ADDREF(mLangGroup = mLangService->GetLocaleLanguageGroup());
}
#endif
GetFontPreferences();
} }
#ifdef IBMBIDI #ifdef IBMBIDI
//ahmed //ahmed

View File

@ -126,6 +126,8 @@ protected:
nsSupportsHashtable mImageLoaders; nsSupportsHashtable mImageLoaders;
PRBool mEnableJapaneseTransform;
#ifdef IBMBIDI #ifdef IBMBIDI
nsBidiPresUtils* mBidiUtils; nsBidiPresUtils* mBidiUtils;
PRUint32 mBidi; PRUint32 mBidi;

View File

@ -768,6 +768,11 @@ pref("bidi.characterset", 1);
pref("layout.word_select.eat_space_to_next_word", false); pref("layout.word_select.eat_space_to_next_word", false);
pref("layout.word_select.stop_at_punctuation", true); pref("layout.word_select.stop_at_punctuation", true);
// pref to control whether or not to replace backslashes with Yen signs
// in documents encoded in one of Japanese legacy encodings (EUC-JP,
// Shift_JIS, ISO-2022-JP)
pref("layout.enable_japanese_specific_transform", false);
// pref to force frames to be resizable // pref to force frames to be resizable
pref("layout.frames.force_resizability", false); pref("layout.frames.force_resizability", false);