mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1257446 part.3 nsTextFrame::GetCharacterRectsInRange() shouldn't call gfxSkipCharsIterator::AdvanceOriginal() before checking if the current offset has already been reached to the end for avoiding assertions r=jfkthame
New eQueryTextRectArray causes a lot of assertions in various automated tests. The cause is that nsTextFrame::GetCharacterRectsInRange() calls gfxSkipCharsIterator::AdvanceOriginal(1) at the end of the |for| loop *without* checking if the iterator has already reached to the end. MozReview-Commit-ID: 3KFxA11uOUc --HG-- extra : rebase_source : 407c47897cad8c2e4929ed1226073302faaecee2
This commit is contained in:
parent
8a489e63dd
commit
e2ec5e1e8a
@ -7453,11 +7453,9 @@ nsTextFrame::GetCharacterRectsInRange(int32_t aInOffset,
|
||||
|
||||
UpdateIteratorFromOffset(properties, aInOffset, iter);
|
||||
|
||||
for (int32_t i = 0; i < aLength; i++) {
|
||||
if (aInOffset > GetContentEnd()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const int32_t kContentEnd = GetContentEnd();
|
||||
const int32_t kEndOffset = std::min(aInOffset + aLength, kContentEnd + 1);
|
||||
while (aInOffset < kEndOffset) {
|
||||
if (!iter.IsOriginalCharSkipped() &&
|
||||
!mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
|
||||
FindClusterStart(mTextRun,
|
||||
@ -7472,12 +7470,12 @@ nsTextFrame::GetCharacterRectsInRange(int32_t aInOffset,
|
||||
rect.y = point.y;
|
||||
|
||||
nscoord iSize = 0;
|
||||
gfxSkipCharsIterator nextIter(iter);
|
||||
if (aInOffset < GetContentEnd()) {
|
||||
if (aInOffset < kContentEnd) {
|
||||
gfxSkipCharsIterator nextIter(iter);
|
||||
nextIter.AdvanceOriginal(1);
|
||||
if (!nextIter.IsOriginalCharSkipped() &&
|
||||
!mTextRun->IsClusterStart(nextIter.GetSkippedOffset())) {
|
||||
FindClusterEnd(mTextRun, GetContentEnd(), &nextIter);
|
||||
FindClusterEnd(mTextRun, kContentEnd, &nextIter);
|
||||
}
|
||||
|
||||
gfxFloat advance =
|
||||
@ -7499,9 +7497,11 @@ nsTextFrame::GetCharacterRectsInRange(int32_t aInOffset,
|
||||
}
|
||||
}
|
||||
aRects.AppendElement(rect);
|
||||
|
||||
iter.AdvanceOriginal(1);
|
||||
aInOffset++;
|
||||
// Don't advance iter if we've reached the end
|
||||
if (aInOffset < kEndOffset) {
|
||||
iter.AdvanceOriginal(1);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user