mirror of
https://abf.rosa.ru/djam/firefox-esr91.git
synced 2025-02-24 17:42:59 +00:00
fix mozilla 1097550 - System dictionaries with underscore separator are ignored when trying to find dictionary: https://bugzilla.mozilla.org/show_bug.cgi?id=1097550
This commit is contained in:
parent
5562f934f3
commit
902c709a4c
2 changed files with 75 additions and 1 deletions
|
@ -63,7 +63,8 @@ Patch204: rhbz-966424.patch
|
|||
Patch215: firefox-enable-addons.patch
|
||||
Patch217: firefox-baseline-disable.patch
|
||||
# Upstream patches
|
||||
Patch300: mozilla-858919.patch
|
||||
Patch300: mozilla-858919.patch
|
||||
Patch301: mozilla-1097550-dict-fix.patch
|
||||
|
||||
BuildRequires: gtk+2-devel
|
||||
BuildRequires: unzip
|
||||
|
@ -190,6 +191,7 @@ Files and macros mainly for building Firefox extensions.
|
|||
|
||||
# Upstream patches
|
||||
%patch300 -p1 -b .858919
|
||||
%patch301 -p1 -b .1097550-dict-fix
|
||||
|
||||
pushd js/src
|
||||
autoconf-2.13
|
||||
|
|
72
mozilla-1097550-dict-fix.patch
Normal file
72
mozilla-1097550-dict-fix.patch
Normal file
|
@ -0,0 +1,72 @@
|
|||
diff -up mozilla-release/editor/composer/nsEditorSpellCheck.cpp.1097550-dict-fix mozilla-release/editor/composer/nsEditorSpellCheck.cpp
|
||||
--- mozilla-release/editor/composer/nsEditorSpellCheck.cpp.1097550-dict-fix 2014-11-26 03:17:14.000000000 +0100
|
||||
+++ mozilla-release/editor/composer/nsEditorSpellCheck.cpp 2014-12-04 16:45:07.192923283 +0100
|
||||
@@ -103,6 +103,23 @@ GetLoadContext(nsIEditor* aEditor)
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Helper function for converting underscore to dash in dictionary name,
|
||||
+ * ie. en_CA to en-CA. This is required for some Linux distributions which
|
||||
+ * use underscore as separator in system-wide installed dictionaries.
|
||||
+ * We use it for nsStyleUtil::DashMatchCompare.
|
||||
+ */
|
||||
+static nsString
|
||||
+GetDictNameWithDash(const nsAString& aDictName)
|
||||
+{
|
||||
+ nsString dictNameWithDash(aDictName);
|
||||
+ int32_t underScore = dictNameWithDash.FindChar('_');
|
||||
+ if (underScore != -1) {
|
||||
+ dictNameWithDash.Replace(underScore, 1, '-');
|
||||
+ }
|
||||
+ return dictNameWithDash;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* Fetches the dictionary stored in content prefs and maintains state during the
|
||||
* fetch, which is asynchronous.
|
||||
*/
|
||||
@@ -606,8 +623,8 @@ nsEditorSpellCheck::SetCurrentDictionary
|
||||
} else {
|
||||
langCode.Assign(aDictionary);
|
||||
}
|
||||
-
|
||||
- if (mPreferredLang.IsEmpty() || !nsStyleUtil::DashMatchCompare(mPreferredLang, langCode, comparator)) {
|
||||
+ if (mPreferredLang.IsEmpty() ||
|
||||
+ !nsStyleUtil::DashMatchCompare(GetDictNameWithDash(mPreferredLang), langCode, comparator)) {
|
||||
// When user sets dictionary manually, we store this value associated
|
||||
// with editor url.
|
||||
StoreCurrentDictionary(mEditor, aDictionary);
|
||||
@@ -763,12 +780,6 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||
|
||||
// otherwise, get language from preferences
|
||||
nsAutoString preferedDict(Preferences::GetLocalizedString("spellchecker.dictionary"));
|
||||
- // Replace '_' with '-' in case the user has an underscore stored in their
|
||||
- // pref, see bug 992118 for how this could have happened.
|
||||
- int32_t underScore = preferedDict.FindChar('_');
|
||||
- if (underScore != -1) {
|
||||
- preferedDict.Replace(underScore, 1, '-');
|
||||
- }
|
||||
if (dictName.IsEmpty()) {
|
||||
dictName.Assign(preferedDict);
|
||||
}
|
||||
@@ -807,8 +818,8 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||
|
||||
// try dictionary.spellchecker preference if it starts with langCode (and
|
||||
// if we haven't tried it already)
|
||||
- if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
|
||||
- nsStyleUtil::DashMatchCompare(preferedDict, langCode, comparator)) {
|
||||
+ if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
|
||||
+ nsStyleUtil::DashMatchCompare(GetDictNameWithDash(preferedDict), langCode, comparator)) {
|
||||
rv = SetCurrentDictionary(preferedDict);
|
||||
}
|
||||
|
||||
@@ -836,8 +847,7 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||
// We have already tried it
|
||||
continue;
|
||||
}
|
||||
-
|
||||
- if (nsStyleUtil::DashMatchCompare(dictStr, langCode, comparator) &&
|
||||
+ if (nsStyleUtil::DashMatchCompare(GetDictNameWithDash(dictStr), langCode, comparator) &&
|
||||
NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
|
||||
break;
|
||||
}
|
Loading…
Add table
Reference in a new issue