Bug 785555. r=roc
authorMats Palmgren <matspal@gmail.com>
Tue, 04 Sep 2012 02:00:38 +0200
changeset 104166 933e1cf855113709386445fd73980e6c0907dc2a
parent 104165 a86b00fa6bc685ebe8af48b5ba18093758889087
child 104167 482edf1460dc0e667462a6820a0e6fd690cdd50d
push id14365
push usermpalmgren@mozilla.com
push dateTue, 04 Sep 2012 00:00:33 +0000
treeherdermozilla-inbound@933e1cf85511 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs785555
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 785555. r=roc
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -7617,18 +7617,25 @@ nsTextFrame::ReflowText(nsLineLayout& aL
   }
   if ((atStartOfLine && !textStyle->WhiteSpaceIsSignificant()) ||
       (GetStateBits() & TEXT_FORCE_TRIM_WHITESPACE)) {
     // Skip leading whitespace. Make sure we don't skip a 'pre-line'
     // newline if there is one.
     int32_t skipLength = newLineOffset >= 0 ? length - 1 : length;
     int32_t whitespaceCount =
       GetTrimmableWhitespaceCount(frag, offset, skipLength, 1);
-    offset += whitespaceCount;
-    length -= whitespaceCount;
+    if (whitespaceCount) {
+      offset += whitespaceCount;
+      length -= whitespaceCount;
+      // Make sure this frame maps the trimmable whitespace.
+      if (NS_UNLIKELY(offset > GetContentEnd())) {
+        SetLength(offset - GetContentOffset(), &aLineLayout,
+                  ALLOW_FRAME_CREATION_AND_DESTRUCTION);
+      }
+    }
   }
 
   bool completedFirstLetter = false;
   // Layout dependent styles are a problem because we need to reconstruct
   // the gfxTextRun based on our layout.
   if (aLineLayout.GetInFirstLetter() || aLineLayout.GetInFirstLine()) {
     SetLength(maxContentLength, &aLineLayout,
               ALLOW_FRAME_CREATION_AND_DESTRUCTION);