From 5af84ee6ee5090fff0c82d45b8ac740363104d37 Mon Sep 17 00:00:00 2001 From: Mirko Brodesser Date: Tue, 20 Apr 2021 07:49:12 +0000 Subject: [PATCH] Bug 1700051: part 32) Move `InvalidateWords` to `SoftText`. r=smaug It's clearer. Differential Revision: https://phabricator.services.mozilla.com/D112549 --- extensions/spellcheck/src/mozInlineSpellWordUtil.cpp | 4 ++-- extensions/spellcheck/src/mozInlineSpellWordUtil.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp index cc867297d70d..db3af85ddb65 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp @@ -232,7 +232,7 @@ nsresult mozInlineSpellWordUtil::SetPositionAndEnd(nsINode* aPositionNode, } } - InvalidateWords(); + mSoftText.Invalidate(); if (!IsSpellCheckingTextNode(aPositionNode)) { // Start at the start of the first text node after aNode/aOffset. @@ -301,7 +301,7 @@ nsresult mozInlineSpellWordUtil::GetRangeForWord(nsINode* aWordNode, NodeOffset pt(aWordNode, aWordOffset); if (!mSoftText.mIsValid || pt != mSoftText.mBegin || pt != mSoftText.mEnd) { - InvalidateWords(); + mSoftText.Invalidate(); mSoftText.mBegin = mSoftText.mEnd = pt; nsresult rv = EnsureWords(); if (NS_FAILED(rv)) { diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.h b/extensions/spellcheck/src/mozInlineSpellWordUtil.h index 89301648ae3c..0282d1cc747f 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.h +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.h @@ -135,6 +135,8 @@ class MOZ_STACK_CLASS mozInlineSpellWordUtil { }; struct SoftText { + void Invalidate() { mIsValid = false; } + // DOM text covering the soft range, with newlines added at block boundaries nsString mValue; @@ -186,7 +188,6 @@ class MOZ_STACK_CLASS mozInlineSpellWordUtil { RealWords mRealWords; int32_t mNextWordIndex; - void InvalidateWords() { mSoftText.mIsValid = false; } nsresult EnsureWords(); int32_t MapDOMPositionToSoftTextOffset(NodeOffset aNodeOffset) const; -- 2.11.4.GIT