Not part of the build. Don't trim whitespace if wrapping is disabled. Don't compress a space that's preceded by an incompressible space.
authorroc+@cs.cmu.edu
Sun, 27 May 2007 19:20:58 -0700
changeset 1911 c7ef61d628fdd99888430416739ae28829c376fa
parent 1910 d63ada1f5399ed2f4c6bb13e6c849f32d43e54b1
child 1912 5ee3a8fd54ab4aa7e12eec5c8c30c92144ce1683
push idunknown
push userunknown
push dateunknown
milestone1.9a5pre
Not part of the build. Don't trim whitespace if wrapping is disabled. Don't compress a space that's preceded by an incompressible space.
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -1393,16 +1393,21 @@ BuildTextRunsScanner::BuildTextRunForFra
         PRUint8* bufStart = NS_STATIC_CAST(PRUint8*, aTextBuffer);
         PRUint8* end = nsTextFrameUtils::TransformText(
             NS_REINTERPRET_CAST(const PRUint8*, frag->Get1b()) + contentStart, contentLength,
             bufStart,
             compressWhitespace, &mTrimNextRunLeadingWhitespace, &builder, &analysisFlags);
         aTextBuffer = end;
       }
     }
+    // In CSS 2.1, we do not compress a space that is preceded by a non-compressible
+    // space.
+    if (!compressWhitespace) {
+      mTrimNextRunLeadingWhitespace = PR_FALSE;
+    }
     textFlags |= analysisFlags;
 
     currentTransformedTextOffset =
       (NS_STATIC_CAST(const PRUint8*, aTextBuffer) - NS_STATIC_CAST(const PRUint8*, textPtr)) >> mDoubleByteText;
 
     lastContent = content;
     endOfLastContent = contentEnd;
   }
@@ -4894,17 +4899,18 @@ nsTextFrame::Reflow(nsPresContext*      
     gfxSkipCharsIterator iter(provider.GetStart());
     iter.SetOriginalOffset(offset + limitLength);
     transformedLength = iter.GetSkippedOffset() - transformedOffset;
   }
   PRUint32 transformedLastBreak = 0;
   PRBool usedHyphenation;
   gfxFloat trimmedWidth = 0;
   gfxFloat availWidth = aReflowState.availableWidth;
-  PRBool canTrimTrailingWhitespace = !textStyle->WhiteSpaceIsSignificant();
+  PRBool canTrimTrailingWhitespace = !textStyle->WhiteSpaceIsSignificant() &&
+    textStyle->WhiteSpaceCanWrap();
   PRUint32 transformedCharsFit =
     mTextRun->BreakAndMeasureText(transformedOffset, transformedLength,
                                   (GetStateBits() & TEXT_START_OF_LINE) != 0,
                                   availWidth,
                                   &provider, suppressInitialBreak,
                                   canTrimTrailingWhitespace ? &trimmedWidth : nsnull,
                                   &textMetrics, needTightBoundingBox,
                                   &usedHyphenation, &transformedLastBreak);