summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
commit70c8ff8e5af7d2661b64fb92a158f2860af7766c (patch)
treee7fd37d81858a7dfa06fbf59880d837d9e7fa256 /extensions
parent53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff)
downloadUXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.gz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.lz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.xz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.zip
Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
Diffstat (limited to 'extensions')
-rw-r--r--extensions/spellcheck/src/mozInlineSpellChecker.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
index 118035aa5..f423adff8 100644
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -356,19 +356,18 @@ mozInlineSpellStatus::FinishNavigationEvent(mozInlineSpellWordUtil& aWordUtil)
NS_ASSERTION(mAnchorRange, "No anchor for navigation!");
nsCOMPtr<nsIDOMNode> newAnchorNode, oldAnchorNode;
- int32_t newAnchorOffset, oldAnchorOffset;
// get the DOM position of the old caret, the range should be collapsed
nsresult rv = mOldNavigationAnchorRange->GetStartContainer(
getter_AddRefs(oldAnchorNode));
NS_ENSURE_SUCCESS(rv, rv);
- rv = mOldNavigationAnchorRange->GetStartOffset(&oldAnchorOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ uint32_t oldAnchorOffset = mOldNavigationAnchorRange->StartOffset();
// find the word on the old caret position, this is the one that we MAY need
// to check
RefPtr<nsRange> oldWord;
- rv = aWordUtil.GetRangeForWord(oldAnchorNode, oldAnchorOffset,
+ rv = aWordUtil.GetRangeForWord(oldAnchorNode,
+ static_cast<int32_t>(oldAnchorOffset),
getter_AddRefs(oldWord));
NS_ENSURE_SUCCESS(rv, rv);
@@ -380,15 +379,16 @@ mozInlineSpellStatus::FinishNavigationEvent(mozInlineSpellWordUtil& aWordUtil)
// get the DOM position of the new caret, the range should be collapsed
rv = mAnchorRange->GetStartContainer(getter_AddRefs(newAnchorNode));
NS_ENSURE_SUCCESS(rv, rv);
- rv = mAnchorRange->GetStartOffset(&newAnchorOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ uint32_t newAnchorOffset = mAnchorRange->StartOffset();
// see if the new cursor position is in the word of the old cursor position
bool isInRange = false;
if (! mForceNavigationWordCheck) {
- rv = oldWord->IsPointInRange(newAnchorNode,
- newAnchorOffset + mNewNavigationPositionOffset,
- &isInRange);
+ rv = oldWord->IsPointInRange(
+ newAnchorNode,
+ static_cast<int32_t>(
+ newAnchorOffset + mNewNavigationPositionOffset),
+ &isInRange);
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -421,11 +421,9 @@ mozInlineSpellStatus::FillNoCheckRangeFromAnchor(
nsresult rv = mAnchorRange->GetStartContainer(getter_AddRefs(anchorNode));
NS_ENSURE_SUCCESS(rv, rv);
- int32_t anchorOffset;
- rv = mAnchorRange->GetStartOffset(&anchorOffset);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return aWordUtil.GetRangeForWord(anchorNode, anchorOffset,
+ uint32_t anchorOffset = mAnchorRange->StartOffset();
+ return aWordUtil.GetRangeForWord(anchorNode,
+ static_cast<int32_t>(anchorOffset),
getter_AddRefs(mNoCheckRange));
}
@@ -1214,7 +1212,7 @@ mozInlineSpellChecker::MakeSpellCheckRange(
return rv;
}
} else {
- int32_t endOffset = -1;
+ uint32_t endOffset;
endNode = nsRange::GetParentAndOffsetAfter(endNode, &endOffset);
rv = range->SetStartAndEnd(startNode, aStartOffset, endNode, endOffset);
if (NS_WARN_IF(NS_FAILED(rv))) {