diff --git a/mozilla/layout/generic/nsTextFrameThebes.cpp b/mozilla/layout/generic/nsTextFrameThebes.cpp index ce992fb67e7..bf119a54d1a 100644 --- a/mozilla/layout/generic/nsTextFrameThebes.cpp +++ b/mozilla/layout/generic/nsTextFrameThebes.cpp @@ -5545,9 +5545,20 @@ 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 = transformedOffset + transformedCharsFit; + while (charIndex > transformedOffset && + mTextRun->GetChar(charIndex - 1) == ' ') { + --charIndex; + } + } NS_ASSERTION(numJustifiableCharacters <= charsFit, - "Bad justifiable character count"); + "Justifiable characters combined???"); lineLayout.SetTextJustificationWeights(numJustifiableCharacters, charsFit - numJustifiableCharacters); }