Bug 1540043 - part 1: Move all constants and methods of nsIPlaintextEditor to nsIEditor and make nsIPlaintextEditor inherit nsIEditor r=m_kato

For preparing to remove `nsIPlaintextEditor` interface, this patch moves
all of them to `nsIEditor`, but for avoiding bustage in comm-central, makes
`nsIPlaintextEditor` inherit `nsIEditor` for now (i.e., even with this patch,
script can access old `nsIPlaintextEditor` members with the interface.

In C++ code, this patch moves `SetWrapColumn()`, `InsertTextAsAction()`,
`InsertTextAsSubAction()` and `InsertLineBreakAsSubAction()` because
they do common things between `TextEditor` and `HTMLEditor`.  On the other
hand, this does not move `TextEditor::GetTextLength()` because it's designed
only for `TextEditor`.

Differential Revision: https://phabricator.services.mozilla.com/D60820
This commit is contained in:
Masayuki Nakano
2020-01-24 08:33:42 +00:00
parent dd6ebf07c3
commit 9c324ab59f
30 changed files with 534 additions and 539 deletions

View File

@@ -215,9 +215,9 @@ class MOZ_RAII AutoRestoreEditorState final {
// appearing the method in profile. So, this class should check if it's
// necessary to call.
uint32_t flags = mSavedFlags;
flags &= ~(nsIPlaintextEditor::eEditorDisabledMask);
flags &= ~(nsIPlaintextEditor::eEditorReadonlyMask);
flags |= nsIPlaintextEditor::eEditorDontEchoPassword;
flags &= ~(nsIEditor::eEditorDisabledMask);
flags &= ~(nsIEditor::eEditorReadonlyMask);
flags |= nsIEditor::eEditorDontEchoPassword;
if (mSavedFlags != flags) {
mTextEditor->SetFlags(flags);
}
@@ -1719,20 +1719,20 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
PresShell* presShell = presContext->GetPresShell();
// Setup the editor flags
uint32_t editorFlags = nsIPlaintextEditor::eEditorPlaintextMask;
uint32_t editorFlags = nsIEditor::eEditorPlaintextMask;
if (IsSingleLineTextControl()) {
editorFlags |= nsIPlaintextEditor::eEditorSingleLineMask;
editorFlags |= nsIEditor::eEditorSingleLineMask;
}
if (IsPasswordTextControl()) {
editorFlags |= nsIPlaintextEditor::eEditorPasswordMask;
editorFlags |= nsIEditor::eEditorPasswordMask;
}
// All nsTextControlFrames are widgets
editorFlags |= nsIPlaintextEditor::eEditorWidgetMask;
editorFlags |= nsIEditor::eEditorWidgetMask;
// Spell check is diabled at creation time. It is enabled once
// the editor comes into focus.
editorFlags |= nsIPlaintextEditor::eEditorSkipSpellCheck;
editorFlags |= nsIEditor::eEditorSkipSpellCheck;
bool shouldInitializeEditor = false;
RefPtr<TextEditor> newTextEditor; // the editor that we might create
@@ -1766,7 +1766,7 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
// Don't lose application flags in the process.
if (newTextEditor->IsMailEditor()) {
editorFlags |= nsIPlaintextEditor::eEditorMailMask;
editorFlags |= nsIEditor::eEditorMailMask;
}
}
@@ -1871,13 +1871,13 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
// Check if the readonly attribute is set.
if (mTextCtrlElement->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
editorFlags |= nsIPlaintextEditor::eEditorReadonlyMask;
editorFlags |= nsIEditor::eEditorReadonlyMask;
}
// Check if the disabled attribute is set.
// TODO: call IsDisabled() here!
if (mTextCtrlElement->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
editorFlags |= nsIPlaintextEditor::eEditorDisabledMask;
editorFlags |= nsIEditor::eEditorDisabledMask;
}
// Disable the selection if necessary.