Bug 1925889 - Get rid of GetPersonalDictionary and GetPersonalDictionaryWord from nsIEdiorSpellCheck. r=masayuki

No one uses GetPersonalDictionary and GetPersonalDictionaryWord in m-c and c-c.
Let's get rid of both.

Differential Revision: https://phabricator.services.mozilla.com/D226583
This commit is contained in:
Makoto Kato 2024-10-28 07:43:30 +00:00
parent 015c2e805d
commit 11017535d8
5 changed files with 0 additions and 70 deletions

View File

@ -80,22 +80,6 @@ interface nsIEditorSpellCheck : nsISupports
*/
void IgnoreWordAllOccurrences(in AString word);
/**
* Fills an internal list of words added to the personal dictionary. These
* words can be retrieved using GetPersonalDictionaryWord()
*
* @see mozSpellChecker::GetPersonalDictionary
* @see GetPersonalDictionaryWord
*/
void GetPersonalDictionary();
/**
* Used after you call GetPersonalDictionary() to iterate through all the
* words added to the personal dictionary. Will return the empty string when
* there are no more words.
*/
AString GetPersonalDictionaryWord();
/**
* Adds a word to the current personal dictionary.
*

View File

@ -298,7 +298,6 @@ NS_IMPL_CYCLE_COLLECTION(EditorSpellCheck, mEditor, mSpellChecker)
EditorSpellCheck::EditorSpellCheck()
: mTxtSrvFilterType(0),
mSuggestedWordIndex(0),
mDictionaryIndex(0),
mDictionaryFetcherGroup(0),
mUpdateDictionaryRunning(false) {}
@ -533,30 +532,6 @@ EditorSpellCheck::IgnoreWordAllOccurrences(const nsAString& aWord) {
return mSpellChecker->IgnoreAll(aWord);
}
NS_IMETHODIMP
EditorSpellCheck::GetPersonalDictionary() {
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
// We can spell check with any editor type
mDictionaryList.Clear();
mDictionaryIndex = 0;
return mSpellChecker->GetPersonalDictionary(&mDictionaryList);
}
NS_IMETHODIMP
EditorSpellCheck::GetPersonalDictionaryWord(nsAString& aDictionaryWord) {
// XXX This is buggy if mDictionaryList.Length() is over INT32_MAX.
if (mDictionaryIndex < static_cast<int32_t>(mDictionaryList.Length())) {
aDictionaryWord = mDictionaryList[mDictionaryIndex];
mDictionaryIndex++;
} else {
// A blank string signals that there are no more strings
aDictionaryWord.Truncate();
}
return NS_OK;
}
NS_IMETHODIMP
EditorSpellCheck::AddWordToDictionary(const nsAString& aWord) {
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
@ -706,8 +681,6 @@ EditorSpellCheck::UninitSpellChecker() {
// Cleanup - kill the spell checker
DeleteSuggestedWordList();
mDictionaryList.Clear();
mDictionaryIndex = 0;
mDictionaryFetcherGroup++;
mSpellChecker = nullptr;
return NS_OK;

View File

@ -64,15 +64,10 @@ class EditorSpellCheck final : public nsIEditorSpellCheck {
nsTArray<nsString> mSuggestedWordList;
// these are the words in the current personal dictionary,
// GetPersonalDictionary must be called to load them.
nsTArray<nsString> mDictionaryList;
nsTArray<nsCString> mPreferredLangs;
uint32_t mTxtSrvFilterType;
int32_t mSuggestedWordIndex;
int32_t mDictionaryIndex;
uint32_t mDictionaryFetcherGroup;
bool mUpdateDictionaryRunning;

View File

@ -345,21 +345,6 @@ nsresult mozSpellChecker::RemoveWordFromPersonalDictionary(
return res;
}
nsresult mozSpellChecker::GetPersonalDictionary(nsTArray<nsString>* aWordList) {
if (!aWordList || !mPersonalDictionary) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIStringEnumerator> words;
mPersonalDictionary->GetWordList(getter_AddRefs(words));
bool hasMore;
nsAutoString word;
while (NS_SUCCEEDED(words->HasMore(&hasMore)) && hasMore) {
words->GetNext(word);
aWordList->AppendElement(word);
}
return NS_OK;
}
nsresult mozSpellChecker::GetDictionaryList(
nsTArray<nsCString>* aDictionaryList) {
MOZ_ASSERT(aDictionaryList->IsEmpty());

View File

@ -112,13 +112,6 @@ class mozSpellChecker final {
*/
nsresult RemoveWordFromPersonalDictionary(const nsAString& aWord);
/**
* Returns the list of words in the user's personal dictionary.
* @param aWordList is an array of nsStrings that represent the
* list of words in the user's personal dictionary.
*/
nsresult GetPersonalDictionary(nsTArray<nsString>* aWordList);
/**
* Returns the list of strings representing the dictionaries
* the spellchecker supports. It was suggested that the strings