From 23d745343cb8968250763519bbfd15aa95cffb48 Mon Sep 17 00:00:00 2001 From: Mirko Brodesser Date: Mon, 26 Apr 2021 07:40:08 +0000 Subject: [PATCH] Bug 1700051: part 41) Const-qualify `mozInlineSpellStatus::mNewNavigationPositionOffset`. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D113099 --- extensions/spellcheck/src/mozInlineSpellChecker.cpp | 19 ++++++++++--------- extensions/spellcheck/src/mozInlineSpellChecker.h | 6 ++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index 5d4d6abb3e10..12baa946456a 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -94,10 +94,12 @@ static const char kMaxSpellCheckSelectionSize[] = static const PRTime kMaxSpellCheckTimeInUsec = INLINESPELL_CHECK_TIMEOUT * PR_USEC_PER_MSEC; -mozInlineSpellStatus::mozInlineSpellStatus(mozInlineSpellChecker* aSpellChecker, - const bool aForceNavigationWordCheck) +mozInlineSpellStatus::mozInlineSpellStatus( + mozInlineSpellChecker* aSpellChecker, const bool aForceNavigationWordCheck, + const int32_t aNewNavigationPositionOffset) : mSpellChecker(aSpellChecker), - mForceNavigationWordCheck(aForceNavigationWordCheck) {} + mForceNavigationWordCheck(aForceNavigationWordCheck), + mNewNavigationPositionOffset(aNewNavigationPositionOffset) {} // mozInlineSpellStatus::CreateForEditorChange // @@ -121,7 +123,7 @@ mozInlineSpellStatus::CreateForEditorChange( UniquePtr status{ /* The constructor is `private`, hence the explicit allocation. */ - new mozInlineSpellStatus{&aSpellChecker, false}}; + new mozInlineSpellStatus{&aSpellChecker, false, 0}}; // save the anchor point as a range so we can find the current word later status->mAnchorRange = @@ -229,12 +231,11 @@ mozInlineSpellStatus::CreateForNavigation( UniquePtr status{ /* The constructor is `private`, hence the explicit allocation. */ - new mozInlineSpellStatus{&aSpellChecker, aForceCheck}}; + new mozInlineSpellStatus{&aSpellChecker, aForceCheck, + aNewPositionOffset}}; status->mOp = eOpNavigation; - status->mNewNavigationPositionOffset = aNewPositionOffset; - // get the root node for checking TextEditor* textEditor = status->mSpellChecker->mTextEditor; if (NS_WARN_IF(!textEditor)) { @@ -278,7 +279,7 @@ UniquePtr mozInlineSpellStatus::CreateForSelection( UniquePtr status{ /* The constructor is `private`, hence the explicit allocation. */ - new mozInlineSpellStatus{&aSpellChecker, false}}; + new mozInlineSpellStatus{&aSpellChecker, false, 0}}; status->mOp = eOpSelection; return status; } @@ -296,7 +297,7 @@ UniquePtr mozInlineSpellStatus::CreateForRange( UniquePtr status{ /* The constructor is `private`, hence the explicit allocation. */ - new mozInlineSpellStatus{&aSpellChecker, false}}; + new mozInlineSpellStatus{&aSpellChecker, false, 0}}; status->mOp = eOpChange; status->mRange = aRange; diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.h b/extensions/spellcheck/src/mozInlineSpellChecker.h index ecd47690f594..b445908acd11 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.h +++ b/extensions/spellcheck/src/mozInlineSpellChecker.h @@ -85,8 +85,10 @@ class mozInlineSpellStatus { private: // @param aSpellChecker must be non-nullptr. // @param aForceNavigationWordCheck see mForceNavigationWordCheck. + // @param aNewNavigationPositionOffset see mNewNavigationPositionOffset. explicit mozInlineSpellStatus(mozInlineSpellChecker* aSpellChecker, - bool aForceNavigationWordCheck); + bool aForceNavigationWordCheck, + int32_t aNewNavigationPositionOffset); // For resuming a previously started check. Operation mOp; @@ -121,7 +123,7 @@ class mozInlineSpellStatus { const bool mForceNavigationWordCheck; // Contains the offset passed in to HandleNavigationEvent - int32_t mNewNavigationPositionOffset; + const int32_t mNewNavigationPositionOffset; nsresult FinishNavigationEvent(mozInlineSpellWordUtil& aWordUtil); -- 2.11.4.GIT