Bug 1286464 part.11 nsTextFrame::GetCharacterRectsInRange() shouldn't compute character rect at the first character in next nsTextFrame r=jfkthame draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 21 Jul 2016 16:24:37 +0900
changeset 399840 d301d6cc2e4273414f8f660a83c17fe912b4f82d
parent 399839 4c45980d158fd5dfb3eb5b9fa3145ff5b3dac278
child 399841 bfa36b7a7fa7228fdfa6b8e9a235a2b9be4b8d80
push id26007
push usermasayuki@d-toybox.com
push dateFri, 12 Aug 2016 06:30:02 +0000
reviewersjfkthame
bugs1286464
milestone51.0a1
Bug 1286464 part.11 nsTextFrame::GetCharacterRectsInRange() shouldn't compute character rect at the first character in next nsTextFrame r=jfkthame nsTextFrame::GetCharacterRectsInRange() handles a character at the end offset of its content as in it. However, it causes odd result when the caller wants first text rect in the next nsTextFrame. E.g., if end of query range is at the next nsTextFrame's first character, currently, it returns the last character as in same line. So, it should stop handling next frame's first character as in it. MozReview-Commit-ID: 7WteerisrZp
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -7449,17 +7449,17 @@ nsTextFrame::GetCharacterRectsInRange(in
   PropertyProvider properties(this, iter, nsTextFrame::eInflated);
   // Don't trim trailing whitespace, we want the caret to appear in the right
   // place if it's positioned there
   properties.InitializeForDisplay(false);
 
   UpdateIteratorFromOffset(properties, aInOffset, iter);
 
   const int32_t kContentEnd = GetContentEnd();
-  const int32_t kEndOffset = std::min(aInOffset + aLength, kContentEnd + 1);
+  const int32_t kEndOffset = std::min(aInOffset + aLength, kContentEnd);
   while (aInOffset < kEndOffset) {
     if (!iter.IsOriginalCharSkipped() &&
         !mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
       FindClusterStart(mTextRun,
                        properties.GetStart().GetOriginalOffset() +
                          properties.GetOriginalLength(),
                        &iter);
     }