Bug 1447890 part 2. Remove nsISelection::RemoveRange. r=mystor

MozReview-Commit-ID: JXq5FYNNXPJ
This commit is contained in:
Boris Zbarsky 2018-03-27 00:35:22 -04:00
Родитель 54d1f87ff4
Коммит 74e28b0d19
7 изменённых файлов: 14 добавлений и 26 удалений

Просмотреть файл

@ -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<int32_t>(domSel->RangeCount()))
return false;
domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum));
domSel->RemoveRange(*domSel->GetRangeAt(aSelectionNum), IgnoreErrors());
return true;
}

Просмотреть файл

@ -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<nsRange*>(aDOMRange);
ErrorResult result;
RemoveRange(*range, result);
return result.StealNSResult();
}
void
Selection::RemoveRange(nsRange& aRange, ErrorResult& aRv)
{

Просмотреть файл

@ -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.
*/

Просмотреть файл

@ -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;

Просмотреть файл

@ -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]

Просмотреть файл

@ -1423,7 +1423,7 @@ HTMLEditor::SelectBlockOfCells(nsIDOMElement* aStartCell,
if (currentRowIndex < maxRow || currentRowIndex > maxRow ||
currentColIndex < maxColumn || currentColIndex > maxColumn) {
selection->RemoveRange(range);
selection->RemoveRange(*static_cast<nsRange*>(range.get()), IgnoreErrors());
// Since we've removed the range, decrement pointer to next range
mSelectedCellIndex--;
}
@ -2183,7 +2183,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
nsCOMPtr<nsIDOMElement> deletedCell;
GetCellFromRange(range, getter_AddRefs(deletedCell));
if (!deletedCell) {
selection->RemoveRange(range);
selection->RemoveRange(*range, IgnoreErrors());
rangeCount--;
i--;
}

Просмотреть файл

@ -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<uint32_t>(maxColIndex) && maxColIndex >= 0 &&
origColIndex + actualColSpan - 1 >= static_cast<uint32_t>(minColIndex)) {
mDomSelections[index]->RemoveRange(range);
mDomSelections[index]->RemoveRange(*range, IgnoreErrors());
// Since we've removed the range, decrement pointer to next range
mSelectedCellIndex--;
}