Title: [151422] trunk/Source/WebCore
Revision
151422
Author
[email protected]
Date
2013-06-10 22:40:28 -0700 (Mon, 10 Jun 2013)

Log Message

text-transform: capitalize shouldn't upconvert
https://bugs.webkit.org/show_bug.cgi?id=117485

Reviewed by Adam Barth.

Avoid the upconversion. Merge https://chromium.googlesource.com/chromium/blink/+/c5a221d6da2443df0639c01c40aac6040908ec79.

* rendering/RenderText.cpp:
(WebCore::makeCapitalized):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151421 => 151422)


--- trunk/Source/WebCore/ChangeLog	2013-06-11 05:37:51 UTC (rev 151421)
+++ trunk/Source/WebCore/ChangeLog	2013-06-11 05:40:28 UTC (rev 151422)
@@ -1,5 +1,17 @@
 2013-06-10  Ryosuke Niwa  <[email protected]>
 
+        text-transform: capitalize shouldn't upconvert
+        https://bugs.webkit.org/show_bug.cgi?id=117485
+
+        Reviewed by Adam Barth.
+
+        Avoid the upconversion. Merge https://chromium.googlesource.com/chromium/blink/+/c5a221d6da2443df0639c01c40aac6040908ec79.
+
+        * rendering/RenderText.cpp:
+        (WebCore::makeCapitalized):
+
+2013-06-10  Ryosuke Niwa  <[email protected]>
+
         DocType strings should be 8 bit wide
         https://bugs.webkit.org/show_bug.cgi?id=117487
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (151421 => 151422)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2013-06-11 05:37:51 UTC (rev 151421)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2013-06-11 05:40:28 UTC (rev 151422)
@@ -100,7 +100,7 @@
         return;
 
     unsigned length = string->length();
-    const UChar* characters = string->characters();
+    const StringImpl& stringImpl = *string->impl();
 
     if (length >= numeric_limits<unsigned>::max())
         CRASH();
@@ -109,28 +109,29 @@
     stringWithPrevious[0] = previous == noBreakSpace ? ' ' : previous;
     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];
     }
 
     TextBreakIterator* boundary = wordBreakIterator(stringWithPrevious.characters(), length + 1);
     if (!boundary)
         return;
 
-    StringBuffer<UChar> data(length);
+    StringBuilder result;
+    result.reserveCapacity(length);
 
     int32_t endOfWord;
     int32_t startOfWord = textBreakFirst(boundary);
     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];
+            result.append(stringImpl[i - 1]);
     }
 
-    *string = String::adopt(data);
+    *string = result.toString();
 }
 
 RenderText::RenderText(Node* node, PassRefPtr<StringImpl> str)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to