Changeset 106253 in webkit


Ignore:
Timestamp:
Jan 30, 2012 10:10:43 AM (12 years ago)
Author:
msaboff@apple.com
Message:

WebCore decodeEscapeSequences unnecessarily converts 8 bit strings to 16 bit when decoding.
https://bugs.webkit.org/show_bug.cgi?id=76648

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added a new overloaded append member that takes a String& argument, an offest
and a length to do direct sub string appending to a StringBuilder.

  • wtf/text/StringBuilder.h:

(WTF::StringBuilder::append):

Source/WebCore:

Using new overloaded append(String&, offset, length) member to build result string.
The new member properly handles 8/16 bit-ness of strings.

Functionality not changed, therefore no new tests.

  • platform/text/DecodeEscapeSequences.h:

(WebCore::decodeEscapeSequences):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r106217 r106253  
     12012-01-30  Michael Saboff  <msaboff@apple.com>
     2
     3        WebCore decodeEscapeSequences unnecessarily converts 8 bit strings to 16 bit when decoding.
     4        https://bugs.webkit.org/show_bug.cgi?id=76648
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Added a new overloaded append member that takes a String& argument, an offest
     9        and a length to do direct sub string appending to a StringBuilder.
     10
     11        * wtf/text/StringBuilder.h:
     12        (WTF::StringBuilder::append):
     13
    1142012-01-29  Zoltan Herczeg  <zherczeg@webkit.org>
    215
  • trunk/Source/JavaScriptCore/wtf/text/StringBuilder.h

    r105635 r106253  
    8787    }
    8888
     89    void append(const String& string, unsigned offset, unsigned length)
     90    {
     91        if (!string.length())
     92            return;
     93
     94        if ((offset + length) > string.length())
     95            return;
     96
     97        if (string.is8Bit())
     98            append(string.characters8() + offset, length);
     99        else
     100            append(string.characters16() + offset, length);
     101    }
     102
    89103    void append(const char* characters)
    90104    {
  • trunk/Source/WebCore/ChangeLog

    r106252 r106253  
     12012-01-30  Michael Saboff  <msaboff@apple.com>
     2
     3        WebCore decodeEscapeSequences unnecessarily converts 8 bit strings to 16 bit when decoding.
     4        https://bugs.webkit.org/show_bug.cgi?id=76648
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Using new overloaded append(String&, offset, length)  member to build result string.
     9        The new member properly handles 8/16 bit-ness of strings.
     10
     11        Functionality not changed, therefore no new tests.
     12
     13        * platform/text/DecodeEscapeSequences.h:
     14        (WebCore::decodeEscapeSequences):
     15
    1162012-01-30  Pavel Feldman  <pfeldman@google.com>
    217
  • trunk/Source/WebCore/platform/text/DecodeEscapeSequences.h

    r105691 r106253  
    140140            continue;
    141141
    142         result.append(string.characters() + decodedPosition, encodedRunPosition - decodedPosition);
     142        result.append(string, decodedPosition, encodedRunPosition - decodedPosition);
    143143        result.append(decoded);
    144144        decodedPosition = encodedRunEnd;
    145145    }
    146     result.append(string.characters() + decodedPosition, length - decodedPosition);
     146    result.append(string, decodedPosition, length - decodedPosition);
    147147    return result.toString();
    148148}
Note: See TracChangeset for help on using the changeset viewer.