RenderText::isAllCollapsibleWhitespace() shouldn't upconvert string to 16-bit.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 23:28:41 +0000 (23:28 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 23:28:41 +0000 (23:28 +0000)
<http://webkit.org/b/109354>

Reviewed by Eric Seidel.

254 KB progression on Membuster3.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142529 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderText.cpp

index ecf019da69d350b2615e3ffa65f103b1f2586815..8ebca5ea4028dccd1e0942b2ca9529ff2259c13b 100644 (file)
@@ -1,3 +1,15 @@
+2013-02-11  Andreas Kling  <akling@apple.com>
+
+        RenderText::isAllCollapsibleWhitespace() shouldn't upconvert string to 16-bit.
+        <http://webkit.org/b/109354>
+
+        Reviewed by Eric Seidel.
+
+        254 KB progression on Membuster3.
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::isAllCollapsibleWhitespace):
+
 2013-02-11  Alpha Lam  <hclam@chromium.org>
 
         Fix code style violations in GIFImageReader.{cc|h}
index c8e8036d8a9b5880a7ea54ab9d86735818d564c1..aa6b0346098065ea1052b05fd18d9111697cf1ab 100644 (file)
@@ -1184,10 +1184,16 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
 
 bool RenderText::isAllCollapsibleWhitespace()
 {
-    int length = textLength();
-    const UChar* text = characters();
-    for (int i = 0; i < length; i++) {
-        if (!style()->isCollapsibleWhiteSpace(text[i]))
+    unsigned length = textLength();
+    if (is8Bit()) {
+        for (unsigned i = 0; i < length; ++i) {
+            if (!style()->isCollapsibleWhiteSpace(characters8()[i]))
+                return false;
+        }
+        return true;
+    }
+    for (unsigned i = 0; i < length; ++i) {
+        if (!style()->isCollapsibleWhiteSpace(characters16()[i]))
             return false;
     }
     return true;