Bug 380625. (Not Part Of The Build). Fix cluster count for trimmed spaces.

This commit is contained in:
roc+@cs.cmu.edu 2007-05-23 02:36:16 -07:00
Родитель eb8714ce2b
Коммит fc987538d0
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -5027,6 +5027,18 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
// This is corrected for in nsLineLayout::TrimWhiteSpaceIn.
PRInt32 numJustifiableCharacters =
provider.ComputeJustifiableCharacters(offset, charsFit);
// Currently canTrimTrailingWhitespace is always true here
// because of the !textStyle->WhiteSpaceIsSignificant() test,
// but that could change...
if (canTrimTrailingWhitespace) {
// Count trimmed spaces and add them to the cluster count
PRUint32 charIndex = transformedCharsFit;
while (charIndex > 0 && mTextRun->GetChar(charIndex - 1) == ' ') {
++textMetrics.mClusterCount;
--charIndex;
}
}
NS_ASSERTION(numJustifiableCharacters <= textMetrics.mClusterCount,
"Justifiable characters combined???");
lineLayout.SetTextJustificationWeights(numJustifiableCharacters,