summaryrefslogtreecommitdiffstats
path: root/toolkit/components/typeaheadfind
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 /toolkit/components/typeaheadfind
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 'toolkit/components/typeaheadfind')
-rw-r--r--toolkit/components/typeaheadfind/nsTypeAheadFind.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
index 53b1ef66d..4690383ab 100644
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -822,7 +822,7 @@ nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
getter_AddRefs(mStartPointRange), nullptr);
}
else {
- int32_t startOffset;
+ uint32_t startOffset;
nsCOMPtr<nsIDOMNode> startNode;
if (aFindPrev) {
currentSelectionRange->GetStartContainer(getter_AddRefs(startNode));
@@ -860,7 +860,7 @@ nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
nsCOMPtr<nsIDOMNode> startNode;
nsCOMPtr<nsIContent> startContent, origContent;
aRange->GetStartContainer(getter_AddRefs(startNode));
- int32_t startOffset;
+ uint32_t startOffset;
aRange->GetStartOffset(&startOffset);
startContent = do_QueryInterface(startNode);
@@ -880,9 +880,10 @@ nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
const nsTextFragment *textFrag = startContent->GetText();
if (textFrag) {
// look for non whitespace character before start offset
- for (int32_t index = 0; index < startOffset; index++) {
+ for (uint32_t index = 0; index < startOffset; index++) {
// FIXME: take content language into account when deciding whitespace.
- if (!mozilla::dom::IsSpaceCharacter(textFrag->CharAt(index))) {
+ if (!mozilla::dom::IsSpaceCharacter(
+ textFrag->CharAt(static_cast<int32_t>(index)))) {
*aIsStartingLink = false; // not at start of a node
break;
@@ -1227,12 +1228,14 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return true; // Don't need it to be on screen, just in rendering tree
// Get the next in flow frame that contains the range start
- int32_t startRangeOffset, startFrameOffset, endFrameOffset;
+ int32_t startFrameOffset, endFrameOffset;
+ uint32_t startRangeOffset;
aRange->GetStartOffset(&startRangeOffset);
while (true) {
frame->GetOffsets(startFrameOffset, endFrameOffset);
- if (startRangeOffset < endFrameOffset)
+ if (static_cast<int32_t>(startRangeOffset) < endFrameOffset) {
break;
+ }
nsIFrame *nextContinuationFrame = frame->GetNextContinuation();
if (nextContinuationFrame)