Bug 1708422: part 17) Rename words to normalizedWords in mozInlineSpellChecker::SpellCheckerSlice::Execute. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D115366
This commit is contained in:
Mirko Brodesser 2021-05-20 09:03:30 +00:00
parent b05af40fa3
commit e74f6c42f1

View File

@ -1409,7 +1409,7 @@ nsresult mozInlineSpellChecker::SpellCheckerSlice::Execute() {
int32_t wordsChecked = 0;
PRTime beginTime = PR_Now();
nsTArray<nsString> words;
nsTArray<nsString> normalizedWords;
nsTArray<NodeOffsetRange> checkRanges;
nsAutoString wordText;
NodeOffsetRange wordNodeOffsetRange;
@ -1432,7 +1432,8 @@ nsresult mozInlineSpellChecker::SpellCheckerSlice::Execute() {
sInlineSpellCheckerLog, LogLevel::Verbose,
("%s: we have run out of time, schedule next round.", __FUNCTION__));
CheckWordsAndAddRangesForMisspellings(words, std::move(checkRanges));
CheckWordsAndAddRangesForMisspellings(normalizedWords,
std::move(checkRanges));
// move the range to encompass the stuff that needs checking.
nsresult rv = mStatus->mRange->SetStart(beginNode, beginOffset);
@ -1496,19 +1497,21 @@ nsresult mozInlineSpellChecker::SpellCheckerSlice::Execute() {
// check spelling and add to selection if misspelled
mozInlineSpellWordUtil::NormalizeWord(wordText);
words.AppendElement(wordText);
normalizedWords.AppendElement(wordText);
checkRanges.AppendElement(wordNodeOffsetRange);
wordsChecked++;
if (words.Length() >= requestChunkSize) {
CheckWordsAndAddRangesForMisspellings(words, std::move(checkRanges));
if (normalizedWords.Length() >= requestChunkSize) {
CheckWordsAndAddRangesForMisspellings(normalizedWords,
std::move(checkRanges));
// Set new empty data for spellcheck range in DOM to avoid
// clang-tidy detection.
words.Clear();
normalizedWords.Clear();
checkRanges = nsTArray<NodeOffsetRange>();
}
}
CheckWordsAndAddRangesForMisspellings(words, std::move(checkRanges));
CheckWordsAndAddRangesForMisspellings(normalizedWords,
std::move(checkRanges));
return NS_OK;
}