Changeset 79567 in webkit


Ignore:
Timestamp:
Feb 24, 2011 8:09:18 AM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2011-02-24 Andreas Kling <kling@webkit.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Remove bogus optimizations in TextBreakIteratorQt
https://bugs.webkit.org/show_bug.cgi?id=55139

Let QTextBoundaryFinder hold a deep copy of the string data it's
operating on, and don't use the same working buffer for all iterators.

  • platform/text/qt/TextBreakIteratorQt.cpp: (WebCore::TextBreakIterator::TextBreakIterator): (WebCore::setUpIterator):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79566 r79567  
     12011-02-24  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Remove bogus optimizations in TextBreakIteratorQt
     6        https://bugs.webkit.org/show_bug.cgi?id=55139
     7
     8        Let QTextBoundaryFinder hold a deep copy of the string data it's
     9        operating on, and don't use the same working buffer for all iterators.
     10
     11        * platform/text/qt/TextBreakIteratorQt.cpp:
     12        (WebCore::TextBreakIterator::TextBreakIterator):
     13        (WebCore::setUpIterator):
     14
    1152011-02-24  Andrey Adaikin  <aandrey@google.com>
    216
  • trunk/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp

    r79518 r79567  
    4040}
    4141#else
    42     static unsigned char buffer[1024];
    43 
    4442    class TextBreakIterator : public QTextBoundaryFinder {
    4543    public:
    46         TextBreakIterator(QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
    47             : QTextBoundaryFinder(type, (const QChar*)string, length, buffer, sizeof(buffer))
    48             , length(length)
    49             , string(string) {}
     44        TextBreakIterator(QTextBoundaryFinder::BoundaryType type, const QString& string)
     45            : QTextBoundaryFinder(type, string)
     46        { }
    5047        TextBreakIterator()
    5148            : QTextBoundaryFinder()
    52             , length(0)
    53             , string(0) {}
    54 
    55         int length;
    56         const UChar* string;
     49        { }
    5750    };
    5851
    59     TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* string, int length)
     52    TextBreakIterator* setUpIterator(TextBreakIterator& iterator, QTextBoundaryFinder::BoundaryType type, const UChar* characters, int length)
    6053    {
    61         if (!string || !length)
     54        if (!characters || !length)
    6255            return 0;
    6356
    64         if (iterator.isValid() && type == iterator.type() && length == iterator.length
    65             && memcmp(string, iterator.string, length) == 0) {
     57        if (iterator.isValid() && type == iterator.type() && iterator.string() == QString::fromRawData(reinterpret_cast<const QChar*>(characters), length)) {
    6658            iterator.toStart();
    6759            return &iterator;
    6860        }
    6961
    70         iterator = TextBreakIterator(type, string, length);
    71 
     62        iterator = TextBreakIterator(type, QString(reinterpret_cast<const QChar*>(characters), length));
    7263        return &iterator;
    7364    }
Note: See TracChangeset for help on using the changeset viewer.