Blob Blame History Raw
Index: trunk/Source/WebCore/rendering/RenderText.cpp
===================================================================
--- trunk/Source/WebCore/rendering/RenderText.cpp	(revision 151327)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	(revision 151422)
@@ -101,5 +101,5 @@
 
     unsigned length = string->length();
-    const UChar* characters = string->characters();
+    const StringImpl& stringImpl = *string->impl();
 
     if (length >= numeric_limits<unsigned>::max())
@@ -110,8 +110,8 @@
     for (unsigned i = 1; i < length + 1; i++) {
         // Replace &nbsp with a real space since ICU no longer treats &nbsp as a word separator.
-        if (characters[i - 1] == noBreakSpace)
+        if (stringImpl[i - 1] == noBreakSpace)
             stringWithPrevious[i] = ' ';
         else
-            stringWithPrevious[i] = characters[i - 1];
+            stringWithPrevious[i] = stringImpl[i - 1];
     }
 
@@ -120,5 +120,6 @@
         return;
 
-    StringBuffer<UChar> data(length);
+    StringBuilder result;
+    result.reserveCapacity(length);
 
     int32_t endOfWord;
@@ -126,10 +127,10 @@
     for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {
         if (startOfWord) // Ignore first char of previous string
-            data[startOfWord - 1] = characters[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]);
+            result.append(stringImpl[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]));
         for (int i = startOfWord + 1; i < endOfWord; i++)
-            data[i - 1] = characters[i - 1];
-    }
-
-    *string = String::adopt(data);
+            result.append(stringImpl[i - 1]);
+    }
+
+    *string = result.toString();
 }