diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index b2acab1fdf9b..b639d0cd9f33 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1340,7 +1340,7 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos) // Set up the selection. for (int32_t idx = domSel->RangeCount() - 1; idx > 0; idx--) - domSel->RemoveRange(domSel->GetRangeAt(idx)); + domSel->RemoveRange(*domSel->GetRangeAt(idx), IgnoreErrors()); SetSelectionBoundsAt(0, aStartPos, aEndPos); // Make sure it is visible @@ -1667,7 +1667,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum, return !err.Failed(); } - domSel->RemoveRange(range); + domSel->RemoveRange(*range, IgnoreErrors()); IgnoredErrorResult err; domSel->AddRange(*range, err); return !err.Failed(); @@ -1683,7 +1683,7 @@ HyperTextAccessible::RemoveFromSelection(int32_t aSelectionNum) if (aSelectionNum < 0 || aSelectionNum >= static_cast(domSel->RangeCount())) return false; - domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum)); + domSel->RemoveRange(*domSel->GetRangeAt(aSelectionNum), IgnoreErrors()); return true; } diff --git a/dom/base/Selection.cpp b/dom/base/Selection.cpp index ec0a6f9d8cfc..a1e2c83f9f28 100644 --- a/dom/base/Selection.cpp +++ b/dom/base/Selection.cpp @@ -2378,18 +2378,6 @@ Selection::AddRangeInternal(nsRange& aRange, nsIDocument* aDocument, // being removed, and cause them to set the selected bits back on their // selected frames after we've cleared the bit from ours. -nsresult -Selection::RemoveRange(nsIDOMRange* aDOMRange) -{ - if (!aDOMRange) { - return NS_ERROR_INVALID_ARG; - } - nsRange* range = static_cast(aDOMRange); - ErrorResult result; - RemoveRange(*range, result); - return result.StealNSResult(); -} - void Selection::RemoveRange(nsRange& aRange, ErrorResult& aRv) { diff --git a/dom/base/nsISelection.idl b/dom/base/nsISelection.idl index 79545ccc69b8..36234f1a5630 100644 --- a/dom/base/nsISelection.idl +++ b/dom/base/nsISelection.idl @@ -113,11 +113,6 @@ interface nsISelection : nsISupports */ void selectAllChildren(in nsIDOMNode parentNode); - /** - * Removes a range from the current selection. - */ - void removeRange(in nsIDOMRange range); - /** * Removes all ranges from the current selection. */ diff --git a/dom/base/nsRange.cpp b/dom/base/nsRange.cpp index 4c0a1c627c72..5aeee5d0d677 100644 --- a/dom/base/nsRange.cpp +++ b/dom/base/nsRange.cpp @@ -1069,7 +1069,7 @@ nsRange::SetSelection(mozilla::dom::Selection* aSelection) // Extra step in case our parent failed to ensure the above // invariant. if (aSelection && mSelection) { - mSelection->RemoveRange(this); + mSelection->RemoveRange(*this, IgnoreErrors()); } mSelection = aSelection; diff --git a/dom/webidl/Selection.webidl b/dom/webidl/Selection.webidl index 955e8bdeed02..6d35fea2aaf4 100644 --- a/dom/webidl/Selection.webidl +++ b/dom/webidl/Selection.webidl @@ -25,6 +25,9 @@ interface Selection { */ [Throws, BinaryName="addRangeJS"] void addRange(Range range); + /** + * Removes a range from the current selection. + */ [Throws] void removeRange(Range range); [Throws] diff --git a/editor/libeditor/HTMLTableEditor.cpp b/editor/libeditor/HTMLTableEditor.cpp index fb14c04c5b78..7d35c6fc5d7e 100644 --- a/editor/libeditor/HTMLTableEditor.cpp +++ b/editor/libeditor/HTMLTableEditor.cpp @@ -1423,7 +1423,7 @@ HTMLEditor::SelectBlockOfCells(nsIDOMElement* aStartCell, if (currentRowIndex < maxRow || currentRowIndex > maxRow || currentColIndex < maxColumn || currentColIndex > maxColumn) { - selection->RemoveRange(range); + selection->RemoveRange(*static_cast(range.get()), IgnoreErrors()); // Since we've removed the range, decrement pointer to next range mSelectedCellIndex--; } @@ -2183,7 +2183,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) nsCOMPtr deletedCell; GetCellFromRange(range, getter_AddRefs(deletedCell)); if (!deletedCell) { - selection->RemoveRange(range); + selection->RemoveRange(*range, IgnoreErrors()); rangeCount--; i--; } diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 3f2bf589e92c..cde53a2aa2d3 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -2377,7 +2377,9 @@ printf("HandleTableSelection: Removing cell from multi-cell selection\n"); mAppendStartSelectedCell = nullptr; // Deselect cell by removing its range from selection - return mDomSelections[index]->RemoveRange(range); + ErrorResult err; + mDomSelections[index]->RemoveRange(*range, err); + return err.StealNSResult(); } } mUnselectCellOnMouseUp = nullptr; @@ -2465,7 +2467,7 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent, if (curRowIndex < minRowIndex || curRowIndex > maxRowIndex || curColIndex < minColIndex || curColIndex > maxColIndex) { - mDomSelections[index]->RemoveRange(range); + mDomSelections[index]->RemoveRange(*range, IgnoreErrors()); // Since we've removed the range, decrement pointer to next range mSelectedCellIndex--; } @@ -2487,7 +2489,7 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent, origColIndex <= static_cast(maxColIndex) && maxColIndex >= 0 && origColIndex + actualColSpan - 1 >= static_cast(minColIndex)) { - mDomSelections[index]->RemoveRange(range); + mDomSelections[index]->RemoveRange(*range, IgnoreErrors()); // Since we've removed the range, decrement pointer to next range mSelectedCellIndex--; }