Fixed dict patch
This commit is contained in:
parent
cd29aef1e3
commit
90c34dbc3a
@ -1,17 +1,7 @@
|
|||||||
# HG changeset patch
|
diff -up mozilla-release/editor/composer/nsEditorSpellCheck.cpp.1097550-dict-fix mozilla-release/editor/composer/nsEditorSpellCheck.cpp
|
||||||
# Parent 2c9781c3e9b5004d6070f62f3b14b517fc692150
|
--- mozilla-release/editor/composer/nsEditorSpellCheck.cpp.1097550-dict-fix 2014-11-26 03:17:14.000000000 +0100
|
||||||
# User Jan Horak <jhorak@redhat.com>
|
+++ mozilla-release/editor/composer/nsEditorSpellCheck.cpp 2014-12-04 16:45:07.192923283 +0100
|
||||||
# Bug 1097550 - convert underscore in dictionary name to dash before calling nsStyleUtil::DashMatchCompare
|
@@ -103,6 +103,23 @@ GetLoadContext(nsIEditor* aEditor)
|
||||||
|
|
||||||
diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSpellCheck.cpp
|
|
||||||
--- a/editor/composer/nsEditorSpellCheck.cpp
|
|
||||||
+++ b/editor/composer/nsEditorSpellCheck.cpp
|
|
||||||
@@ -101,16 +101,33 @@ GetLoadContext(nsIEditor* aEditor)
|
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
|
||||||
NS_ENSURE_TRUE(doc, nullptr);
|
|
||||||
|
|
||||||
nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
|
|
||||||
return loadContext.forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,17 +25,7 @@ diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSp
|
|||||||
* Fetches the dictionary stored in content prefs and maintains state during the
|
* Fetches the dictionary stored in content prefs and maintains state during the
|
||||||
* fetch, which is asynchronous.
|
* fetch, which is asynchronous.
|
||||||
*/
|
*/
|
||||||
class DictionaryFetcher MOZ_FINAL : public nsIContentPrefCallback2
|
@@ -606,8 +623,8 @@ nsEditorSpellCheck::SetCurrentDictionary
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
@@ -598,18 +615,18 @@ nsEditorSpellCheck::SetCurrentDictionary
|
|
||||||
nsDefaultStringComparator comparator;
|
|
||||||
nsAutoString langCode;
|
|
||||||
int32_t dashIdx = aDictionary.FindChar('-');
|
|
||||||
if (dashIdx != -1) {
|
|
||||||
langCode.Assign(Substring(aDictionary, 0, dashIdx));
|
|
||||||
} else {
|
} else {
|
||||||
langCode.Assign(aDictionary);
|
langCode.Assign(aDictionary);
|
||||||
}
|
}
|
||||||
@ -56,17 +36,7 @@ diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSp
|
|||||||
// When user sets dictionary manually, we store this value associated
|
// When user sets dictionary manually, we store this value associated
|
||||||
// with editor url.
|
// with editor url.
|
||||||
StoreCurrentDictionary(mEditor, aDictionary);
|
StoreCurrentDictionary(mEditor, aDictionary);
|
||||||
} else {
|
@@ -763,12 +780,6 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||||
// If user sets a dictionary matching (even partially), lang defined by
|
|
||||||
// document, we consider content pref has been canceled, and we clear it.
|
|
||||||
ClearCurrentDictionary(mEditor);
|
|
||||||
}
|
|
||||||
@@ -745,22 +762,16 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
|
||||||
|
|
||||||
// Then, try to use language computed from element
|
|
||||||
if (!mPreferredLang.IsEmpty()) {
|
|
||||||
dictName.Assign(mPreferredLang);
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise, get language from preferences
|
// otherwise, get language from preferences
|
||||||
nsAutoString preferedDict(Preferences::GetLocalizedString("spellchecker.dictionary"));
|
nsAutoString preferedDict(Preferences::GetLocalizedString("spellchecker.dictionary"));
|
||||||
@ -79,17 +49,7 @@ diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSp
|
|||||||
if (dictName.IsEmpty()) {
|
if (dictName.IsEmpty()) {
|
||||||
dictName.Assign(preferedDict);
|
dictName.Assign(preferedDict);
|
||||||
}
|
}
|
||||||
|
@@ -807,8 +818,8 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||||
nsresult rv = NS_OK;
|
|
||||||
if (dictName.IsEmpty()) {
|
|
||||||
// Prefs didn't give us a dictionary name, so just get the current
|
|
||||||
// locale and use that as the default dictionary name!
|
|
||||||
@@ -789,18 +800,18 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
|
||||||
} else {
|
|
||||||
langCode.Assign(dictName);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDefaultStringComparator comparator;
|
|
||||||
|
|
||||||
// try dictionary.spellchecker preference if it starts with langCode (and
|
// try dictionary.spellchecker preference if it starts with langCode (and
|
||||||
// if we haven't tried it already)
|
// if we haven't tried it already)
|
||||||
@ -100,17 +60,7 @@ diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSp
|
|||||||
rv = SetCurrentDictionary(preferedDict);
|
rv = SetCurrentDictionary(preferedDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, try langCode (if we haven't tried it already)
|
@@ -836,8 +847,7 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
if (!dictName.Equals(langCode) && !preferedDict.Equals(langCode)) {
|
|
||||||
rv = SetCurrentDictionary(langCode);
|
|
||||||
}
|
|
||||||
@@ -818,18 +829,17 @@ nsEditorSpellCheck::DictionaryFetched(Di
|
|
||||||
nsAutoString dictStr(dictList.ElementAt(i));
|
|
||||||
|
|
||||||
if (dictStr.Equals(dictName) ||
|
|
||||||
dictStr.Equals(preferedDict) ||
|
|
||||||
dictStr.Equals(langCode)) {
|
|
||||||
// We have already tried it
|
// We have already tried it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -120,8 +70,3 @@ diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSp
|
|||||||
NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
|
NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user