summaryrefslogtreecommitdiff
path: root/layout
diff options
context:
space:
mode:
authorDaniel Holbert <dholbert@cs.stanford.edu>2018-02-10 08:46:49 -0800
committerwolfbeast <mcwerewolf@gmail.com>2018-03-14 11:00:47 +0100
commit5babf7dc56e5d8fcd566845bbc991989a5b1c7b1 (patch)
tree5be3207933897068611ae8702b6084d785eddb86 /layout
parent756fb3e1455cd903f952ded1c45f86e3527875ed (diff)
downloaduxp-5babf7dc56e5d8fcd566845bbc991989a5b1c7b1.tar.gz
Bug 1324042 - Fix trimmedOffsets arithmetic in GetRenderedText(). r=mats, a=RyanVM
MozReview-Commit-ID: H4ngU8Juyln --HG-- extra : rebase_source : f4d6ab58ae70e485dfe72d5290cf6fae2c8397dd extra : intermediate-source : bec50ba1fb12aebde4e4065b2799bc730bc30010 extra : source : fbf54020043bd09c162530907b2a1091a10f4f92
Diffstat (limited to 'layout')
-rw-r--r--layout/generic/nsTextFrame.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
index b9848bcf18..00c0016fd1 100644
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9751,9 +9751,13 @@ nsTextFrame::GetRenderedText(uint32_t aStartOffset,
startOffset = aStartOffset;
endOffset = std::min<uint32_t>(INT32_MAX, aEndOffset);
}
+
+ // If startOffset and/or endOffset are inside of trimmedOffsets' range,
+ // then clamp the edges of trimmedOffsets accordingly.
+ int32_t origTrimmedOffsetsEnd = trimmedOffsets.GetEnd();
trimmedOffsets.mStart = std::max<uint32_t>(trimmedOffsets.mStart,
startOffset);
- trimmedOffsets.mLength = std::min<uint32_t>(trimmedOffsets.GetEnd(),
+ trimmedOffsets.mLength = std::min<uint32_t>(origTrimmedOffsetsEnd,
endOffset) - trimmedOffsets.mStart;
if (trimmedOffsets.mLength <= 0) {
offsetInRenderedString = nextOffsetInRenderedString;