Commit 248000cc authored by eric@webkit.org's avatar eric@webkit.org

2010-02-24 Andreas Kling <andreas.kling@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        Optimized Font::normalizeSpaces() by caching the String::characters()
        instead of repeatedly calling operator[]

        https://bugs.webkit.org/show_bug.cgi?id=35336

        * platform/graphics/Font.cpp:
        (WebCore::Font::normalizeSpaces):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0aff2ed4
2010-02-24 Andreas Kling <andreas.kling@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
Optimized Font::normalizeSpaces() by caching the String::characters()
instead of repeatedly calling operator[]
https://bugs.webkit.org/show_bug.cgi?id=35336
* platform/graphics/Font.cpp:
(WebCore::Font::normalizeSpaces):
2010-02-24 Jungshik Shin <jshin@chromium.org> 2010-02-24 Jungshik Shin <jshin@chromium.org>
Reviewed by David Levin. Reviewed by David Levin.
......
...@@ -267,12 +267,13 @@ FontSelector* Font::fontSelector() const ...@@ -267,12 +267,13 @@ FontSelector* Font::fontSelector() const
String Font::normalizeSpaces(const String& string) String Font::normalizeSpaces(const String& string)
{ {
const UChar* characters = string.characters();
unsigned length = string.length(); unsigned length = string.length();
Vector<UChar, 256> buffer(length); Vector<UChar, 256> buffer(length);
bool didReplacement = false; bool didReplacement = false;
for (unsigned i = 0; i < length; ++i) { for (unsigned i = 0; i < length; ++i) {
UChar originalCharacter = string[i]; UChar originalCharacter = characters[i];
buffer[i] = normalizeSpaces(originalCharacter); buffer[i] = normalizeSpaces(originalCharacter);
if (buffer[i] != originalCharacter) if (buffer[i] != originalCharacter)
didReplacement = true; didReplacement = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment