Bug 249141 Incorrect ellipsis width calculation when all text cropped from right r=Enn sr=roc

This commit is contained in:
Neil Rashbrook 2009-01-06 21:35:18 +00:00
Родитель 56ba08ed13
Коммит ef3dffc4f9
1 изменённых файлов: 6 добавлений и 9 удалений

Просмотреть файл

@ -679,23 +679,20 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext,
// see if the width is even smaller than the ellipsis
// if so, clear the text (XXX set as many '.' as we can?).
nscoord ellipsisWidth;
aRenderingContext.SetTextRunRTL(PR_FALSE);
aRenderingContext.GetWidth(kEllipsis, ellipsisWidth);
aRenderingContext.GetWidth(kEllipsis, mTitleWidth);
if (ellipsisWidth > aWidth) {
if (mTitleWidth > aWidth) {
mCroppedTitle.SetLength(0);
mTitleWidth = aWidth;
mTitleWidth = 0;
return;
}
// if the ellipsis fits perfectly, no use in trying to insert
if (ellipsisWidth == aWidth) {
mTitleWidth = aWidth;
if (mTitleWidth == aWidth)
return;
}
aWidth -= ellipsisWidth;
aWidth -= mTitleWidth;
// XXX: This whole block should probably take surrogates into account
// XXX and clusters!
@ -755,7 +752,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext,
}
if (i == length-1)
break;
return;
nsAutoString copy;
mTitle.Right(copy, length-1-i);