From 70c8ff8e5af7d2661b64fb92a158f2860af7766c Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 06:10:23 -0400 Subject: Bug 1377978 - Make nsRange use uint32_t to offset Tag #1375 --- layout/generic/nsImageFrame.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'layout/generic/nsImageFrame.cpp') diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index c64520f2e..ee35ecad8 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1836,7 +1836,7 @@ nsImageFrame::ShouldDisplaySelection() int32_t thisOffset = parentContent->IndexOf(mContent); nsCOMPtr parentNode = do_QueryInterface(parentContent); nsCOMPtr rangeNode; - int32_t rangeOffset; + uint32_t rangeOffset; nsCOMPtr range; selection->GetRangeAt(0,getter_AddRefs(range)); if (range) @@ -1844,12 +1844,16 @@ nsImageFrame::ShouldDisplaySelection() range->GetStartContainer(getter_AddRefs(rangeNode)); range->GetStartOffset(&rangeOffset); - if (parentNode && rangeNode && (rangeNode == parentNode) && rangeOffset == thisOffset) - { + if (parentNode && rangeNode && rangeNode == parentNode && + static_cast(rangeOffset) == thisOffset) { range->GetEndContainer(getter_AddRefs(rangeNode)); range->GetEndOffset(&rangeOffset); - if ((rangeNode == parentNode) && (rangeOffset == (thisOffset +1))) //+1 since that would mean this whole content is selected only - return false; //do not allow nsFrame do draw any further selection + // +1 since that would mean this whole content is selected only + if (rangeNode == parentNode && + static_cast(rangeOffset) == thisOffset + 1) { + // Do not allow nsFrame do draw any further selection + return false; + } } } } -- cgit v1.2.3