Bug 1291082 part.2 ContentCache::TextRectArray::IsOverlappingWith() shouldn't include end offset in its range r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 16 Aug 2016 16:07:54 +0900
changeset 310167 10ca767648a511eaaee798ec22dbda768407973e
parent 310166 3a2ae963910c238e09e9b5571d6f5603f5a1f5ec
child 310168 c127bdf8186fa2de85aa0bb54fd46c45074d66c6
push id80791
push usermasayuki@d-toybox.com
push dateFri, 19 Aug 2016 08:55:15 +0000
treeherdermozilla-inbound@c127bdf8186f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1291082
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1291082 part.2 ContentCache::TextRectArray::IsOverlappingWith() shouldn't include end offset in its range r=m_kato ContentCache::TextRectArray's end offset is computed as start offset + its length. Therefore, end offset is the last offset in the range + 1. So, IsOverlappingWith() shouldn't return true only when end offset is overlapped with given range. That means that when TextRectArray doesn't have rects, i.e., mRects is empty, IsOverlappingWith() always returns false. And when TextRectArray has one or more rects, IsOverlappingWith() should compare its range and given range without "=". MozReview-Commit-ID: JxNPcEwikjR
widget/ContentCache.h
--- a/widget/ContentCache.h
+++ b/widget/ContentCache.h
@@ -237,25 +237,25 @@ protected:
         CheckedInt<uint32_t>(aOffset) + aLength;
       if (NS_WARN_IF(!endOffset.isValid())) {
         return false;
       }
       return InRange(aOffset) && aOffset + aLength <= EndOffset();
     }
     bool IsOverlappingWith(uint32_t aOffset, uint32_t aLength) const
     {
-      if (!IsValid() || aOffset == UINT32_MAX) {
+      if (!HasRects() || aOffset == UINT32_MAX || !aLength) {
         return false;
       }
       CheckedInt<uint32_t> endOffset =
         CheckedInt<uint32_t>(aOffset) + aLength;
       if (NS_WARN_IF(!endOffset.isValid())) {
         return false;
       }
-      return aOffset <= EndOffset() && endOffset.value() >= mStart;
+      return aOffset < EndOffset() && endOffset.value() > mStart;
     }
     LayoutDeviceIntRect GetRect(uint32_t aOffset) const;
     LayoutDeviceIntRect GetUnionRect(uint32_t aOffset, uint32_t aLength) const;
     LayoutDeviceIntRect GetUnionRectAsFarAsPossible(
                           uint32_t aOffset, uint32_t aLength,
                           bool aRoundToExistingOffset) const;
   } mTextRectArray;