Bug 1467670 - Devirtualize InsertFromDrop. r=masayuki

InsertFromDrop is implemented on TextEditor only, so it can do devirtualize
this method.  Also, this method is only called by drop event handler of
EditorEventListener, so it should rename to better name (OnDrop).

Differential Revision: https://phabricator.services.mozilla.com/D1592
This commit is contained in:
Makoto Kato 2018-06-08 05:19:51 +00:00
Родитель 13f95591c1
Коммит ef31f52f39
4 изменённых файлов: 9 добавлений и 7 удалений

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

@ -660,8 +660,6 @@ public:
*/
void OnFocus(dom::EventTarget* aFocusEventTarget);
virtual nsresult InsertFromDrop(dom::DragEvent* aDropEvent) = 0;
/** Resyncs spellchecking state (enabled/disabled). This should be called
* when anything that affects spellchecking state changes, such as the
* spellcheck attribute value.

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

@ -898,8 +898,8 @@ EditorEventListener::Drop(DragEvent* aDragEvent)
aDragEvent->StopPropagation();
aDragEvent->PreventDefault();
RefPtr<EditorBase> editorBase(mEditorBase);
return editorBase->InsertFromDrop(aDragEvent);
RefPtr<TextEditor> textEditor = mEditorBase->AsTextEditor();
return textEditor->OnDrop(aDragEvent);
}
bool

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

@ -172,6 +172,12 @@ public:
*/
void OnCompositionEnd(WidgetCompositionEvent& aCompositionEndEvent);
/**
* OnDrop() is called from EditorEventListener::Drop that is handler of drop
* event.
*/
nsresult OnDrop(dom::DragEvent* aDropEvent);
protected: // May be called by friends.
/****************************************************************************
* Some classes like TextEditRules, HTMLEditRules, WSRunObject which are
@ -194,8 +200,6 @@ protected: // May be called by friends.
using EditorBase::RemoveAttributeOrEquivalent;
using EditorBase::SetAttributeOrEquivalent;
virtual nsresult InsertFromDrop(dom::DragEvent* aDropEvent) override;
/**
* DeleteSelectionWithTransaction() removes selected content or content
* around caret with transactions.

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

@ -163,7 +163,7 @@ TextEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
}
nsresult
TextEditor::InsertFromDrop(DragEvent* aDropEvent)
TextEditor::OnDrop(DragEvent* aDropEvent)
{
CommitComposition();