Bug 1469759 - Part 1. Use mozEnglishWordUtils directly. r?masayuki
mozISpellI18NManager is only used to get mozISpellI18NUtil. And
mozISpellI18NUtil is only implemented on mozEnglishWordUtils. So we should
create an instance of mozEnglishWordUtils instead of using mozISpellI18NManager.
MozReview-Commit-ID: FmCuMAMmH9C
--- a/extensions/spellcheck/src/mozInlineSpellChecker.h
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.h
@@ -11,17 +11,16 @@
#include "nsIEditorSpellCheck.h"
#include "nsIInlineSpellChecker.h"
#include "nsRange.h"
#include "nsWeakReference.h"
class InitEditorSpellCheckCallback;
class mozInlineSpellWordUtil;
class mozInlineSpellChecker;
-class mozISpellI18NUtil;
class mozInlineSpellResume;
class UpdateCurrentDictionaryCallback;
namespace mozilla {
class EditorSpellCheck;
class TextEditor;
enum class EditSubAction : int32_t;
@@ -130,17 +129,16 @@ private:
enum SpellCheckingState { SpellCheck_Uninitialized = -1,
SpellCheck_NotAvailable = 0,
SpellCheck_Available = 1};
static SpellCheckingState gCanEnableSpellChecking;
RefPtr<mozilla::TextEditor> mTextEditor;
RefPtr<mozilla::EditorSpellCheck> mSpellCheck;
RefPtr<mozilla::EditorSpellCheck> mPendingSpellCheck;
- nsCOMPtr<mozISpellI18NUtil> mConverter;
int32_t mNumWordsInSpellSelection;
int32_t mMaxNumWordsInSpellSelection;
// How many misspellings we can add at once. This is often less than the max
// total number of misspellings. When you have a large textarea prepopulated
// with text with many misspellings, we can hit this limit. By making it
// lower than the total number of misspelled words, new text typed by the
--- a/extensions/spellcheck/src/mozSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozSpellChecker.cpp
@@ -1,20 +1,20 @@
/* vim: set ts=2 sts=2 sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozSpellChecker.h"
#include "nsIServiceManager.h"
-#include "mozISpellI18NManager.h"
#include "nsIStringEnumerator.h"
#include "nsICategoryManager.h"
#include "nsISupportsPrimitives.h"
#include "nsISimpleEnumerator.h"
+#include "mozEnglishWordUtils.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/PRemoteSpellcheckEngineChild.h"
#include "mozilla/TextServicesDocument.h"
#include "nsXULAppAPI.h"
#include "RemoteSpellCheckEngineChild.h"
using mozilla::dom::ContentChild;
using mozilla::GenericPromise;
@@ -422,19 +422,18 @@ mozSpellChecker::SetCurrentDictionary(co
mSpellCheckingEngine = spellCheckingEngines[i];
rv = mSpellCheckingEngine->SetDictionary(PromiseFlatString(aDictionary).get());
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<mozIPersonalDictionary> personalDictionary = do_GetService("@mozilla.org/spellchecker/personaldictionary;1");
mSpellCheckingEngine->SetPersonalDictionary(personalDictionary.get());
- nsCOMPtr<mozISpellI18NManager> serv(do_GetService("@mozilla.org/spellchecker/i18nmanager;1", &rv));
- NS_ENSURE_SUCCESS(rv, rv);
- return serv->GetUtil(nullptr, getter_AddRefs(mConverter));
+ mConverter = new mozEnglishWordUtils;
+ return NS_OK;
}
}
mSpellCheckingEngine = nullptr;
// We could not find any engine with the requested dictionary
return NS_ERROR_NOT_AVAILABLE;
}
--- a/extensions/spellcheck/src/mozSpellChecker.h
+++ b/extensions/spellcheck/src/mozSpellChecker.h
@@ -9,19 +9,20 @@
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsISpellChecker.h"
#include "nsString.h"
#include "mozIPersonalDictionary.h"
#include "mozISpellCheckingEngine.h"
#include "nsClassHashtable.h"
#include "nsTArray.h"
-#include "mozISpellI18NUtil.h"
#include "nsCycleCollectionParticipant.h"
+class mozEnglishWordUtils;
+
namespace mozilla {
class RemoteSpellcheckEngineChild;
} // namespace mozilla
class mozSpellChecker : public nsISpellChecker
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -53,17 +54,17 @@ public:
mEngine = nullptr;
}
mozilla::TextServicesDocument* GetTextServicesDocument();
protected:
virtual ~mozSpellChecker();
- nsCOMPtr<mozISpellI18NUtil> mConverter;
+ RefPtr<mozEnglishWordUtils> mConverter;
RefPtr<mozilla::TextServicesDocument> mTextServicesDocument;
nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
nsCOMPtr<mozISpellCheckingEngine> mSpellCheckingEngine;
bool mFromStart;
nsString mCurrentDictionary;