diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /editor/libeditor/EditorBase.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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, |