mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
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:
parent
8da32ee8b3
commit
db7992dc59
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -551,7 +551,7 @@ HTMLEditRules::AfterEditInner(EditAction aAction,
|
||||
|
||||
nsresult rv =
|
||||
mHTMLEditor->HandleInlineSpellCheck(
|
||||
aAction, selection,
|
||||
aAction, *selection,
|
||||
mRangeItem->mStartContainer,
|
||||
mRangeItem->mStartOffset,
|
||||
rangeStartContainer,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user