Changeset 69773 in webkit


Ignore:
Timestamp:
Oct 14, 2010 9:57:00 AM (14 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2010-10-14 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Andreas Kling.

[Qt] Text breaking is slow: enable ICU as an opt-in
https://bugs.webkit.org/show_bug.cgi?id=40332

Added a config flag that enables ICU as an opt-in instead of the Qt specific code.
Because of the inclusion of ICU headers, some explicit casting was necessary in UnicodeQt4.h

  • JavaScriptCore.pri:
  • wtf/unicode/qt4/UnicodeQt4.h: (WTF::Unicode::toLower): (WTF::Unicode::toUpper): (WTF::Unicode::toTitleCase): (WTF::Unicode::foldCase): (WTF::Unicode::isPrintableChar): (WTF::Unicode::isSeparatorSpace): (WTF::Unicode::isPunct): (WTF::Unicode::isLower): (WTF::Unicode::mirroredChar): (WTF::Unicode::combiningClass): (WTF::Unicode::direction): (WTF::Unicode::category):

2010-10-14 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Andreas Kling.

[Qt] Text breaking is slow: enable ICU as an opt-in
https://bugs.webkit.org/show_bug.cgi?id=40332

Added a config flag that enables ICU as an opt-in instead of the Qt specific code.

No new tests, this should be covered by existing tests.

  • WebCore.pro:
  • platform/text/qt/TextBreakIteratorQt.cpp: (WebCore::currentTextBreakLocaleID):
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r69753 r69773  
     12010-10-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Text breaking is slow: enable ICU as an opt-in
     6        https://bugs.webkit.org/show_bug.cgi?id=40332
     7
     8        Added a config flag that enables ICU as an opt-in instead of the Qt specific code.
     9        Because of the inclusion of ICU headers, some explicit casting was necessary in UnicodeQt4.h
     10
     11        * JavaScriptCore.pri:
     12        * wtf/unicode/qt4/UnicodeQt4.h:
     13        (WTF::Unicode::toLower):
     14        (WTF::Unicode::toUpper):
     15        (WTF::Unicode::toTitleCase):
     16        (WTF::Unicode::foldCase):
     17        (WTF::Unicode::isPrintableChar):
     18        (WTF::Unicode::isSeparatorSpace):
     19        (WTF::Unicode::isPunct):
     20        (WTF::Unicode::isLower):
     21        (WTF::Unicode::mirroredChar):
     22        (WTF::Unicode::combiningClass):
     23        (WTF::Unicode::direction):
     24        (WTF::Unicode::category):
     25
    1262010-10-14  Anton Faern  <anton@bladehawke.com>
    227
  • trunk/JavaScriptCore/JavaScriptCore.pri

    r68511 r69773  
    5555DEFINES += BUILDING_QT__ BUILDING_JavaScriptCore BUILDING_WTF
    5656
     57# CONFIG += text_breaking_with_icu
     58
     59contains (CONFIG, text_breaking_with_icu) {
     60    DEFINES += WTF_USE_QT_ICU_TEXT_BREAKING=1
     61}
     62
    5763wince* {
    5864    INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/ce-compat
  • trunk/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h

    r68087 r69773  
    3232
    3333#include <stdint.h>
     34#if USE(QT_ICU_TEXT_BREAKING)
     35#include <unicode/ubrk.h>
     36#endif
    3437
    3538QT_BEGIN_NAMESPACE
     
    6467typedef uint16_t UChar;
    6568#endif
     69
     70#if !USE(QT_ICU_TEXT_BREAKING)
    6671typedef uint32_t UChar32;
     72#endif
    6773
    6874namespace WTF {
     
    151157inline UChar32 toLower(UChar32 ch)
    152158{
    153     return QChar::toLower(ch);
     159    return QChar::toLower(uint32_t(ch));
    154160}
    155161
     
    207213}
    208214
    209 inline UChar32 toUpper(UChar32 ch)
    210 {
    211     return QChar::toUpper(ch);
     215inline UChar32 toUpper(UChar32 c)
     216{
     217    return QChar::toUpper(uint32_t(c));
    212218}
    213219
     
    267273inline int toTitleCase(UChar32 c)
    268274{
    269     return QChar::toTitleCase(c);
     275    return QChar::toTitleCase(uint32_t(c));
    270276}
    271277
    272278inline UChar32 foldCase(UChar32 c)
    273279{
    274     return QChar::toCaseFolded(c);
     280    return QChar::toCaseFolded(uint32_t(c));
    275281}
    276282
     
    297303    const uint test = U_MASK(QChar::Other_Control) |
    298304                      U_MASK(QChar::Other_NotAssigned);
    299     return !(U_MASK(QChar::category(c)) & test);
     305    return !(U_MASK(QChar::category(uint32_t(c))) & test);
    300306}
    301307
    302308inline bool isSeparatorSpace(UChar32 c)
    303309{
    304     return QChar::category(c) == QChar::Separator_Space;
     310    return QChar::category(uint32_t(c)) == QChar::Separator_Space;
    305311}
    306312
     
    314320                      U_MASK(QChar::Punctuation_FinalQuote) |
    315321                      U_MASK(QChar::Punctuation_Other);
    316     return U_MASK(QChar::category(c)) & test;
     322    return U_MASK(QChar::category(uint32_t(c))) & test;
    317323}
    318324
    319325inline bool isLower(UChar32 c)
    320326{
    321     return QChar::category(c) == QChar::Letter_Lowercase;
     327    return QChar::category(uint32_t(c)) == QChar::Letter_Lowercase;
    322328}
    323329
     
    330336inline UChar32 mirroredChar(UChar32 c)
    331337{
    332     return QChar::mirroredChar(c);
     338    return QChar::mirroredChar(uint32_t(c));
    333339}
    334340
    335341inline uint8_t combiningClass(UChar32 c)
    336342{
    337     return QChar::combiningClass(c);
     343    return QChar::combiningClass(uint32_t(c));
    338344}
    339345
     
    357363inline Direction direction(UChar32 c)
    358364{
    359     return (Direction)QChar::direction(c);
     365    return (Direction)QChar::direction(uint32_t(c));
    360366}
    361367
    362368inline CharCategory category(UChar32 c)
    363369{
    364     return (CharCategory) U_MASK(QChar::category(c));
     370    return (CharCategory) U_MASK(QChar::category(uint32_t(c)));
    365371}
    366372
  • trunk/WebCore/ChangeLog

    r69772 r69773  
     12010-10-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Text breaking is slow: enable ICU as an opt-in
     6        https://bugs.webkit.org/show_bug.cgi?id=40332
     7
     8        Added a config flag that enables ICU as an opt-in instead of the Qt specific code.
     9
     10        No new tests, this should be covered by existing tests.
     11
     12        * WebCore.pro:
     13        * platform/text/qt/TextBreakIteratorQt.cpp:
     14        (WebCore::currentTextBreakLocaleID):
     15
    1162010-10-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
    217
  • trunk/WebCore/WebCore.pro

    r69761 r69773  
    26772677    ../WebKit/qt/Api/qwebkitversion.cpp
    26782678
    2679 
    26802679contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) {
    26812680    HEADERS += platform/qt/QtMobileWebStyle.h
     
    27122711        LIBS += -lole32
    27132712    }
     2713
     2714contains (CONFIG, text_breaking_with_icu) {
     2715    SOURCES += platform/text/TextBreakIteratorICU.cpp
     2716    LIBS += -licuuc
     2717}
    27142718
    27152719contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
  • trunk/WebCore/platform/text/qt/TextBreakIteratorQt.cpp

    r60851 r69773  
    3434namespace WebCore {
    3535
     36#if USE(QT_ICU_TEXT_BREAKING)
     37const char* currentTextBreakLocaleID()
     38{
     39    return QLocale::system().name().toLatin1();
     40}
     41#else
    3642    static unsigned char buffer[1024];
    3743
     
    136142        return true;
    137143    }
     144#endif
    138145
    139146}
Note: See TracChangeset for help on using the changeset viewer.