Bug 1374207 - part4: Element classes should use TextEditor class instead of nIEditor r=smaug

Unfortunately, nsGenericHTMLElement::GetAssociatedEditor() cannot use concrete classes because it may return nsIEditor which is set via nsIDocShell.editor.  The editor set to nsIDocShell may be implemented by JS since nsIEditor isn't marked as builtinclass.

MozReview-Commit-ID: 6GY9LOYp4hM
This commit is contained in:
Masayuki Nakano
2017-06-22 15:21:31 +09:00
parent a248c7645b
commit 53a0be1b54
13 changed files with 71 additions and 52 deletions

View File

@@ -70,6 +70,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/GenericSpecifiedValuesInlines.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
@@ -2617,6 +2618,12 @@ HTMLInputElement::SetUserInput(const nsAString& aValue)
nsIEditor*
HTMLInputElement::GetEditor()
{
return GetTextEditorFromState();
}
TextEditor*
HTMLInputElement::GetTextEditorFromState()
{
nsTextEditorState* state = GetEditorState();
if (state) {
@@ -2625,10 +2632,10 @@ HTMLInputElement::GetEditor()
return nullptr;
}
NS_IMETHODIMP_(nsIEditor*)
NS_IMETHODIMP_(TextEditor*)
HTMLInputElement::GetTextEditor()
{
return GetEditor();
return GetTextEditorFromState();
}
NS_IMETHODIMP_(nsISelectionController*)