Bug 546530. Bound search for previous cluster start. r=smontagu

git-svn-id: svn://10.0.0.236/trunk@259934 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu 2010-03-10 00:00:56 +00:00
parent e17df3b580
commit 07ac036472

View File

@ -2207,10 +2207,10 @@ PropertyProvider::ComputeJustifiableCharacters(PRInt32 aOffset, PRInt32 aLength)
/**
* Finds the offset of the first character of the cluster containing aPos
*/
static void FindClusterStart(gfxTextRun* aTextRun,
static void FindClusterStart(gfxTextRun* aTextRun, PRInt32 aOriginalStart,
gfxSkipCharsIterator* aPos)
{
while (aPos->GetOriginalOffset() > 0) {
while (aPos->GetOriginalOffset() > aOriginalStart) {
if (aPos->IsOriginalCharSkipped() ||
aTextRun->IsClusterStart(aPos->GetSkippedOffset())) {
break;
@ -2326,7 +2326,7 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
PRInt32 originalOffset = run.GetOriginalOffset() + i;
if (IsJustifiableCharacter(mFrag, originalOffset, isCJK)) {
iter.SetOriginalOffset(originalOffset);
FindClusterStart(mTextRun, &iter);
FindClusterStart(mTextRun, run.GetOriginalOffset(), &iter);
PRUint32 clusterFirstChar = iter.GetSkippedOffset();
FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter);
PRUint32 clusterLastChar = iter.GetSkippedOffset();
@ -4615,7 +4615,7 @@ nsTextFrame::GetPointFromOffset(PRInt32 inOffset,
!iter.IsOriginalCharSkipped() &&
!mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
NS_WARNING("GetPointFromOffset called for non-cluster boundary");
FindClusterStart(mTextRun, &iter);
FindClusterStart(mTextRun, trimmedOffset, &iter);
}
gfxFloat advanceWidth =