Bug 1343695 Part 2: Narrow an overly restrictive assert in GetRenderedText. r=mats
authorBrad Werth <bwerth@mozilla.com>
Tue, 14 Mar 2017 14:27:30 -0700
changeset 347626 9bf81510d7bcc8b94ab40e90421b6abc56375b5a
parent 347625 da8e1454252907cbc7b000f880eff1f2baec8ca0
child 347627 31129448027bdc3e5a874c8f10d6d6e6dab9813e
push id38876
push userbwerth@mozilla.com
push dateWed, 15 Mar 2017 00:46:52 +0000
treeherderautoland@31129448027b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1343695
milestone55.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 1343695 Part 2: Narrow an overly restrictive assert in GetRenderedText. r=mats MozReview-Commit-ID: EuxNJmKPxok
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9833,17 +9833,23 @@ LineEndsInHardLineBreak(nsTextFrame* aFr
 }
 
 nsIFrame::RenderedText
 nsTextFrame::GetRenderedText(uint32_t aStartOffset,
                              uint32_t aEndOffset,
                              TextOffsetType aOffsetType,
                              TrailingWhitespace aTrimTrailingWhitespace)
 {
-  NS_ASSERTION(!GetPrevContinuation(), "Must be called on first-in-flow");
+  MOZ_ASSERT(aStartOffset <= aEndOffset, "bogus offsets");
+  MOZ_ASSERT(!GetPrevContinuation() ||
+             (aOffsetType == TextOffsetType::OFFSETS_IN_CONTENT_TEXT &&
+              aStartOffset >= (uint32_t)GetContentOffset() &&
+              aEndOffset <= (uint32_t)GetContentEnd()),
+             "Must be called on first-in-flow, or content offsets must be "
+             "given and be within this frame.");
 
   // The handling of offsets could be more efficient...
   RenderedText result;
   nsBlockFrame* lineContainer = nullptr;
   nsTextFrame* textFrame;
   const nsTextFragment* textFrag = mContent->GetText();
   uint32_t offsetInRenderedString = 0;
   bool haveOffsets = false;