From fc987538d0a3c61512eb08d08d6c32f7455c5a5f Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Wed, 23 May 2007 02:36:16 -0700 Subject: [PATCH] Bug 380625. (Not Part Of The Build). Fix cluster count for trimmed spaces. --- layout/generic/nsTextFrameThebes.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index e43d6374d9c5..2933add6b21f 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -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,