Not part of the build (barely). Don't allow PeekOffsetWord to break before the first cluster. Avoids a fencepost error in ClusterIterator where going backwards we might try to look at one past the end of mWordBreaks.

git-svn-id: svn://10.0.0.236/trunk@227993 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu 2007-06-13 18:25:14 +00:00
parent e315fe0d0f
commit 0235ebf43c

View File

@ -4751,13 +4751,14 @@ nsTextFrame::PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool
PRBool stopBeforePunctuation = stopAfterPunctuation && aIsKeyboardSelect;
PRInt32 offset = mContentOffset + (*aOffset < 0 ? mContentLength : *aOffset);
ClusterIterator cIter(this, offset, aForward ? 1 : -1);
PRBool firstCluster = PR_TRUE;
while (cIter.NextCluster()) {
if (aWordSelectEatSpace == cIter.IsWhitespace() && !*aSawBeforeType) {
*aSawBeforeType = PR_TRUE;
} else {
if ((*aSawBeforeType && cIter.HaveWordBreakBefore()) ||
(stopBeforePunctuation && cIter.IsPunctuation())) {
if (!firstCluster && ((*aSawBeforeType && cIter.HaveWordBreakBefore()) ||
(stopBeforePunctuation && cIter.IsPunctuation()))) {
*aOffset = cIter.GetBeforeOffset() - mContentOffset;
return PR_TRUE;
}
@ -4766,6 +4767,7 @@ nsTextFrame::PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool
return PR_TRUE;
}
}
firstCluster = PR_FALSE;
}
*aOffset = cIter.GetAfterOffset() - mContentOffset;
return PR_FALSE;