Bug 1457431 - Devirtualize mozInlineSpellChecker::SpellCheckAfterEditorChange. r=masayuki

It is unnecessary to keep virtual method for
mozInlineSpellChecker::SpellCheckAfterEditorChange, so we should remove virtual
keyword.

MozReview-Commit-ID: 2ry5uhMTFVC

--HG--
extra : rebase_source : ba86bb7c4e47598f83e3869733a238a740cef6b2
This commit is contained in:
Makoto Kato 2018-04-27 21:11:31 +09:00
parent 8da32ee8b3
commit db7992dc59
7 changed files with 26 additions and 34 deletions

View File

@ -4633,7 +4633,7 @@ EditorBase::HandleKeyPressEvent(WidgetKeyboardEvent* aKeyboardEvent)
nsresult
EditorBase::HandleInlineSpellCheck(EditAction action,
Selection* aSelection,
Selection& aSelection,
nsINode* previousSelectedNode,
uint32_t previousSelectedOffset,
nsINode* aStartContainer,
@ -4641,13 +4641,14 @@ EditorBase::HandleInlineSpellCheck(EditAction action,
nsINode* aEndContainer,
uint32_t aEndOffset)
{
// Have to cast action here because this method is from an IDL
return mInlineSpellChecker ? mInlineSpellChecker->SpellCheckAfterEditorChange(
(int32_t)action, aSelection,
previousSelectedNode, previousSelectedOffset,
aStartContainer, aStartOffset, aEndContainer,
aEndOffset)
: NS_OK;
if (!mInlineSpellChecker) {
return NS_OK;
}
return mInlineSpellChecker->SpellCheckAfterEditorChange(
action, aSelection,
previousSelectedNode, previousSelectedOffset,
aStartContainer, aStartOffset, aEndContainer,
aEndOffset);
}
already_AddRefed<nsIContent>

View File

@ -1518,7 +1518,7 @@ public:
virtual nsresult HandleKeyPressEvent(WidgetKeyboardEvent* aKeyboardEvent);
nsresult HandleInlineSpellCheck(EditAction action,
Selection* aSelection,
Selection& aSelection,
nsINode* previousSelectedNode,
uint32_t previousSelectedOffset,
nsINode* aStartContainer,

View File

@ -551,7 +551,7 @@ HTMLEditRules::AfterEditInner(EditAction aAction,
nsresult rv =
mHTMLEditor->HandleInlineSpellCheck(
aAction, selection,
aAction, *selection,
mRangeItem->mStartContainer,
mRangeItem->mStartOffset,
rangeStartContainer,

View File

@ -238,7 +238,7 @@ TextEditRules::AfterEdit(EditAction aAction,
NS_ENSURE_STATE(mTextEditor);
nsresult rv =
mTextEditor->HandleInlineSpellCheck(aAction, selection,
mTextEditor->HandleInlineSpellCheck(aAction, *selection,
mCachedSelectionNode,
mCachedSelectionOffset,
nullptr, 0, nullptr, 0);

View File

@ -10,11 +10,6 @@ interface nsISelection;
interface nsIEditor;
interface nsIEditorSpellCheck;
%{ C++
class nsINode;
%}
[ptr] native nsINodePtr(nsINode);
[scriptable, uuid(b7b7a77c-40c4-4196-b0b7-b0338243b3fe)]
interface nsIInlineSpellChecker : nsISupports
{
@ -25,16 +20,6 @@ interface nsIInlineSpellChecker : nsISupports
attribute boolean enableRealTimeSpell;
[noscript] void spellCheckAfterEditorChange(
in long aAction,
in nsISelection aSelection,
in nsINodePtr aPreviousSelectedNode,
in unsigned long aPreviousSelectedOffset,
in nsINodePtr aStartNode,
in unsigned long aStartOffset,
in nsINodePtr aEndNode,
in unsigned long aEndOffset);
void spellCheckRange(in nsIDOMRange aSelection);
nsIDOMRange getMisspelledWord(in nsIDOMNode aNode, in long aOffset);

View File

@ -861,15 +861,14 @@ mozInlineSpellChecker::NotifyObservers(const char* aTopic,
// because you want the range (for example, pasting). We ignore them in
// this case.
NS_IMETHODIMP
nsresult
mozInlineSpellChecker::SpellCheckAfterEditorChange(
int32_t aAction, nsISelection *aSelection,
EditAction aAction, Selection& aSelection,
nsINode *aPreviousSelectedNode, uint32_t aPreviousSelectedOffset,
nsINode *aStartNode, uint32_t aStartOffset,
nsINode *aEndNode, uint32_t aEndOffset)
{
nsresult rv;
NS_ENSURE_ARG_POINTER(aSelection);
if (!mSpellCheck)
return NS_OK; // disabling spell checking is not an error
@ -877,13 +876,11 @@ mozInlineSpellChecker::SpellCheckAfterEditorChange(
// therefore, we should spellcheck for subsequent caret navigations
mNeedsCheckAfterNavigation = true;
RefPtr<Selection> selection = aSelection->AsSelection();
// the anchor node is the position of the caret
auto status = MakeUnique<mozInlineSpellStatus>(this);
rv = status->InitForEditorChange((EditAction)aAction,
selection->GetAnchorNode(),
selection->AnchorOffset(),
rv = status->InitForEditorChange(aAction,
aSelection.GetAnchorNode(),
aSelection.AnchorOffset(),
aPreviousSelectedNode,
aPreviousSelectedOffset,
aStartNode, aStartOffset,

View File

@ -257,6 +257,15 @@ public:
void DidSplitNode(nsINode* aExistingRightNode, nsINode* aNewLeftNode);
void DidJoinNodes(nsINode& aRightNode, nsINode& aLeftNode);
nsresult SpellCheckAfterEditorChange(mozilla::EditAction aAction,
mozilla::dom::Selection& aSelection,
nsINode* aPreviousSelectedNode,
uint32_t aPreviousSelectedOffset,
nsINode* aStartNode,
uint32_t aStartOffset,
nsINode* aEndNode,
uint32_t aEndOffset);
protected:
virtual ~mozInlineSpellChecker();