Changeset 58507 in webkit


Ignore:
Timestamp:
Apr 29, 2010 6:36:00 AM (14 years ago)
Author:
Csaba Osztrogonác
Message:

[Qt] Speed up text layouting
https://bugs.webkit.org/show_bug.cgi?id=31719

Patch by Simon Hausmann <simon.hausmann@nokia.com> on 2010-04-29
Reviewed by Kenneth Rohde Christiansen.

Use QFontMetrics::width() for the text width calculation instead
of QTextLayout. This avoids expensive bearing calculations and the
line breaking code.

  • platform/graphics/qt/FontQt.cpp:

(WebCore::Font::floatWidthForComplexText):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58506 r58507  
     12010-04-29  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Speed up text layouting
     6        https://bugs.webkit.org/show_bug.cgi?id=31719
     7
     8        Use QFontMetrics::width() for the text width calculation instead
     9        of QTextLayout. This avoids expensive bearing calculations and the
     10        line breaking code.
     11
     12        * platform/graphics/qt/FontQt.cpp:
     13        (WebCore::Font::floatWidthForComplexText):
     14
    1152010-04-29  Kwang Yul Seo  <skyul@company100.net>
    216
  • trunk/WebCore/platform/graphics/qt/FontQt.cpp

    r57717 r58507  
    181181    QString string = fromRawDataWithoutRef(sanitized);
    182182
    183     QTextLayout layout(string, font());
    184     QTextLine line = setupLayout(&layout, run);
    185 #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    186     int w = int(line.horizontalAdvance());
    187 #else
    188     int w = int(line.naturalTextWidth());
    189 #endif
     183    int w = QFontMetrics(font()).width(string);
    190184    // WebKit expects us to ignore word spacing on the first character (as opposed to what Qt does)
    191185    if (treatAsSpace(run[0]))
Note: See TracChangeset for help on using the changeset viewer.