diff options
Diffstat (limited to 'editor/libeditor/EditorBase.cpp')
-rw-r--r-- | editor/libeditor/EditorBase.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 22452c59d2..e8120d93d9 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -4869,6 +4869,29 @@ nsresult EditorBase::DeleteSelectionWithTransaction( return NS_OK; } +Result<CaretPoint, nsresult> EditorBase::DeleteRangeWithTransaction( + nsIEditor::EDirection aDirectionAndAmount, + nsIEditor::EStripWrappers aStripWrappers, nsRange& aRangeToDelete) { + MOZ_ASSERT(IsEditActionDataAvailable()); + MOZ_ASSERT(!Destroyed()); + MOZ_ASSERT(aStripWrappers == eStrip || aStripWrappers == eNoStrip); + + HowToHandleCollapsedRange howToHandleCollapsedRange = + EditorBase::HowToHandleCollapsedRangeFor(aDirectionAndAmount); + if (MOZ_UNLIKELY(aRangeToDelete.Collapsed() && + howToHandleCollapsedRange == + HowToHandleCollapsedRange::Ignore)) { + return CaretPoint(EditorDOMPoint(aRangeToDelete.StartRef())); + } + + AutoRangeArray rangesToDelete(aRangeToDelete); + Result<CaretPoint, nsresult> result = DeleteRangesWithTransaction( + aDirectionAndAmount, aStripWrappers, rangesToDelete); + NS_WARNING_ASSERTION(result.isOk(), + "EditorBase::DeleteRangesWithTransaction() failed"); + return result; +} + Result<CaretPoint, nsresult> EditorBase::DeleteRangesWithTransaction( nsIEditor::EDirection aDirectionAndAmount, nsIEditor::EStripWrappers aStripWrappers, |