Bug 1735446 - part 4: Make Selection::GetRangeAt() take uint32_t instead of int32_t r=smaug

It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
This commit is contained in:
Masayuki Nakano
2021-12-09 07:35:09 +00:00
parent cfba7911d9
commit daf79ccd1e
26 changed files with 175 additions and 90 deletions

View File

@@ -2931,6 +2931,7 @@ NS_IMETHODIMP HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) {
// Cleanup selection: remove ranges where cells were deleted
uint32_t rangeCount = SelectionRef().RangeCount();
// TODO: Rewriting this with reversed ranged-loop may make it simpler.
RefPtr<nsRange> range;
for (uint32_t i = 0; i < rangeCount; i++) {
range = SelectionRef().GetRangeAt(i);