Closed Bug 1735446 Opened 3 years ago Closed 2 years ago

`Selection` should treat offset and range count/index with `uint32_t` instead of `int32_t`

Categories

(Core :: DOM: Selection, task, P3)

task

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(5 files)

No description provided.
Summary: `Selection` should treat offset with `uint32_t` instead of `int32_t` → `Selection` should treat offset and range count/index with `uint32_t` instead of `int32_t`
Severity: -- → N/A
Priority: -- → P3

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.

Depends on D128846

It has two methods which take (signed) long argument to specify offset in a
DOM node, but it's declared as "unsigned long" in the standards. And now,
they work with rewritten Selection API which take uint32_t so that they should
use unsigned long for making the handling simpler and safer.

Depends on D128848

Blocks: 1740853
See Also: 1740853
Attachment #9246582 - Attachment description: Bug 1735446 - part 1: Make `Selection` use `uint32_t` for handling offset in DOM nodes r=mbrodesser! → Bug 1735446 - part 1: Make `Selection` use `uint32_t` for handling offset in DOM nodes r=smaug!
Attachment #9246584 - Attachment description: Bug 1735446 - part 3: Make `Selection` use `size_t` and `Maybe<size_t>` for handling index of array of the ranges r=mbrodesser! → Bug 1735446 - part 3: Make `Selection` use `size_t` and `Maybe<size_t>` for handling index of array of the ranges r=smaug!
Attachment #9246586 - Attachment description: Bug 1735446 - part 4: Make `Selection::GetRangeAt()` take `uint32_t` instead of `int32_t` r=mbrodesser! → Bug 1735446 - part 4: Make `Selection::GetRangeAt()` take `uint32_t` instead of `int32_t` r=smaug!
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e6de69a93ae7
part 1: Make `Selection` use `uint32_t` for handling offset in DOM nodes r=smaug
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/877ee15662d4
part 2: Make `Selection::SetAnchorFocusRange()` take `size_t` for range index instead of `int32_t` r=mbrodesser
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/86b416bbfb56
part 3: Make `Selection` use `size_t` and `Maybe<size_t>` for handling index of array of the ranges r=smaug
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/6723340819e9
part 4: Make `Selection::GetRangeAt()` take `uint32_t` instead of `int32_t` r=smaug
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/c0bbe23d100a
part 5: Make `nsIInlineSpellChecker` use `unsigned long` as offset in node r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: