Bug 1503491 - Part 1. Remove CheckCurrentWordNoSuggest. r=masayuki

No one uses CheckCurrentWordNoSuggest. So I would like to get a rid of this
method. And this method is only user of mozSpellChecker::CheckWord. So
mozSpellChecker::CheckWord shouldn't allow that aSuggestions is nullptr on
content process since we already have async API as mozSpellChecker::CheckWords.

Differential Revision: https://phabricator.services.mozilla.com/D19303

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2019-02-10 22:03:53 +00:00
parent 46b802fc11
commit c1917e9616
4 changed files with 7 additions and 28 deletions

View File

@ -139,17 +139,6 @@ interface nsIEditorSpellCheck : nsISupports
*/
void setFilterType(in unsigned long filterType);
/**
* Like CheckCurrentWord, checks the word you give it, returning true if it's
* misspelled. This is faster than CheckCurrentWord because it does not
* compute any suggestions.
*
* Watch out: this does not clear any suggestions left over from previous
* calls to CheckCurrentWord, so there may be suggestions, but they will be
* invalid.
*/
boolean CheckCurrentWordNoSuggest(in AString suggestedWord);
/**
* Update the dictionary in use to be sure it corresponds to what the editor
* needs. The update is asynchronous and is not complete until the given

View File

@ -434,14 +434,6 @@ EditorSpellCheck::CheckCurrentWord(const nsAString& aSuggestedWord,
&mSuggestedWordList);
}
NS_IMETHODIMP
EditorSpellCheck::CheckCurrentWordNoSuggest(const nsAString& aSuggestedWord,
bool* aIsMisspelled) {
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
return mSpellChecker->CheckWord(aSuggestedWord, aIsMisspelled, nullptr);
}
RefPtr<CheckWordPromise> EditorSpellCheck::CheckCurrentWordsNoSuggest(
const nsTArray<nsString>& aSuggestedWords) {
if (NS_WARN_IF(!mSpellChecker)) {

View File

@ -150,15 +150,12 @@ nsresult mozSpellChecker::CheckWord(const nsAString &aWord, bool *aIsMisspelled,
bool correct;
if (XRE_IsContentProcess()) {
nsString wordwrapped = nsString(aWord);
bool rv;
if (aSuggestions) {
rv = mEngine->SendCheckAndSuggest(wordwrapped, aIsMisspelled,
aSuggestions);
} else {
rv = mEngine->SendCheck(wordwrapped, aIsMisspelled);
MOZ_ASSERT(aSuggestions, "Use CheckWords if content process");
if (!mEngine->SendCheckAndSuggest(nsString(aWord), aIsMisspelled,
aSuggestions)) {
return NS_ERROR_NOT_AVAILABLE;
}
return rv ? NS_OK : NS_ERROR_NOT_AVAILABLE;
return NS_OK;
}
if (!mSpellCheckingEngine) {

View File

@ -60,7 +60,8 @@ class mozSpellChecker final {
* @param aIsMisspelled will be set to true if the word is misspelled.
* @param aSuggestions is an array of nsStrings which represent the
* suggested replacements for the misspelled word. The array will be empty
* if there aren't any suggestions.
* in chrome process if there aren't any suggestions. If suggestions is
* unnecessary, use CheckWords of async version.
*/
nsresult CheckWord(const nsAString& aWord, bool* aIsMisspelled,
nsTArray<nsString>* aSuggestions);