[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:34:43 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit e967f240b40c20b6f904a7c9f59b99db3cb21747
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 26 15:00:27 2009 +0000

    2009-09-26  Shu Chang  <Chang.Shu at nokia.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Optimize the code so only the text from start to end is scanned.
            https://bugs.webkit.org/show_bug.cgi?id=29092
    
            On a platform with webkit+Qt+Symbian, the parsing time for a 600K text
            file improved from 400ms to 40ms (10x faster).
    
            * dom/Text.cpp:
            (WebCore::Text::createWithLengthLimit):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48790 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ddc675c..47b1901 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-09-26  Shu Chang  <Chang.Shu at nokia.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Optimize the code so only the text from start to end is scanned.
+        https://bugs.webkit.org/show_bug.cgi?id=29092
+
+        On a platform with webkit+Qt+Symbian, the parsing time for a 600K text
+        file improved from 400ms to 40ms (10x faster).
+
+        * dom/Text.cpp:
+        (WebCore::Text::createWithLengthLimit):
+
 2009-09-26  Xiaomei Ji  <xji at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp
index 00db1c1..1ce074a 100644
--- a/WebCore/dom/Text.cpp
+++ b/WebCore/dom/Text.cpp
@@ -315,10 +315,15 @@ PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& d
     unsigned end = start + min(charsLeft, maxChars);
     
     // Check we are not on an unbreakable boundary.
-    TextBreakIterator* it = characterBreakIterator(data.characters(), dataLength);
-    if (end < dataLength && !isTextBreak(it, end))
-        end = textBreakPreceding(it, end);
-        
+    // Some text break iterator implementations work best if the passed buffer is as small as possible, 
+    // see <https://bugs.webkit.org/show_bug.cgi?id=29092>. 
+    // We need at least two characters look-ahead to account for UTF-16 surrogates.
+    if (end < dataLength) {
+        TextBreakIterator* it = characterBreakIterator(data.characters() + start, (end + 2 > dataLength) ? dataLength - start : end - start + 2);
+        if (!isTextBreak(it, end - start))
+            end = textBreakPreceding(it, end - start) + start;
+    }
+    
     // If we have maxChars of unbreakable characters the above could lead to
     // an infinite loop.
     // FIXME: It would be better to just have the old value of end before calling

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list