зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1716746 - Rename `EditorBase::IsPlaintextEditor()` to `IsInPlaintextMode()` r=m_kato
Developers may be confused at `IsTextEditor()` and `IsPlaintextEditor()`. When the latter is `true`, the former is always `true`, but it may be `true` when the editor is `HTMLEditor` too. So, it's a mode of `HTMLEditor`. Differential Revision: https://phabricator.services.mozilla.com/D118246
This commit is contained in:
Родитель
fb069248c0
Коммит
698fd90470
|
@ -386,7 +386,7 @@ nsresult EditorBase::InitEditorContentAndSelection() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlaintextEditor() && !IsSingleLineEditor()) {
|
if (IsInPlaintextMode() && !IsSingleLineEditor()) {
|
||||||
nsresult rv = EnsurePaddingBRElementInMultilineEditor();
|
nsresult rv = EnsurePaddingBRElementInMultilineEditor();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING(
|
NS_WARNING(
|
||||||
|
@ -580,7 +580,7 @@ bool EditorBase::GetDesiredSpellCheckState() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPlaintextEditor()) {
|
if (!IsInPlaintextMode()) {
|
||||||
// Some of the page content might be editable and some not, if spellcheck=
|
// Some of the page content might be editable and some not, if spellcheck=
|
||||||
// is explicitly set anywhere, so if there's anything editable on the page,
|
// is explicitly set anywhere, so if there's anything editable on the page,
|
||||||
// return true and let the spellchecker figure it out.
|
// return true and let the spellchecker figure it out.
|
||||||
|
@ -674,6 +674,10 @@ NS_IMETHODIMP EditorBase::SetFlags(uint32_t aFlags) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're a `TextEditor` instance, the plaintext mode should always be set.
|
||||||
|
// If we're an `HTMLEditor` instance, either is fine.
|
||||||
|
MOZ_ASSERT_IF(IsTextEditor(), !!(aFlags & nsIEditor::eEditorPlaintextMask));
|
||||||
|
|
||||||
DebugOnly<bool> changingPasswordEditorFlagDynamically =
|
DebugOnly<bool> changingPasswordEditorFlagDynamically =
|
||||||
mFlags != ~aFlags && ((mFlags ^ aFlags) & nsIEditor::eEditorPasswordMask);
|
mFlags != ~aFlags && ((mFlags ^ aFlags) & nsIEditor::eEditorPasswordMask);
|
||||||
MOZ_ASSERT(
|
MOZ_ASSERT(
|
||||||
|
@ -2871,7 +2875,7 @@ EditorRawDOMPoint EditorBase::FindBetterInsertionPoint(
|
||||||
return aPoint;
|
return aPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPlaintextEditor()) {
|
if (!IsInPlaintextMode()) {
|
||||||
// We cannot find "better" insertion point in HTML editor.
|
// We cannot find "better" insertion point in HTML editor.
|
||||||
// WARNING: When you add some code to find better node in HTML editor,
|
// WARNING: When you add some code to find better node in HTML editor,
|
||||||
// you need to call this before calling InsertTextWithTransaction()
|
// you need to call this before calling InsertTextWithTransaction()
|
||||||
|
@ -3304,7 +3308,6 @@ nsresult EditorBase::SetTextNodeWithoutTransaction(const nsAString& aString,
|
||||||
Text& aTextNode) {
|
Text& aTextNode) {
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
MOZ_ASSERT(IsTextEditor());
|
MOZ_ASSERT(IsTextEditor());
|
||||||
MOZ_ASSERT(IsPlaintextEditor());
|
|
||||||
MOZ_ASSERT(!IsUndoRedoEnabled());
|
MOZ_ASSERT(!IsUndoRedoEnabled());
|
||||||
|
|
||||||
const uint32_t length = aTextNode.Length();
|
const uint32_t length = aTextNode.Length();
|
||||||
|
@ -3538,7 +3541,7 @@ nsresult EditorBase::GetEndChildNode(const Selection& aSelection,
|
||||||
|
|
||||||
nsresult EditorBase::EnsurePaddingBRElementInMultilineEditor() {
|
nsresult EditorBase::EnsurePaddingBRElementInMultilineEditor() {
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
MOZ_ASSERT(IsPlaintextEditor());
|
MOZ_ASSERT(IsInPlaintextMode());
|
||||||
MOZ_ASSERT(!IsSingleLineEditor());
|
MOZ_ASSERT(!IsSingleLineEditor());
|
||||||
|
|
||||||
Element* anonymousDivOrBodyElement = GetRoot();
|
Element* anonymousDivOrBodyElement = GetRoot();
|
||||||
|
@ -4662,7 +4665,7 @@ nsresult EditorBase::HandleDropEvent(DragEvent* aDropEvent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
for (nsIContent* content = droppedAt.GetContainerAsContent(); content;
|
for (nsIContent* content = droppedAt.GetContainerAsContent(); content;
|
||||||
content = content->GetParent()) {
|
content = content->GetParent()) {
|
||||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(content));
|
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(content));
|
||||||
|
@ -5239,7 +5242,7 @@ nsresult EditorBase::HandleKeyPressEvent(WidgetKeyboardEvent* aKeyboardEvent) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
case NS_VK_TAB: {
|
case NS_VK_TAB: {
|
||||||
MOZ_ASSERT_IF(IsHTMLEditor(), IsPlaintextEditor());
|
MOZ_ASSERT_IF(IsHTMLEditor(), IsInPlaintextMode());
|
||||||
if (IsTabbable()) {
|
if (IsTabbable()) {
|
||||||
return NS_OK; // let it be used for focus switching
|
return NS_OK; // let it be used for focus switching
|
||||||
}
|
}
|
||||||
|
@ -6115,7 +6118,7 @@ NS_IMETHODIMP EditorBase::SetWrapWidth(int32_t aWrapColumn) {
|
||||||
|
|
||||||
// Make sure we're a plaintext editor, otherwise we shouldn't
|
// Make sure we're a plaintext editor, otherwise we shouldn't
|
||||||
// do the rest of this.
|
// do the rest of this.
|
||||||
if (!IsPlaintextEditor()) {
|
if (!IsInPlaintextMode()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -550,8 +550,11 @@ class EditorBase : public nsIEditor,
|
||||||
return SetFlags(kNewFlags); // virtual call and may be expensive.
|
return SetFlags(kNewFlags); // virtual call and may be expensive.
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPlaintextEditor() const {
|
bool IsInPlaintextMode() const {
|
||||||
return (mFlags & nsIEditor::eEditorPlaintextMask) != 0;
|
const bool isPlaintextMode =
|
||||||
|
(mFlags & nsIEditor::eEditorPlaintextMask) != 0;
|
||||||
|
MOZ_ASSERT_IF(IsTextEditor(), isPlaintextMode);
|
||||||
|
return isPlaintextMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSingleLineEditor() const {
|
bool IsSingleLineEditor() const {
|
||||||
|
|
|
@ -572,7 +572,7 @@ nsresult EditorEventListener::KeyUp(const WidgetKeyboardEvent* aKeyboardEvent) {
|
||||||
RefPtr<EditorBase> editorBase(mEditorBase);
|
RefPtr<EditorBase> editorBase(mEditorBase);
|
||||||
if ((aKeyboardEvent->mKeyCode == NS_VK_SHIFT ||
|
if ((aKeyboardEvent->mKeyCode == NS_VK_SHIFT ||
|
||||||
aKeyboardEvent->mKeyCode == NS_VK_CONTROL) &&
|
aKeyboardEvent->mKeyCode == NS_VK_CONTROL) &&
|
||||||
mShouldSwitchTextDirection && editorBase->IsPlaintextEditor()) {
|
mShouldSwitchTextDirection && editorBase->IsInPlaintextMode()) {
|
||||||
editorBase->SwitchTextDirectionTo(mSwitchToRTL
|
editorBase->SwitchTextDirectionTo(mSwitchToRTL
|
||||||
? EditorBase::TextDirection::eRTL
|
? EditorBase::TextDirection::eRTL
|
||||||
: EditorBase::TextDirection::eLTR);
|
: EditorBase::TextDirection::eLTR);
|
||||||
|
@ -974,7 +974,7 @@ bool EditorEventListener::DragEventHasSupportingData(
|
||||||
return dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kTextMime)) ||
|
return dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kTextMime)) ||
|
||||||
dataTransfer->HasType(
|
dataTransfer->HasType(
|
||||||
NS_LITERAL_STRING_FROM_CSTRING(kMozTextInternal)) ||
|
NS_LITERAL_STRING_FROM_CSTRING(kMozTextInternal)) ||
|
||||||
(!mEditorBase->IsPlaintextEditor() &&
|
(!mEditorBase->IsInPlaintextMode() &&
|
||||||
(dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kHTMLMime)) ||
|
(dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kHTMLMime)) ||
|
||||||
dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kFileMime))));
|
dataTransfer->HasType(NS_LITERAL_STRING_FROM_CSTRING(kFileMime))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -968,7 +968,7 @@ EditActionResult HTMLEditor::HandleInsertText(
|
||||||
// for efficiency, break out the pre case separately. This is because
|
// for efficiency, break out the pre case separately. This is because
|
||||||
// its a lot cheaper to search the input string for only newlines than
|
// its a lot cheaper to search the input string for only newlines than
|
||||||
// it is to search for both tabs and newlines.
|
// it is to search for both tabs and newlines.
|
||||||
if (isPRE || IsPlaintextEditor()) {
|
if (isPRE || IsInPlaintextMode()) {
|
||||||
while (pos != -1 &&
|
while (pos != -1 &&
|
||||||
pos < static_cast<int32_t>(aInsertionString.Length())) {
|
pos < static_cast<int32_t>(aInsertionString.Length())) {
|
||||||
int32_t oldPos = pos;
|
int32_t oldPos = pos;
|
||||||
|
@ -1478,7 +1478,7 @@ nsresult HTMLEditor::InsertBRElement(const EditorDOMPoint& aPointToBreak) {
|
||||||
|
|
||||||
// First, insert a <br> element.
|
// First, insert a <br> element.
|
||||||
RefPtr<Element> brElement;
|
RefPtr<Element> brElement;
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
Result<RefPtr<Element>, nsresult> resultOfInsertingBRElement =
|
Result<RefPtr<Element>, nsresult> resultOfInsertingBRElement =
|
||||||
InsertBRElementWithTransaction(aPointToBreak);
|
InsertBRElementWithTransaction(aPointToBreak);
|
||||||
if (resultOfInsertingBRElement.isErr()) {
|
if (resultOfInsertingBRElement.isErr()) {
|
||||||
|
@ -7674,7 +7674,7 @@ nsresult HTMLEditor::JoinNearestEditableNodesWithTransaction(
|
||||||
|
|
||||||
Element* HTMLEditor::GetMostAncestorMailCiteElement(nsINode& aNode) const {
|
Element* HTMLEditor::GetMostAncestorMailCiteElement(nsINode& aNode) const {
|
||||||
Element* mailCiteElement = nullptr;
|
Element* mailCiteElement = nullptr;
|
||||||
bool isPlaintextEditor = IsPlaintextEditor();
|
const bool isPlaintextEditor = IsInPlaintextMode();
|
||||||
for (nsINode* node = &aNode; node; node = node->GetParentNode()) {
|
for (nsINode* node = &aNode; node; node = node->GetParentNode()) {
|
||||||
if ((isPlaintextEditor && node->IsHTMLElement(nsGkAtoms::pre)) ||
|
if ((isPlaintextEditor && node->IsHTMLElement(nsGkAtoms::pre)) ||
|
||||||
HTMLEditUtils::IsMailCite(node)) {
|
HTMLEditUtils::IsMailCite(node)) {
|
||||||
|
|
|
@ -276,7 +276,7 @@ nsresult HTMLEditor::Init(Document& aDoc, Element* aRoot,
|
||||||
if (NS_WARN_IF(!document)) {
|
if (NS_WARN_IF(!document)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (!IsPlaintextEditor() && !IsInteractionAllowed()) {
|
if (!IsInPlaintextMode() && !IsInteractionAllowed()) {
|
||||||
mDisabledLinkHandling = true;
|
mDisabledLinkHandling = true;
|
||||||
mOldLinkHandlingEnabled = document->LinkHandlingEnabled();
|
mOldLinkHandlingEnabled = document->LinkHandlingEnabled();
|
||||||
document->SetLinkHandlingEnabled(false);
|
document->SetLinkHandlingEnabled(false);
|
||||||
|
@ -897,7 +897,7 @@ nsresult HTMLEditor::HandleKeyPressEvent(WidgetKeyboardEvent* aKeyboardEvent) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
case NS_VK_TAB: {
|
case NS_VK_TAB: {
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
// If this works as plain text editor, e.g., mail editor for plain
|
// If this works as plain text editor, e.g., mail editor for plain
|
||||||
// text, should be handled with common logic with EditorBase.
|
// text, should be handled with common logic with EditorBase.
|
||||||
nsresult rv = EditorBase::HandleKeyPressEvent(aKeyboardEvent);
|
nsresult rv = EditorBase::HandleKeyPressEvent(aKeyboardEvent);
|
||||||
|
@ -5123,7 +5123,7 @@ nsresult HTMLEditor::SetCSSBackgroundColorWithTransaction(
|
||||||
CommitComposition();
|
CommitComposition();
|
||||||
|
|
||||||
// XXX Shouldn't we do this before calling `CommitComposition()`?
|
// XXX Shouldn't we do this before calling `CommitComposition()`?
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3135,7 +3135,7 @@ class HTMLEditor final : public EditorBase,
|
||||||
/**
|
/**
|
||||||
* InsertAsCitedQuotationInternal() inserts a <blockquote> element whose
|
* InsertAsCitedQuotationInternal() inserts a <blockquote> element whose
|
||||||
* cite attribute is aCitation and whose content is aQuotedText.
|
* cite attribute is aCitation and whose content is aQuotedText.
|
||||||
* Note that this shouldn't be called when IsPlaintextEditor() is true.
|
* Note that this shouldn't be called when IsInPlaintextMode() is true.
|
||||||
*
|
*
|
||||||
* @param aQuotedText HTML source if aInsertHTML is true. Otherwise,
|
* @param aQuotedText HTML source if aInsertHTML is true. Otherwise,
|
||||||
* plain text. This is inserted into new <blockquote>
|
* plain text. This is inserted into new <blockquote>
|
||||||
|
|
|
@ -1167,7 +1167,7 @@ void HTMLEditor::HTMLTransferablePreparer::AddDataFlavorsInBestOrder(
|
||||||
// Create the desired DataFlavor for the type of data
|
// Create the desired DataFlavor for the type of data
|
||||||
// we want to get out of the transferable
|
// we want to get out of the transferable
|
||||||
// This should only happen in html editors, not plaintext
|
// This should only happen in html editors, not plaintext
|
||||||
if (!mHTMLEditor.IsPlaintextEditor()) {
|
if (!mHTMLEditor.IsInPlaintextMode()) {
|
||||||
DebugOnly<nsresult> rvIgnored =
|
DebugOnly<nsresult> rvIgnored =
|
||||||
aTransferable.AddDataFlavor(kNativeHTMLMime);
|
aTransferable.AddDataFlavor(kNativeHTMLMime);
|
||||||
NS_WARNING_ASSERTION(
|
NS_WARNING_ASSERTION(
|
||||||
|
@ -1902,7 +1902,7 @@ nsresult HTMLEditor::InsertFromDataTransfer(const DataTransfer* aDataTransfer,
|
||||||
bool hasPrivateHTMLFlavor =
|
bool hasPrivateHTMLFlavor =
|
||||||
types->Contains(NS_LITERAL_STRING_FROM_CSTRING(kHTMLContext));
|
types->Contains(NS_LITERAL_STRING_FROM_CSTRING(kHTMLContext));
|
||||||
|
|
||||||
bool isPlaintextEditor = IsPlaintextEditor();
|
bool isPlaintextEditor = IsInPlaintextMode();
|
||||||
bool isSafe = IsSafeToInsertData(aSourceDoc);
|
bool isSafe = IsSafeToInsertData(aSourceDoc);
|
||||||
|
|
||||||
uint32_t length = types->Length();
|
uint32_t length = types->Length();
|
||||||
|
@ -2322,7 +2322,7 @@ bool HTMLEditor::CanPaste(int32_t aClipboardType) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the flavors depending on the current editor mask
|
// Use the flavors depending on the current editor mask
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
AutoTArray<nsCString, ArrayLength(textEditorFlavors)> flavors;
|
AutoTArray<nsCString, ArrayLength(textEditorFlavors)> flavors;
|
||||||
flavors.AppendElements<const char*>(Span<const char*>(textEditorFlavors));
|
flavors.AppendElements<const char*>(Span<const char*>(textEditorFlavors));
|
||||||
bool haveFlavors;
|
bool haveFlavors;
|
||||||
|
@ -2358,7 +2358,7 @@ bool HTMLEditor::CanPasteTransferable(nsITransferable* aTransferable) {
|
||||||
// Use the flavors depending on the current editor mask
|
// Use the flavors depending on the current editor mask
|
||||||
const char** flavors;
|
const char** flavors;
|
||||||
size_t length;
|
size_t length;
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
flavors = textEditorFlavors;
|
flavors = textEditorFlavors;
|
||||||
length = ArrayLength(textEditorFlavors);
|
length = ArrayLength(textEditorFlavors);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2412,7 +2412,7 @@ nsresult HTMLEditor::PasteAsQuotationAsAction(int32_t aClipboardType,
|
||||||
return EditorBase::ToGenericNSResult(rv);
|
return EditorBase::ToGenericNSResult(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
nsresult rv = PasteAsPlaintextQuotation(aClipboardType);
|
nsresult rv = PasteAsPlaintextQuotation(aClipboardType);
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
|
||||||
"HTMLEditor::PasteAsPlaintextQuotation() failed");
|
"HTMLEditor::PasteAsPlaintextQuotation() failed");
|
||||||
|
@ -2772,7 +2772,7 @@ nsresult HTMLEditor::InsertTextWithQuotationsInternal(
|
||||||
|
|
||||||
nsresult HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
nsresult HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||||
nsINode** aNodeInserted) {
|
nsINode** aNodeInserted) {
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
AutoEditActionDataSetter editActionData(*this, EditAction::eInsertText);
|
AutoEditActionDataSetter editActionData(*this, EditAction::eInsertText);
|
||||||
MOZ_ASSERT(!aQuotedText.IsVoid());
|
MOZ_ASSERT(!aQuotedText.IsVoid());
|
||||||
editActionData.SetData(aQuotedText);
|
editActionData.SetData(aQuotedText);
|
||||||
|
@ -3035,7 +3035,7 @@ NS_IMETHODIMP HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
||||||
bool aInsertHTML,
|
bool aInsertHTML,
|
||||||
nsINode** aNodeInserted) {
|
nsINode** aNodeInserted) {
|
||||||
// Don't let anyone insert HTML when we're in plaintext mode.
|
// Don't let anyone insert HTML when we're in plaintext mode.
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
NS_ASSERTION(
|
NS_ASSERTION(
|
||||||
!aInsertHTML,
|
!aInsertHTML,
|
||||||
"InsertAsCitedQuotation: trying to insert html into plaintext editor");
|
"InsertAsCitedQuotation: trying to insert html into plaintext editor");
|
||||||
|
@ -3081,7 +3081,7 @@ nsresult HTMLEditor::InsertAsCitedQuotationInternal(
|
||||||
const nsAString& aQuotedText, const nsAString& aCitation, bool aInsertHTML,
|
const nsAString& aQuotedText, const nsAString& aCitation, bool aInsertHTML,
|
||||||
nsINode** aNodeInserted) {
|
nsINode** aNodeInserted) {
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
MOZ_ASSERT(!IsPlaintextEditor());
|
MOZ_ASSERT(!IsInPlaintextMode());
|
||||||
|
|
||||||
if (IsReadonly()) {
|
if (IsReadonly()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -2908,7 +2908,7 @@ HTMLEditor::AutoDeleteRangesHandler::ComputeRangesToDeleteNonCollapsedRanges(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aHTMLEditor.IsPlaintextEditor()) {
|
if (!aHTMLEditor.IsInPlaintextMode()) {
|
||||||
EditorDOMRange firstRange(aRangesToDelete.FirstRangeRef());
|
EditorDOMRange firstRange(aRangesToDelete.FirstRangeRef());
|
||||||
EditorDOMRange extendedRange =
|
EditorDOMRange extendedRange =
|
||||||
WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
|
WSRunScanner::GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries(
|
||||||
|
@ -3001,7 +3001,7 @@ HTMLEditor::AutoDeleteRangesHandler::HandleDeleteNonCollapsedRanges(
|
||||||
|
|
||||||
// Figure out if the endpoints are in nodes that can be merged. Adjust
|
// Figure out if the endpoints are in nodes that can be merged. Adjust
|
||||||
// surrounding white-space in preparation to delete selection.
|
// surrounding white-space in preparation to delete selection.
|
||||||
if (!aHTMLEditor.IsPlaintextEditor()) {
|
if (!aHTMLEditor.IsInPlaintextMode()) {
|
||||||
AutoTransactionsConserveSelection dontChangeMySelection(aHTMLEditor);
|
AutoTransactionsConserveSelection dontChangeMySelection(aHTMLEditor);
|
||||||
AutoTrackDOMRange firstRangeTracker(aHTMLEditor.RangeUpdaterRef(),
|
AutoTrackDOMRange firstRangeTracker(aHTMLEditor.RangeUpdaterRef(),
|
||||||
&aRangesToDelete.FirstRangeRef());
|
&aRangesToDelete.FirstRangeRef());
|
||||||
|
|
|
@ -216,7 +216,7 @@ nsresult HTMLEditor::SetInlinePropertyInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX Shouldn't we return before calling `CommitComposition()`?
|
// XXX Shouldn't we return before calling `CommitComposition()`?
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1898,7 +1898,7 @@ nsresult HTMLEditor::RemoveInlinePropertyInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX Shouldn't we quit before calling `CommitComposition()`?
|
// XXX Shouldn't we quit before calling `CommitComposition()`?
|
||||||
if (IsPlaintextEditor()) {
|
if (IsInPlaintextMode()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ nsresult TextEditor::SetTextAsSubAction(const nsAString& aString) {
|
||||||
!ignoredError.Failed(),
|
!ignoredError.Failed(),
|
||||||
"TextEditor::OnStartToHandleTopLevelEditSubAction() failed, but ignored");
|
"TextEditor::OnStartToHandleTopLevelEditSubAction() failed, but ignored");
|
||||||
|
|
||||||
if (IsPlaintextEditor() && !IsIMEComposing() && !IsUndoRedoEnabled() &&
|
if (!IsIMEComposing() && !IsUndoRedoEnabled() &&
|
||||||
GetEditAction() != EditAction::eReplaceText && mMaxTextLength < 0) {
|
GetEditAction() != EditAction::eReplaceText && mMaxTextLength < 0) {
|
||||||
EditActionResult result = SetTextWithoutTransaction(aString);
|
EditActionResult result = SetTextWithoutTransaction(aString);
|
||||||
if (result.Failed() || result.Canceled() || result.Handled()) {
|
if (result.Failed() || result.Canceled() || result.Handled()) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче