Bug 1714914 - Make editor classes treat offset in parent node as uint32_t r=m_kato

It should be treated as `uint32_t` since DOM API does so.  However, there are
some exceptions:

* Result of `nsINode::ComputeIndexOf()`
* Result of `nsAString` methods

They return `-1` as not found, and anyway, they cannot treat large integer
than `INT32_MAX`.  Therefore, this patch does not touch around them.

Differential Revision: https://phabricator.services.mozilla.com/D118933
This commit is contained in:
Masayuki Nakano
2021-06-30 07:07:28 +00:00
parent 8e909e3339
commit 780fbf11f8
24 changed files with 186 additions and 181 deletions

View File

@@ -193,7 +193,7 @@ class Selection final : public nsSupportsWeakReference,
nsresult RemoveCollapsedRanges();
void Clear(nsPresContext* aPresContext);
MOZ_CAN_RUN_SCRIPT nsresult CollapseInLimiter(nsINode* aContainer,
int32_t aOffset) {
uint32_t aOffset) {
if (!aContainer) {
return NS_ERROR_INVALID_ARG;
}
@@ -460,7 +460,7 @@ class Selection final : public nsSupportsWeakReference,
* in the given node. When the selection is collapsed, and the content
* is focused and editable, the caret will blink there.
* @param aContainer The given node where the selection will be set
* @param offset Where in given dom node to place the selection (the
* @param aOffset Where in given dom node to place the selection (the
* offset into the given node)
*/
MOZ_CAN_RUN_SCRIPT void CollapseInLimiter(nsINode& aContainer,