Bug 1708422: part 12) Move some code into `mozInlineSpellChecker::SpellCheckerTimeSlice::ShouldSpellCheckRange`. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D114331
This commit is contained in:
Mirko Brodesser 2021-05-20 09:03:28 +00:00
Родитель 9c30eeb984
Коммит a89ff13783
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -1307,6 +1307,10 @@ class MOZ_STACK_CLASS mozInlineSpellChecker::SpellCheckerTimeSlice {
bool mozInlineSpellChecker::SpellCheckerTimeSlice::ShouldSpellCheckRange(
const nsRange& aRange) const {
if (aRange.Collapsed()) {
return false;
}
nsINode* beginNode = aRange.GetStartContainer();
nsINode* endNode = aRange.GetEndContainer();
@ -1367,7 +1371,8 @@ nsresult mozInlineSpellChecker::SpellCheckerTimeSlice::Execute() {
return NS_ERROR_FAILURE;
}
if (mStatus->mRange->Collapsed()) {
if (!ShouldSpellCheckRange(*mStatus->mRange)) {
// Just bail out and don't try to spell-check this
return NS_OK;
}
@ -1376,11 +1381,6 @@ nsresult mozInlineSpellChecker::SpellCheckerTimeSlice::Execute() {
// when there are no misspelled words yet).
int32_t originalRangeCount = mSpellCheckSelection.RangeCount();
if (!ShouldSpellCheckRange(*mStatus->mRange)) {
// Just bail out and don't try to spell-check this
return NS_OK;
}
// set the starting DOM position to be the beginning of our range
if (nsresult rv = mWordUtil.SetPositionAndEnd(
mStatus->mRange->GetStartContainer(), mStatus->mRange->StartOffset(),