mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 387358. Don't go into an infinite loop searching for end-of-first-letter-cluster; also translate from DOM to textrun offsets. r=smontagu
This commit is contained in:
parent
f1b527c30a
commit
b3d6a2dc31
@ -4864,7 +4864,8 @@ nsTextFrame::GetOffsets(PRInt32 &start, PRInt32 &end) const
|
||||
static PRBool
|
||||
FindFirstLetterRange(const nsTextFragment* aFrag,
|
||||
gfxTextRun* aTextRun,
|
||||
PRInt32 aOffset, PRInt32* aLength)
|
||||
PRInt32 aOffset, const gfxSkipCharsIterator& aIter,
|
||||
PRInt32* aLength)
|
||||
{
|
||||
// Find first non-whitespace, non-punctuation cluster, and stop after it
|
||||
PRInt32 i;
|
||||
@ -4878,12 +4879,16 @@ FindFirstLetterRange(const nsTextFragment* aFrag,
|
||||
if (i == length)
|
||||
return PR_FALSE;
|
||||
|
||||
// Advance to the end of the cluster (when i+1 starts a new cluster)
|
||||
while (i + 1 < length) {
|
||||
if (aTextRun->IsClusterStart(aOffset + i + 1))
|
||||
// Advance to the end of the cluster
|
||||
gfxSkipCharsIterator iter(aIter);
|
||||
PRInt32 nextClusterStart;
|
||||
for (nextClusterStart = i + 1; nextClusterStart < length; ++nextClusterStart) {
|
||||
iter.SetOriginalOffset(nextClusterStart);
|
||||
if (iter.IsOriginalCharSkipped() ||
|
||||
aTextRun->IsClusterStart(iter.GetSkippedOffset()))
|
||||
break;
|
||||
}
|
||||
*aLength = i + 1;
|
||||
*aLength = nextClusterStart;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -5303,7 +5308,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
PRBool completedFirstLetter = PR_FALSE;
|
||||
if (lineLayout.GetFirstLetterStyleOK()) {
|
||||
AddStateBits(TEXT_FIRST_LETTER);
|
||||
completedFirstLetter = FindFirstLetterRange(frag, mTextRun, offset, &length);
|
||||
completedFirstLetter = FindFirstLetterRange(frag, mTextRun, offset, iter, &length);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user