mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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.
This commit is contained in:
parent
3f7e3e99ea
commit
5c7dda1060
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user